Spaces:
Running
Running
Update flare-ui/src/app/components/spark/spark.component.ts
Browse files
flare-ui/src/app/components/spark/spark.component.ts
CHANGED
@@ -110,101 +110,90 @@ interface SparkProject {
|
|
110 |
</button>
|
111 |
</div>
|
112 |
|
113 |
-
|
114 |
-
<
|
115 |
-
|
116 |
-
|
117 |
-
</div>
|
118 |
-
}
|
119 |
|
120 |
-
|
121 |
<mat-divider class="section-divider"></mat-divider>
|
122 |
|
123 |
<h3>Response History</h3>
|
124 |
|
125 |
<div class="response-list">
|
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 |
-
@if (response.error) {
|
199 |
-
<div class="response-section error">
|
200 |
-
<h4>Error:</h4>
|
201 |
-
<pre class="json-display error-text">{{ response.error }}</pre>
|
202 |
-
</div>
|
203 |
-
}
|
204 |
-
</mat-expansion-panel>
|
205 |
-
}
|
206 |
</div>
|
207 |
-
|
208 |
</mat-card-content>
|
209 |
</mat-card>
|
210 |
</div>
|
@@ -543,4 +532,8 @@ export class SparkComponent implements OnInit {
|
|
543 |
return '';
|
544 |
}
|
545 |
}
|
|
|
|
|
|
|
|
|
546 |
}
|
|
|
110 |
</button>
|
111 |
</div>
|
112 |
|
113 |
+
<div class="loading-indicator" *ngIf="loading">
|
114 |
+
<mat-spinner diameter="40"></mat-spinner>
|
115 |
+
<p>Processing request...</p>
|
116 |
+
</div>
|
|
|
|
|
117 |
|
118 |
+
<ng-container *ngIf="responses.length > 0">
|
119 |
<mat-divider class="section-divider"></mat-divider>
|
120 |
|
121 |
<h3>Response History</h3>
|
122 |
|
123 |
<div class="response-list">
|
124 |
+
<mat-expansion-panel *ngFor="let response of responses; let i = index; trackBy: trackByTimestamp"
|
125 |
+
[expanded]="i === 0">
|
126 |
+
<mat-expansion-panel-header>
|
127 |
+
<mat-panel-title>
|
128 |
+
<mat-chip [class]="response.error ? 'error-chip' : 'success-chip'">
|
129 |
+
{{ response.type }}
|
130 |
+
</mat-chip>
|
131 |
+
<span class="timestamp">{{ response.timestamp | date:'HH:mm:ss' }}</span>
|
132 |
+
</mat-panel-title>
|
133 |
+
</mat-expansion-panel-header>
|
134 |
+
|
135 |
+
<div class="response-section" *ngIf="response.request">
|
136 |
+
<h4>Request:</h4>
|
137 |
+
<pre class="json-display">{{ response.request | json }}</pre>
|
138 |
+
</div>
|
139 |
+
|
140 |
+
<div class="response-section" *ngIf="response.response">
|
141 |
+
<h4>Response:</h4>
|
142 |
+
<table mat-table [dataSource]="response.response.projects" class="projects-table"
|
143 |
+
*ngIf="response.type === 'Get Project Status' && response.response.projects">
|
144 |
+
<ng-container matColumnDef="project_name">
|
145 |
+
<th mat-header-cell *matHeaderCellDef>Project</th>
|
146 |
+
<td mat-cell *matCellDef="let project">{{ project.project_name }}</td>
|
147 |
+
</ng-container>
|
148 |
+
|
149 |
+
<ng-container matColumnDef="version">
|
150 |
+
<th mat-header-cell *matHeaderCellDef>Version</th>
|
151 |
+
<td mat-cell *matCellDef="let project">v{{ project.version }}</td>
|
152 |
+
</ng-container>
|
153 |
+
|
154 |
+
<ng-container matColumnDef="status">
|
155 |
+
<th mat-header-cell *matHeaderCellDef>Status</th>
|
156 |
+
<td mat-cell *matCellDef="let project">
|
157 |
+
<mat-chip [class]="getStatusClass(project.status)">
|
158 |
+
{{ project.status }}
|
159 |
+
</mat-chip>
|
160 |
+
</td>
|
161 |
+
</ng-container>
|
162 |
+
|
163 |
+
<ng-container matColumnDef="enabled">
|
164 |
+
<th mat-header-cell *matHeaderCellDef>Enabled</th>
|
165 |
+
<td mat-cell *matCellDef="let project">
|
166 |
+
<mat-icon [color]="project.enabled ? 'primary' : ''">
|
167 |
+
{{ project.enabled ? 'check_circle' : 'cancel' }}
|
168 |
+
</mat-icon>
|
169 |
+
</td>
|
170 |
+
</ng-container>
|
171 |
+
|
172 |
+
<ng-container matColumnDef="base_model">
|
173 |
+
<th mat-header-cell *matHeaderCellDef>Base Model</th>
|
174 |
+
<td mat-cell *matCellDef="let project" class="model-cell">
|
175 |
+
{{ project.base_model }}
|
176 |
+
</td>
|
177 |
+
</ng-container>
|
178 |
+
|
179 |
+
<ng-container matColumnDef="last_accessed">
|
180 |
+
<th mat-header-cell *matHeaderCellDef>Last Accessed</th>
|
181 |
+
<td mat-cell *matCellDef="let project">{{ project.last_accessed }}</td>
|
182 |
+
</ng-container>
|
183 |
+
|
184 |
+
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
185 |
+
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
186 |
+
</table>
|
187 |
+
<pre class="json-display" *ngIf="!(response.type === 'Get Project Status' && response.response.projects)">{{ response.response | json }}</pre>
|
188 |
+
</div>
|
189 |
+
|
190 |
+
<div class="response-section error" *ngIf="response.error">
|
191 |
+
<h4>Error:</h4>
|
192 |
+
<pre class="json-display error-text">{{ response.error }}</pre>
|
193 |
+
</div>
|
194 |
+
</mat-expansion-panel>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
</div>
|
196 |
+
</ng-container>
|
197 |
</mat-card-content>
|
198 |
</mat-card>
|
199 |
</div>
|
|
|
532 |
return '';
|
533 |
}
|
534 |
}
|
535 |
+
|
536 |
+
trackByTimestamp(index: number, response: SparkResponse): Date {
|
537 |
+
return response.timestamp;
|
538 |
+
}
|
539 |
}
|