From 5b593496b8f1b8e8be8d7d2dbcc223332e65a49b Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 29 Jul 2018 16:13:45 +0300 Subject: re base code Change-Id: I12a5ca14a6d8a87e9316b9ff362eb131105f98a5 Issue-ID: SDC-1566 Signed-off-by: Michael Lando --- catalog-ui/src/app/services/entity-service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'catalog-ui/src/app/services/entity-service.ts') diff --git a/catalog-ui/src/app/services/entity-service.ts b/catalog-ui/src/app/services/entity-service.ts index b7ac8805ce..2e7b2e1eed 100644 --- a/catalog-ui/src/app/services/entity-service.ts +++ b/catalog-ui/src/app/services/entity-service.ts @@ -19,6 +19,7 @@ */ 'use strict'; +import * as _ from "lodash"; import { Service, IApi, IAppConfigurtaion, Resource, Component} from "../models"; import {SharingService} from "./sharing-service"; import {ComponentFactory} from "../utils/component-factory"; @@ -26,7 +27,7 @@ import {CacheService} from "./cache-service"; import {ResourceType} from "app/utils"; interface IEntityService { - getAllComponents():ng.IPromise>; + getAllComponents(smallObjects?:boolean):ng.IPromise>; } interface IComponentsArray { @@ -36,6 +37,7 @@ interface IComponentsArray { export class EntityService implements IEntityService { static '$inject' = ['$http', '$q', 'sdcConfig', 'Sdc.Services.SharingService', 'ComponentFactory', 'Sdc.Services.CacheService']; + private _smallObjectAttributes = ['uniqueId', 'name', 'componentType', 'resourceType', 'lastUpdateDate', 'lifecycleState', 'distributionStatus', 'icon', 'version']; private api:IApi; constructor(private $http:ng.IHttpService, @@ -66,7 +68,6 @@ export class EntityService implements IEntityService { this.sharingService.addUuidValue(component.uniqueId, component.uuid); }); - this.cacheService.set('breadcrumbsComponents', componentsList); defer.resolve(componentsList); },(responce) => { defer.reject(responce); @@ -74,7 +75,7 @@ export class EntityService implements IEntityService { return defer.promise; }; - getAllComponents = ():ng.IPromise> => { + getAllComponents = (smallObjects?:boolean):ng.IPromise> => { let defer = this.$q.defer>(); this.$http.get(this.api.root + this.api.GET_element) .then((response:any) => { @@ -82,18 +83,19 @@ export class EntityService implements IEntityService { let componentsList:Array = []; componentResponse.services && componentResponse.services.forEach((serviceResponse:Service) => { + serviceResponse = (smallObjects) ? _.pick(serviceResponse, this._smallObjectAttributes) : serviceResponse; let component:Service = this.ComponentFactory.createService(serviceResponse); componentsList.push(component); this.sharingService.addUuidValue(component.uniqueId, component.uuid); }); componentResponse.resources && componentResponse.resources.forEach((resourceResponse:Resource) => { + resourceResponse = (smallObjects) ? _.pick(resourceResponse, this._smallObjectAttributes) : resourceResponse; let component:Resource = this.ComponentFactory.createResource(resourceResponse); componentsList.push(component); this.sharingService.addUuidValue(component.uniqueId, component.uuid); }); - this.cacheService.set('breadcrumbsComponents', componentsList); defer.resolve(componentsList); }); -- cgit 1.2.3-korg