summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-12-05 08:44:29 +0200
committerEylon Malin <eylon.malin@intl.att.com>2019-12-05 08:44:29 +0200
commitbfc61c4bb476d05ed0e06ecc9e68121e364cfceb (patch)
treee26869bee96c431158082953c2314b39ce95a70c
parent7cdf685b0b8726e9ee2233d189692dbeb7e434f5 (diff)
support recreate and isRecreateEnabled in instantiationStatus service
Issue-ID: VID-724 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com> Change-Id: Iae797bfa49d73059d67e66b5a6dc0ea62de1195c
-rw-r--r--vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.spec.ts14
-rw-r--r--vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts9
2 files changed, 23 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.spec.ts b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.spec.ts
index a5e6fab89..29adfa9e0 100644
--- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.spec.ts
+++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.spec.ts
@@ -10,6 +10,8 @@ import {DrawingBoardModes} from "../drawingBoard/service-planning/drawing-board.
import {RouterTestingModule} from "@angular/router/testing";
import {of} from "rxjs";
import {UrlTree} from "@angular/router";
+import each from "jest-each";
+import {ServiceAction} from "../shared/models/serviceInstanceActions";
class MockAppStore<T> {
@@ -158,6 +160,18 @@ describe('Instantiation Status Service', () => {
expect(statusResult.iconClassName).toEqual(UNKNOWN);
});
+
+ each([
+ [true, ServiceAction.INSTANTIATE],
+ [false, ServiceAction.UPDATE],
+ [false, ServiceAction.DELETE],
+ ]).
+ test('isRecreateEnabled: should be %s if action is %s', (expected:boolean, action:ServiceAction) => {
+ let serviceInfoModel = new ServiceInfoModel();
+ serviceInfoModel.action = action;
+ expect(service.isRecreateEnabled(serviceInfoModel)).toBe(expected);
+ });
+
test('getStatusTooltip should return correct icon per job status', () => {
let result : ServiceStatus = service.getStatus('pending');
expect(result.iconClassName).toEqual(PENDING);
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 6848a9948..227fff10d 100644
--- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts
+++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts
@@ -12,6 +12,7 @@ import {updateDrawingBoardStatus} from "../shared/storeUtil/utils/global/global.
import {Router, UrlTree} from "@angular/router";
import {of} from "rxjs";
import {MsoService} from "../shared/services/msoService/mso.service";
+import {ServiceAction} from "../shared/models/serviceInstanceActions";
export let PENDING : string = "pending";
export let INPROGRESS : string = "in_progress";
@@ -175,6 +176,14 @@ export class InstantiationStatusComponentService {
this.navigateToNewViewEdit(item, DrawingBoardModes.RETRY_EDIT);
}
+ recreate(item: ServiceInfoModel): void {
+ this.navigateToNewViewEdit(item, DrawingBoardModes.RECREATE);
+ }
+
+ isRecreateEnabled(item: ServiceInfoModel): boolean {
+ return item.action === ServiceAction.INSTANTIATE;
+ }
+
}