Audit screen corrections from drawing board 58/117158/3
authorRachithaRamappa93 <rachitha.ramappa@att.com>
Wed, 27 Jan 2021 13:13:58 +0000 (18:43 +0530)
committerIkram Ikramullah <ikram@research.att.com>
Tue, 2 Feb 2021 20:12:35 +0000 (20:12 +0000)
Change-Id: Ia1479d18f9af34e39258bd68ae0b14cb52f3fbd0
Issue-ID: VID-945
Signed-off-by: rachitha.ramappa@att.com
vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.ts
vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts
vid-webpack-master/src/app/shared/storeUtil/utils/main.reducer.ts
vid-webpack-master/src/app/shared/storeUtil/utils/service/service.actions.ts
vid-webpack-master/src/app/shared/storeUtil/utils/service/service.reducers.ts

index 8cebb23..80ce6e0 100644 (file)
@@ -12,6 +12,7 @@ import {ErrorMsgService} from "../../../shared/components/error-msg/error-msg.se
 import {DrawingBoardModes} from "../drawing-board.modes";
 import {ServiceInstance} from "../../../shared/models/serviceInstance";
 import {FeatureFlagsService, Features} from "../../../shared/services/featureFlag/feature-flags.service";
+import {ServiceInfoModel} from "../../../shared/server/serviceInfo/serviceInfo.model";
 
 @Injectable()
 export class DrawingBoardHeaderService{
@@ -48,7 +49,13 @@ export class DrawingBoardHeaderService{
   showAuditInfo(serviceModelId) : void {
     let instance: ServiceInstance = this.store.getState().service.serviceInstance[serviceModelId];
     let model =  new ServiceModel(this.store.getState().service.serviceHierarchy[serviceModelId]);
-    AuditInfoModalComponent.openInstanceAuditInfoModal.next({instanceId : serviceModelId , type : 'SERVICE', model : model , instance : instance});
+    let serviceInfoModel: ServiceInfoModel = this.store.getState().service.serviceInfoModel;
+    console.log("ShowAuditInfo : ServiceInfoModel from drawing-board-header service : ", serviceInfoModel);
+    if(serviceInfoModel != null || serviceInfoModel != undefined){
+      AuditInfoModalComponent.openModal.next(serviceInfoModel);
+    } else{
+      AuditInfoModalComponent.openInstanceAuditInfoModal.next({instanceId : serviceModelId , type : 'SERVICE', model : model , instance : instance});
+    }
   }
 
   toggleResumeService(serviceModelId, isResume: boolean) : void {
index 676c3a4..20e93df 100644 (file)
@@ -13,6 +13,7 @@ import {NgRedux} from '@angular-redux/store';
 import {JobStatus, ServiceAction} from "../shared/models/serviceInstanceActions";
 import {ActivatedRoute} from "@angular/router";
 import {FeatureFlagsService, Features} from "../shared/services/featureFlag/feature-flags.service";
+import {updateServiceInfoModel} from "../shared/storeUtil/utils/service/service.actions";
 
 export interface MenuAction{
   name: string;
@@ -62,7 +63,7 @@ export class InstantiationStatusComponent implements OnInit {
       name: "Open",
       dataTestId: "context-menu-open",
       className: "fa-external-link",
-      click: (item: ServiceInfoModel) => this.instantiationStatusComponentService.open(item),
+      click: (item: ServiceInfoModel) => this.openModule(item),
       enabled: (item: ServiceInfoModel) =>  this.isOpenEnabled(item),
       visible: () =>  true,
     },
@@ -70,7 +71,7 @@ export class InstantiationStatusComponent implements OnInit {
       name: "New View/Edit",
       dataTestId: "context-menu-new-view-edit",
       className: "fa-pencil",
-      click: (item: ServiceInfoModel) => this.instantiationStatusComponentService.forwardToNewViewEdit(item),
+      click: (item: ServiceInfoModel) => this.newViewEdit(item),
       enabled: () => true,
       visible: () => this.instantiationStatusComponentService.isNewViewEditVisible(),
     },
@@ -78,7 +79,7 @@ export class InstantiationStatusComponent implements OnInit {
       name: "Create another one",
       dataTestId: "context-menu-create-another-one",
       className: "fa-clone",
-      click: (item: ServiceInfoModel) => this.instantiationStatusComponentService.recreate(item),
+      click: (item: ServiceInfoModel) => this.recreateItem(item),
       enabled: (item: ServiceInfoModel) =>  this.instantiationStatusComponentService.isRecreateEnabled(item),
       visible: () =>  this.instantiationStatusComponentService.isRecreateVisible(),
     },
@@ -145,6 +146,11 @@ export class InstantiationStatusComponent implements OnInit {
     clearInterval(this.timer);
   }
 
+  openModule(item: ServiceInfoModel){
+    this._store.dispatch(updateServiceInfoModel(item));
+    this.instantiationStatusComponentService.open(item);
+  }
+
   refreshData(): void {
     this.dataIsReady = false;
     this._serviceInfoService.getServicesJobInfo(this.lastUpdatedDate === null)
@@ -166,6 +172,7 @@ export class InstantiationStatusComponent implements OnInit {
   }
 
   deleteItem(item: ServiceInfoModel): void {
+    this._store.dispatch(updateServiceInfoModel(item));
     this._serviceInfoService.deleteJob(item.jobId).subscribe(() => {
       this.refreshData();
     });
@@ -178,12 +185,24 @@ export class InstantiationStatusComponent implements OnInit {
   }
 
   retryItem(item: ServiceInfoModel) : void {
+    this._store.dispatch(updateServiceInfoModel(item));
     if (item.isRetryEnabled) {
       this._instantiationStatusComponentService.retry(item);
     }
   }
 
+  recreateItem(item: ServiceInfoModel){
+    this._store.dispatch(updateServiceInfoModel(item));
+    this.instantiationStatusComponentService.recreate(item)
+  }
+
+  newViewEdit(item: ServiceInfoModel) : void {
+    this._store.dispatch(updateServiceInfoModel(item));
+    this.instantiationStatusComponentService.forwardToNewViewEdit(item)
+  }
+
   resumeItem(item: ServiceInfoModel) : void {
+    this._store.dispatch(updateServiceInfoModel(item));
     if(item.isRetryEnabled && item.jobStatus === JobStatus.COMPLETED_AND_PAUSED){
       this._instantiationStatusComponentService.resume(item);
     }
index faf4aae..a8254b4 100644 (file)
@@ -31,6 +31,7 @@ import {pnfReducer} from "./pnf/pnf.reducers";
 
 export let initialState: ServiceState = {
   serviceHierarchy: {},
+  serviceInfoModel: {},
   serviceInstance: {},
   lcpRegionsAndTenants: new LcpRegionsAndTenants(),
   subscribers: null,
@@ -44,6 +45,7 @@ export let initialState: ServiceState = {
 
 export interface ServiceState {
   serviceHierarchy: any;
+  serviceInfoModel: any;
   serviceInstance: { [uuid: string]: ServiceInstance; };
   lcpRegionsAndTenants: LcpRegionsAndTenants;
   subscribers: SelectOptionInterface[];
index 069ef82..20c6dbe 100644 (file)
@@ -12,6 +12,7 @@ export enum ServiceActions {
   UNDO_DELETE_ACTION_SERVICE_INSTANCE = "UNDO_DELETE_ACTION_SERVICE_INSTANCE",
   CHANGE_SERVICE_IS_DIRTY = "CHANGE_SERVICE_IS_DIRTY",
   UPGRADE_SERVICE_ACTION = "UPGRADE_SERVICE_ACTION",
+  UPDATE_SERVICE_INFO_MODEL = "UPDATE_SERVICE_INFO_MODEL",
   UNDO_UPGRADE_SERVICE_ACTION = "UNDO_UPGRADE_SERVICE_ACTION"
 }
 
@@ -63,6 +64,10 @@ export interface ChangeServiceDirty extends Action {
   serviceId : string;
 }
 
+export interface UpdateServiceModelInfoAction extends  Action {
+  serviceInfoModel?: any;
+}
+
 export const addServiceAction: ActionCreator<AddServiceAction> = (serviceUuid : string, actionName : ServiceInstanceActions) => ({
   type: ServiceActions.ADD_SERVICE_ACTION,
   serviceUuid: serviceUuid,
@@ -117,3 +122,8 @@ export const undoUpgradeService: ActionCreator<UndoUpgradeServiceAction> = (serv
   type: ServiceActions.UNDO_UPGRADE_SERVICE_ACTION,
   serviceUuid
 });
+
+export const updateServiceInfoModel : ActionCreator<UpdateServiceModelInfoAction> = (serviceInfoModel : any) => ({
+  type: ServiceActions.UPDATE_SERVICE_INFO_MODEL,
+  serviceInfoModel
+});
index 8112383..771dc23 100644 (file)
@@ -7,12 +7,14 @@ import {
   UndoUpgradeServiceAction,
   UpdateServiceInstanceAction,
   UpdateServiceModelAction,
-  UpgradeServiceAction
+  UpgradeServiceAction,
+  UpdateServiceModelInfoAction
 } from "./service.actions";
 import {ServiceInstance} from "../../../models/serviceInstance";
 import {ServiceState} from "../main.reducer";
 import {ServiceInstanceActions} from "../../../models/serviceInstanceActions";
 import * as _ from "lodash";
+import {ServiceInfoModel} from "../../../server/serviceInfo/serviceInfo.model";
 
 export function serviceReducer(state: ServiceState, action: Action) : ServiceState{
 
@@ -98,6 +100,15 @@ export function serviceReducer(state: ServiceState, action: Action) : ServiceSta
         return undoUpgradeServiceInstance(clonedState, uuid);
       }
     }
+
+    case ServiceActions.UPDATE_SERVICE_INFO_MODEL: {
+      const updateServiceInfoModel = <UpdateServiceModelInfoAction>action;
+      let newState = _.cloneDeep(state);
+      const serviceInfoModel : ServiceInfoModel = new ServiceInfoModel();
+      const currentServiceInfoModel = state.serviceInfoModel ? serviceInfoModel : null;
+      newState.serviceInfoModel = Object.assign(serviceInfoModel, updateServiceInfoModel.serviceInfoModel);
+      return newState
+    }
   }
 }