Indicate a workflow was archived in operation 93/73793/3
authorArielk <Ariel.Kenan@amdocs.com>
Wed, 28 Nov 2018 10:24:34 +0000 (12:24 +0200)
committerAvi Gaffa <avi.gaffa@amdocs.com>
Sun, 2 Dec 2018 13:45:45 +0000 (13:45 +0000)
Change-Id: I0d57384d036a575ba5dd86ad872c6e0f5b397490
Issue-ID: SDC-1866
Signed-off-by: Arielk <Ariel.Kenan@amdocs.com>
catalog-ui/configurations/menu.js
catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html
catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.less
catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts
catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.module.ts
catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts
catalog-ui/src/app/ng2/services/workflow.service.ts
catalog-ui/src/assets/languages/en_US.json

index 1ad3bd6..e433ebc 100644 (file)
@@ -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"}
         ],
index 6010bca..441875b 100644 (file)
@@ -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"
             </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()">
                 *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"
                         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>
 
index f64a087..10976ef 100644 (file)
                 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 {
index a6c1fb1..e27c783 100644 (file)
@@ -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;
     }
 
index 461a35e..7d88123 100644 (file)
@@ -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: [],
index de795eb..9bedfa7 100644 (file)
@@ -29,7 +29,6 @@ export class ParamRowComponent {
                 prop => prop.type
             )
         );
-        console.log(this.dataTypeService.getAllDataTypes());
         this.onChangeType();
     }
 
index 24ba882..1fc5c78 100644 (file)
@@ -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) {
index d959d84..02bc58f 100644 (file)
     "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.",