From e92e60ea797e4cc8f10ad1ee119b6fc0d5b76b6b Mon Sep 17 00:00:00 2001 From: Rogerio Pontual Date: Thu, 31 Oct 2024 17:23:41 +0100 Subject: [PATCH] Add Unknown functional status to UI --- .../inventory-item-details.controller.spec.js | 8 ++++++++ .../functional-status.constant.js | 10 ++++++++-- src/cce-inventory-item-status/messages_en.json | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/cce-inventory-item-details/inventory-item-details.controller.spec.js b/src/cce-inventory-item-details/inventory-item-details.controller.spec.js index e826d3d..7e50ee4 100644 --- a/src/cce-inventory-item-details/inventory-item-details.controller.spec.js +++ b/src/cce-inventory-item-details/inventory-item-details.controller.spec.js @@ -195,6 +195,14 @@ describe('InventoryItemDetailsController', function() { expect(vm.getFunctionalStatusLabel()).toEqual('cceInventoryItemStatus.unserviceable'); }); + it('should return the value of cceInventoryItemStatus.unknown for UNKNOWN', function() { + vm.inventoryItem = new FacilityProgramInventoryItemDataBuilder() + .withFunctionalStatus('UNKNOWN') + .build(); + + expect(vm.getFunctionalStatusLabel()).toEqual('cceInventoryItemStatus.unknown'); + }); + }); }); diff --git a/src/cce-inventory-item-status/functional-status.constant.js b/src/cce-inventory-item-status/functional-status.constant.js index a8b56d5..cef8ced 100644 --- a/src/cce-inventory-item-status/functional-status.constant.js +++ b/src/cce-inventory-item-status/functional-status.constant.js @@ -33,6 +33,7 @@ FUNCTIONING: 'FUNCTIONING', AWAITING_REPAIR: 'AWAITING_REPAIR', UNSERVICEABLE: 'UNSERVICEABLE', + UNKNOWN: 'UNKNOWN', getLabel: getLabel, getStatuses: getStatuses, getClass: getClass @@ -40,7 +41,8 @@ labels = { FUNCTIONING: 'cceInventoryItemStatus.functioning', AWAITING_REPAIR: 'cceInventoryItemStatus.awaitingRepair', - UNSERVICEABLE: 'cceInventoryItemStatus.unserviceable' + UNSERVICEABLE: 'cceInventoryItemStatus.unserviceable', + UNKNOWN: 'cceInventoryItemStatus.unknown' }; return FUNCTIONAL_STATUS; @@ -80,7 +82,8 @@ return [ FUNCTIONAL_STATUS.FUNCTIONING, FUNCTIONAL_STATUS.AWAITING_REPAIR, - FUNCTIONAL_STATUS.UNSERVICEABLE + FUNCTIONAL_STATUS.UNSERVICEABLE, + FUNCTIONAL_STATUS.UNKNOWN ]; } @@ -108,6 +111,9 @@ case FUNCTIONAL_STATUS.UNSERVICEABLE: statusClass = 'is-unserviceable'; break; + case FUNCTIONAL_STATUS.UNKNOWN: + statusClass = 'is-unserviceable'; + break; default: throw 'Invalid status'; } diff --git a/src/cce-inventory-item-status/messages_en.json b/src/cce-inventory-item-status/messages_en.json index 4be88d4..b4c3b3a 100644 --- a/src/cce-inventory-item-status/messages_en.json +++ b/src/cce-inventory-item-status/messages_en.json @@ -6,6 +6,7 @@ "cceInventoryItemStatus.equipmentFunctionalStatus": "Equipment Functional Status", "cceInventoryItemStatus.functionalityStatus": "Functionality Status", "cceInventoryItemStatus.awaitingRepair": "Awaiting Repair", + "cceInventoryItemStatus.unknown": "Unknown", "cceInventoryItemStatus.unserviceable": "Unserviceable", "cceInventoryItemStatus.notInUse": "Not in use", "cceInventoryItemStatus.decommissioned": "Decommissioned",