#2732 feat(stacks): adding html button to save a stack in editor mode

pull/12341/head
Cesar Munoz 2024-10-20 16:11:54 +02:00
parent 8a4373a113
commit e1b4fdaab5
No known key found for this signature in database
GPG Key ID: 1211B71005DDB995
2 changed files with 21 additions and 2 deletions

View File

@ -219,7 +219,7 @@ angular
var env = FormHelper.removeInvalidEnvVars($scope.formValues.Env);
const endpointId = +$state.params.endpointId;
if (method === 'editor' || method === 'template') {
if (method === 'editor') {
var stackFileContent = $scope.formValues.StackFileContent;
return StackService.saveComposeStackFromFileContent(name, stackFileContent, env, endpointId);
}
@ -231,7 +231,7 @@ angular
var env = FormHelper.removeInvalidEnvVars($scope.formValues.Env);
const endpointId = +$state.params.endpointId;
if (method === 'template' || method === 'editor') {
if (method === 'editor') {
var stackFileContent = $scope.formValues.StackFileContent;
return StackService.saveSwarmStackFromFileContent(name, stackFileContent, env, endpointId);
}

View File

@ -179,6 +179,25 @@
<span ng-hide="state.actionInProgress">Deploy the stack</span>
<span ng-show="state.actionInProgress">Deployment in progress...</span>
</button>
<button
type="button"
class="btn btn-primary btn-sm !ml-0"
ng-show="state.Method === 'editor'"
ng-disabled="state.actionInProgress
|| !createStackForm.$valid
|| ((state.Method === 'editor') && (!formValues.StackFileContent || state.editorYamlValidationError))
|| !formValues.Name"
ng-click="saveStack()"
button-spinner="state.actionInProgress"
analytics-on
analytics-category="docker"
analytics-event="docker-stack-save"
analytics-properties="buildAnalyticsProperties()"
>
<span ng-hide="state.actionInProgress">Save the stack</span>
<span ng-show="state.actionInProgress">Saving in progress...</span>
</button>
<span class="text-danger" ng-if="state.formValidationError" style="margin-left: 5px">{{ state.formValidationError }}</span>
</div>
</div>