aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-01-06 11:45:35 +0000
committerGerrit Code Review <gerrit@onap.org>2020-01-06 11:45:35 +0000
commit794218e76ef533adf10815c789c513721336ea4d (patch)
tree7ce99e2602f63a1bc75647e1d8143b78a5499195 /vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts
parentfd03c225db2e436e5dc957d9e50b5b89646d3d1c (diff)
parent39a8639ddd4f9821c207cfa53264a475dcca8cf2 (diff)
Merge "Hide Templates entry point when no instances"
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' });
}
}