summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services/modal.service.ts
diff options
context:
space:
mode:
authorMaciej Malewski <maciej.malewski@nokia.com>2021-01-27 08:54:20 +0100
committerMaciej Malewski <maciej.malewski@nokia.com>2021-01-28 14:22:52 +0100
commit3c957597725f306b4ca06cebfa54fbf0f2622938 (patch)
tree21388ff2e3c08c343b329b09c48d099475df819c /catalog-ui/src/app/ng2/services/modal.service.ts
parent87eec9a2ad04e1cbe1304f23071ac6d85bdd5503 (diff)
Add popup informing about long validation time for large pm_dictionary files.
For large pm_dictionary files, validation may take up to several minutes (average ~ 17s). The popup informs the user that the system is still working properly. Issue-ID: SDC-3390 Change-Id: Ia9ef211f2cab8a557aa1631d311ed06439fb3c26 Signed-off-by: Maciej Malewski <maciej.malewski@nokia.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/services/modal.service.ts')
-rw-r--r--catalog-ui/src/app/ng2/services/modal.service.ts22
1 files changed, 16 insertions, 6 deletions
diff --git a/catalog-ui/src/app/ng2/services/modal.service.ts b/catalog-ui/src/app/ng2/services/modal.service.ts
index a8f1b99ac2..897571b5ee 100644
--- a/catalog-ui/src/app/ng2/services/modal.service.ts
+++ b/catalog-ui/src/app/ng2/services/modal.service.ts
@@ -7,7 +7,7 @@ import {MultiStepsWizardComponent} from "../components/ui/multi-steps-wizard/mul
import {ModalComponent} from "../components/ui/modal/modal.component";
import {WizardHeaderBaseComponent} from "app/ng2/components/ui/multi-steps-wizard/multi-steps-wizard-header-base.component";
import { DynamicComponentService } from 'app/ng2/services/dynamic-component.service';
-
+import { getSdcConfig } from "../config/sdc-config.config.factory";
@Injectable()
export class ModalService {
@@ -16,7 +16,8 @@ export class ModalService {
constructor(private dynamicComponentService: DynamicComponentService) { }
-
+ public _shouldDisplayDelayedAlertModal: boolean = true;
+
/* Shortcut method to open an alert modal with title, message, and close button that simply closes the modal. */
public openAlertModal(title: string, message: string, closeButtonText?:string) {
let closeButton: ButtonModel = new ButtonModel(closeButtonText || 'Close', 'grey', this.closeCurrentModal);
@@ -24,6 +25,17 @@ export class ModalService {
this.createCustomModal(modalModel).instance.open();
}
+ public openDelayedAlertModal(title: string, message: string,
+ closeButtonText?:string) {
+ const timeDelay : number = getSdcConfig().displayAlertValidationAfterMilisec;
+ setTimeout(() => {
+ if(this._shouldDisplayDelayedAlertModal) {
+ this.openAlertModal(title, message, closeButtonText);
+ }
+ }, timeDelay);
+ this._shouldDisplayDelayedAlertModal = true;
+ }
+
public openErrorModal = (closeButtonText?: string, errorMessage?: string):void => {
let errorModal = this.createErrorModal(closeButtonText, errorMessage);
errorModal.instance.open();
@@ -38,7 +50,7 @@ export class ModalService {
* @param actionButtonText Blue call to action button
* @param actionButtonCallback function to invoke when button is clicked
* @param cancelButtonText text for close/cancel button
- */
+ */
public createActionModal = (title: string, message: string, actionButtonText: string, actionButtonCallback: Function, cancelButtonText: string): ComponentRef<ModalComponent> => {
let actionButton: ButtonModel = new ButtonModel(actionButtonText, 'blue', actionButtonCallback);
let cancelButton: ButtonModel = new ButtonModel(cancelButtonText, 'grey', this.closeCurrentModal);
@@ -81,7 +93,7 @@ export class ModalService {
return wizardInstance;
}
-
+
public closeCurrentModal = () => {
if (!this.currentModal) return;
this.currentModal.instance.close();
@@ -106,5 +118,3 @@ export class ModalService {
}
-
-