1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-30 02:39:41 +02:00

refactor(app): redesign dashboard-item component [EE-3634] (#7175)

This commit is contained in:
Chaim Lev-Ari 2022-07-06 11:23:53 +03:00 committed by GitHub
parent a66fd78dc1
commit 8bf1c91bc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 236 additions and 248 deletions

View file

@ -3,6 +3,8 @@ import _ from 'lodash';
import { isOfflineEndpoint } from '@/portainer/helpers/endpointHelper';
import { PortainerEndpointTypes } from 'Portainer/models/endpoint/models';
import { useContainerStatusComponent } from '@/react/docker/DashboardView/ContainerStatus';
import { useImagesTotalSizeComponent } from '@/react/docker/DashboardView/ImagesTotalSize';
angular.module('portainer.docker').controller('DashboardController', [
'$scope',
@ -60,7 +62,11 @@ angular.module('portainer.docker').controller('DashboardController', [
})
.then(function success(data) {
$scope.containers = data.containers;
$scope.containerStatusComponent = useContainerStatusComponent(data.containers);
$scope.images = data.images;
$scope.imagesTotalSizeComponent = useImagesTotalSizeComponent(imagesTotalSize(data.images));
$scope.volumeCount = data.volumes.length;
$scope.networkCount = data.networks.length;
$scope.serviceCount = data.services.length;
@ -94,3 +100,7 @@ angular.module('portainer.docker').controller('DashboardController', [
initView();
},
]);
function imagesTotalSize(images) {
return images.reduce((acc, image) => acc + image.VirtualSize, 0);
}