aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/ng2/services')
-rw-r--r--catalog-ui/src/app/ng2/services/event-bus.service.ts44
-rw-r--r--catalog-ui/src/app/ng2/services/plugins.service.ts2
2 files changed, 45 insertions, 1 deletions
diff --git a/catalog-ui/src/app/ng2/services/event-bus.service.ts b/catalog-ui/src/app/ng2/services/event-bus.service.ts
index 438437d193..cff18e1db3 100644
--- a/catalog-ui/src/app/ng2/services/event-bus.service.ts
+++ b/catalog-ui/src/app/ng2/services/event-bus.service.ts
@@ -49,4 +49,48 @@ export class EventBusService extends BasePubSub {
this.handlePluginRegistration(event.data, event);
}
}
+
+ public disableNavigation(isDisable: boolean) {
+ if (isDisable) {
+ let disableDiv = document.createElement('div');
+ disableDiv.style.cssText = "position: fixed;\n" +
+ "z-index: 1029;\n" +
+ "background: rgba(0,0,0,0.5);\n" +
+ "width: 100%;\n" +
+ "height: 100%;\n" +
+ "top: 0;\n" +
+ "left: 0;";
+ disableDiv.setAttribute("class", "disable-navigation-div");
+ document.body.appendChild(disableDiv);
+ }
+ else {
+ document.getElementsByClassName("disable-navigation-div")[0].remove();
+ }
+ }
+
+ public notify(eventType:string, eventData?:any, disableOnWaiting:boolean=true) {
+ let doDisable = false;
+
+ if (disableOnWaiting) {
+ doDisable = this.isWaitingForEvent(eventType);
+
+ if (doDisable) {
+ this.disableNavigation(true);
+ }
+ }
+
+ const origSubscribe = super.notify(eventType, eventData).subscribe;
+
+ return {
+ subscribe: function (callbackFn) {
+ origSubscribe(() => {
+ if (doDisable) {
+ this.disableNavigation(false);
+ }
+
+ callbackFn();
+ });
+ }.bind(this)
+ };
+ }
}
diff --git a/catalog-ui/src/app/ng2/services/plugins.service.ts b/catalog-ui/src/app/ng2/services/plugins.service.ts
index 4ec90d1ac4..7a85b6e1b6 100644
--- a/catalog-ui/src/app/ng2/services/plugins.service.ts
+++ b/catalog-ui/src/app/ng2/services/plugins.service.ts
@@ -19,5 +19,5 @@ export class PluginsService {
return plugin.pluginDisplayOptions["context"] &&
plugin.pluginDisplayOptions["context"].displayRoles.includes(userRole) &&
plugin.pluginDisplayOptions["context"].displayContext.indexOf(contextType) !== -1
- }
+ };
}