diff options
author | Arielk <Ariel.Kenan@amdocs.com> | 2018-11-28 12:24:34 +0200 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-12-02 13:45:45 +0000 |
commit | 4a99e32a55f5b9210625274310cb8d68dd4095e7 (patch) | |
tree | 8e839e0e0ed56628db49f8004dbf9b32c71265f1 /catalog-ui | |
parent | 42b83b0b7a51849671cfa4718b55cbf7fe2df8a2 (diff) |
Indicate a workflow was archived in operation
Change-Id: I0d57384d036a575ba5dd86ad872c6e0f5b397490
Issue-ID: SDC-1866
Signed-off-by: Arielk <Ariel.Kenan@amdocs.com>
Diffstat (limited to 'catalog-ui')
8 files changed, 77 insertions, 41 deletions
diff --git a/catalog-ui/configurations/menu.js b/catalog-ui/configurations/menu.js index 1ad3bd68a0..e433ebc857 100644 --- a/catalog-ui/configurations/menu.js +++ b/catalog-ui/configurations/menu.js @@ -463,7 +463,7 @@ const SDC_MENU_CONFIG = { {"text": "Information Artifact", "action": "onMenuItemPressed", "state": "workspace.information_artifacts"}, {"text": "TOSCA Artifacts", "action": "onMenuItemPressed", "state": "workspace.tosca_artifacts"}, {"text": "Composition", "action": "onMenuItemPressed", "state": "workspace.composition.details"}, - {"text":"Operation", "action":"onMenuItemPressed", "state": "workspace.interface_operation"}, + {"text": "Operation", "action":"onMenuItemPressed", "state": "workspace.interface_operation"}, {"text": "Activity Log", "action": "onMenuItemPressed", "state": "workspace.activity_log"}, {"text": "Deployment", "action": "onMenuItemPressed", "state": "workspace.deployment"}, {"text": "Properties Assignment", "action": "onMenuItemPressed", "state": "workspace.properties_assignment"} @@ -473,6 +473,7 @@ const SDC_MENU_CONFIG = { {"text": "Information Artifact", "action": "onMenuItemPressed", "state": "workspace.information_artifacts"}, {"text": "TOSCA Artifacts", "action": "onMenuItemPressed", "state": "workspace.tosca_artifacts"}, {"text": "Composition", "action": "onMenuItemPressed", "state": "workspace.composition.details"}, + {"text": "Operation", "action": "onMenuItemPressed", "state": "workspace.interface_operation"}, {"text": "Activity Log", "action": "onMenuItemPressed", "state": "workspace.activity_log"}, {"text": "Properties Assignment", "action": "onMenuItemPressed", "state": "workspace.properties_assignment"} ], 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 6010bca10f..441875b2a9 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 @@ -21,7 +21,7 @@ <div class="side-by-side"> <div class="i-sdc-form-item"> - <label class="i-sdc-form-label" [ngClass]="{'required': !isEditMode}">Operation Name</label> + <label class="i-sdc-form-label" [ngClass]="{'required': !isEditMode}">{{ 'OPERATION_NAME' | translate }}</label> <input type="text" name="type" @@ -32,7 +32,7 @@ </div> <div class="i-sdc-form-item"> - <label class="i-sdc-form-label">Description</label> + <label class="i-sdc-form-label">{{ 'OPERATION_DESCRIPTION' | translate }}</label> <input type="text" data-tests-id="operationDescription" @@ -45,7 +45,7 @@ <div class="side-by-side association-options"> <div class="i-sdc-form-item" *ngIf="enableWorkflowAssociation"> - <label class="i-sdc-form-label">Workflow Assignment</label> + <label class="i-sdc-form-label">{{ 'OPERATION_WORKFLOW_ASSIGNMENT' | translate }}</label> <ui-element-dropdown data-tests-id="association-type" [(value)]="operation.workflowAssociationType" @@ -59,7 +59,9 @@ <div class="side-by-side" *ngIf="isUsingExistingWF()"> <div class="i-sdc-form-item"> - <label class="i-sdc-form-label required">Workflow</label> + <label class="i-sdc-form-label required">{{ 'OPERATION_WORKFLOW' | translate }} + <span class="archive-warning" *ngIf="archivedWorkflowId === operation.workflowId">({{ 'OPERATION_WORKFLOW_ARCHIVED' | translate }})</span> + </label> <ui-element-dropdown data-tests-id="associated-workflow" [readonly]="readonly" @@ -70,10 +72,10 @@ </div> <div class="i-sdc-form-item"> - <label class="i-sdc-form-label required">Workflow Version</label> + <label class="i-sdc-form-label required">{{ 'OPERATION_WORKFLOW_VERSION' | translate }}</label> <ui-element-dropdown data-tests-id="associated-workflow-version" - [readonly]="!operation.workflowId || readonly" + [readonly]="!operation.workflowId || archivedWorkflowId === operation.workflowId || readonly" [values]="workflowVersions" [(value)]="operation.workflowVersionId" (valueChange)="changeWorkflowVersion()"> @@ -91,15 +93,15 @@ *ngIf="!isUsingExistingWF() && !readonly" data-tests-id="addInputParameter" [ngClass]="{'disabled':!canAdd()}" - (click)="addParam()">Add Parameter</a> + (click)="addParam()">{{ 'OPERATION_ADD_PARAMS' | translate }}</a> </div> <div class="generic-table"> <div class="header-row table-row"> - <span class="cell header-cell field-name">Name</span> - <span class="cell header-cell field-type">Type</span> + <span class="cell header-cell field-name">{{ 'OPERATION_PARAM_NAME' | translate }}</span> + <span class="cell header-cell field-type">{{ 'OPERATION_PARAM_TYPE' | translate }}</span> <span class="cell header-cell field-property" *ngIf="currentTab == TYPE_INPUT"> - Property + {{ 'OPERATION_PARAM_PROPERTY' | translate }} <span *ngIf="!isUsingExistingWF()" class="sprite-new info-icon" @@ -107,20 +109,18 @@ tooltipDelay="0"> </span> </span> - <span class="cell header-cell field-mandatory" *ngIf="!isUsingExistingWF()">Mandatory</span> + <span class="cell header-cell field-mandatory" *ngIf="!isUsingExistingWF()">{{ 'OPERATION_PARAM_MANDATORY' | translate }}</span> <span class="cell header-cell remove" *ngIf="!isUsingExistingWF() && !readonly">●●●</span> </div> <div class="empty-msg data-row" *ngIf="tableParameters.length === 0"> - <div>NO PARAMETERS TO SHOW</div> + <div>{{ 'EMPTY_PARAM_TABLE_HEADER' | translate }}</div> <div *ngIf="isUsingExistingWF() && !operation.workflowVersionId"> <div *ngIf="workflows.length"> - <span class="bold-message">Select Workflow and Workflow Version above</span> - <span>in order to see the parameters</span> - </div> - <div *ngIf="!workflows.length"> - Only <span class="bold-message">certified</span> workflow versions can be assigned to an operation + <span class="bold-message">{{ 'EMPTY_PARAM_TABLE_NO_SELECTED_WORKFLOW_1' | translate }}</span> + <span>{{ 'EMPTY_PARAM_TABLE_NO_SELECTED_WORKFLOW_2' | translate }}</span> </div> + <div *ngIf="!workflows.length" [innerHTML]="'EMPTY_PARAM_TABLE_NO_WORKFLOWS' | translate"></div> </div> </div> diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.less b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.less index f64a087abc..10976ef473 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.less +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.less @@ -28,6 +28,11 @@ flex-basis: 40%; margin-right: 10px; } + + .archive-warning { + font-family: @font-opensans-bold; + color: @main_color_i; + } } } @@ -69,7 +74,7 @@ .data-row { &.empty-msg { .bold-message { - font-weight: 600; + font-family: @font-opensans-bold; } :first-child { 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 a6c1fb1c4c..e27c783620 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 @@ -33,7 +33,7 @@ export class OperationCreatorComponent { workflows: Array<DropdownValue> = []; workflowVersions: Array<DropdownValue> = []; inputProperties: Array<InputBEModel> = []; - inputPropertyTypes: { [key: string]: string }; + archivedWorkflowId: string = '&'; inputParameters: Array<OperationParameter> = []; noAssignInputParameters: Array<OperationParameter> = []; @@ -51,7 +51,6 @@ export class OperationCreatorComponent { isEditMode: boolean = false; isLoading: boolean = false; readonly: boolean; - isService: boolean; propertyTooltipText: String; @@ -76,7 +75,6 @@ export class OperationCreatorComponent { ngOnInit() { this.readonly = this.input.readonly; - this.isService = this.input.isService; this.enableWorkflowAssociation = this.input.enableWorkflowAssociation; this.inputProperties = this.input.inputProperties; @@ -90,9 +88,23 @@ export class OperationCreatorComponent { this.isLoading = true; this.workflowServiceNg2.getWorkflows().subscribe(workflows => { this.isLoading = false; - this.workflows = _.map(workflows, (workflow: any) => { - return new DropdownValue(workflow.id, workflow.name); - }); + this.workflows = _.map( + _.filter( + workflows, + (workflow: any) => { + if (workflow.archiving === this.workflowServiceNg2.WF_STATE_ACTIVE) { + return true; + } + if (workflow.archiving === this.workflowServiceNg2.WF_STATE_ARCHIVED && + workflow.id === this.operation.workflowId) { + this.archivedWorkflowId = workflow.id; + return true; + } + return false; + } + ), + (workflow: any) => new DropdownValue(workflow.id, workflow.name) + ); this.reconstructOperation(); }); } else { @@ -103,16 +115,16 @@ export class OperationCreatorComponent { reconstructOperation = () => { const inputOperation = this.input.operation; if (inputOperation) { - if (!this.enableWorkflowAssociation || !inputOperation.workflowVersionId) { - this.inputParameters = this.noAssignInputParameters; - this.outputParameters = this.noAssignOutputParameters; - this.buildParams(); - this.updateTable(); - } else { + if (this.enableWorkflowAssociation && inputOperation.workflowVersionId && this.isUsingExistingWF(inputOperation)) { this.onSelectWorkflow(inputOperation.workflowVersionId).add(() => { this.buildParams(); this.updateTable(); }); + } else { + this.inputParameters = this.noAssignInputParameters; + this.outputParameters = this.noAssignOutputParameters; + this.buildParams(); + this.updateTable(); } if (inputOperation.uniqueId) { @@ -239,15 +251,11 @@ export class OperationCreatorComponent { let valid = true; if (this.currentTab === this.TYPE_INPUT) { _.forEach(this.inputParameters, param => { - if (!param.name || !param.property) { - valid = false; - } + if (!param.name || !param.property) valid = false; }); } else { _.forEach(this.outputParameters, param => { - if (!param.name || !param.type) { - valid = false; - } + if (!param.name || !param.type) valid = false; }); } return valid; @@ -278,11 +286,13 @@ export class OperationCreatorComponent { this.operation.createOutputParamsList(this.outputParameters); } - isUsingExistingWF = (): boolean => { - return this.operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING; + isUsingExistingWF = (operation?: OperationModel): boolean => { + operation = operation || this.operation; + return operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.EXISTING; } - shouldCreateWF(): boolean { + shouldCreateWF(operation?: OperationModel): boolean { + operation = operation || this.operation; return this.operation.workflowAssociationType === WORKFLOW_ASSOCIATION_OPTIONS.NEW; } diff --git a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.module.ts b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.module.ts index 461a35e4d1..7d881231d5 100644 --- a/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.module.ts +++ b/catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.module.ts @@ -3,6 +3,7 @@ import {CommonModule} from "@angular/common"; import {FormsModule} from "@angular/forms"; import {FormElementsModule} from "app/ng2/components/ui/form-components/form-elements.module"; +import {TranslateModule} from "app/ng2/shared/translator/translate.module"; import {UiElementsModule} from "app/ng2/components/ui/ui-elements.module"; import {OperationCreatorComponent} from "./operation-creator.component"; @@ -17,6 +18,7 @@ import {ParamRowComponent} from './param-row/param-row.component'; CommonModule, FormsModule, FormElementsModule, + TranslateModule, UiElementsModule ], exports: [], 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 de795eb8f4..9bedfa7031 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 @@ -29,7 +29,6 @@ export class ParamRowComponent { prop => prop.type ) ); - console.log(this.dataTypeService.getAllDataTypes()); this.onChangeType(); } diff --git a/catalog-ui/src/app/ng2/services/workflow.service.ts b/catalog-ui/src/app/ng2/services/workflow.service.ts index 24ba882a96..1fc5c7843b 100644 --- a/catalog-ui/src/app/ng2/services/workflow.service.ts +++ b/catalog-ui/src/app/ng2/services/workflow.service.ts @@ -11,6 +11,8 @@ export class WorkflowServiceNg2 { protected baseUrl; protected catalogBaseUrl; + WF_STATE_ACTIVE = 'ACTIVE'; + WF_STATE_ARCHIVED = 'ARCHIVED'; VERSION_STATE_CERTIFIED = 'CERTIFIED'; constructor(private http: HttpService, @Inject(SdcConfigToken) sdcConfig: ISdcConfig) { diff --git a/catalog-ui/src/assets/languages/en_US.json b/catalog-ui/src/assets/languages/en_US.json index d959d84df9..02bc58ffb4 100644 --- a/catalog-ui/src/assets/languages/en_US.json +++ b/catalog-ui/src/assets/languages/en_US.json @@ -458,6 +458,23 @@ "NEW_WORKFLOW_ASSOCIATION": "New Workflow", "EXISTING_WORKFLOW_ASSOCIATION": "Existing Workflow", + "OPERATION_NAME": "Operation Name", + "OPERATION_DESCRIPTION": "Description", + "OPERATION_WORKFLOW_ASSIGNMENT": "Workflow Assignment", + "OPERATION_WORKFLOW": "Workflow", + "OPERATION_WORKFLOW_ARCHIVED": "Archived", + "OPERATION_WORKFLOW_VERSION": "Workflow Version", + "OPERATION_ADD_PARAMS": "Add Paramaters", + "OPERATION_PARAM_NAME": "Name", + "OPERATION_PARAM_TYPE": "Type", + "OPERATION_PARAM_PROPERTY": "Property", + "OPERATION_PARAM_MANDATORY": "Mandatory", + "EMPTY_PARAM_TABLE_HEADER": "NO PARAMETERS TO SHOW", + "EMPTY_PARAM_TABLE_NO_SELECTED_WORKFLOW_1": "Select Workflow and Workflow Version above", + "EMPTY_PARAM_TABLE_NO_SELECTED_WORKFLOW_2": "in order to see the parameters", + "EMPTY_PARAM_TABLE_NO_WORKFLOWS": "Only <b>certified</b> workflow versions can be assigned to an operation", + + "=========== PLUGIN NOT CONNECTED ===========": "", "PLUGIN_NOT_CONNECTED_ERROR_MAIN": "The \"{{pluginName}}\" plugin is currently unavailable.", "PLUGIN_NOT_CONNECTED_ERROR_SUB": "Please try again later.", |