1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

feat(edge): EE-4570 allow pre-pull images with edge stack deployment (#8210)

Co-authored-by: Matt Hook <hookenz@gmail.com>
This commit is contained in:
cmeng 2022-12-21 13:18:51 +13:00 committed by GitHub
parent 7fe0712b61
commit 919a854d93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 234 additions and 53 deletions

View file

@ -20,12 +20,6 @@ export class EdgeStackEndpointsDatatableController {
this.onPageChange = this.onPageChange.bind(this);
this.paginationChanged = this.paginationChanged.bind(this);
this.paginationChangedAsync = this.paginationChangedAsync.bind(this);
this.statusMap = {
1: 'OK',
2: 'Error',
3: 'Acknowledged',
};
}
extendGenericController($controller, $scope) {
@ -45,8 +39,9 @@ export class EdgeStackEndpointsDatatableController {
endpointStatusLabel(endpointId) {
const status = this.getEndpointStatus(endpointId);
const details = (status && status.Details) || {};
return status ? this.statusMap[status.Type] : 'Pending';
return (details.Error && 'Error') || (details.Ok && 'Ok') || (details.ImagesPulled && 'Images pre-pulled') || (details.Acknowledged && 'Acknowledged') || 'Pending';
}
endpointStatusError(endpointId) {

View file

@ -0,0 +1,28 @@
.edge-stack-status {
padding: 2px 10px;
border-radius: 10px;
}
.edge-stack-status.status-acknowledged {
color: #337ab7;
background-color: rgba(51, 122, 183, 0.1);
}
.edge-stack-status.status-images-pulled {
color: #e1a800;
background-color: rgba(238, 192, 32, 0.1);
}
.edge-stack-status.status-ok {
color: #23ae89;
background-color: rgba(35, 174, 137, 0.1);
}
.edge-stack-status.status-error {
color: #ae2323;
background-color: rgba(174, 35, 35, 0.1);
}
.edge-stack-status.status-total {
background-color: rgba(168, 167, 167, 0.1);
}

View file

@ -87,7 +87,10 @@
></table-column-header>
</div>
</th>
<th> Status </th>
<th class="text-center"> Acknowledged </th>
<th class="text-center"> Deployed </th>
<th class="text-center"> Failed </th>
<th class="text-center"> Total deployments </th>
<th>
<table-column-header
col-title="'Creation Date'"
@ -113,14 +116,36 @@
{{ item.Name }}
</a>
</td>
<td><edge-stack-status stack-status="item.Status"></edge-stack-status></td>
<td class="text-center">
<span class="edge-stack-status status-acknowledged">
&bull;
{{ item.aggregateStatus.acknowledged }}
</span>
</td>
<td class="text-center">
<span class="edge-stack-status status-ok">
&bull;
{{ item.aggregateStatus.ok }}
</span>
</td>
<td class="text-center">
<span class="edge-stack-status status-error">
&bull;
{{ item.aggregateStatus.error }}
</span>
</td>
<td class="text-center">
<span class="edge-stack-status status-total">
{{ item.NumDeployments }}
</span>
</td>
<td>{{ item.CreationDate | getisodatefromtimestamp }}</td>
</tr>
<tr ng-if="!$ctrl.dataset" data-cy="edgeStack-loadingRow">
<td colspan="4" class="text-center text-muted">Loading...</td>
<td colspan="6" class="text-center text-muted">Loading...</td>
</tr>
<tr ng-if="$ctrl.state.filteredDataSet.length === 0" data-cy="edgeStack-noStackRow">
<td colspan="4" class="text-center text-muted"> No stack available. </td>
<td colspan="6" class="text-center text-muted"> No stack available. </td>
</tr>
</tbody>
</table>

View file

@ -1,4 +1,5 @@
import angular from 'angular';
import './edgeStackDatatable.css';
angular.module('portainer.edge').component('edgeStacksDatatable', {
templateUrl: './edgeStacksDatatable.html',

View file

@ -32,7 +32,7 @@
</div>
<web-editor-form
ng-if="$ctrl.model.DeploymentType === 0"
ng-if="$ctrl.model.DeploymentType === $ctrl.EditorType.Compose"
value="$ctrl.model.StackFileContent"
yml="true"
identifier="compose-editor"
@ -48,7 +48,7 @@
</editor-description>
</web-editor-form>
<div ng-if="$ctrl.model.DeploymentType === 1">
<div ng-if="$ctrl.model.DeploymentType === $ctrl.EditorType.Kubernetes">
<div class="form-group">
<div class="col-sm-12">
<por-switch-field

View file

@ -1,4 +1,5 @@
import { PortainerEndpointTypes } from '@/portainer/models/endpoint/models';
import { EditorType } from '@/react/edge/edge-stacks/types';
export class EditEdgeStackFormController {
/* @ngInject */
@ -13,6 +14,8 @@ export class EditEdgeStackFormController {
1: '',
};
this.EditorType = EditorType;
this.onChangeGroups = this.onChangeGroups.bind(this);
this.onChangeFileContent = this.onChangeFileContent.bind(this);
this.onChangeComposeConfig = this.onChangeComposeConfig.bind(this);