summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/ng2/pages')
-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
6 files changed, 64 insertions, 32 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'
+ );
}
}