summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages
diff options
context:
space:
mode:
authorArielk <Ariel.Kenan@amdocs.com>2019-02-05 15:29:23 +0200
committerArielk <Ariel.Kenan@amdocs.com>2019-02-05 15:30:29 +0200
commit7780659822de5314578acad565e342c0a3b76c6f (patch)
tree2b2cd511908cb305c30ca8447b6dff99af8658e1 /catalog-ui/src/app/ng2/pages
parente53320e41123bd6219158208b4eac36f44d67cd2 (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')
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/interface-operation.page.component.ts10
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.html9
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/operation-creator.component.ts67
-rw-r--r--catalog-ui/src/app/ng2/pages/interface-operation/operation-creator/param-row/param-row.component.ts2
4 files changed, 55 insertions, 33 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 b22a4bdc83..f04ccd9085 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
@@ -18,8 +18,9 @@ import {ModalButtonComponent} from "sdc-ui/lib/angular/components";
import {ComponentServiceNg2} from 'app/ng2/services/component-services/component.service';
import {ComponentGenericResponse} from 'app/ng2/services/responses/component-generic-response';
import {WorkflowServiceNg2} from 'app/ng2/services/workflow.service';
+import {PluginsService} from "app/ng2/services/plugins.service";
-import {OperationCreatorComponent, OperationCreatorInput} from './operation-creator/operation-creator.component';
+import {OperationCreatorComponent, OperationCreatorInput} from 'app/ng2/pages/interface-operation/operation-creator/operation-creator.component';
export class UIOperationModel extends OperationModel {
isCollapsed: boolean = true;
@@ -111,6 +112,7 @@ export class InterfaceOperationComponent {
isLoading: boolean;
interfaceTypes:{ [interfaceType: string]: Array<string> };
modalTranslation: ModalTranslation;
+ workflowIsOnline: boolean;
workflows: Array<any>;
@Input() component: IComponent;
@@ -122,6 +124,7 @@ export class InterfaceOperationComponent {
@Inject(SdcConfigToken) private sdcConfig: ISdcConfig,
@Inject("$state") private $state: ng.ui.IStateService,
private TranslateService: TranslateService,
+ private PluginsService: PluginsService,
private ComponentServiceNg2: ComponentServiceNg2,
private WorkflowServiceNg2: WorkflowServiceNg2,
private ModalServiceNg2: ModalService,
@@ -133,7 +136,8 @@ export class InterfaceOperationComponent {
ngOnInit(): void {
this.isLoading = true;
- const workflowSubscription = this.enableWorkflowAssociation ? this.WorkflowServiceNg2.getWorkflows() : Promise.resolve();
+ this.workflowIsOnline = !_.isUndefined(this.PluginsService.getPluginByStateUrl('workflowDesigner'));
+ const workflowSubscription = this.enableWorkflowAssociation && this.workflowIsOnline ? this.WorkflowServiceNg2.getWorkflows() : Promise.resolve();
Observable.forkJoin(
this.ComponentServiceNg2.getInterfaces(this.component),
this.ComponentServiceNg2.getComponentInputs(this.component),
@@ -249,9 +253,9 @@ export class InterfaceOperationComponent {
inputProperties: this.inputs,
enableWorkflowAssociation: this.enableWorkflowAssociation,
readonly: this.readonly,
- isService: this.component.isService(),
interfaceTypes: this.interfaceTypes,
validityChangedCallback: this.enableOrDisableSaveButton,
+ workflowIsOnline: this.workflowIsOnline
};
const modalConfig: IModalConfig = {
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;
}