Show previous instantiations button only in new service modal 77/99477/2
authorSara Weiss <sara.weiss@intl.att.com>
Wed, 11 Dec 2019 10:53:44 +0000 (12:53 +0200)
committerSara Weiss <sara.weiss@intl.att.com>
Thu, 12 Dec 2019 08:27:25 +0000 (10:27 +0200)
Issue-ID: VID-724
Signed-off-by: Sara Weiss <sara.weiss@intl.att.com>
Change-Id: Ia1dfd930be3b392a2772b0c9f791ab9ff9d84565

vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.html
vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.scss
vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts

index f9da426..f9a11ea 100644 (file)
@@ -61,7 +61,7 @@
           (click)="openTemplateModal()"
         ><span>Template</span></button>
         <button
-          *ngIf=isInstantiationStatusFilterFlagOn()
+          *ngIf="isShowPreviousInstantiationBtn"
           [attr.data-tests-id]="'ShowPreviousInstancesButton'"
           type="button" class="btn btn-success submit"
           (click)="formPopupDetails.onOtherAction(formPopupDetails.that, dynamicForm)">
index 159871f..3939e44 100644 (file)
@@ -46,6 +46,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
   type: PopupType;
   uuidData: UUIDData;
   showTemplateBtn: boolean = false;
+  isShowPreviousInstantiationBtn: boolean = false;
   isUpdateMode: boolean;
   node: ITreeNode = null;
   hasGeneralApiError: boolean = false;
@@ -85,29 +86,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
       .subscribe(params => {
         console.log('changed');
         if (params['serviceModelId'] && params['isCreate'] == "true") {
-          this._genericFormPopupService.initReduxOnCreateNewService().then((serviceModelId: string) => {
-            this.uuidData = <any>{
-              bulkSize: 1,
-              isMacro: this._store.getState().service.serviceHierarchy[serviceModelId].service.vidNotions.instantiationType === 'Macro',
-              type: PopupType.SERVICE,
-              serviceId: serviceModelId,
-              popupService: this._servicePopupService,
-            };
-            this.showTemplateBtn = !!this._store.getState().global.flags["FLAG_2004_INSTANTIATION_TEMPLATES_POPUP"];
-
-            this.uuidData.popupService.closeDialogEvent.subscribe((that) => {
-              this.closeDialog(that);
-            });
-
-            this.formPopupDetails = this.uuidData.popupService.getGenericFormPopupDetails(
-              this.uuidData['serviceId'],
-              null,
-              null,
-              this.node,
-              this.uuidData,
-              false
-            );
-          });
+          this.onInitForCreateNewServicePopup();
         }
       });
 
@@ -125,6 +104,34 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
     }
   }
 
+  private onInitForCreateNewServicePopup() {
+    this._genericFormPopupService.initReduxOnCreateNewService().then((serviceModelId: string) => {
+      this.uuidData = <any>{
+        bulkSize: 1,
+        isMacro: this._store.getState().service.serviceHierarchy[serviceModelId].service.vidNotions.instantiationType === 'Macro',
+        type: PopupType.SERVICE,
+        serviceId: serviceModelId,
+        popupService: this._servicePopupService,
+      };
+      this.showTemplateBtn = !!this._store.getState().global.flags["FLAG_2004_INSTANTIATION_TEMPLATES_POPUP"];
+
+      this.isShowPreviousInstantiationBtn = !!this._store.getState().global.flags["FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER"];
+
+      this.uuidData.popupService.closeDialogEvent.subscribe((that) => {
+        this.closeDialog(that);
+      });
+
+      this.formPopupDetails = this.uuidData.popupService.getGenericFormPopupDetails(
+        this.uuidData['serviceId'],
+        null,
+        null,
+        this.node,
+        this.uuidData,
+        false
+      );
+    });
+  }
+
   hasSomeError(formPopupDetails: FormPopupDetails, form: FormGroup): boolean {
     if (_.isNil(formPopupDetails)) return false;
     else {
@@ -148,9 +155,6 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole
     this._dialogService.addDialog(InstantiationTemplatesModalComponent, {});
   }
 
-  isInstantiationStatusFilterFlagOn() {
-    return FeatureFlagsService.getFlagState(Features.FLAG_2004_TEMP_BUTTON_TO_INSTANTIATION_STATUS_FILTER, this._store);
-  }
 }