summaryrefslogtreecommitdiffstats
path: root/portal-FE-common/src/app/pages/role/bulk-upload-role/bulk-upload-role.component.html
blob: e9c7bd2d117b33f4177ccdb570c1b04b8cca7a3f (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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<!--
  ============LICENSE_START==========================================
  ONAP Portal
  ===================================================================
  Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
  ===================================================================
 
  Unless otherwise specified, all software contained herein is licensed
  under the Apache License, Version 2.0 (the "License");
  you may not use this software 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.
 
  Unless otherwise specified, all documentation contained herein is licensed
  under the Creative Commons License, Attribution 4.0 Intl. (the "License");
  you may not use this documentation except in compliance with the License.
  You may obtain a copy of the License at
 
              https://creativecommons.org/licenses/by/4.0/
 
  Unless required by applicable law or agreed to in writing, documentation
  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="container">
  <div class="modal-header">
    <h4 class="modal-title">{{title}}</h4>
    <button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross')">
      <span aria-hidden="true">&times;</span>
    </button>
  </div>
  <div class="modal-body">
    <div *ngIf="dialogState === 1">
      <mat-form-field>
        <mat-label> Select Upload Type: </mat-label>
        <mat-select [(ngModel)]="selectedUploadDropdown">
          <mat-option *ngFor="let uploadOpt of ngRepeatBulkUploadOptions" [value]="uploadOpt">
            {{uploadOpt.title}}</mat-option>
        </mat-select>
      </mat-form-field>
    </div>
    <div *ngIf="dialogState === 2">
      <div class="upload-instructions">Select Upload File:</div>
      <!-- input type=file is difficult to style.
             Instead use a label styled as a button. -->
      <label class="file-label">
        <input type="file" (change)="onFileSelect($event.target)" accept="text/plain,.csv" />
      </label>{{selectedFile}}
      <div *ngIf="selectedUploadDropdown.value === 'functions'" class="upload-instructions">File must be .csv or .txt
        and one entry per line with this format:
        <pre>Function Type, Function Instance, Function Action, Function Name</pre>
      </div>
      <div *ngIf="selectedUploadDropdown.value === 'roles'" class="upload-instructions">File must be .csv or .txt and
        one entry per line with this format:
        <pre>Role Name, Priority (Optional)</pre>
      </div>
      <div *ngIf="selectedUploadDropdown.value === 'roleFunctions'" class="upload-instructions">File must be .csv or
        .txt and one entry per line with this format:
        <pre>Role Name, Function Type, Function Instance, Function Action, Function Name</pre>
      </div>
      <div *ngIf="selectedUploadDropdown.value === 'globalRoleFunctions'" class="upload-instructions">File must be .csv
        or .txt and one entry per line with this format:
        <pre>Global Role Name, Function Type, Function Instance, Function Action, Function Name</pre>
      </div>
    </div>
    <div class="bulk-upload" *ngIf="dialogState === 3">

      <div *ngIf="selectedUploadDropdown.value === 'roles' && !isProcessing">Click OK to upload the valid
        roles. Invalid or existing roles will be ignored.
        <p style="font-size: 80%;">
          <span id="required" style="color: Red;" visible="false">*</span>Name can only contain alphanumeric
          characters, dots(.), forward slashes(/), and underscores(_)
        </p>
      </div>

      <div *ngIf="selectedUploadDropdown.value === 'functions' && !isProcessing">Click OK to upload the valid
        functions. Invalid or existing functions will be ignored.
        <p style="font-size: 80%;">
          <span id="required" style="color: Red; font-size: 180%;" visible="false">*</span>Type can only contain
          alphanumeric
          characters, dots(.) and underscores(_)
        </p>
        <p style="font-size: 80%;">
          <span id="required" style="color: Red; font-size: 180%;" visible="false">*</span>Action can only contain
          alphanumeric
          characters, hyphens(-), dots(.) and underscores(_) and single
          asterisk character(*)
        </p>
        <p style="font-size: 80%;">
          <span id="required" style="color: Red; font-size: 180%;" visible="false">*</span>Instance/Code can only
          contain alphanumeric
          characters, hyphens(-), dots(.), colons(:), forwardSlash(/) ,
          asterisk(*) and underscores(_)
        </p>
        <p style="font-size: 80%;">
          <span id="required" style="color: Red; font-size: 180%;" visible="false">*</span>Name can only contain
          alphanumeric
          characters, spaces, hyphens(-), dots(.) and underscores(_)
        </p>
      </div>

      <div *ngIf="selectedUploadDropdown.value === 'roleFunctions' && !isProcessing">Click OK to upload the valid
        role functions. Invalid or existing functions will be ignored.
      </div>
      <div *ngIf="selectedUploadDropdown.value === 'globalRoleFunctions' && !isProcessing">Click OK to upload the valid
        global role functions. Invalid or existing functions will be ignored.
      </div>
      <!-- progress indicator -->
      <div class="upload-instructions" [hidden]="!isProcessing">
        {{progressMsg}}
        <br>
        <br>
        <span class="onap-spinner"></span>
      </div>

      <!-- progress indicator -->
      <div class="upload-instructions" [hidden]="!isProcessedRecords">
        {{conformMsg}}
      </div>
      <div [hidden]="isProcessing || isProcessedRecords">
        
        <table [hidden]="selectedUploadDropdown.value !== 'functions'" mat-table
          [dataSource]="uploadFunctionsDataSource">

          <ng-container matColumnDef="line">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Line
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">{{element.line}}
            </td>
          </ng-container>
          <ng-container matColumnDef="type">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Type
            <td id="rowheader_t1_{{i}}-roles" mat-cell *matCellDef="let element; let i=index;">
              {{element.type}}
            </td>
          </ng-container>
          <ng-container matColumnDef="instance">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Instance/Code
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.instance  }}
            </td>
          </ng-container>
          <ng-container matColumnDef="action">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Action
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.action}}
            </td>
          </ng-container>
          <ng-container matColumnDef="name">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Name
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.name}}
            </td>
          </ng-container>
          <ng-container matColumnDef="status">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Status
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.status}}
            </td>
          </ng-container>

          <tr mat-header-row *matHeaderRowDef="displayedFunctionColumns; sticky: true"></tr>
          <tr mat-row id="table-row-{{i}}" *matRowDef="let row; columns: displayedFunctionColumns; let i = index;"></tr>
        </table>

        <table [hidden]="selectedUploadDropdown.value !== 'roles'" mat-table [dataSource]="uploadRolesDataSource">

          <ng-container matColumnDef="line">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Line
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">{{element.line}}
            </td>
          </ng-container>
          <ng-container matColumnDef="name">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Name
            <td id="rowheader_t1_{{i}}-roles" mat-cell *matCellDef="let element; let i=index;">
              {{element.name}}
            </td>
          </ng-container>
          <ng-container matColumnDef="priority">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Priority
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.priority}}
            </td>
          </ng-container>
          <ng-container matColumnDef="status">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Status
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.status}}
            </td>
          </ng-container>

          <tr mat-header-row *matHeaderRowDef="displayedRoleColumns; sticky: true"></tr>
          <tr mat-row id="table-row-{{i}}" *matRowDef="let row; columns: displayedRoleColumns; let i = index;"></tr>
        </table>


        <table [hidden]="selectedUploadDropdown.value !== 'roleFunctions'" mat-table
          [dataSource]="uploadRoleFunctionsDataSource">

          <ng-container matColumnDef="line">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Line
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">{{element.line}}
            </td>
          </ng-container>
          <ng-container matColumnDef="role">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Role Name
            <td id="rowheader_t1_{{i}}-roles" mat-cell *matCellDef="let element; let i=index;">
              {{element.role}}
            </td>
          </ng-container>
          <ng-container matColumnDef="type">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef>Function Type
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.type}}
            </td>
          </ng-container>
          <ng-container matColumnDef="instance">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef>Function Instance
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.instance}}
            </td>
          </ng-container>
          <ng-container matColumnDef="action">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef>Function Action
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.action}}
            </td>
          </ng-container>
          <ng-container matColumnDef="name">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef>Function Name
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.name}}
            </td>
          </ng-container>
          <ng-container matColumnDef="status">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Status
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.status}}
            </td>
          </ng-container>

          <tr mat-header-row *matHeaderRowDef="displayedRoleFunctionColumns; sticky: true"></tr>
          <tr mat-row id="table-row-{{i}}" *matRowDef="let row; columns: displayedRoleFunctionColumns; let i = index;">
          </tr>
        </table>

        <table [hidden]="selectedUploadDropdown.value !== 'globalRoleFunctions'" mat-table
          [dataSource]="uploadGlobalRoleFunctionsDataSource">

          <ng-container matColumnDef="line">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Line
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">{{element.line}}
            </td>
          </ng-container>
          <ng-container matColumnDef="role">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Global Role Name
            <td id="rowheader_t1_{{i}}-roles" mat-cell *matCellDef="let element; let i=index;">
              {{element.role}}
            </td>
          </ng-container>
          <ng-container matColumnDef="type">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef>Function Type
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.type}}
            </td>
          </ng-container>
          <ng-container matColumnDef="instance">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef>Function Instance
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.instance}}
            </td>
          </ng-container>
          <ng-container matColumnDef="action">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef>Function Action
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.action}}
            </td>
          </ng-container>
          <ng-container matColumnDef="name">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef>Function Name
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.name}}
            </td>
          </ng-container>
          <ng-container matColumnDef="status">
            <th id="rowheader-result" mat-header-cell *matHeaderCellDef> Status
            <td id="table-data-{{i}}" mat-cell *matCellDef="let element; let i = index;">
              {{element.status}}
            </td>
          </ng-container>

          <tr mat-header-row *matHeaderRowDef="displayedGlobalRoleFunctionColumns; sticky: true"></tr>
          <tr mat-row id="table-row-{{i}}"
            *matRowDef="let row; columns: displayedGlobalRoleFunctionColumns; let i = index;"></tr>
        </table>
      </div>
    </div>
  </div>
  <div class="modal-footer">
    <button type="submit" class="btn btn-primary" [hidden]="dialogState !== 1"
      (click)="navigateUploadScreen()">Next</button> &nbsp;
    <button type="submit" class="btn btn-primary" [hidden]="dialogState !== 2"
      (click)="navigateSelectTypeUpload()">Back</button>
    <button type="submit" class="btn btn-primary" [hidden]="dialogState !== 3" (click)="updateInDB()">Ok</button>
    <button type="submit" class="btn btn-primary" [hidden]="dialogState !== 3"
      (click)="navigateUploadScreen()">Cancel</button>
    <button type="button" class="btn btn-primary" [hidden]="dialogState !== 1"
      (click)="activeModal.close('Close')">Cancel</button>
  </div>
</div>