summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-07-29 16:13:45 +0300
committerMichael Lando <ml636r@att.com>2018-07-29 16:20:34 +0300
commit5b593496b8f1b8e8be8d7d2dbcc223332e65a49b (patch)
tree2f9dfc45191e723da69cf74be7829784e9741b94 /catalog-ui/src/app/ng2/services
parent9200382f2ce7b4bb729aa287d0878004b2d2b4f9 (diff)
re base code
Change-Id: I12a5ca14a6d8a87e9316b9ff362eb131105f98a5 Issue-ID: SDC-1566 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/services')
-rw-r--r--catalog-ui/src/app/ng2/services/archive.service.ts67
-rw-r--r--catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts28
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/component.service.ts33
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/service.service.ts2
-rw-r--r--catalog-ui/src/app/ng2/services/config.service.ts2
-rw-r--r--catalog-ui/src/app/ng2/services/groups.service.ts78
-rw-r--r--catalog-ui/src/app/ng2/services/modal.service.ts8
-rw-r--r--catalog-ui/src/app/ng2/services/policies.service.ts101
-rw-r--r--catalog-ui/src/app/ng2/services/responses/automated-upgrade-response.ts16
-rw-r--r--catalog-ui/src/app/ng2/services/responses/component-generic-response.ts7
-rw-r--r--catalog-ui/src/app/ng2/services/responses/dependencies-server-response.ts14
-rw-r--r--catalog-ui/src/app/ng2/services/responses/properties.response.ts27
-rw-r--r--catalog-ui/src/app/ng2/services/window.service.ts8
13 files changed, 345 insertions, 46 deletions
diff --git a/catalog-ui/src/app/ng2/services/archive.service.ts b/catalog-ui/src/app/ng2/services/archive.service.ts
new file mode 100644
index 0000000000..83f1c502c2
--- /dev/null
+++ b/catalog-ui/src/app/ng2/services/archive.service.ts
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+import { Injectable, Inject } from "@angular/core";
+import { Observable } from "rxjs/Observable";
+import { HttpService } from "./http.service";
+import { SdcConfigToken, ISdcConfig } from "../config/sdc-config.config";
+import { Component } from "../../models";
+import { ComponentFactory } from 'app/utils/component-factory';
+
+
+@Injectable()
+export class ArchiveService {
+ protected baseUrl;
+
+ constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig, private componentFactory:ComponentFactory/*, @Inject(ComponentFactory) componentFactory */) {
+ this.baseUrl = sdcConfig.api.root ;
+ }
+
+ public getArchiveCatalog() {
+ let archiveCatalogItems:Component[] = [];
+ let archiveCatalogResourceItems:Component[] = [];
+ let archiveCatalogServiceItems:Component[] = [];
+
+ return this.http.get(this.baseUrl + '/v1/catalog/archive/', {}).map(res => {
+ let archiveCatalogObject = res.json();
+ if (archiveCatalogObject.resources) archiveCatalogResourceItems = this.getResourceItems(archiveCatalogObject.resources);
+ if (archiveCatalogObject.services) archiveCatalogServiceItems = this.getServiceItems(archiveCatalogObject.services);
+ archiveCatalogItems = [].concat(archiveCatalogResourceItems, archiveCatalogServiceItems);
+
+ return archiveCatalogItems;
+ });
+ }
+
+
+ private getResourceItems(resources){
+ let resourceItems = resources.map((resource)=>{
+ return this.componentFactory.createResource(resource)
+ })
+ return resourceItems;
+ }
+
+ private getServiceItems(services){
+ let serviceItems = services.map((service)=>{
+ return this.componentFactory.createService(service)
+ })
+ return serviceItems;
+ }
+
+} \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts b/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts
index 0947b2aa7f..15750020dc 100644
--- a/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts
@@ -92,4 +92,32 @@ export class ComponentInstanceServiceNg2 {
return res.json().map((resInput) => new PropertyBEModel(resInput));
});
}
+
+ getComponentGroupInstanceProperties(component: Component, groupInstanceId: string): Observable<Array<PropertyBEModel>> {
+ return this.http.get(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/groups/' + groupInstanceId + '/properties')
+ .map((res: Response) => {
+ return CommonUtils.initBeProperties(res.json());
+ });
+ }
+
+ updateComponentGroupInstanceProperties(component: Component, groupInstanceId: string, properties: PropertyBEModel[]): Observable<Array<PropertyBEModel>> {
+ return this.http.put(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/groups/' + groupInstanceId + '/properties', properties)
+ .map((res: Response) => {
+ return res.json().map((resProperty) => new PropertyBEModel(resProperty));
+ });
+ }
+
+ getComponentPolicyInstanceProperties(component: Component, policyInstanceId: string): Observable<Array<PropertyBEModel>> {
+ return this.http.get(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/policies/' + policyInstanceId + '/properties')
+ .map((res: Response) => {
+ return CommonUtils.initBeProperties(res.json());
+ });
+ }
+
+ updateComponentPolicyInstanceProperties(component: Component, policyInstanceId: string, properties: PropertyBEModel[]): Observable<Array<PropertyBEModel>> {
+ return this.http.put(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/policies/' + policyInstanceId + '/properties', properties)
+ .map((res: Response) => {
+ return res.json().map((resProperty) => new PropertyBEModel(resProperty));
+ });
+ }
}
diff --git a/catalog-ui/src/app/ng2/services/component-services/component.service.ts b/catalog-ui/src/app/ng2/services/component-services/component.service.ts
index 381995d91c..3546ebd374 100644
--- a/catalog-ui/src/app/ng2/services/component-services/component.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-services/component.service.ts
@@ -25,6 +25,7 @@ import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import {Response, URLSearchParams} from '@angular/http';
import { Component, InputBEModel, InstancePropertiesAPIMap, FilterPropertiesAssignmentData, OperationModel, CreateOperationResponse} from "app/models";
+import {downgradeInjectable} from '@angular/upgrade/static';
import {COMPONENT_FIELDS} from "app/utils";
import {ComponentGenericResponse} from "../responses/component-generic-response";
import {InstanceBePropertiesMap} from "../../../models/properties-inputs/property-fe-map";
@@ -32,6 +33,9 @@ import {API_QUERY_PARAMS} from "app/utils";
import { ComponentType, ServerTypeUrl } from "../../../utils/constants";
import { HttpService } from '../http.service';
import {SdcConfigToken, ISdcConfig} from "../../config/sdc-config.config";
+import {IDependenciesServerResponse} from "../responses/dependencies-server-response";
+import {AutomatedUpgradeGenericResponse} from "../responses/automated-upgrade-response";
+import {IAutomatedUpgradeRequestObj} from "../../pages/automated-upgrade/automated-upgrade.service";
declare var angular:angular.IAngularStatic;
@@ -83,7 +87,11 @@ export class ComponentServiceNg2 {
}
getComponentCompositionData(component:Component):Observable<ComponentGenericResponse> {
- return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_RELATION, COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_POLICIES, COMPONENT_FIELDS.COMPONENT_GROUPS]);
+ return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_RELATION, COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_POLICIES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_GROUPS]);
+ }
+
+ getComponentResourcePropertiesData(component:Component):Observable<ComponentGenericResponse> {
+ return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES, COMPONENT_FIELDS.COMPONENT_POLICIES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_GROUPS]);
}
getComponentResourceInstances(component:Component):Observable<ComponentGenericResponse> {
@@ -171,6 +179,15 @@ export class ComponentServiceNg2 {
})
}
+ restoreComponent(componentType:string, componentId:string){
+ return this.http.post(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/restore', {})
+ }
+
+ archiveComponent(componentType:string, componentId:string){
+ return this.http.post(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/archive', {})
+ }
+
+
deleteInput(component:Component, input:InputBEModel):Observable<InputBEModel> {
return this.http.delete(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/delete/' + input.uniqueId + '/input')
@@ -198,5 +215,19 @@ export class ComponentServiceNg2 {
return res.json();
});
}
+
+ getDependencies(componentType:string, componentId: string):Observable<Array<IDependenciesServerResponse>> {
+ return this.http.get(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/dependencies')
+ .map((res:Response) => {
+ return res.json();
+ });
+ }
+
+ automatedUpgrade(componentType:string, componentId: string, componentsIdsToUpgrade:Array<IAutomatedUpgradeRequestObj>):Observable<AutomatedUpgradeGenericResponse> {
+ return this.http.post(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/automatedupgrade', componentsIdsToUpgrade)
+ .map((res:Response) => {
+ return res.json();
+ });
+ }
}
diff --git a/catalog-ui/src/app/ng2/services/component-services/service.service.ts b/catalog-ui/src/app/ng2/services/component-services/service.service.ts
index 0439f2047e..15e624b81f 100644
--- a/catalog-ui/src/app/ng2/services/component-services/service.service.ts
+++ b/catalog-ui/src/app/ng2/services/component-services/service.service.ts
@@ -126,7 +126,7 @@ export class ServiceServiceNg2 extends ComponentServiceNg2 {
}
getComponentCompositionData(component:Component):Observable<ComponentGenericResponse> {
- return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_RELATION, COMPONENT_FIELDS.COMPONENT_INSTANCES, SERVICE_FIELDS.FORWARDING_PATHS]);
+ return this.getComponentDataByFieldsName(component.componentType, component.uniqueId, [COMPONENT_FIELDS.COMPONENT_INSTANCES_RELATION, COMPONENT_FIELDS.COMPONENT_INSTANCES, SERVICE_FIELDS.FORWARDING_PATHS, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_POLICIES, COMPONENT_FIELDS.COMPONENT_NON_EXCLUDED_GROUPS]);
}
protected analyzeComponentDataResponse(res: Response):ComponentGenericResponse {
diff --git a/catalog-ui/src/app/ng2/services/config.service.ts b/catalog-ui/src/app/ng2/services/config.service.ts
index a9a4e86a55..1774a663e2 100644
--- a/catalog-ui/src/app/ng2/services/config.service.ts
+++ b/catalog-ui/src/app/ng2/services/config.service.ts
@@ -38,7 +38,7 @@ export class ConfigService {
constructor(private http: Http, @Inject(SdcConfigToken) private sdcConfig:ISdcConfig) {
this.api = this.sdcConfig.api;
- this.baseUrl = this.sdcConfig.api.root + this.sdcConfig.api.component_api_root;
+ this.baseUrl = this.api.root + this.sdcConfig.api.component_api_root;
}
loadValidationConfiguration(): Promise<ValidationConfiguration> {
diff --git a/catalog-ui/src/app/ng2/services/groups.service.ts b/catalog-ui/src/app/ng2/services/groups.service.ts
new file mode 100644
index 0000000000..e3b3d85b50
--- /dev/null
+++ b/catalog-ui/src/app/ng2/services/groups.service.ts
@@ -0,0 +1,78 @@
+import {IZoneInstanceAssignment} from '../../models/graph/zones/zone-instance';
+import {Injectable, Inject} from "@angular/core";
+import {Observable} from "rxjs/Observable";
+import {HttpService} from "./http.service";
+import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config";
+import {GroupInstance} from '../../models/graph/zones/group-instance';
+import {UiBaseObject} from "../../models/ui-models/ui-base-object";
+import {IZoneService} from "../../models/graph/zones/zone";
+
+@Injectable()
+export class GroupsService implements IZoneService {
+
+ protected baseUrl;
+
+ private mapApiDirections = {
+ 'RESOURCE': 'resources',
+ 'SERVICE': 'services'
+ }
+
+ constructor(private http:HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig) {
+ this.baseUrl = sdcConfig.api.root;
+ }
+
+ public createGroupInstance(componentType:string, componentUniqueId:string, groupType:string) {
+ return this.http.post(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[componentType.toUpperCase()] + '/' + componentUniqueId + '/groups/' + groupType, {}).map(resp => {
+ return resp.json();
+ });
+ };
+
+ public addGroupMember(topologyTemplateType:string, topologyTemplateId:string, group:GroupInstance, memberId:string) {
+ let members:Array<string> = Object.assign({}, group.members);
+ members.push(memberId);
+ return this.updateGroupMembers(topologyTemplateType, topologyTemplateId, group.uniqueId, members);
+ }
+
+ public deleteGroupMember(topologyTemplateType:string, topologyTemplateId:string, group:GroupInstance, memberId:string) {
+ let _members:Array<string> = angular.copy(group.members);
+ _members =_.without(_members, memberId);
+ return this.updateGroupMembers(topologyTemplateType, topologyTemplateId, group.uniqueId, _members);
+ }
+
+ public updateGroupMembers(topologyTemplateType:string, topologyTemplateId:string, groupId:string, members:Array<string>):Observable<Array<string>> {
+ return this.http.post(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[topologyTemplateType.toUpperCase()] + '/' + topologyTemplateId + '/groups/' + groupId + '/members', members)
+ .map(response => response.json());
+ }
+
+ public updateMembers(topologyTemplateType:string, topologyTemplateId:string, groupId:string, members:Array<UiBaseObject>):Observable<Array<string>> {
+ let membersIds:Array<string> = members.map(member => member.uniqueId);
+ return this.updateGroupMembers(topologyTemplateType, topologyTemplateId, groupId, membersIds);
+ }
+
+ public getSpecificGroup(topologyTemplateType:string, topologyTemplateId:string, groupId:string):Observable<GroupInstance> {
+ return this.http.get(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[topologyTemplateType.toUpperCase()] + '/' + topologyTemplateId + '/groups/' + groupId)
+ .map(res => {
+ return new GroupInstance(res.json());
+ });
+ }
+
+ public updateName(topologyTemplateType:string, topologyTemplateId:string, groupId:string, newName:string):Observable<GroupInstance> {
+ return this.http.put(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[topologyTemplateType.toUpperCase()] + '/' + topologyTemplateId + '/groups/' + groupId, {name: newName}).map(resp => {
+ return resp.json();
+ });
+ };
+
+ public deleteGroup(topologyTemplateType:string, topologyTemplateId:string, groupId:string) {
+ return this.http.delete(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[topologyTemplateType.toUpperCase()] + '/' + topologyTemplateId + '/groups/' + groupId).map(resp => {
+ return resp.json();
+ });
+ };
+
+ public updateZoneInstanceAssignments(topologyTemplateType:string, topologyTemplateId:string, policyId:string, members:Array<IZoneInstanceAssignment>):Observable<any> {
+ return this.updateMembers(topologyTemplateType, topologyTemplateId, policyId, members);
+ };
+
+ public deleteZoneInstance(topologyTemplateType:string, topologyTemplateId:string, policyId:string):Observable<any> {
+ return this.deleteGroup(topologyTemplateType, topologyTemplateId, policyId);
+ };
+} \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/services/modal.service.ts b/catalog-ui/src/app/ng2/services/modal.service.ts
index 4e86d6accf..a8f1b99ac2 100644
--- a/catalog-ui/src/app/ng2/services/modal.service.ts
+++ b/catalog-ui/src/app/ng2/services/modal.service.ts
@@ -24,6 +24,10 @@ export class ModalService {
this.createCustomModal(modalModel).instance.open();
}
+ public openErrorModal = (closeButtonText?: string, errorMessage?: string):void => {
+ let errorModal = this.createErrorModal(closeButtonText, errorMessage);
+ errorModal.instance.open();
+ };
/**
* Shortcut method to open a basic modal with title, message, and an action button with callback, as well as close button.
@@ -77,7 +81,7 @@ export class ModalService {
return wizardInstance;
}
-
+
public closeCurrentModal = () => {
if (!this.currentModal) return;
this.currentModal.instance.close();
@@ -102,3 +106,5 @@ export class ModalService {
}
+
+
diff --git a/catalog-ui/src/app/ng2/services/policies.service.ts b/catalog-ui/src/app/ng2/services/policies.service.ts
index 2b564b8915..3675a7b9ab 100644
--- a/catalog-ui/src/app/ng2/services/policies.service.ts
+++ b/catalog-ui/src/app/ng2/services/policies.service.ts
@@ -18,32 +18,107 @@
* ============LICENSE_END=========================================================
*/
-import { Injectable, Inject } from "@angular/core";
-import { Headers } from "@angular/http";
-import { Observable } from "rxjs/Observable";
-import { HttpService } from "./http.service";
-import { Cookie2Service } from "./cookie.service";
+import {Injectable, Inject} from "@angular/core";
+import {Observable} from "rxjs/Observable";
+import {HttpService} from "./http.service";
import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config";
+import {PolicyInstance, PolicyTargetsRequest} from '../../models/graph/zones/policy-instance';
+import {IZoneInstanceAssignment} from "../../models/graph/zones/zone-instance";
+import {IZoneService} from "../../models/graph/zones/zone";
+import {TargetUiObject} from "../../models/ui-models/ui-target-object";
+import {TargetOrMemberType} from "../../utils/constants";
@Injectable()
-export class PoliciesService {
+export class PoliciesService implements IZoneService {
protected baseUrl;
private mapApiDirections = {
- 'RESOURCE':'resources',
- 'SERVICE':'services'
+ 'RESOURCE': 'resources',
+ 'SERVICE': 'services'
}
- constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig) {
- this.baseUrl = sdcConfig.api.root ;
+ constructor(private http:HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig) {
+ this.baseUrl = sdcConfig.api.root;
}
- public createPolicyInstance(entityType:string, id:string, policyType:string) {
- return this.http.post(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[entityType] + '/' + id +'/policies/' + policyType, {}).map(resp => {
- return resp.json();
+ public createPolicyInstance(topologyTemplateType:string, topologyTemplateId:string, policyType:string) {
+ return this.http.post(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[topologyTemplateType.toUpperCase()] + '/' + topologyTemplateId + '/policies/' + policyType, {}).map(resp => {
+ return resp.json();
});
}
+ public addPolicyTarget(topologyTemplateType:string, topologyTemplateId:string, policy:PolicyInstance, targetId:string, targetType:TargetOrMemberType) {
+ let _targets:Array<string>;
+ let _members:Array<string>;
+
+ if (targetType === TargetOrMemberType.COMPONENT_INSTANCES) {
+ _targets = angular.copy(policy.targets.COMPONENT_INSTANCES);
+ _targets.push(targetId);
+ } else if (targetType === TargetOrMemberType.GROUPS) {
+ _members = angular.copy(policy.targets.GROUPS);
+ _members.push(targetId);
+ }
+ let policyTargetRequest:PolicyTargetsRequest = new PolicyTargetsRequest(_members, _targets);
+ return this.updatePolicyTargets(topologyTemplateType, topologyTemplateId, policy.uniqueId, policyTargetRequest);
+ }
+
+ public deletePolicyTarget(topologyTemplateType:string, topologyTemplateId:string, policy:PolicyInstance, targetId:string, targetType:TargetOrMemberType): Observable<PolicyInstance> {
+ let _targets:Array<string> = angular.copy(policy.targets.COMPONENT_INSTANCES);
+ let _members:Array<string> = angular.copy(policy.targets.GROUPS);
+ if (targetType === TargetOrMemberType.COMPONENT_INSTANCES) {
+ _targets = _.without(_targets, targetId);
+ } else if (targetType === TargetOrMemberType.GROUPS) {
+ _members = _.without(_members, targetId);
+ }
+ let policyTargetRequest:PolicyTargetsRequest = new PolicyTargetsRequest(_members, _targets);
+ return this.updatePolicyTargets(topologyTemplateType, topologyTemplateId, policy.uniqueId, policyTargetRequest);
+ }
+
+ public updatePolicyTargets(topologyTemplateType:string, topologyTemplateId:string, policyId:string, targets:PolicyTargetsRequest): Observable<PolicyInstance> {
+ return this.http.post(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[topologyTemplateType.toUpperCase()] + '/' + topologyTemplateId + '/policies/' + policyId + '/targets', targets.requestItems)
+ .map(response => new PolicyInstance(response.json()));
+ }
+
+ public updateTargets(topologyTemplateType:string, topologyTemplateId:string, policyId:string, targets:Array<TargetUiObject>):Observable<PolicyInstance> {
+ let instances:Array<string> = _.filter(targets, (target:TargetUiObject)=> {
+ return target.type === TargetOrMemberType.COMPONENT_INSTANCES;
+ }).map(target => target.uniqueId);
+
+ let groups:Array<string> = _.filter(targets, (target:TargetUiObject)=> {
+ return target.type === TargetOrMemberType.GROUPS;
+ }).map(target => target.uniqueId);
+
+ let policyTargetRequest:PolicyTargetsRequest = new PolicyTargetsRequest(groups, instances);
+ return this.updatePolicyTargets(topologyTemplateType, topologyTemplateId, policyId, policyTargetRequest);
+ }
+
+ public getSpecificPolicy(topologyTemplateType:string, topologyTemplateId:string, policyId:string):Observable<PolicyInstance> {
+ return this.http.get(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[topologyTemplateType.toUpperCase()] + '/' + topologyTemplateId + '/policies/' + policyId)
+ .map(res => {
+ return new PolicyInstance(res.json());
+ });
+ }
+
+ public updateName(topologyTemplateType:string, topologyTemplateId:string, policyId:string, newName:string):Observable<any> {
+ return this.http.put(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[topologyTemplateType.toUpperCase()] + '/' + topologyTemplateId + '/policies/' + policyId, {name: newName}).map(res => {
+ return res.json();
+ });
+ };
+
+ public deletePolicy(topologyTemplateType:string, topologyTemplateId:string, policyId:string) {
+ return this.http.delete(this.baseUrl + '/v1/catalog/' + this.mapApiDirections[topologyTemplateType.toUpperCase()] + '/' + topologyTemplateId + '/policies/' + policyId).map(resp => {
+ return resp.json();
+ });
+ };
+
+ public updateZoneInstanceAssignments(topologyTemplateType:string, topologyTemplateId:string, policyId:string, targets:Array<IZoneInstanceAssignment>):Observable<PolicyInstance>{
+ return this.updateTargets(topologyTemplateType, topologyTemplateId, policyId, targets);
+ };
+
+ public deleteZoneInstance(topologyTemplateType:string, topologyTemplateId:string, policyId:string):Observable<any> {
+ return this.deletePolicy(topologyTemplateType, topologyTemplateId, policyId);
+ };
+
}
diff --git a/catalog-ui/src/app/ng2/services/responses/automated-upgrade-response.ts b/catalog-ui/src/app/ng2/services/responses/automated-upgrade-response.ts
new file mode 100644
index 0000000000..feac8685a7
--- /dev/null
+++ b/catalog-ui/src/app/ng2/services/responses/automated-upgrade-response.ts
@@ -0,0 +1,16 @@
+/**
+ * Created by ob0695 on 4/29/2018.
+ */
+
+export class AutomatedUpgradeStatusResponse {
+ name:string;
+ status:string;
+ uniqueId:string;
+ version:string;
+}
+
+export class AutomatedUpgradeGenericResponse {
+ error:string;
+ status:string;
+ componentToUpgradeStatus:Array<AutomatedUpgradeStatusResponse>;
+} \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
index 5036a10a9d..a77133e09f 100644
--- a/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
+++ b/catalog-ui/src/app/ng2/services/responses/component-generic-response.ts
@@ -28,6 +28,7 @@ import {CommonUtils} from "app/utils";
import {Serializable} from "../utils/serializable";
import {PropertyBEModel} from "../../../models/properties-inputs/property-be-model";
import { PolicyInstance } from "app/models/graph/zones/policy-instance";
+import { GroupInstance } from "../../../models/graph/zones/group-instance";
export class ComponentGenericResponse implements Serializable<ComponentGenericResponse> {
@@ -45,7 +46,8 @@ export class ComponentGenericResponse implements Serializable<ComponentGenericR
public properties:Array<PropertyModel>;
public attributes:Array<AttributeModel>;
public policies:Array<PolicyInstance>;
- public groups:Array<Module>;
+ public groupInstances: Array<GroupInstance>;
+ public modules:Array<Module>;
public interfaces:any;
public interfaceOperations:Array<OperationModel>;
public additionalInformation:any;
@@ -96,7 +98,8 @@ export class ComponentGenericResponse implements Serializable<ComponentGenericR
this.metadata = new ComponentMetadata().deserialize(response.metadata);
}
if(response.groups) {
- this.groups = CommonUtils.initModules(response.groups);
+ this.modules = CommonUtils.initModules(response.groups);
+ this.groupInstances = CommonUtils.initGroups(response.groups)
}
if(response.policies) {
this.policies = CommonUtils.initPolicies(response.policies);
diff --git a/catalog-ui/src/app/ng2/services/responses/dependencies-server-response.ts b/catalog-ui/src/app/ng2/services/responses/dependencies-server-response.ts
new file mode 100644
index 0000000000..be8aaea75d
--- /dev/null
+++ b/catalog-ui/src/app/ng2/services/responses/dependencies-server-response.ts
@@ -0,0 +1,14 @@
+import { state } from '@angular/core';
+/**
+ * Created by ob0695 on 4/23/2018.
+ */
+export interface IDependenciesServerResponse {
+ icon: string;
+ name: string;
+ type: string;
+ uniqueId: string;
+ version: string;
+ state: string;
+ dependencies: Array<IDependenciesServerResponse>;
+ instanceNames: Array<string>;
+} \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/services/responses/properties.response.ts b/catalog-ui/src/app/ng2/services/responses/properties.response.ts
deleted file mode 100644
index a1c0660c0f..0000000000
--- a/catalog-ui/src/app/ng2/services/responses/properties.response.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-export class PropertiesResponse {
- properties: Array<Property>;
-}
-
-class Property {
- name: string
-}
diff --git a/catalog-ui/src/app/ng2/services/window.service.ts b/catalog-ui/src/app/ng2/services/window.service.ts
new file mode 100644
index 0000000000..0a11166f7b
--- /dev/null
+++ b/catalog-ui/src/app/ng2/services/window.service.ts
@@ -0,0 +1,8 @@
+import {Injectable} from "@angular/core";
+
+@Injectable()
+export class WindowRef {
+ get nativeWindow(): any {
+ return window;
+ }
+}