From 43b7ae5f11c2ef00ef737d179dda894c51594f45 Mon Sep 17 00:00:00 2001 From: ikram Date: Wed, 12 Aug 2020 16:31:06 -0400 Subject: Other Pause and Resume Related Scenarios Please see the user story for more details. Issue-ID: VID-875 Signed-off-by: Rachitha Ramappa Change-Id: Ib2b9f62c6c0c5f0f8c162cc776dc128d39dbb37e --- .../src/app/drawingBoard/drawingBoard.routing.ts | 9 +++++++++ .../guards/servicePlanningGuard/drawingBoardGuard.ts | 4 +++- .../drawing-board-header/drawing-board-header.service.ts | 6 +++++- .../drawingBoard/service-planning/drawing-board.modes.ts | 3 ++- .../instantiationStatus.component.service.ts | 5 +++++ .../instantiationStatus/instantiationStatus.component.ts | 16 +++++++++++++++- .../auditInfoModal/auditInfoModal.component.html | 1 + .../src/app/shared/models/serviceInstanceActions.ts | 3 ++- 8 files changed, 42 insertions(+), 5 deletions(-) (limited to 'vid-webpack-master/src') diff --git a/vid-webpack-master/src/app/drawingBoard/drawingBoard.routing.ts b/vid-webpack-master/src/app/drawingBoard/drawingBoard.routing.ts index aebbdee5a..dd3b6766a 100644 --- a/vid-webpack-master/src/app/drawingBoard/drawingBoard.routing.ts +++ b/vid-webpack-master/src/app/drawingBoard/drawingBoard.routing.ts @@ -44,6 +44,15 @@ export const DrawingBoardRoutes: Route[] = [ }, canActivate: [DrawingBoardGuard] }, + { + path: 'RESUME', + component: ServicePlanningComponent, + resolve: { + flags: FlagsResolve, + viewEditResolver: RetryResolver + }, + canActivate: [DrawingBoardGuard] + }, { path: 'RETRY', component: ServicePlanningComponent, diff --git a/vid-webpack-master/src/app/drawingBoard/guards/servicePlanningGuard/drawingBoardGuard.ts b/vid-webpack-master/src/app/drawingBoard/guards/servicePlanningGuard/drawingBoardGuard.ts index d486fb4fa..8b5058011 100644 --- a/vid-webpack-master/src/app/drawingBoard/guards/servicePlanningGuard/drawingBoardGuard.ts +++ b/vid-webpack-master/src/app/drawingBoard/guards/servicePlanningGuard/drawingBoardGuard.ts @@ -12,7 +12,9 @@ export class DrawingBoardGuard implements CanActivate { constructor(private store: NgRedux, private _http: HttpClient, private _router : Router) { } canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { let url : string = `../../roles/service_permissions?subscriberId=${next.queryParams['subscriberId']}&serviceType=${next.queryParams['serviceType']}`; - const viewMode = state.url.includes(DrawingBoardModes.RETRY_EDIT)? DrawingBoardModes.RETRY: DrawingBoardModes.VIEW; + const viewMode = state.url.includes(DrawingBoardModes.RETRY_EDIT)? DrawingBoardModes.RETRY: + state.url.includes(DrawingBoardModes.RESUME)? DrawingBoardModes.RESUME: + DrawingBoardModes.VIEW; return this._http.get(url) .map((result : DrawingBoardPermissions) => { if(!result.isEditPermitted){ diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.ts index 4e8e31163..8cebb23e9 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-header/drawing-board-header.service.ts @@ -68,7 +68,7 @@ export class DrawingBoardHeaderService{ if (!_.isNil(this.errorMsgService.errorMsgObject) && mode !== DrawingBoardModes.RETRY_EDIT) return true; if(validationCounter > 0) return true; if(serviceInstance.action !== ServiceInstanceActions.None) return false; - if(mode === DrawingBoardModes.RETRY_EDIT) return false; + if(mode === DrawingBoardModes.RETRY_EDIT || mode === DrawingBoardModes.RESUME) return false; return !serviceInstance.isDirty; } return true; @@ -80,6 +80,8 @@ export class DrawingBoardHeaderService{ return 'UPDATE'; case DrawingBoardModes.RETRY_EDIT: return 'REDEPLOY'; + case DrawingBoardModes.RESUME: + return 'RESUME'; default: return 'DEPLOY'; } } @@ -91,6 +93,8 @@ export class DrawingBoardHeaderService{ case DrawingBoardModes.RETRY_EDIT: case DrawingBoardModes.RETRY: return 'REDEPLOY'; + case DrawingBoardModes.RESUME: + return 'RESUME'; } } diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board.modes.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board.modes.ts index 78e2b629e..427c6915d 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board.modes.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board.modes.ts @@ -5,5 +5,6 @@ export enum DrawingBoardModes { EDIT = 'EDIT', OLD_VIEW_EDIT = 'OLD_VIEW_EDIT', CREATE = 'CREATE', - RECREATE = 'RECREATE' + RECREATE = 'RECREATE', + RESUME = 'RESUME' } diff --git a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts index e59c16a3a..cdbe890a5 100644 --- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts +++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts @@ -115,6 +115,7 @@ export class InstantiationStatusComponentService { } navigateToNewViewEdit(item: InstantiationBase, mode: DrawingBoardModes): void { + console.log("Mode : ", mode); this._store.dispatch(updateDrawingBoardStatus(mode)); const viewEditUrlTree:UrlTree = this.getNewViewEditUrlTree(item, mode); this._router.navigateByUrl(viewEditUrlTree); @@ -180,6 +181,10 @@ export class InstantiationStatusComponentService { this.navigateToNewViewEdit(item, DrawingBoardModes.RETRY_EDIT); } + resume(item: ServiceInfoModel): void { + this.navigateToNewViewEdit(item, DrawingBoardModes.RESUME); + } + recreate(item: ServiceInfoModel): void { this.navigateToNewViewEdit(item, DrawingBoardModes.RECREATE); } diff --git a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts index 4dccb9e32..b5f54bcca 100644 --- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts +++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts @@ -48,7 +48,15 @@ export class InstantiationStatusComponent implements OnInit { className: "fa-repeat", click: (item: ServiceInfoModel) => this.retryItem(item), enabled: () => true, - visible: (item: ServiceInfoModel) => item.isRetryEnabled, + visible: (item: ServiceInfoModel) => (item.isRetryEnabled && (item.jobStatus !== JobStatus.COMPLETED_AND_PAUSED)), + }, + { + name: "Resume", + dataTestId: "context-menu-retry", + className: "fa-repeat", + click: (item: ServiceInfoModel) => this.resumeItem(item), + enabled: () => true, + visible: (item: ServiceInfoModel) => item.jobStatus === JobStatus.COMPLETED_AND_PAUSED, }, { name: "Open", @@ -175,6 +183,12 @@ export class InstantiationStatusComponent implements OnInit { } } + resumeItem(item: ServiceInfoModel) : void { + if(item.isRetryEnabled && item.jobStatus === JobStatus.COMPLETED_AND_PAUSED){ + this._instantiationStatusComponentService.resume(item); + } + } + auditInfo(jobData : ServiceInfoModel): void { AuditInfoModalComponent.openModal.next(jobData); } diff --git a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html index 3dff92cdc..086669091 100644 --- a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html +++ b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.html @@ -52,6 +52,7 @@ diff --git a/vid-webpack-master/src/app/shared/models/serviceInstanceActions.ts b/vid-webpack-master/src/app/shared/models/serviceInstanceActions.ts index e029f48f9..e7eb55d89 100644 --- a/vid-webpack-master/src/app/shared/models/serviceInstanceActions.ts +++ b/vid-webpack-master/src/app/shared/models/serviceInstanceActions.ts @@ -25,7 +25,8 @@ export enum JobStatus { STOPPED = 'STOPPED', COMPLETED_WITH_ERRORS = 'COMPLETED_WITH_ERRORS', CREATING = 'CREATING', - PAUSE_UPON_COMPLETION = 'PAUSE_UPON_COMPLETION' + PAUSE_UPON_COMPLETION = 'PAUSE_UPON_COMPLETION', + COMPLETED_AND_PAUSED = 'COMPLETED_AND_PAUSED' } export enum PauseStatus { AFTER_COMPLETION = 'afterCompletion', -- cgit 1.2.3-korg