1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-04 21:35:23 +02:00

feat(custom-templates): switching a template to standalone makes it disappear in swarm mode (#4829)

* feat(custom-templates): switching a template to standalone makes it disappear in swarm mode

* feat(custom-template): disable deploy button and add an error message

* fix(custom-template): invert variable

* fix(custom-templates): put the warning message below the button
This commit is contained in:
Maxime Bajeux 2021-02-23 00:52:18 +01:00 committed by GitHub
parent 44b6aaedc8
commit c84da11a91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 24 deletions

View file

@ -55,7 +55,7 @@
<button
type="button"
class="btn btn-primary btn-sm"
ng-disabled="$ctrl.state.actionInProgress || !$ctrl.formValues.name"
ng-disabled="$ctrl.state.actionInProgress || !$ctrl.formValues.name || $ctrl.state.provider !== $ctrl.template.Type"
ng-click="$ctrl.createTemplate()"
button-spinner="$ctrl.state.actionInProgress"
>
@ -63,7 +63,10 @@
<span ng-show="$ctrl.state.actionInProgress">Deployment in progress...</span>
</button>
<button type="button" class="btn btn-sm btn-default" ng-click="$ctrl.unselectTemplate($ctrl.template)">Hide</button>
<span class="text-danger" ng-if="$ctrl.state.formValidationError" style="margin-left: 5px;">{{ $ctrl.state.formValidationError }}</span>
<div class="cols-sm-12 small text-danger" ng-if="$ctrl.state.formValidationError" style="margin-left: 5px; margin-top: 5px;">{{ $ctrl.state.formValidationError }}</div>
<div class="cols-sm-12 small text-danger" ng-if="$ctrl.state.provider !== $ctrl.template.Type" style="margin-left: 5px; margin-top: 5px;"
>This template type cannot be deployed on this endpoint.</div
>
</div>
</div>
<!-- !actions -->

View file

@ -40,6 +40,7 @@ class CustomTemplatesViewController {
formValidationError: '',
actionInProgress: false,
isEditorVisible: false,
provider: 0,
};
this.currentUser = {
@ -231,6 +232,7 @@ class CustomTemplatesViewController {
apiVersion,
} = applicationState;
this.state.provider = endpointMode.provider === 'DOCKER_STANDALONE' ? 2 : 1;
this.getTemplates(endpointMode);
this.getNetworks(endpointMode.provider, apiVersion);

View file

@ -254,6 +254,7 @@ angular.module('portainer.app').controller('TemplatesController', [
var endpointMode = $scope.applicationState.endpoint.mode;
var apiVersion = $scope.applicationState.endpoint.apiVersion;
this.state.provider = endpointMode.provider === 'DOCKER_STANDALONE' ? 2 : 1;
$q.all({
templates: TemplateService.templates(),