mirror of https://github.com/portainer/portainer
resolve conflicts
commit
048bd35dfb
|
@ -1,4 +1,5 @@
|
||||||
import uuidv4 from 'uuid/v4';
|
import uuidv4 from 'uuid/v4';
|
||||||
|
|
||||||
class StackRedeployGitFormController {
|
class StackRedeployGitFormController {
|
||||||
/* @ngInject */
|
/* @ngInject */
|
||||||
constructor($async, $state, StackService, ModalService, Notifications, WebhookHelper, FormHelper) {
|
constructor($async, $state, StackService, ModalService, Notifications, WebhookHelper, FormHelper) {
|
||||||
|
@ -15,6 +16,7 @@ class StackRedeployGitFormController {
|
||||||
redeployInProgress: false,
|
redeployInProgress: false,
|
||||||
showConfig: false,
|
showConfig: false,
|
||||||
isEdit: false,
|
isEdit: false,
|
||||||
|
hasUnsavedChanges: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.formValues = {
|
this.formValues = {
|
||||||
|
@ -34,11 +36,8 @@ class StackRedeployGitFormController {
|
||||||
|
|
||||||
this.onChange = this.onChange.bind(this);
|
this.onChange = this.onChange.bind(this);
|
||||||
this.onChangeRef = this.onChangeRef.bind(this);
|
this.onChangeRef = this.onChangeRef.bind(this);
|
||||||
this.handleEnvVarChange = this.handleEnvVarChange.bind(this);
|
this.onChangeAutoUpdate = this.onChangeAutoUpdate.bind(this);
|
||||||
}
|
this.onChangeEnvVar = this.onChangeEnvVar.bind(this);
|
||||||
|
|
||||||
onChangeRef(value) {
|
|
||||||
this.onChange({ RefName: value });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange(values) {
|
onChange(values) {
|
||||||
|
@ -46,6 +45,25 @@ class StackRedeployGitFormController {
|
||||||
...this.formValues,
|
...this.formValues,
|
||||||
...values,
|
...values,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.state.hasUnsavedChanges = angular.toJson(this.savedFormValues) !== angular.toJson(this.formValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeRef(value) {
|
||||||
|
this.onChange({ RefName: value });
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeAutoUpdate(values) {
|
||||||
|
this.onChange({
|
||||||
|
AutoUpdate: {
|
||||||
|
...this.formValues.AutoUpdate,
|
||||||
|
...values,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangeEnvVar(value) {
|
||||||
|
this.onChange({ Env: value });
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
|
@ -83,6 +101,8 @@ class StackRedeployGitFormController {
|
||||||
try {
|
try {
|
||||||
this.state.inProgress = true;
|
this.state.inProgress = true;
|
||||||
await this.StackService.updateGitStackSettings(this.stack.Id, this.stack.EndpointId, this.FormHelper.removeInvalidEnvVars(this.formValues.Env), this.formValues);
|
await this.StackService.updateGitStackSettings(this.stack.Id, this.stack.EndpointId, this.FormHelper.removeInvalidEnvVars(this.formValues.Env), this.formValues);
|
||||||
|
this.savedFormValues = angular.copy(this.formValues);
|
||||||
|
this.state.hasUnsavedChanges = false;
|
||||||
this.Notifications.success('Save stack settings successfully');
|
this.Notifications.success('Save stack settings successfully');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.Notifications.error('Failure', err, 'Unable to save stack settings');
|
this.Notifications.error('Failure', err, 'Unable to save stack settings');
|
||||||
|
@ -96,10 +116,6 @@ class StackRedeployGitFormController {
|
||||||
return this.state.inProgress || this.state.redeployInProgress;
|
return this.state.inProgress || this.state.redeployInProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleEnvVarChange(value) {
|
|
||||||
this.formValues.Env = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
this.formValues.RefName = this.model.ReferenceName;
|
this.formValues.RefName = this.model.ReferenceName;
|
||||||
this.formValues.Env = this.stack.Env;
|
this.formValues.Env = this.stack.Env;
|
||||||
|
@ -125,6 +141,8 @@ class StackRedeployGitFormController {
|
||||||
this.formValues.RepositoryAuthentication = true;
|
this.formValues.RepositoryAuthentication = true;
|
||||||
this.state.isEdit = true;
|
this.state.isEdit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.savedFormValues = angular.copy(this.formValues);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
additional-files="$ctrl.stack.AdditionalFiles"
|
additional-files="$ctrl.stack.AdditionalFiles"
|
||||||
></git-form-info-panel>
|
></git-form-info-panel>
|
||||||
|
|
||||||
<git-form-auto-update-fieldset model="$ctrl.formValues.AutoUpdate" on-change="($ctrl.onChange)"></git-form-auto-update-fieldset>
|
<git-form-auto-update-fieldset model="$ctrl.formValues.AutoUpdate" on-change="($ctrl.onChangeAutoUpdate)"></git-form-auto-update-fieldset>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<p>
|
<p>
|
||||||
|
@ -31,14 +31,14 @@
|
||||||
<environment-variables-panel
|
<environment-variables-panel
|
||||||
ng-model="$ctrl.formValues.Env"
|
ng-model="$ctrl.formValues.Env"
|
||||||
explanation="These values will be used as substitutions in the stack file"
|
explanation="These values will be used as substitutions in the stack file"
|
||||||
on-change="($ctrl.handleEnvVarChange)"
|
on-change="($ctrl.onChangeEnvVar)"
|
||||||
></environment-variables-panel>
|
></environment-variables-panel>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-primary"
|
class="btn btn-sm btn-primary"
|
||||||
ng-click="$ctrl.submit()"
|
ng-click="$ctrl.submit()"
|
||||||
ng-if="!$ctrl.formValues.AutoUpdate.RepositoryAutomaticUpdates"
|
ng-if="!$ctrl.formValues.AutoUpdate.RepositoryAutomaticUpdates"
|
||||||
ng-disabled="$ctrl.isSubmitButtonDisabled() || !$ctrl.redeployGitForm.$valid"
|
ng-disabled="$ctrl.isSubmitButtonDisabled() || $ctrl.state.hasUnsavedChanges || !$ctrl.redeployGitForm.$valid"
|
||||||
style="margin-top: 7px; margin-left: 0;"
|
style="margin-top: 7px; margin-left: 0;"
|
||||||
button-spinner="$ctrl.state.redeployInProgress"
|
button-spinner="$ctrl.state.redeployInProgress"
|
||||||
style="margin-top: 7px; margin-left: 0;"
|
style="margin-top: 7px; margin-left: 0;"
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-primary"
|
class="btn btn-sm btn-primary"
|
||||||
ng-click="$ctrl.saveGitSettings()"
|
ng-click="$ctrl.saveGitSettings()"
|
||||||
ng-disabled="$ctrl.isSubmitButtonDisabled() || !$ctrl.redeployGitForm.$valid"
|
ng-disabled="$ctrl.isSubmitButtonDisabled() || !$ctrl.state.hasUnsavedChanges || !$ctrl.redeployGitForm.$valid"
|
||||||
style="margin-top: 7px; margin-left: 0;"
|
style="margin-top: 7px; margin-left: 0;"
|
||||||
button-spinner="$ctrl.state.inProgress"
|
button-spinner="$ctrl.state.inProgress"
|
||||||
>
|
>
|
||||||
|
|
|
@ -175,7 +175,7 @@ function shell_build_binary_azuredevops(p, a) {
|
||||||
function shell_run_container() {
|
function shell_run_container() {
|
||||||
return [
|
return [
|
||||||
'docker rm -f portainer',
|
'docker rm -f portainer',
|
||||||
'docker run -d -p 8000:8000 -p 9000:9000 -v ' +
|
'docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 -v ' +
|
||||||
portainer_root +
|
portainer_root +
|
||||||
'/dist:/app -v ' +
|
'/dist:/app -v ' +
|
||||||
portainer_data +
|
portainer_data +
|
||||||
|
|
Loading…
Reference in New Issue