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

feat(stack): detach git based stacks from git EE-2143 (#6307)

* feat(stack): detach git based stacks from git
This commit is contained in:
Hao Zhang 2022-01-14 11:47:47 +08:00 committed by GitHub
parent 125d84cbd1
commit 9ff8f42a66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 3 deletions

View file

@ -115,6 +115,21 @@ export function confirmDeletion(message: string, callback: ConfirmCallback) {
});
}
export function confirmDetachment(message: string, callback: ConfirmCallback) {
const messageSanitized = sanitize(message);
confirm({
title: 'Are you sure ?',
message: messageSanitized,
buttons: {
confirm: {
label: 'Detach',
className: 'btn-danger',
},
},
callback,
});
}
export function confirmDeassociate(callback: ConfirmCallback) {
const message =
'<p>De-associating this Edge environment will mark it as non associated and will clear the registered Edge ID.</p>' +

View file

@ -7,6 +7,7 @@ import {
confirmAsync,
confirmDeassociate,
confirmDeletion,
confirmDetachment,
confirmDeletionAsync,
confirmEndpointSnapshot,
confirmImageExport,
@ -45,6 +46,7 @@ export function ModalServiceAngular() {
confirmImageForceRemoval,
cancelRegistryRepositoryAction,
confirmDeletion,
confirmDetachment,
confirmDeassociate,
confirmUpdate,
confirmRedeploy,

View file

@ -71,6 +71,18 @@
<i class="fa fa-plus space-right" aria-hidden="true"></i>
Create template from stack
</button>
<button
authorization="PortainerStackUpdate"
ng-if="regular && stackFileContent && !stack.FromAppTemplate && stack.GitConfig"
ng-disabled="state.actionInProgress"
ng-click="detachStackFromGit()"
button-spinner="state.actionInProgress"
class="btn btn-primary btn-xs"
>
<i class="fa fa-arrow-right space-right" aria-hidden="true"></i>
<span ng-hide="state.actionInProgress">Detach from Git</span>
<span ng-show="state.actionInProgress">Detachment in progress...</span>
</button>
</div>
</div>
<!-- !stack-details -->
@ -101,8 +113,12 @@
</form>
</div>
<!-- !associate -->
<stack-redeploy-git-form ng-if="stack.GitConfig && !stack.FromAppTemplate" model="stack.GitConfig" stack="stack" authorization="PortainerStackUpdate">
<stack-redeploy-git-form
ng-if="stack.GitConfig && !stack.FromAppTemplate && !state.actionInProgress"
model="stack.GitConfig"
stack="stack"
authorization="PortainerStackUpdate"
>
</stack-redeploy-git-form>
<stack-duplication-form
ng-if="regular && endpoints.length > 0"

View file

@ -137,6 +137,15 @@ angular.module('portainer.app').controller('StackController', [
});
};
$scope.detachStackFromGit = function () {
ModalService.confirmDetachment('Do you want to detach the stack from Git?', function onConfirm(confirmed) {
if (!confirmed) {
return;
}
$scope.deployStack();
});
};
function migrateStack(name, targetEndpointId) {
const stack = $scope.stack;