summaryrefslogtreecommitdiffstats
path: root/catalog-ui
diff options
context:
space:
mode:
authorsiddharth0905 <siddharth.singh4@amdocs.com>2018-11-22 13:37:31 +0530
committersiddharth0905 <siddharth.singh4@amdocs.com>2018-11-23 12:48:21 +0530
commitb734ea21ac7be393c59cf9976f0e5ddeaf27d568 (patch)
treedde5d205c378ac748bcecdf7f17f5a41567156fe /catalog-ui
parentabbd5cf62a0bdd6a22b9bea0cf589e42da0be229 (diff)
Service Workflow changes
Service workflow change with few bug fixes Change-Id: Ice2376565bf46fb8d86fb6062654ec54bb2daa43 Issue-ID: SDC-1937 Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
Diffstat (limited to 'catalog-ui')
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts8
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html3
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts19
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html6
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.less2
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts58
-rw-r--r--catalog-ui/src/app/ng2/services/component-services/component.service.ts18
-rw-r--r--catalog-ui/src/app/ng2/services/workflow.service.ts23
8 files changed, 80 insertions, 57 deletions
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts b/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts
index da9cf5f752..e19d3457b3 100644
--- a/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts
+++ b/catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts
@@ -174,12 +174,11 @@ export class InterfaceOperationComponent {
this.operationList.sort((a, b) => a.operationType.localeCompare(b.operationType));
if (response.workflowId && operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING) {
- const resourceId = this.component.uuid;
const operationId = response.uniqueId;
const workflowId = response.workflowId;
const versionId = response.workflowVersionId;
const artifactId = response.artifactUUID;
- this.WorkflowServiceNg2.associateWorkflowArtifact(resourceId, operationId, workflowId, versionId, artifactId).subscribe();
+ this.WorkflowServiceNg2.associateWorkflowArtifact(this.component, operationId, workflowId, versionId, artifactId).subscribe();
} else if (operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.NEW) {
this.$state.go('workspace.plugins', { path: 'workflowDesigner' });
}
@@ -193,13 +192,12 @@ export class InterfaceOperationComponent {
this.operationList.splice(index, 1, newOperation);
this.component.interfaceOperations = this.operationList;
- if (newOperation.workflowId) {
- const resourceId = this.component.uuid;
+ if (newOperation.workflowId && operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING) {
const operationId = newOperation.uniqueId;
const workflowId = newOperation.workflowId;
const versionId = newOperation.workflowVersionId;
const artifactId = newOperation.artifactUUID;
- this.WorkflowServiceNg2.associateWorkflowArtifact(resourceId, operationId, workflowId, versionId, artifactId).subscribe();
+ this.WorkflowServiceNg2.associateWorkflowArtifact(this.component, operationId, workflowId, versionId, artifactId).subscribe();
}
});
}
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html
index 982cbb204c..6010bca10f 100644
--- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html
+++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html
@@ -127,11 +127,10 @@
<param-row
*ngFor="let param of tableParameters"
class="data-row"
- [isInputParam]="currentTab == TYPE_INPUT"
+ [isInputParam]="currentTab === TYPE_INPUT"
[isAssociateWorkflow]="isUsingExistingWF()"
[param]="param"
[inputProps]="inputProperties"
- [propTypes]="inputPropertyTypes"
[onRemoveParam]="onRemoveParam"
[readonly]="readonly">
</param-row>
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts
index 5d3b027493..a6c1fb1c4c 100644
--- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts
+++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts
@@ -18,7 +18,6 @@ export interface OperationCreatorInput {
isService: boolean
}
-
@Component({
selector: 'operation-creator',
templateUrl: './operation-creator.component.html',
@@ -33,7 +32,7 @@ export class OperationCreatorComponent {
workflows: Array<DropdownValue> = [];
workflowVersions: Array<DropdownValue> = [];
- inputProperties: Array<DropdownValue> = [];
+ inputProperties: Array<InputBEModel> = [];
inputPropertyTypes: { [key: string]: string };
inputParameters: Array<OperationParameter> = [];
@@ -76,19 +75,10 @@ export class OperationCreatorComponent {
}
ngOnInit() {
-
this.readonly = this.input.readonly;
this.isService = this.input.isService;
- this.enableWorkflowAssociation = this.input.enableWorkflowAssociation && !this.isService;
-
- this.inputProperties = _.map(this.input.inputProperties,
- (input: InputBEModel) => new DropdownValue(input.uniqueId, input.name)
- );
-
- this.inputPropertyTypes = {};
- _.forEach(this.input.inputProperties, (input: InputBEModel) => {
- this.inputPropertyTypes[input.uniqueId] = input.type;
- });
+ this.enableWorkflowAssociation = this.input.enableWorkflowAssociation;
+ this.inputProperties = this.input.inputProperties;
const inputOperation = this.input.operation;
this.operation = new OperationModel(inputOperation || {});
@@ -108,13 +98,12 @@ export class OperationCreatorComponent {
} else {
this.reconstructOperation();
}
-
}
reconstructOperation = () => {
const inputOperation = this.input.operation;
if (inputOperation) {
- if (!this.enableWorkflowAssociation || !inputOperation.workflowVersionId || this.isService) {
+ if (!this.enableWorkflowAssociation || !inputOperation.workflowVersionId) {
this.inputParameters = this.noAssignInputParameters;
this.outputParameters = this.noAssignOutputParameters;
this.buildParams();
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html
index 94d2fce1ea..9a5c101e87 100644
--- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html
+++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.html
@@ -1,5 +1,5 @@
<!--
- ~ Copyright © 2016-2018 European Support Limited
+ ~ Copyright � 2016-2018 European Support Limited
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -38,14 +38,14 @@
<div class="cell field-property" *ngIf="isInputParam">
<ui-element-dropdown
- *ngIf="filteredInputProps.length > 0 || !isAssociateWorkflow"
+ *ngIf="filteredInputProps.length || !isAssociateWorkflow"
data-tests-id="paramProperty"
[values]="filteredInputProps"
[(value)]="param.property"
[readonly]="readonly">
</ui-element-dropdown>
<span
- *ngIf="filteredInputProps.length == 0 && isAssociateWorkflow"
+ *ngIf="!filteredInputProps.length && isAssociateWorkflow"
class="no-properties-error">
No available properties of this type.
</span>
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.less b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.less
index 28932eb90f..2c2625d778 100644
--- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.less
+++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.less
@@ -38,7 +38,7 @@
}
.no-properties-error {
- color: red;
+ color: @func_color_q;
font-style: italic;
}
}
diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts
index 8844cf65bb..de795eb8f4 100644
--- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts
+++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts
@@ -1,6 +1,6 @@
import {Component, Input} from '@angular/core';
import {DataTypeService} from "app/ng2/services/data-type.service";
-import {OperationParameter} from 'app/models';
+import {OperationParameter, InputBEModel} from 'app/models';
import {DropdownValue} from "app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component";
@Component({
@@ -11,8 +11,7 @@ import {DropdownValue} from "app/ng2/components/ui/form-components/dropdown/ui-e
export class ParamRowComponent {
@Input() param: OperationParameter;
- @Input() inputProps: Array<DropdownValue>;
- @Input() propTypes: { [key: string]: string };
+ @Input() inputProps: Array<InputBEModel>;
@Input() onRemoveParam: Function;
@Input() isAssociateWorkflow: boolean;
@Input() readonly: boolean;
@@ -21,14 +20,61 @@ export class ParamRowComponent {
propTypeEnum: Array<String> = [];
filteredInputProps: Array<DropdownValue> = [];
+ constructor(private dataTypeService: DataTypeService) {}
+
ngOnInit() {
- this.propTypeEnum = _.uniq(_.toArray(this.propTypes));
+ this.propTypeEnum = _.uniq(
+ _.map(
+ this.getPrimitiveSubtypes(),
+ prop => prop.type
+ )
+ );
+ console.log(this.dataTypeService.getAllDataTypes());
this.onChangeType();
}
onChangeType() {
- this.filteredInputProps = _.filter(this.inputProps, prop => {
- return this.propTypes[prop.value] === this.param.type;
+ this.filteredInputProps = _.map(
+ _.filter(
+ this.getPrimitiveSubtypes(),
+ prop => prop.type === this.param.type
+ ),
+ prop => new DropdownValue(prop.uniqueId, prop.name)
+ );
+ }
+
+ getPrimitiveSubtypes(): Array<InputBEModel> {
+ const flattenedProps: Array<any> = [];
+ const dataTypes = this.dataTypeService.getAllDataTypes();
+ _.forEach(this.inputProps, prop => {
+ const type = _.find(
+ _.toArray(dataTypes),
+ (type: any) => type.name === prop.type
+ );
+ if (!type.properties) {
+ flattenedProps.push(prop);
+ } else {
+ _.forEach(type.properties, subType => {
+ if (this.isTypePrimitive(subType.type)) {
+ flattenedProps.push({
+ type: subType.type,
+ name: `${prop.name}.${subType.name}`,
+ uniqueId: `${prop.uniqueId}.${subType.name}`
+ });
+ }
+ });
+ }
});
+
+ return flattenedProps;
+ }
+
+ isTypePrimitive(type): boolean {
+ return (
+ type === 'string' ||
+ type === 'integer' ||
+ type === 'float' ||
+ type === 'boolean'
+ );
}
}
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 3546ebd374..26b0291156 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
@@ -128,9 +128,7 @@ export class ComponentServiceNg2 {
getInterfaceOperation(component:Component, operation:OperationModel):Observable<OperationModel> {
return this.http.get(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations/' + operation.uniqueId)
- .map((res:Response) => {
- return res.json();
- });
+ .map((res:Response) => res.json());
}
createInterfaceOperation(component:Component, operation:OperationModel):Observable<CreateOperationResponse> {
@@ -140,9 +138,7 @@ export class ComponentServiceNg2 {
}
};
return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations', operationList)
- .map((res:Response) => {
- return res.json();
- });
+ .map((res:Response) => res.json());
}
updateInterfaceOperation(component:Component, operation:OperationModel):Observable<CreateOperationResponse> {
@@ -152,16 +148,12 @@ export class ComponentServiceNg2 {
}
};
return this.http.put(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations', operationList)
- .map((res:Response) => {
- return res.json();
- });
+ .map((res:Response) => res.json());
}
deleteInterfaceOperation(component:Component, operation:OperationModel):Observable<OperationModel> {
return this.http.delete(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/interfaceOperations/' + operation.uniqueId)
- .map((res:Response) => {
- return res.json();
- });
+ .map((res:Response) => res.json());
}
getCapabilitiesAndRequirements(componentType: string, componentId:string):Observable<ComponentGenericResponse> {
@@ -189,7 +181,6 @@ export class ComponentServiceNg2 {
deleteInput(component:Component, input:InputBEModel):Observable<InputBEModel> {
-
return this.http.delete(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/delete/' + input.uniqueId + '/input')
.map((res:Response) => {
return new InputBEModel(res.json());
@@ -197,7 +188,6 @@ export class ComponentServiceNg2 {
}
updateComponentInputs(component:Component, inputs:InputBEModel[]):Observable<InputBEModel[]> {
-
return this.http.post(this.baseUrl + component.getTypeUrl() + component.uniqueId + '/update/inputs', inputs)
.map((res:Response) => {
return res.json().map((input) => new InputBEModel(input));
diff --git a/catalog-ui/src/app/ng2/services/workflow.service.ts b/catalog-ui/src/app/ng2/services/workflow.service.ts
index ae06a39713..24ba882a96 100644
--- a/catalog-ui/src/app/ng2/services/workflow.service.ts
+++ b/catalog-ui/src/app/ng2/services/workflow.service.ts
@@ -3,6 +3,7 @@ import { Response } from "@angular/http";
import { Observable } from "rxjs/Observable";
import { HttpService } from "./http.service";
import { SdcConfigToken, ISdcConfig } from "../config/sdc-config.config";
+import { Component } from "app/models";
@Injectable()
export class WorkflowServiceNg2 {
@@ -12,11 +13,21 @@ export class WorkflowServiceNg2 {
VERSION_STATE_CERTIFIED = 'CERTIFIED';
- constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig:ISdcConfig) {
+ constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig: ISdcConfig) {
this.baseUrl = sdcConfig.api.workflow_root;
this.catalogBaseUrl = sdcConfig.api.POST_workflow_artifact;
}
+ public associateWorkflowArtifact(component: Component, operationId: string, workflowId: string, workflowVersionId: string, artifactUuid: string): Observable<any> {
+ return this.http.post(this.baseUrl + '/workflows/' + workflowId + '/versions/' + workflowVersionId + '/artifact-deliveries', {
+ endpoint: this.catalogBaseUrl + '/' + component.getTypeUrl() + component.uuid + '/interfaces/' + operationId + '/artifacts/' + artifactUuid,
+ method: 'POST'
+ })
+ .map((res:Response) => {
+ return res.json();
+ });
+ }
+
public getWorkflows(filterCertified: boolean = true): Observable<any> {
return this.http.get(this.baseUrl + '/workflows' + (filterCertified ? '?versionState=' + this.VERSION_STATE_CERTIFIED : ''))
.map((res:Response) => {
@@ -38,14 +49,4 @@ export class WorkflowServiceNg2 {
});
}
- public associateWorkflowArtifact(resourceUuid, operationId, workflowId, workflowVersionId, artifactUuid): Observable<any> {
- return this.http.post(this.baseUrl + '/workflows/' + workflowId + '/versions/' + workflowVersionId + '/artifact-deliveries', {
- endpoint: this.catalogBaseUrl + '/resources/' + resourceUuid + '/interfaces/' + operationId + '/artifacts/' + artifactUuid,
- method: 'POST'
- })
- .map((res:Response) => {
- return res.json();
- });
- }
-
}