diff options
author | 2019-02-05 15:29:23 +0200 | |
---|---|---|
committer | 2019-02-05 15:30:29 +0200 | |
commit | 7780659822de5314578acad565e342c0a3b76c6f (patch) | |
tree | 2b2cd511908cb305c30ca8447b6dff99af8658e1 /catalog-ui/src/app/ng2/pages/interface-operation/operation-creator | |
parent | e53320e41123bd6219158208b4eac36f44d67cd2 (diff) |
Check if WF plugin is loaded
Change-Id: Ia3538d66ace7d5e862625861c242aed68bf09f18
Issue-ID: SDC-2084
Signed-off-by: Arielk <Ariel.Kenan@amdocs.com>
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/interface-operation/operation-creator')
3 files changed, 48 insertions, 30 deletions
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 5848b585e9..7abc1a52c0 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 @@ -84,8 +84,9 @@ <div class="form-item sdc-input" *ngIf="isUsingExistingWF()"> <label class="sdc-input__label required">{{ 'OPERATION_WORKFLOW' | translate }} - <span class="archive-warning" *ngIf="archivedWorkflowId === operation.workflowId">({{ 'OPERATION_WORKFLOW_ARCHIVED' | translate }})</span> - <span class="no-workflow-warning" *ngIf="!workflows.length">{{ 'OPERATION_NO_WORKFLOW_ERROR' | translate }}</span> + <span class="archive-warning" *ngIf="workflowIsOnline && archivedWorkflowId === operation.workflowId">({{ 'OPERATION_WORKFLOW_ARCHIVED' | translate }})</span> + <span class="no-workflow-warning" *ngIf="!workflowIsOnline">Failed to load workflows</span> + <span class="no-workflow-warning" *ngIf="workflowIsOnline && !workflows.length">{{ 'OPERATION_NO_WORKFLOW_ERROR' | translate }}</span> </label> <sdc-dropdown placeHolder="Select..." @@ -93,13 +94,13 @@ selectedOption="{{operation.workflowId}}" [options]="workflows" (changed)="onSelectWorkflow($event)" - [disabled]="readonly || !workflows.length"> + [disabled]="readonly || !workflows.length || !workflowIsOnline"> </sdc-dropdown> </div> <div class="form-item sdc-input" *ngIf="isUsingExistingWF()"> <sdc-dropdown - *ngIf="workflows.length" + *ngIf="workflowIsOnline && workflows.length" label="{{ 'OPERATION_WORKFLOW_VERSION' | translate }}" testId="associated-workflow-version" selectedOption="{{operation.workflowVersionId}}" 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 329ce704c3..6099cdbe98 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 @@ -37,9 +37,9 @@ export interface OperationCreatorInput { inputProperties: Array<InputBEModel>, enableWorkflowAssociation: boolean, readonly: boolean, - isService: boolean, interfaceTypes: { [interfaceType: string]: Array<string> }, validityChangedCallback: Function, + workflowIsOnline: boolean; } @Component({ @@ -49,7 +49,7 @@ export interface OperationCreatorInput { providers: [TranslateService] }) -export class OperationCreatorComponent { +export class OperationCreatorComponent implements OperationCreatorInput { input: OperationCreatorInput; inputOperation: OperationModel; @@ -81,6 +81,7 @@ export class OperationCreatorComponent { workflowAssociationType: string; enableWorkflowAssociation: boolean; + workflowIsOnline: boolean; isEditMode: boolean = false; isLoading: boolean = false; readonly: boolean; @@ -147,23 +148,27 @@ export class OperationCreatorComponent { []); if (this.enableWorkflowAssociation) { - this.workflows = _.map( - _.filter( - this.allWorkflows, - (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; + if (this.workflowIsOnline) { + this.workflows = _.map( + _.filter( + this.allWorkflows, + (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; } - return false; - } - ), - (workflow: any) => new DropdownValue(workflow.id, workflow.name) - ); + ), + (workflow: any) => new DropdownValue(workflow.id, workflow.name) + ); + } else { + this.workflows = [new DropdownValue(this.operation.workflowId, this.operation.workflowId)]; + } } this.reconstructOperation(); this.validityChanged(); @@ -171,37 +176,47 @@ export class OperationCreatorComponent { } reconstructOperation = () => { + + const buildAndUpdate = () => { + this.buildParams(); + this.updateTable(); + }; + const inputOperation = this.inputOperation; if (inputOperation) { this.onSelectInterface(new DropDownOption(this.operation.interfaceType)); + if (this.enableWorkflowAssociation && inputOperation.workflowVersionId && this.isUsingExistingWF(inputOperation)) { this.assignInputParameters[this.operation.workflowId] = {[inputOperation.workflowVersionId]: []}; this.assignOutputParameters[this.operation.workflowId] = {[inputOperation.workflowVersionId]: []}; this.inputParameters = this.assignInputParameters[this.operation.workflowId][this.operation.workflowVersionId]; this.outputParameters = this.assignOutputParameters[this.operation.workflowId][this.operation.workflowVersionId]; + const sub = this.onSelectWorkflow(new DropDownOption(inputOperation.workflowId), inputOperation.workflowVersionId); if (sub) { sub.add(() => { - this.buildParams(); - this.updateTable(); + buildAndUpdate(); this.operation.workflowVersionId = '-1'; - setTimeout(() => this.operation.workflowVersionId = this.inputOperation.workflowVersionId, 0); + setTimeout(() => this.operation.workflowVersionId = this.inputOperation.workflowVersionId); }); + } else { + buildAndUpdate(); } } else { this.inputParameters = this.noAssignInputParameters; this.outputParameters = this.noAssignOutputParameters; - this.buildParams(); - this.updateTable(); + buildAndUpdate(); } if (inputOperation.uniqueId) { this.isEditMode = true; } } + } buildParams = () => { + if (this.inputOperation.outputs) { this.currentTab = this.TYPE_OUTPUT; this.updateTable(); @@ -212,6 +227,7 @@ export class OperationCreatorComponent { } ); } + this.currentTab = this.TYPE_INPUT; this.updateTable(); if (this.inputOperation.inputs) { @@ -222,6 +238,7 @@ export class OperationCreatorComponent { } ); } + } isInterfaceOther(): boolean { @@ -275,7 +292,7 @@ export class OperationCreatorComponent { onSelectWorkflow(workflowId: DropDownOption, selectedVersionId?: string): Subscription { - if (_.isUndefined(workflowId)) { + if (_.isUndefined(workflowId) || !this.workflowIsOnline) { return; } this.operation.workflowId = workflowId.value; @@ -320,7 +337,7 @@ export class OperationCreatorComponent { changeWorkflowVersion(versionId: DropDownOption) { - if (_.isUndefined(versionId)) { + if (_.isUndefined(versionId) || !this.workflowIsOnline) { return; } 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 bfa2b11b1c..1b51d721af 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 @@ -86,7 +86,7 @@ export class ParamRowComponent { const selProp = this.getSelectedProp(); if (selProp && selProp.type === this.param.type) { this.param.inputId = '-1'; - setTimeout(() => this.param.inputId = selProp.uniqueId || selProp.value, 0); + setTimeout(() => this.param.inputId = selProp.uniqueId || selProp.value); } else { this.param.inputId = null; } |