From 2152a9a43767cdd486fd8c93894f66a05083f53c Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Wed, 5 May 2021 15:31:04 +0100 Subject: Support for selection of capabilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib1a3e3e1a59fc84c62620932c408e231acf77024 Issue-ID: SDC-3580 Signed-off-by: André Schmid --- .../component-instance.service.ts | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'catalog-ui/src/app/ng2/services/component-instance-services/component-instance.service.ts') 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 5ae2918805..1e4ddda9c0 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 @@ -18,15 +18,25 @@ * ============LICENSE_END========================================================= */ -import {Injectable, Inject} from '@angular/core'; -import { Observable } from 'rxjs/Observable'; -import {PropertyFEModel, PropertyBEModel, Requirement} from "app/models"; -import {CommonUtils, ComponentType, ServerTypeUrl, ComponentInstanceFactory} from "app/utils"; -import {Component, ComponentInstance, Capability, PropertyModel, ArtifactGroupModel, ArtifactModel, AttributeModel, IFileDownload} from "app/models"; -import {SdcConfigToken, ISdcConfig} from "../../config/sdc-config.config"; -import { HttpClient, HttpHeaders } from '@angular/common/http'; -import { InputBEModel } from '../../../models/properties-inputs/input-be-model'; -import { HttpHelperService } from '../http-hepler.service'; +import {Inject, Injectable} from '@angular/core'; +import {Observable} from 'rxjs/Observable'; +import { + ArtifactGroupModel, + ArtifactModel, + AttributeModel, + Capability, + Component, + ComponentInstance, + IFileDownload, + PropertyBEModel, + PropertyModel, + Requirement +} from "app/models"; +import {CommonUtils, ComponentInstanceFactory, ComponentType, ServerTypeUrl} from "app/utils"; +import {ISdcConfig, SdcConfigToken} from "../../config/sdc-config.config"; +import {HttpClient, HttpHeaders} from '@angular/common/http'; +import {InputBEModel} from '../../../models/properties-inputs/input-be-model'; +import {HttpHelperService} from '../http-hepler.service'; import {AttributeBEModel} from "../../../models/attributes-outputs/attribute-be-model"; import {OutputBEModel} from "../../../models/attributes-outputs/output-be-model"; @@ -158,6 +168,11 @@ export class ComponentInstanceServiceNg2 { '/requirementName/' + requirement.name, requirement); } + updateInstanceCapability(componentTypeUrl: string, componentId: string, componentInstanceId: string, capability: Capability): Observable { + const url = `${this.baseUrl}${componentTypeUrl}${componentId}/componentInstances/${componentInstanceId}/capability/`; + return this.http.put(url, capability); + } + updateInstanceInputs(component: Component, componentInstanceId: string, inputs: PropertyBEModel[]): Observable { return this.http.post>(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/resourceInstance/' + componentInstanceId + '/inputs', inputs) @@ -203,7 +218,6 @@ export class ComponentInstanceServiceNg2 { } addInstanceArtifact = (componentType:string, componentId:string, instanceId:string, artifact:ArtifactModel):Observable => { - // let deferred = this.$q.defer(); let headerObj = new HttpHeaders(); if (artifact.payloadData) { headerObj = headerObj.set('Content-MD5', HttpHelperService.getHeaderMd5(artifact)); @@ -217,7 +231,7 @@ export class ComponentInstanceServiceNg2 { updateInstanceArtifact = (componentType:string, componentId:string, instanceId:string, artifact:ArtifactModel):Observable => { return this.http.post(this.baseUrl + this.getServerTypeUrl(componentType) + componentId + '/resourceInstance/' + instanceId + '/artifacts/' + artifact.uniqueId, artifact).map((res) => { return new ArtifactModel(res); - });; + }); }; deleteInstanceArtifact = (componentId:string, componentType:string, instanceId:string, artifactId:string, artifactLabel:string):Observable => { -- cgit 1.2.3-korg