From 74d32db7741c0ab183296acdf6c79b345b39b4ca Mon Sep 17 00:00:00 2001 From: davsad Date: Mon, 1 Mar 2021 23:47:07 +0000 Subject: Restrict metadata valid values per category Issue-ID: SDC-3504 Signed-off-by: davsad Change-Id: I95c4769b231de8e681a2f0ff5eb84cc01c2d4367 --- catalog-ui/src/app/utils/constants.ts | 2 +- .../workspace/tabs/general/general-view-model.ts | 9 +- .../workspace/tabs/general/general-view.html | 174 +++++++++++++++------ 3 files changed, 133 insertions(+), 52 deletions(-) (limited to 'catalog-ui/src') diff --git a/catalog-ui/src/app/utils/constants.ts b/catalog-ui/src/app/utils/constants.ts index 0df1a6522c..3e86ec9e96 100644 --- a/catalog-ui/src/app/utils/constants.ts +++ b/catalog-ui/src/app/utils/constants.ts @@ -27,7 +27,7 @@ export let DEFAULT_ICON = 'defaulticon'; export let CP_END_POINT = 'CpEndPoint'; export let CHANGE_COMPONENT_CSAR_VERSION_FLAG = 'changeComponentCsarVersion'; export let PREVIOUS_CSAR_COMPONENT = 'previousCsarComponent' - +export let CATEGORY_SERVICE_METADATA_KEYS = ["Naming Policy","Service Type","Service Function","Service Role"]; export class GeneralStatus { static OK = 'OK'; diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts index cab4b6c236..54caa42317 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts +++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts @@ -27,7 +27,7 @@ import {CacheService, OnboardingService, ImportVSPService} from "app/services-ng import {IAppConfigurtaion, IValidate, IMainCategory, Resource, ISubCategory,Service, ICsarComponent, Component, IMetadataKey} from "app/models"; import {IWorkspaceViewModelScope} from "app/view-models/workspace/workspace-view-model"; import {Dictionary} from "lodash"; -import { PREVIOUS_CSAR_COMPONENT } from "../../../../utils/constants"; +import { PREVIOUS_CSAR_COMPONENT, CATEGORY_SERVICE_METADATA_KEYS } from "../../../../utils/constants"; import { Observable, Subject } from "rxjs"; import { MetadataEntry } from "app/models/metadataEntry"; import { Metadata } from "app/models/metadata"; @@ -678,6 +678,9 @@ export class GeneralViewModel { return this.getMetadataKey(this.$scope.component.categories, key) != null; } + this.$scope.isCategoryServiceMetadataKey = (key: string): boolean => { + return this.isServiceMetadataKey(key); + } } private setUnsavedChanges = (hasChanges: boolean): void => { @@ -706,5 +709,9 @@ export class GeneralViewModel { return null; } + private isServiceMetadataKey(key: string) : boolean { + return CATEGORY_SERVICE_METADATA_KEYS.indexOf(key) > -1; + } + } diff --git a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html index a04948e460..cb661f73fc 100644 --- a/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html +++ b/catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html @@ -119,7 +119,7 @@
-
@@ -135,7 +135,7 @@
-
-
@@ -161,7 +161,7 @@
-
- - - +
+
+ +
+
+ +
+ +
+
+ + +
@@ -399,17 +419,38 @@
- - + data-ng-class="{'error': validateField(editForm.serviceFunctionType)}"> +
+
+ +
+
+ +
+ +
+
+ + +
@@ -421,37 +462,70 @@
- - +
+
+ +
+
+ +
+ +
+
+ + +
-
- - + +
+ +
+
+ +
-- cgit 1.2.3-korg