summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2020-03-09 11:04:52 +0200
committerAlexey Sandler <alexey.sandler@intl.att.com>2020-03-09 13:05:24 +0200
commit5c249d4675c6f8f293d676c28de436cfe615e630 (patch)
tree2711232dc8cf41c64537604747d06cf4ceccdbce /vid-webpack-master/src/app
parentd46b13b53c422a4f3c01fb02012c3315aff6bde6 (diff)
Upgrade vfModule popup: show modelVersionId and invariantiD from instance or model.
Issue-ID: Issue-ID: VID-771 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com> Change-Id: I2132df5557d346537a9283c5f7147f47f1da36af Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts32
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts30
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts4
3 files changed, 51 insertions, 15 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
index c0a159142..fcef504fd 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
@@ -44,7 +44,6 @@ import {VfModuleUpgradePopupService} from "../../../shared/components/genericFor
import {SharedControllersService} from "../../../shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service";
import {ModalService} from "../../../shared/components/customModal/services/modal.service";
import {CreateDynamicComponentService} from "../../../shared/components/customModal/services/create-dynamic-component.service";
-import {instance} from "ts-mockito";
class MockAppStore<T> {
getState() {
@@ -289,6 +288,29 @@ describe('Shared Tree Service', () => {
expect(actualResult).toEqual(expectedResult);
});
+ each([
+ ['UUID from instance', getSelectedModelInfo(), getNetworkModelInfoFromHierarchy(),"UUID-from-instance" ],
+ ['UUID from instance', getSelectedModelInfo(), null,"UUID-from-instance" ],
+ ['UUID from hierarchy', null, getNetworkModelInfoFromHierarchy(),"UUID-from-hierarchy" ],
+ ['UUID undefined', null, null, undefined],
+
+ ]).
+ test('getModelVersionIdEitherFromInstanceOrFromHierarchy should %s', (description, instance, model, expectedResult) => {
+ let actualUuid = service.getModelVersionIdEitherFromInstanceOrFromHierarchy(instance, model);
+ expect(actualUuid).toEqual(expectedResult);
+ });
+
+ each([
+ ['from instance', getSelectedModelInfo(), getNetworkModelInfoFromHierarchy(), 'invariantId-from-instance'],
+ ['from instance', getSelectedModelInfo(), null, 'invariantId-from-instance'],
+ ['from hierarchy', null, getNetworkModelInfoFromHierarchy(), 'invariantId-from-hierarchy'],
+ ['undefined', null, null, undefined],
+ ]).
+ test('getModelInvariantIdEitherFromInstanceOrFromHierarchy should return invariantId %s', (description, instance, model, expectedInvariantId) =>{
+ let actualInvariantId = service.getModelInvariantIdEitherFromInstanceOrFromHierarchy(instance, model);
+ expect(actualInvariantId).toEqual(expectedInvariantId);
+ });
+
test('statusProperties should be prop on node according to node properties', () => {
let node = service.addingStatusProperty({orchStatus: 'completed', provStatus: 'inProgress', inMaint: false});
expect(node.statusProperties).toBeDefined();
@@ -1534,7 +1556,9 @@ function getStore() {
function getNetworkModelInfoFromHierarchy(){
return {
"version": "2.0",
- "customizationUuid":"customization-id-from-hierarchy"
+ "customizationUuid":"customization-id-from-hierarchy",
+ "uuid": "UUID-from-hierarchy",
+ "invariantUuid": "invariantId-from-hierarchy"
}
}
@@ -1542,7 +1566,9 @@ function getSelectedModelInfo() {
return {
"instanceModelInfo": {
"modelVersion": "5.0",
- "modelCustomizationId": "model-customization-id-from-instance"
+ "modelCustomizationId": "model-customization-id-from-instance",
+ "modelVersionId": "UUID-from-instance",
+ "modelInvariantId": "invariantId-from-instance"
}
}
}
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
index d543991b5..1e8512784 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
@@ -478,19 +478,29 @@ export class SharedTreeService {
}
getModelVersionEitherFromInstanceOrFromHierarchy(selectedNodeData, model): string | undefined {
- if (selectedNodeData && selectedNodeData.instanceModelInfo && selectedNodeData.instanceModelInfo.modelVersion) {
- return selectedNodeData.instanceModelInfo.modelVersion;
- } else if (model && model.version) {
- return model.version;
- }
- return undefined;
+ return this.getNamedFieldFromInstanceOrFromHierarchy(selectedNodeData, "modelVersion", model, "version");
}
getModelCustomizationIdEitherFromInstanceOrFromHierarchy(selectedNodeData, model): string | undefined {
- if (selectedNodeData && selectedNodeData.instanceModelInfo && selectedNodeData.instanceModelInfo.modelCustomizationId) {
- return selectedNodeData.instanceModelInfo.modelCustomizationId;
- } else if (model && model.customizationUuid) {
- return model.customizationUuid;
+ return this.getNamedFieldFromInstanceOrFromHierarchy(selectedNodeData, "modelCustomizationId", model, "customizationUuid");
+ }
+
+ getModelInvariantIdEitherFromInstanceOrFromHierarchy(selectedNodeData, model): string | undefined {
+ return this.getNamedFieldFromInstanceOrFromHierarchy(selectedNodeData, "modelInvariantId", model, "invariantUuid");
+ }
+
+ getModelVersionIdEitherFromInstanceOrFromHierarchy(selectedNodeData, model): string | undefined {
+ return this.getNamedFieldFromInstanceOrFromHierarchy (selectedNodeData, "modelVersionId", model, "uuid");
+ }
+
+
+
+ getNamedFieldFromInstanceOrFromHierarchy(selectedNodeData, instanceModelInfoFieldName, model, modelFieldName): string | undefined {
+ if (instanceModelInfoFieldName && selectedNodeData && selectedNodeData.instanceModelInfo
+ && selectedNodeData.instanceModelInfo[instanceModelInfoFieldName]) {
+ return selectedNodeData.instanceModelInfo[instanceModelInfoFieldName];
+ } else if (modelFieldName && model && model[modelFieldName]) {
+ return model[modelFieldName];
}
return undefined;
}
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts
index 130e9f50f..6bf593462 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.ts
@@ -79,8 +79,8 @@ export abstract class VfModulePopupServiceBase {
new ModelInformationItem("Description", "description", [this.model.description]),
new ModelInformationItem("Category", "category", [this.model.category]),
new ModelInformationItem("Sub Category", "subCategory", [this.model.subCategory]),
- new ModelInformationItem("UUID", "uuid", [this.model.uuid], Constants.ServicePopup.TOOLTIP_UUID, true),
- new ModelInformationItem("Invariant UUID", "invariantUuid", [this.model.invariantUuid], Constants.ServicePopup.TOOLTIP_INVARIANT_UUID, true),
+ new ModelInformationItem("UUID", "uuid", [this._sharedTreeService.getModelVersionIdEitherFromInstanceOrFromHierarchy(vfModuleModeNode.data, this.model)], Constants.ServicePopup.TOOLTIP_UUID, true),
+ new ModelInformationItem("Invariant UUID", "invariantUuid", [this._sharedTreeService.getModelInvariantIdEitherFromInstanceOrFromHierarchy(vfModuleModeNode, this.model)], Constants.ServicePopup.TOOLTIP_INVARIANT_UUID, true),
new ModelInformationItem("Service type", "serviceType", [this.serviceModel.serviceType]),
new ModelInformationItem("Service role", "serviceRole", [this.serviceModel.serviceRole]),
new ModelInformationItem("Minimum to instantiate", "min", this.model.min == undefined ? ['0'] : [this.model.min.toString()], "", true),