mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
refactor(docker/images): convert table to react [EE-4668] (#8910)
This commit is contained in:
parent
0e9902fee9
commit
ecd54ab929
26 changed files with 496 additions and 441 deletions
|
@ -44,20 +44,17 @@
|
|||
</rd-widget>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<images-datatable
|
||||
title-text="Images"
|
||||
title-icon="list"
|
||||
dataset="images"
|
||||
table-key="images"
|
||||
order-by="RepoTags"
|
||||
show-host-column="applicationState.endpoint.mode.agentProxy && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'"
|
||||
download-action="downloadAction"
|
||||
remove-action="confirmRemove"
|
||||
force-remove-action="confirmForceRemove"
|
||||
export-in-progress="state.exportInProgress"
|
||||
refresh-callback="getImages"
|
||||
></images-datatable>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<docker-images-datatable
|
||||
ng-if="images"
|
||||
dataset="images"
|
||||
is-host-column-visible="applicationState.endpoint.mode.agentProxy && applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE'"
|
||||
on-download="(downloadAction)"
|
||||
on-remove="(confirmRemovalAction)"
|
||||
on-refresh="(getImages)"
|
||||
is-export-in-progress="state.exportInProgress"
|
||||
storage-key="images"
|
||||
environment="endpoint"
|
||||
settings-store="settingsStore"
|
||||
containers="containers"
|
||||
></docker-images-datatable>
|
||||
|
|
|
@ -15,7 +15,7 @@ angular.module('portainer.docker').controller('ImagesController', [
|
|||
'Blob',
|
||||
'endpoint',
|
||||
'$async',
|
||||
function ($scope, $state, Authentication, ImageService, Notifications, HttpRequestHelper, FileSaver, Blob, endpoint, $async) {
|
||||
function ($scope, $state, Authentication, ImageService, Notifications, HttpRequestHelper, FileSaver, Blob, endpoint) {
|
||||
$scope.endpoint = endpoint;
|
||||
$scope.isAdmin = Authentication.isAdmin();
|
||||
|
||||
|
@ -54,40 +54,32 @@ angular.module('portainer.docker').controller('ImagesController', [
|
|||
});
|
||||
};
|
||||
|
||||
$scope.confirmForceRemove = confirmForceRemove;
|
||||
function confirmForceRemove(selectedItems, force) {
|
||||
return $async(async () => {
|
||||
const confirmed = await confirmDestructive({
|
||||
title: 'Are you sure?',
|
||||
message: 'Forcing the removal of the image will remove the image even if it has multiple tags or if it is used by stopped containers.',
|
||||
confirmButton: buildConfirmButton('Remove the image', 'danger'),
|
||||
});
|
||||
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.removeAction(selectedItems, force);
|
||||
function confirmImageForceRemoval() {
|
||||
return confirmDestructive({
|
||||
title: 'Are you sure?',
|
||||
message: 'Forcing the removal of the image will remove the image even if it has multiple tags or if it is used by stopped containers.',
|
||||
confirmButton: buildConfirmButton('Remove the image', 'danger'),
|
||||
});
|
||||
}
|
||||
|
||||
$scope.confirmRemove = confirmRemove;
|
||||
function confirmRemove(selectedItems) {
|
||||
return $async(async () => {
|
||||
const confirmed = await confirmDestructive({
|
||||
title: 'Are you sure?',
|
||||
message: 'Removing the image will remove all tags associated to that image. Are you sure you want to remove the image?',
|
||||
confirmButton: buildConfirmButton('Remove the image', 'danger'),
|
||||
});
|
||||
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.removeAction(selectedItems, false);
|
||||
function confirmRegularRemove() {
|
||||
return confirmDestructive({
|
||||
title: 'Are you sure?',
|
||||
message: 'Removing the image will remove all tags associated to that image. Are you sure you want to remove the image?',
|
||||
confirmButton: buildConfirmButton('Remove the image', 'danger'),
|
||||
});
|
||||
}
|
||||
|
||||
$scope.confirmRemovalAction = async function (selectedItems, force) {
|
||||
const confirmed = await (force ? confirmImageForceRemoval() : confirmRegularRemove());
|
||||
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.removeAction(selectedItems, force);
|
||||
};
|
||||
|
||||
function isAuthorizedToDownload(selectedItems) {
|
||||
for (var i = 0; i < selectedItems.length; i++) {
|
||||
var image = selectedItems[i];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue