aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
diff options
context:
space:
mode:
authorYoav Schneiderman <yoav.schneiderman@intl.att.com>2020-01-05 15:03:16 +0200
committerYoav Schneiderman <yoav.schneiderman@intl.att.com>2020-01-06 13:04:17 +0200
commit39a8639ddd4f9821c207cfa53264a475dcca8cf2 (patch)
tree5c671033f1d16caacb1014042fef5f731f96a584 /vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
parenta98e5f9165caf14f058d03cbc6749420adefe568 (diff)
Hide Templates entry point when no instances
Issue-ID: VID-741 Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com> Change-Id: I9f2c1879b30ed15b227cdd6189d14ef988bc3b1e Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts')
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts17
1 files changed, 9 insertions, 8 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
index eb608652c..9063e6723 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
@@ -8,7 +8,7 @@ import * as _ from "lodash";
import {NgRedux} from "@angular-redux/store";
import {AppState} from "../../store/reducers";
import {ServicePopupService} from "./genericFormServices/service/service.popup.service";
-import {ActivatedRoute} from "@angular/router";
+import {ActivatedRoute, Router} from "@angular/router";
import {AaiService} from "../../services/aaiService/aai.service";
import {GenericFormPopupService} from "./generic-form-popup.service";
import {FormControlModel} from "../../models/formControlModels/formControl.model";
@@ -53,7 +53,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
hasGeneralApiError: boolean = false;
parentElementClassName = 'content';
errorMsg = 'Page contains errors. Please see details next to the relevant fields.';
-
+ serviceModelId : string;
servicesQty = 1;
quantityOptions = _.range(1, 51)
@@ -65,6 +65,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
private _aaiService: AaiService,
private _dialogService: DialogService,
private _route: ActivatedRoute,
+ private _router : Router,
private _genericFormPopupService: GenericFormPopupService) {
super(dialogService);
}
@@ -86,9 +87,9 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
this._route
.queryParams
.subscribe(params => {
- console.log('changed');
- if (params['serviceModelId'] && params['isCreate'] == "true") {
- this.onInitForCreateNewServicePopup();
+ this.serviceModelId = params['serviceModelId'];
+ if (this.serviceModelId && params['isCreate'] == "true") {
+ this.onInitForCreateNewServicePopup(params['hasTemplate']);
}
});
@@ -106,7 +107,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
}
}
- private onInitForCreateNewServicePopup() {
+ private onInitForCreateNewServicePopup(hasTemplate : boolean) {
this._genericFormPopupService.initReduxOnCreateNewService().then((serviceModelId: string) => {
this.uuidData = <any>{
bulkSize: 1,
@@ -115,8 +116,8 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
serviceId: serviceModelId,
popupService: this._servicePopupService,
};
- this.showTemplateBtn = !!this._store.getState().global.flags["FLAG_2004_INSTANTIATION_TEMPLATES_POPUP"];
+ this.showTemplateBtn = this._genericFormPopupService.shouldShowTemplateBtn(hasTemplate);
this.isShowPreviousInstantiationBtn = !!this._store.getState().global.flags["FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER"];
this.uuidData.popupService.closeDialogEvent.subscribe((that) => {
@@ -154,7 +155,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
openTemplateModal = (): void => {
- this._dialogService.addDialog(InstantiationTemplatesModalComponent, {});
+ this._router.navigate(['/instantiationTemplatesPopup'], { queryParams: { serviceModelId: this.serviceModelId}, queryParamsHandling: 'merge' });
}
}