Skip to content

Commit

Permalink
fix layouting issue with local application service wrapper elements
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Jan 14, 2020
1 parent ace104d commit d74840a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,17 @@ export const renderApp = (element: HTMLElement, appBasePath: string, deps: Rende
};
};

const mainTemplate = (basePath: string) => `<div style="height: 100%">
const mainTemplate = (basePath: string) => `<div ng-view class="kbnLocalApplicationWrapper">
<base href="${basePath}" />
<div ng-view style="height: 100%;"></div>
</div>
`;
</div>`;

const moduleName = 'app/dashboard';

const thirdPartyAngularDependencies = ['ngSanitize', 'ngRoute', 'react'];

function mountDashboardApp(appBasePath: string, element: HTMLElement) {
const mountpoint = document.createElement('div');
mountpoint.setAttribute('style', 'height: 100%');
mountpoint.setAttribute('class', 'kbnLocalApplicationWrapper');
// eslint-disable-next-line
mountpoint.innerHTML = mainTemplate(appBasePath);
// bootstrap angular into detached element and attach it later to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.kbnLocalApplicationWrapper {
height: 100%;
display: flex;
flex-direction: column;
flex-grow: 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class LocalApplicationService {
outerAngularWrapperRoute: true,
reloadOnSearch: false,
reloadOnUrl: false,
template: `<div class="kbnLocalApplicationWrapper kbnLocalApplicationWrapper--${app.id}" id="${wrapperElementId}"></div>`,
template: `<div class="kbnLocalApplicationWrapper" id="${wrapperElementId}"></div>`,
controller($scope: IScope) {
const element = document.getElementById(wrapperElementId)!;
let unmountHandler: AppUnmount | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ export const renderApp = async (
return () => $injector.get('$rootScope').$destroy();
};

const mainTemplate = (basePath: string) => `<div style="height: 100%">
const mainTemplate = (basePath: string) => `<div ng-view class="kbnLocalApplicationWrapper">
<base href="${basePath}" />
<div ng-view style="height: 100%;"></div>
</div>
`;

Expand All @@ -75,7 +74,7 @@ const thirdPartyAngularDependencies = ['ngSanitize', 'ngRoute', 'react'];

function mountVisualizeApp(appBasePath: string, element: HTMLElement) {
const mountpoint = document.createElement('div');
mountpoint.setAttribute('style', 'height: 100%');
mountpoint.setAttribute('class', 'kbnLocalApplicationWrapper');
mountpoint.innerHTML = mainTemplate(appBasePath);
// bootstrap angular into detached element and attach it later to
// make angular-within-angular possible
Expand Down
5 changes: 2 additions & 3 deletions x-pack/legacy/plugins/graph/public/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ export const renderApp = ({ appBasePath, element, ...deps }: GraphDependencies)
};
};

const mainTemplate = (basePath: string) => `<div style="height: 100%">
const mainTemplate = (basePath: string) => `<div ng-view class="kbnLocalApplicationWrapper">
<base href="${basePath}" />
<div ng-view style="height: 100%; display:flex; justify-content: center;"></div>
</div>
`;

Expand All @@ -108,7 +107,7 @@ const thirdPartyAngularDependencies = ['ngSanitize', 'ngRoute', 'react', 'ui.boo

function mountGraphApp(appBasePath: string, element: HTMLElement) {
const mountpoint = document.createElement('div');
mountpoint.setAttribute('style', 'height: 100%');
mountpoint.setAttribute('class', 'kbnLocalApplicationWrapper');
// eslint-disable-next-line
mountpoint.innerHTML = mainTemplate(appBasePath);
// bootstrap angular into detached element and attach it later to
Expand Down

0 comments on commit d74840a

Please sign in to comment.