summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app
diff options
context:
space:
mode:
authorNilay Ranjan <nilay.ranjan@team.telstra.com>2019-12-09 22:58:39 +0530
committerOfir Sonsino <ofir.sonsino@intl.att.com>2019-12-20 07:18:39 +0000
commite38ef745ab296de90cb428f26348de32e4295420 (patch)
tree123d9e1949f588421a4d5eda687c7f6cccac6de6 /catalog-ui/src/app
parentf13ad6348df59f8883c9a3f86a7ef81ee4cb089c (diff)
Disabled manual service creation for Partner
Changes to disable/hide Partner Domain Service category to disable manual creation of such services Issue-ID: SDC-2382 Change-Id: Ie15732360d78542f41101e315fa4aa803531b5f2 Signed-off-by: Atif Husain <atif.husain@team.telstra.com>
Diffstat (limited to 'catalog-ui/src/app')
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view-model.ts43
-rw-r--r--catalog-ui/src/app/view-models/workspace/tabs/general/general-view.html2
2 files changed, 44 insertions, 1 deletions
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 635fc54a27..b4529700cf 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
@@ -65,6 +65,7 @@ export interface IGeneralScope extends IWorkspaceViewModelScope {
browseFileLabel:string;
componentCategories:componentCategories;
instantiationTypes:Array<instantiationType>;
+ isHiddenCategorySelected: boolean;
save():Promise<any>;
revert():void;
@@ -344,6 +345,39 @@ export class GeneralViewModel {
this.$scope.updateMenuComponentName(this.$scope.component.name);
};
+ //Find if a category is applicable for External API or not
+ private isHiddenCategory = (category: string) => {
+ let items: Array<any> = new Array<any>();
+ items = this.$scope.sdcMenu.component_workspace_menu_option[this.$scope.component.getComponentSubType()];
+ for(let index = 0; index < items.length; ++index) {
+ if ((items[index].hiddenCategories && items[index].hiddenCategories.indexOf(category) > -1)) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ private filteredCategories = () => {
+ let tempCategories: Array<IMainCategory> = new Array<IMainCategory>();
+ this.$scope.categories.forEach((category) => {
+ if (!this.isHiddenCategory(category.name)
+ && this.$scope.isCreateMode()
+ ) {
+ tempCategories.push(category);
+ } else if ((ComponentState.NOT_CERTIFIED_CHECKOUT === this.$scope.component.lifecycleState)
+ && !this.isHiddenCategory(this.$scope.component.selectedCategory)
+ && !this.isHiddenCategory(category.name)
+ ) {
+ tempCategories.push(category);
+ } else if ((ComponentState.NOT_CERTIFIED_CHECKOUT === this.$scope.component.lifecycleState)
+ && this.isHiddenCategory(this.$scope.component.selectedCategory)) {
+ tempCategories.push(category);
+ }
+ });
+
+ return tempCategories;
+ };
+
private initScopeMethods = ():void => {
this.$scope.initCategoreis = ():void => {
@@ -353,6 +387,14 @@ export class GeneralViewModel {
}
if (this.$scope.componentType === ComponentType.SERVICE) {
this.$scope.categories = this.cacheService.get('serviceCategories');
+
+ //Remove categories from dropdown applicable for External API
+ if (this.$scope.isCreateMode() || (ComponentState.NOT_CERTIFIED_CHECKOUT === this.$scope.component.lifecycleState)) {
+ this.$scope.categories = this.filteredCategories();
+ //Flag to disbale category if service is created through External API
+ this.$scope.isHiddenCategorySelected = this.isHiddenCategory(this.$scope.component.selectedCategory);
+ }
+
}
};
@@ -582,3 +624,4 @@ export class GeneralViewModel {
};
}
+
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 ee9b58d4e3..07f1e4d6ed 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
@@ -89,7 +89,7 @@
name="category"
data-ng-class="{'view-mode': isViewMode()}"
data-ng-change="onCategoryChange()"
- data-ng-disabled="component.isAlreadyCertified() || (component.isCsarComponent() && component.selectedCategory && component.selectedCategory!=='')"
+ data-ng-disabled="component.isAlreadyCertified() || (component.isCsarComponent() && component.selectedCategory && component.selectedCategory!=='') || isHiddenCategorySelected"
data-ng-model="componentCategories.selectedCategory"
data-tests-id="selectGeneralCategory"
>