mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-29 20:25:56 +00:00
some architecture changes
This commit is contained in:
parent
e9fe18b33b
commit
16f0acb3c0
@ -164,33 +164,19 @@ export default Route.extend(ApplicationRouteMixin, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We are NOT using the renderTemplate hook to implement any custom rendering logic. Since we don't have a didTransition
|
* At a more granular level, initializing the banner before the render loop of the entire page ends will results in the
|
||||||
* hook for the application route, this hook is being used instead to schedule a banner after initial render in order to
|
* render loop of the application breaking the css transition animation for our initial banners. This hook is being used
|
||||||
* let users see the animation for banner entrance
|
* to schedule banners only after initial render has taken place in order to allow users see the banner animation
|
||||||
|
* on entry
|
||||||
*/
|
*/
|
||||||
renderTemplate() {
|
renderTemplate() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
run.scheduleOnce('afterRender', this, 'initializeBanners');
|
const { showStagingBanner, showStaleSearchBanner } = get(this, 'controller').get('model');
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Looks for the existence of any banners that may/should exist at app initialization and displays to the user
|
|
||||||
*/
|
|
||||||
initializeBanners() {
|
|
||||||
const model = get(this, 'controller').get('model');
|
|
||||||
const { showStagingBanner, showStaleSearchBanner } = model;
|
|
||||||
const banners = get(this, 'banners');
|
const banners = get(this, 'banners');
|
||||||
|
run.scheduleOnce('afterRender', this, banners.appInitialBanners.bind(banners), [
|
||||||
if (showStagingBanner) {
|
showStagingBanner,
|
||||||
banners.addBanner(
|
showStaleSearchBanner
|
||||||
'You are viewing/editing in the staging environment. Changes made here will not reflect in production',
|
]);
|
||||||
'info'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showStaleSearchBanner) {
|
|
||||||
banners.addBanner('components/notifications/partials/stale-search-alert', 'info', true);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
processLegacyDomOperations() {
|
processLegacyDomOperations() {
|
||||||
|
|||||||
@ -56,6 +56,19 @@ export default class BannerService extends Service {
|
|||||||
return banners.length > 0 && (banners.length > 1 || !banners[0].isExiting);
|
return banners.length > 0 && (banners.length > 1 || !banners[0].isExiting);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
appInitialBanners([showStagingBanner, showStaleSearchBanner]: Array<boolean>): void {
|
||||||
|
if (showStagingBanner) {
|
||||||
|
this.addBanner(
|
||||||
|
'You are viewing/editing in the staging environment. Changes made here will not reflect in production',
|
||||||
|
NotificationEvent['info']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showStaleSearchBanner) {
|
||||||
|
this.addBanner('components/notifications/partials/stale-search-alert', NotificationEvent['info'], true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to actually take care of removing the first banner from our queue.
|
* Method to actually take care of removing the first banner from our queue.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user