From a8ebb74702f07acead84edcdaf083d78a84d00a3 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Tue, 29 Oct 2019 17:54:54 +0200 Subject: [PATCH] Instantiation-Status: default on unexpected statuses Issue-ID: VID-692 Change-Id: I1a81a71d32aa36fb1f0dc3b349733db11d4e579d Signed-off-by: Ittay Stern --- .../mocks/jsons/asyncInstantiation.json | 40 +++++++++++++++++++ .../instantiationStatus.component.service.spec.ts | 45 +++++++++++----------- .../instantiationStatus.component.service.ts | 9 ++++- 3 files changed, 69 insertions(+), 25 deletions(-) diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json index eba4798db..01eda9551 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/asyncInstantiation.json @@ -75,6 +75,46 @@ "createdBulkDate": 1525075968000, "isRetryEnabled": false }, + { + "id": 2325, + "created": 1564412293000, + "modified": 1564412330000, + "createdId": null, + "modifiedId": null, + "rowNum": null, + "auditUserId": null, + "auditTrail": null, + "jobId": "602c353c-660d-4253-b3c7-c76e2b2746e1", + "templateId": "9df7d0ce-8579-4c6a-a4d8-0f43663e751c", + "userId": "by5924", + "msoRequestId": "198ef9d5-02ae-4fff-94e6-cc103ab287df", + "jobStatus": "COMPLETED_WITH_NO_ACTION", + "statusModifiedDate": 1564412330000, + "hidden": false, + "pause": false, + "deletedAt": null, + "owningEntityId": "10c645f5-9924-4b89-bec0-b17cf49d3cad", + "owningEntityName": "WayneHolland", + "project": "WATKINS", + "aicZoneId": null, + "aicZoneName": null, + "tenantId": null, + "tenantName": null, + "regionId": null, + "regionName": null, + "serviceType": "TYLER SILVIA", + "subscriberName": "e433710f-9217-458d-a79d-1c7aff376d89", + "subscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "serviceInstanceId": "70320ad3-a423-4e3d-b259-c728e1e9f9c8", + "serviceInstanceName": "instance name _ 005", + "serviceModelId": "76450af1-6768-4fbb-9399-9c6705327efd", + "serviceModelName": "network", + "serviceModelVersion": "2.0", + "createdBulkDate": 1564412293000, + "action": "UPGRADE", + "isRetryEnabled": false, + "aLaCarte": true + }, { "id": 6, "created": 1525007432000, 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 aeaa05780..d115984f6 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 @@ -6,8 +6,9 @@ import { PAUSE, PENDING, ServiceStatus, - STOPED, + STOPPED, SUCCESS_CIRCLE, + UNKNOWN, X_O } from './instantiationStatus.component.service'; import {ServiceInfoModel} from '../shared/server/serviceInfo/serviceInfo.model'; @@ -129,28 +130,23 @@ describe('Instantiation Status Service', () => { expect (suffix + serviceModelUrl).toEqual(result); }); - test('getStatusTooltip should return status popover', () => { - let result : ServiceStatus = service.getStatus('pending'); - expect(result.tooltip).toEqual('Pending: The action required will be sent as soon as possible.'); - - result = service.getStatus('IN_PROGRESS'); - expect(result.tooltip).toEqual('In-progress: the service is in process of the action required.'); - - result = service.getStatus('PAUSED'); - expect(result.tooltip).toEqual('Paused: Service has paused and waiting for your action.\n Select actions from the menu to the right.'); - - result = service.getStatus('FAILED'); - expect(result.tooltip).toEqual('Failed: All planned actions have failed.'); - - result = service.getStatus('COMPLETED'); - expect(result.tooltip).toEqual('Completed successfully: Service is successfully instantiated, updated or deleted.'); - - result = service.getStatus('STOPPED'); - expect(result.tooltip).toEqual('Stopped: Due to previous failure, will not be instantiated.'); + for (let [status, tooltip] of Object.entries({ + 'pending': 'Pending: The action required will be sent as soon as possible.', + 'IN_PROGRESS': 'In-progress: the service is in process of the action required.', + 'PAUSED': 'Paused: Service has paused and waiting for your action.\n Select actions from the menu to the right.', + 'FAILED': 'Failed: All planned actions have failed.', + 'COMPLETED': 'Completed successfully: Service is successfully instantiated, updated or deleted.', + 'STOPPED': 'Stopped: Due to previous failure, will not be instantiated.', + 'StOpPeD': 'Stopped: Due to previous failure, will not be instantiated.', + 'COMPLETED_WITH_ERRORS': 'Completed with errors: some of the planned actions where successfully committed while other have not.\n Open the service to check it out.', + 'UNEXPECTED_STATUS': 'Unexpected status: "UNEXPECTED_RANDOM_STATUS"', + })) { + + test(`getStatusTooltip should return status popover: status=${status}`, () => { + expect(service.getStatus(status).tooltip).toEqual(tooltip); + }); - result = service.getStatus('COMPLETED_WITH_ERRORS'); - expect(result.tooltip).toEqual('Completed with errors: some of the planned actions where successfully committed while other have not.\n Open the service to check it out.'); - }); + } test('getStatusTooltip should return correct icon per job status', () => { let result : ServiceStatus = service.getStatus('pending'); @@ -169,10 +165,13 @@ describe('Instantiation Status Service', () => { expect(result.iconClassName).toEqual(SUCCESS_CIRCLE); result = service.getStatus('STOPPED'); - expect(result.iconClassName).toEqual(STOPED); + expect(result.iconClassName).toEqual(STOPPED); result = service.getStatus('COMPLETED_WITH_ERRORS'); expect(result.iconClassName).toEqual(COMPLETED_WITH_ERRORS); + + result = service.getStatus('UNEXPECTED_RANDOM_STATUS'); + expect(result.iconClassName).toEqual(UNKNOWN); }); function generateServiceInfoData(){ 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 0e4451ca8..6a85d9da1 100644 --- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts +++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts @@ -12,13 +12,15 @@ 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"; + export let PENDING : string = "pending"; export let INPROGRESS : string = "in_progress"; export let PAUSE : string = "pause"; export let X_O : string = "x-circle-o"; export let SUCCESS_CIRCLE : string = "success-circle-o"; -export let STOPED : string = "stop"; +export let STOPPED : string = "stop"; export let COMPLETED_WITH_ERRORS : string = "success_with_warning"; +export let UNKNOWN : string = "question-mark-circle-o"; @Injectable() @@ -148,9 +150,12 @@ export class InstantiationStatusComponentService { case 'COMPLETED' : return new ServiceStatus(SUCCESS_CIRCLE, 'success', 'Completed successfully: Service is successfully instantiated, updated or deleted.'); case 'STOPPED' : - return new ServiceStatus(STOPED, 'error', 'Stopped: Due to previous failure, will not be instantiated.'); + return new ServiceStatus(STOPPED, 'error', 'Stopped: Due to previous failure, will not be instantiated.'); case 'COMPLETED_WITH_ERRORS' : return new ServiceStatus(COMPLETED_WITH_ERRORS, 'success', 'Completed with errors: some of the planned actions where successfully committed while other have not.\n Open the service to check it out.'); + + default: + return new ServiceStatus(UNKNOWN, 'primary', `Unexpected status: "${status}"`); } } -- 2.16.6