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
|
<!--
# ============LICENSE_START=======================================================
# Copyright (c) 2020 AT&T Intellectual Property. 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=========================================================
-->
<ng4-loading-spinner [timeout]="1000000"></ng4-loading-spinner>
<div class="table_div">
<p-table #dt *ngIf="loadTable" [columns]="cols" [value]="msInstances" sortMode="multiple" [paginator]="true"
[rows]="18" [rowsPerPageOptions]="[10,12,14,16,18,20,25,50]" selectionMode="multiple"
[(selection)]="selectedMsInstances" (onFilter)="onTableFiltered(dt.filteredValue)" dataKey="id">
<ng-template pTemplate="caption">
<div class="table_caption_header">
<!--Microservices Table Header-->
<div style="float: left;">
<!--Refresh-->
<i class="fa fa-refresh" (click)="getAllInstances()"></i>
<!--Global Filter-->
<input type="text" pInputText size="50" placeholder="Global Filter"
(input)="dt.filterGlobal($event.target.value, 'contains')"
class="table_global_filter">
<i class="fa fa-search" style="margin:4px 0 0 8px"></i>
</div>
<div class="table_title">
<h4><b>Microservice Instances</b></h4>
</div>
</div>
</ng-template>
<!--column headers-->
<ng-template pTemplate="header" let-columns>
<tr>
<th style="width: 3em"></th>
<th class="ui-state-highlight" *ngFor="let col of columns" style="outline: none; vertical-align: bottom; text-align: center;" [pSortableColumn]="col.field" [ngStyle]="{'width': col.width}">
{{col.header}}<br>
<p-sortIcon [field]="col.field" style="font-size: 8px;"></p-sortIcon>
</th>
<!--actions column-->
<th style="width: 7%;">
Actions
</th>
</tr>
<!--Second header row for individual column filters-->
<tr>
<th style="width: 3em"></th>
<th *ngFor="let col of columns" [ngSwitch]="col.field">
<input pInputText type="text" (input)="dt.filter($event.target.value, col.field, 'contains')" class="table_column_filter" placeholder="Filter">
</th>
<th>
<div style="text-align: center;">
<p-tableHeaderCheckbox style="padding-right: 5px;"></p-tableHeaderCheckbox>
<button pButton type="button" class="ui-button-secondary" (click)="checkCanGenerateBp()" [matMenuTriggerFor]="menu"
style="background-color: transparent; border: none; width: 20px; height: 20px; vertical-align: middle;">
<i class="pi pi-ellipsis-h" style="color: grey;"></i>
</button>
<mat-menu #menu="matMenu" xPosition="before">
<div style="background-color: rgba(128, 128, 128, 0.25);">
<span style="font-size: 12px; margin-left: 10px; font-weight: 500;"><i class="pi pi-plus"
style="font-size: 10px;"></i> Add</span>
</div>
<div matTooltip="{{generateSelectedBPsTooltip}}" [matTooltipDisabled]="canGenerateSelectedBPs" matTooltipPosition="left">
<button mat-menu-item (click)="generateSelectedBlueprints()" class="table_action_item" [disabled]="!canGenerateSelectedBPs" style="margin-top: 5px;">Generate Selected Blueprints</button>
</div>
</mat-menu>
</div>
</th>
</tr>
</ng-template>
<!--row data-->
<ng-template pTemplate="body" let-rowData let-expanded="expanded" let-msElem>
<tr>
<!--Column for row expand buttons-->
<td>
<a href="#" [pRowToggler]="rowData">
<i [ngClass]="expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'"></i>
</a>
</td>
<td *ngFor="let col of cols">
<div *ngIf="col.field==='status'"
style="width: fit-content; width: -moz-max-content; padding: 0px 5px 0px 5px; border-radius: 3px; font-weight: 600;" [ngClass]="{
'greenStatus' : msElem[col.field] === 'DEV_COMPLETE' || msElem[col.field] === 'CERTIFIED' || msElem[col.field] === 'PROD_DEPLOYED',
'blueStatus' : msElem[col.field] === 'NEW' || msElem[col.field] === 'IN_DEV' || msElem[col.field] === 'IN_TEST'}">
{{msElem[col.field]}}
</div>
<div *ngIf="col.field!=='status'">{{msElem[col.field]}}</div>
</td>
<td>
<div style="text-align: center">
<p-tableCheckbox [value]="rowData" style="padding-right: 5px;"></p-tableCheckbox>
<button pButton type="button" class="ui-button-secondary" [matMenuTriggerFor]="menu"
style="background-color: transparent; border: none; width: 20px; height: 20px; vertical-align: middle;">
<i class="pi pi-ellipsis-h" style="color: grey;"></i>
</button>
<mat-menu #menu="matMenu" xPosition="before">
<div style="background-color: rgba(128, 128, 128, 0.25);">
<span style="font-size: 12px; margin-left: 10px; font-weight: 500;"><i class="pi pi-plus" style="font-size: 10px;"></i> Add</span>
</div>
<!-- * * * * Add component spec * * * * -->
<button mat-menu-item class="table_action_item" (click)="showAddCSDialog(rowData)">Component Spec...</button>
<!-- * * * * Generate Blueprint * * * * -->
<div matTooltip="No Active Component Spec" [matTooltipDisabled]="rowData.activeSpec!==null" matTooltipPosition="left">
<button mat-menu-item class="table_action_item" (click)="generateBlueprints(rowData)" [disabled]="rowData.activeSpec===null">Generate Blueprint</button>
</div>
<div style="background-color: rgba(128, 128, 128, 0.25);">
<span style="font-size: 12px; margin-left: 10px; font-weight: 500;"><i class="pi pi-search" style="font-size: 10px;"></i> View</span>
</div>
<!-- * * * * Go to spec files table * * * * -->
<div matTooltip="No Component Specs" [matTooltipDisabled]="rowData.activeSpec!==null" matTooltipPosition="left">
<button mat-menu-item class="table_action_item" (click)="viewCompSpecs(rowData)" [disabled]="rowData.activeSpec===null">Component Specs</button>
</div>
<!-- * * * * Go to blueprints table * * * * -->
<button mat-menu-item class="table_action_item" (click)="viewBlueprints(rowData)" [disabled]="rowData.activeSpec===null">Blueprints</button>
<div style="background-color: rgba(128, 128, 128, 0.25);">
<span style="font-size: 12px; margin-left: 10px; font-weight: 500;"><i class="pi pi-pencil"></i> Update</span>
</div>
<!-- * * * * Update ms instance record * * * * -->
<button mat-menu-item class="table_action_item" (click)="showAddChangeDialog(rowData)">Update MS Instance...</button>
</mat-menu>
</div>
</td>
</tr>
</ng-template>
<!--Row expand content-->
<ng-template pTemplate="rowexpansion" let-rowData let-columns="columns">
<tr>
<td [attr.colspan]="columns.length + 2">
<div class="row-expand-layout" [@rowExpansionTrigger]="'active'">
<!-- Audit Fields -->
<div class="row-expand-card" style="background-color: rgba(95, 158, 160, 0.295);">
<b>Created By:</b> {{rowData.metadata.createdBy}}<br>
<b>Created On:</b> {{rowData.metadata.createdOn}}<br>
<b>Updated By:</b> {{rowData.metadata.updatedBy}}<br>
<b>Updated On:</b> {{rowData.metadata.updatedOn}}
</div>
<!-- People -->
<div class="row-expand-card" style="background-color: rgba(160, 159, 95, 0.295)">
<b>Scrum Lead: </b>{{rowData.metadata.scrumLead}}
<span *ngIf="rowData.metadata.scrumLeadId"> ({{rowData.metadata.scrumLeadId}})</span><br/>
<b>Systems Engineer: </b>{{rowData.metadata.systemsEngineer}}
<span *ngIf="rowData.metadata.systemsEngineerId"> ({{rowData.metadata.systemsEngineerId}})</span><br/>
<b>Developer: </b>{{rowData.metadata.developer}}
<span *ngIf="rowData.metadata.developerId"> ({{rowData.metadata.developerId}})</span>
</div>
<!-- Notes -->
<div class="row-expand-card" style="background-color: rgba(100, 148, 237, 0.295); white-space: pre-line;">
<b>Notes:</b><br>
<p-scrollPanel [style]="{width: '100%', height: '62px'}">
<div style="font-size: 12px; word-break: normal;">{{rowData.metadata.notes}}</div>
</p-scrollPanel>
</div>
<!-- Labels -->
<div class="row-expand-card" style="background-color: rgba(76, 65, 225, 0.295)">
<b style="padding-bottom: 5px;">Labels:</b><br>
<div *ngFor="let label of rowData['metadata']['labels']"
style="display: inline-flex; margin-top: 5px;">
<div style="padding: 2px 7px 3px 0px;">
<span style="background-color: rgba(80, 80, 80, 0.185); padding: 5px; border-radius: 3px;">{{label}}</span>
</div>
</div>
</div>
</div>
</td>
</tr>
</ng-template>
</p-table>
<!--download buttons for exporting table to either csv or excel file-->
<div *ngIf="loadTable" class="table_export_buttons_alignment">
<button pButton type="button" class="table_export_button" (click)="exportTable('csv')" matTooltip="Export Table to CSV" matTooltipPosition="above" style="width: 55px;">
<i class="pi pi-file" style="margin-top: 3px; margin-left: 4px;"></i>
<label style="font-weight: 800; margin-top: 1px;">CSV</label>
</button>
<button pButton type="button" class="table_export_button" (click)="exportTable('excel')" matTooltip="Export Table to XLSX" matTooltipPosition="above" style="width: 65px; background-color: green;">
<i class="pi pi-file-excel" style="margin-top: 3px; margin-left: 4px;"></i>
<label style="font-weight: 800; margin-top: 1px">Excel</label>
</button>
</div>
<!-- Dialog to Change an MS Instance -->
<app-ms-instance-add *ngIf="showAddChangeMsInstance" [visible]="showAddChangeMsInstance" [msName]="msName" [msInstanceChange]="msInstanceChange" [currentRow]="currentRow" (handler)="addChangeMsInstance($event)"></app-ms-instance-add>
<!-- Dialog to Add a Component Spec -->
<app-comp-spec-add *ngIf="showCsAddDialog" [visible]="showCsAddDialog" (handler)="addNewCs($event)"></app-comp-spec-add>
<!--Pop-up for "Success" changing MS Instance-->
<p-toast key="changeSuccess"></p-toast>
<!--Pop-up for "Success" adding Component Spec-->
<p-toast key="compSpecAdded" [style]="{width: '400px'}"></p-toast>
<!--Pop-up for "Error" adding Component Spec-->
<p-toast class="toast-newline" key="errorOnCsAdd" [style]="{width: '700px'}"></p-toast>
<p-toast class="toast-newline" key="csViewError" [style]="{width: '700px'}"></p-toast>
<p-toast key="bpGenMessage" [style]="{width: '450px'}"></p-toast>
</div>
|