aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/catalog
diff options
context:
space:
mode:
authordavsad <david.sadlier@est.tech>2021-09-07 15:50:44 +0100
committerMichael Morris <michael.morris@est.tech>2021-09-10 10:34:54 +0000
commitdd69d6a46433c252128df82d0c9aff5dbd5fafec (patch)
tree5577b39687d0c14b7d1868a507e792fe2e96b5c6 /catalog-ui/src/app/ng2/pages/catalog
parentd40595719a4309f4053c8a13432e556577641b95 (diff)
Model hierarchy not being considered while filtering
Issue-ID: SDC-3718 Signed-off-by: davsad <david.sadlier@est.tech> Change-Id: I4a984906aca180d470eb7bd71a09bfb0384cecb6
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/catalog')
-rw-r--r--catalog-ui/src/app/ng2/pages/catalog/catalog.component.ts35
1 files changed, 23 insertions, 12 deletions
diff --git a/catalog-ui/src/app/ng2/pages/catalog/catalog.component.ts b/catalog-ui/src/app/ng2/pages/catalog/catalog.component.ts
index 5d6526001c..5298e7e0d3 100644
--- a/catalog-ui/src/app/ng2/pages/catalog/catalog.component.ts
+++ b/catalog-ui/src/app/ng2/pages/catalog/catalog.component.ts
@@ -27,7 +27,6 @@ import { SdcMenuToken, IAppMenu } from "../../config/sdc-menu.config";
import { Component, ICategoryBase, IMainCategory, ISubCategory, IConfigStatuses, ICatalogSelector, CatalogSelectorTypes } from "app/models";
import { ResourceNamePipe } from "../../pipes/resource-name.pipe";
import { EntityFilterPipe, IEntityFilterObject, ISearchFilter} from "../../pipes/entity-filter.pipe";
-import { Model } from "app/models/model";
import { DEFAULT_MODEL_NAME } from "app/utils/constants";
interface Gui {
@@ -78,7 +77,7 @@ export class CatalogComponent {
public checkboxesFilterKeys:ICheckboxesFilterKeys;
public gui:Gui;
public categories:Array<IMainCategory>;
- public models: Array<string> = new Array();
+ public models: Array<any> = new Array();
public filteredCategories:Array<IMainCategory>;
public confStatus:IConfigStatuses;
public componentTypes:{[key:string]: Array<string>};
@@ -157,8 +156,17 @@ export class CatalogComponent {
this.numberOfItemToDisplay = 0;
this.categories = this.makeSortedCategories(this.cacheService.get('serviceCategories').concat(this.cacheService.get('resourceCategories')))
.map((cat) => <IMainCategory>cat);
- this.models = this.cacheService.get('models').map((model:Model) => model.name);
- this.models.unshift(DEFAULT_MODEL_NAME);
+
+ var modelList = this.cacheService.get('models');
+ modelList.sort((o:any, o1:any) => new String(o.modelType).localeCompare(o1.modelType));
+ modelList.forEach(m => {
+ if (m.derivedFrom) {
+ this.models[m.derivedFrom].push(m.name);
+ } else {
+ this.models[m.name] = [];
+ }
+ });
+ this.models[DEFAULT_MODEL_NAME] = [];
this.confStatus = this.sdcMenu.statuses;
this.expandedSection = ["type", "category", "status", "model"];
this.catalogItems = [];
@@ -229,14 +237,17 @@ export class CatalogComponent {
private buildChecklistModelForModels() {
this.modelsChecklistModel = new SdcUiCommon.ChecklistModel(this.checkboxesFilterKeys.models._main,
- this.models.map((model) => new SdcUiCommon.ChecklistItemModel(
- model,
- false,
- this.checkboxesFilterKeys.models._main.indexOf(model) !== -1,
- null,
- this.getTestIdForCheckboxByText(model),
- model))
- );
+ Object.keys(this.models).map((modelName) => {
+ var modelList = this.models[modelName];
+ modelList.unshift(modelName);
+ return new SdcUiCommon.ChecklistItemModel(
+ modelName,
+ false,
+ this.checkboxesFilterKeys.models._main.indexOf(modelName) !== -1,
+ null,
+ this.getTestIdForCheckboxByText(modelName),
+ modelList);
+ }));
}
private buildChecklistModelForStatuses() {