1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-09 07:45:22 +02:00

EE-2570 disable pull image toggle when invalid (#7002)

This commit is contained in:
Chao Geng 2022-06-30 08:35:32 +08:00 committed by GitHub
parent 81f8b88541
commit cd66e32912
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 4 deletions

View file

@ -85,7 +85,10 @@ export function selectRegistry(options: PromptOptions) {
prompt(options);
}
export function confirmContainerRecreation(callback: PromptCallback) {
export function confirmContainerRecreation(
cannotPullImage: boolean | null,
callback: PromptCallback
) {
const box = prompt({
title: 'Are you sure?',
@ -105,9 +108,26 @@ export function confirmContainerRecreation(callback: PromptCallback) {
callback,
});
const message = `You're about to re-create this container, any non-persisted data will be lost. This container will be removed and another one will be created using the same configuration.`;
const message = `You're about to recreate this container and any non-persisted data will be lost. This container will be removed and another one will be created using the same configuration.`;
box.find('.bootbox-body').prepend(`<p>${message}</p>`);
const label = box.find('.form-check-label');
label.css('padding-left', '5px');
label.css('padding-right', '25px');
customizeCheckboxPrompt(box, message);
if (cannotPullImage) {
label.css('cursor', 'not-allowed');
label.find('i').css('cursor', 'not-allowed');
const checkbox = box.find('.bootbox-input-checkbox');
checkbox.prop('disabled', true);
const formCheck = box.find('.form-check');
formCheck.prop('style', 'height: 45px;');
const cannotPullImageMessage = `<div class="fa fa-exclamation-triangle text-warning"/>
<div class="inline-text text-warning">
<span>Cannot pull latest as the image is inaccessible - either it no longer exists or the tag or name is no longer correct.
</span>
</div>`;
formCheck.append(`${cannotPullImageMessage}`);
}
}
export function confirmServiceForceUpdate(