aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/interface-definition/operation-creator/operation-creator-interface-definition.component.html
blob: 687c79fe86fedf845d74ce14625bc2fcae440ab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!--
 * ============LICENSE_START=======================================================
 * SDC
 * ================================================================================
 * Copyright (C) 2022 Nordix Foundation. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
-->
  
<div class="operation-creator-interface-definition">
    <loader [display]="isLoading" [size]="'large'" [relative]="true"></loader>

    <form class="w-sdc-form">

        <div class="side-by-side">
            <div class="form-item">
                <sdc-dropdown
                    label="{{ 'OPERATION_INTERFACE_TYPE' | translate }}"
                    [required]="true"
                    testId="interface-name"
                    [selectedOption]="getSelectedDropdown(interfaceNames, operation.interfaceType)"
                    placeHolder="Select..."
                    [disabled]="readonly"
                    (changed)="onSelectInterface($event)"
                    [options]="interfaceNames">
                </sdc-dropdown>
            </div>

            <div class="form-item" *ngIf="!isInterfaceOther()">
                <sdc-dropdown
                    #operationNamesDropdown
                    label="{{ 'OPERATION_NAME' | translate }}"
                    [required]="true"
                    testId="operation-name"
                    [selectedOption]="getSelectedDropdown(operationNames, operation.name)"
                    placeHolder="Select..."
                    [disabled]="readonly"
                    (changed)="onSelectOperationName($event)"
                    [options]="operationNames">
                </sdc-dropdown>
            </div>
            <div class="form-item" *ngIf="isInterfaceOther()">
                <sdc-input
                    label="{{ 'OPERATION_NAME' | translate }}"
                    [(value)]="operation.name"
                    testId="operationName"
                    (valueChange)="onChangeName()"
                    [disabled]="readonly">
                </sdc-input>
            </div>

        </div>

        <div class="i-sdc-form-item sdc-input">
            <span class="sdc-input__label">{{ 'OPERATION_DESCRIPTION' | translate }}</span>
            <textarea
                data-tests-id="operationDescription"
                rows="2"
                name="description"
                [(ngModel)]="descriptionValue"
                [ngClass]="{'disabled': readonly}">
            </textarea>
        </div>

        <div class="side-by-side" *ngIf="enableWorkflowAssociation">
            <div class="form-item">
                <sdc-dropdown
                    #workflowAssignmentDropdown
                    label="{{ 'OPERATION_WORKFLOW_ASSIGNMENT' | translate }}"
                    placeHolder="Select..."
                    testId="association-type"
                    [selectedOption]="toDropDownOption(workflowAssociationType)"
                    [options]="associationOptions"
                    (changed)="toggleAssociateWorkflow($event)"
                    [disabled]="readonly">
                </sdc-dropdown>
            </div>

            <div class="form-item" *ngIf="!isUsingExistingWF() && !isUsingExternalWF()"></div>

            <div
                *ngIf="isUsingExternalWF()"
                class="form-item sdc-input">
                <label class="sdc-input__label">{{ 'OPERATION_ARTIFACT' | translate }}</label>
                <div class="i-sdc-form-item i-sdc-form-file-upload">
                    <span
                        class="i-sdc-form-file-name"
                        data-tests-id="artifactFilename">
                        {{ operation.artifactFileName }}
                    </span>
                    <div
                        *ngIf="operation.artifactFileName"
                        class="i-sdc-form-file-upload-x-btn"
                        data-tests-id="clearArtifact"
                        (click)="onChangeArtifactFile({ target: {} })"></div>
                    <label
                        class="i-sdc-form-file-upload-label"
                        [ngClass]="{'disabled': readonly}">
                        <input
                            type="file"
                            base-sixty-four-input
                            maxsize="10240"
                            data-tests-id="artifactUpload"
                            (change)="onChangeArtifactFile($event)"
                            (click)="$event.target.value = ''"
                        />
                        <div class="file-upload-browse-btn">Browse</div>
                    </label>
                </div>
            </div>

            <div class="form-item sdc-input" *ngIf="isUsingExistingWF()">
                <label class="sdc-input__label required">{{ 'OPERATION_WORKFLOW' | translate }}
                    <span class="archive-warning" *ngIf="workflowIsOnline && archivedWorkflowId === operation.workflowId">({{ 'OPERATION_WORKFLOW_ARCHIVED' | translate }})</span>
                    <span class="no-workflow-warning" *ngIf="!workflowIsOnline">{{ 'OPERATION_NO_WORKFLOW_CONNECTION' | translate }}</span>
                    <span class="no-workflow-warning" *ngIf="workflowIsOnline && !workflows.length">{{ 'OPERATION_NO_WORKFLOW_ERROR' | translate }}</span>
                </label>
                <sdc-dropdown
                    placeHolder="Select..."
                    testId="associated-workflow"
                    [selectedOption]="getSelectedDropdown(workflows, operation.workflowId)"
                    [options]="workflows"
                    (changed)="onSelectWorkflow($event)"
                    [disabled]="readonly || !workflows.length || !workflowIsOnline">
                </sdc-dropdown>
            </div>

            <div class="form-item sdc-input" *ngIf="isUsingExistingWF()">
                <sdc-dropdown
                    *ngIf="workflowIsOnline && workflows.length"
                    label="{{ 'OPERATION_WORKFLOW_VERSION' | translate }}"
                    testId="associated-workflow-version"
                    [selectedOption]="getSelectedDropdown(workflowVersions, operation.workflowVersionId)"
                    [options]="workflowVersions"
                    (changed)="changeWorkflowVersion($event)"
                    [disabled]="!operation.workflowId || archivedWorkflowId === operation.workflowId || readonly">
                </sdc-dropdown>
            </div>
        </div>

        <div class="separator-buttons">
            <tabs #propertyInputTabs tabStyle="round-tabs" (tabChanged)="tabChanged($event)" [hideIndicationOnTabChange]="true">
                <tab tabTitle="Inputs"></tab>
                <tab tabTitle="Outputs"></tab>
            </tabs>
            <a
                class="add-param-link add-btn"
                *ngIf="!isUsingExistingWF() && !readonly"
                data-tests-id="addInputParameter"
                [ngClass]="{'disabled':!canAdd()}"
                (click)="addParam()">{{ currentTab === TYPE_INPUT ? 'Add Input' : 'Add Output' }}</a>
        </div>

        <div class="generic-table">
            <div class="header-row table-row">
                <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">
                    {{ 'OPERATION_PARAM_PROPERTY' | translate }}
                    <span
                        *ngIf="!isUsingExistingWF()"
                        class="sprite-new info-icon"
                        tooltip="{{propertyTooltipText}}"
                        tooltipDelay="0">
                    </span>
                </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>{{ 'EMPTY_PARAM_TABLE_HEADER' | translate }}</div>
                <div *ngIf="isUsingExistingWF() && !operation.workflowVersionId">
                    <div *ngIf="workflows.length">
                        <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">
                        Only <span class="bold-message">certified</span> workflow versions can be assigned to an operation
                    </div>
                </div>
            </div>

            <param-row
                    *ngFor="let param of tableParameters"
                    class="data-row"
                    [isInputParam]="currentTab === TYPE_INPUT"
                    [isAssociateWorkflow]="isUsingExistingWF()"
                    [param]="param"
                    [inputProps]="inputProperties"
                    [capabilitiesProps]="componentCapabilities"
                    [operationOutputs]="operationOutputs"
                    [onRemoveParam]="onRemoveParam"
                    [readonly]="readonly"
                    [validityChanged]="validityChanged">
            </param-row>
        </div>

    </form>
</div>