mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 22:05:23 +02:00
fix(edge/stacks): show correct status for env [EE-3374] (#7466)
This commit is contained in:
parent
a247db7e93
commit
29f0daa7ea
8 changed files with 39 additions and 21 deletions
|
@ -56,8 +56,8 @@
|
|||
ng-class="{ active: item.Checked }"
|
||||
>
|
||||
<td>{{ item.Name }}</td>
|
||||
<td>{{ $ctrl.statusMap[item.Status.Type] || 'Pending' }}</td>
|
||||
<td>{{ item.Status.Error ? item.Status.Error : '-' }}</td>
|
||||
<td>{{ $ctrl.endpointStatusLabel(item.Id) }}</td>
|
||||
<td>{{ $ctrl.endpointStatusError(item.Id) }}</td>
|
||||
</tr>
|
||||
<tr ng-if="$ctrl.state.loading">
|
||||
<td colspan="5" class="text-center text-muted">Loading...</td>
|
||||
|
|
|
@ -39,6 +39,22 @@ export class EdgeStackEndpointsDatatableController {
|
|||
this.onTextFilterChange = onTextFilterChange;
|
||||
}
|
||||
|
||||
getEndpointStatus(endpointId) {
|
||||
return this.endpointsStatus[endpointId];
|
||||
}
|
||||
|
||||
endpointStatusLabel(endpointId) {
|
||||
const status = this.getEndpointStatus(endpointId);
|
||||
|
||||
return status ? this.statusMap[status.Type] : 'Pending';
|
||||
}
|
||||
|
||||
endpointStatusError(endpointId) {
|
||||
const status = this.getEndpointStatus(endpointId);
|
||||
|
||||
return status && status.Error ? status.Error : '-';
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this.setDefaults();
|
||||
this.prepareTableFromDataset();
|
||||
|
|
|
@ -12,5 +12,7 @@ angular.module('portainer.edge').component('edgeStackEndpointsDatatable', {
|
|||
orderBy: '@',
|
||||
reverseOrder: '<',
|
||||
retrievePage: '<',
|
||||
edgeStackId: '<',
|
||||
endpointsStatus: '<',
|
||||
},
|
||||
});
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
table-key="edgeStackEndpoints"
|
||||
order-by="Name"
|
||||
retrieve-page="$ctrl.getPaginatedEndpoints"
|
||||
edge-stack-id="$ctrl.stack.Id"
|
||||
endpoints-status="$ctrl.stack.Status"
|
||||
>
|
||||
</edge-stack-endpoints-datatable>
|
||||
</div>
|
||||
|
|
|
@ -99,14 +99,14 @@ export class EditEdgeStackViewController {
|
|||
|
||||
async getPaginatedEndpointsAsync(lastId, limit, search) {
|
||||
try {
|
||||
if (this.stackEndpointIds.length === 0) {
|
||||
return { endpoints: [], totalCount: 0 };
|
||||
}
|
||||
|
||||
const query = { search, endpointIds: this.stackEndpointIds };
|
||||
const { value, totalCount } = await getEnvironments({ start: lastId, limit, query });
|
||||
const endpoints = _.map(value, (endpoint) => {
|
||||
const status = this.stack.Status[endpoint.Id];
|
||||
endpoint.Status = status;
|
||||
return endpoint;
|
||||
});
|
||||
return { endpoints, totalCount };
|
||||
|
||||
return { endpoints: value, totalCount };
|
||||
} catch (err) {
|
||||
this.Notifications.error('Failure', err, 'Unable to retrieve environment information');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue