diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-05 15:08:03 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-05 15:08:03 +0300 |
commit | 3c86701bc89302550abb9bbaa060132fdcd52480 (patch) | |
tree | b73328cbd2de6d43afd0eb5253ec215274011dc8 /app/assets/javascripts/runner | |
parent | 17ef30f3df6d3939e41e69efc7cfa3deaa08605d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/runner')
4 files changed, 21 insertions, 17 deletions
diff --git a/app/assets/javascripts/runner/admin_runner_edit/admin_runner_edit_app.vue b/app/assets/javascripts/runner/admin_runner_edit/admin_runner_edit_app.vue index 406081e4422..7c2a575bf93 100644 --- a/app/assets/javascripts/runner/admin_runner_edit/admin_runner_edit_app.vue +++ b/app/assets/javascripts/runner/admin_runner_edit/admin_runner_edit_app.vue @@ -19,7 +19,7 @@ export default { type: String, required: true, }, - runnerUrl: { + runnerPath: { type: String, required: false, default: null, @@ -66,7 +66,7 @@ export default { <runner-update-form :loading="loading" :runner="runner" - :runner-url="runnerUrl" + :runner-path="runnerPath" class="gl-my-5" /> </div> diff --git a/app/assets/javascripts/runner/admin_runner_edit/index.js b/app/assets/javascripts/runner/admin_runner_edit/index.js index 876422534c1..a2ac5731a62 100644 --- a/app/assets/javascripts/runner/admin_runner_edit/index.js +++ b/app/assets/javascripts/runner/admin_runner_edit/index.js @@ -12,7 +12,7 @@ export const initAdminRunnerEdit = (selector = '#js-admin-runner-edit') => { return null; } - const { runnerId, runnerUrl } = el.dataset; + const { runnerId, runnerPath } = el.dataset; const apolloProvider = new VueApollo({ defaultClient: createDefaultClient(), @@ -25,7 +25,7 @@ export const initAdminRunnerEdit = (selector = '#js-admin-runner-edit') => { return h(AdminRunnerEditApp, { props: { runnerId, - runnerUrl, + runnerPath, }, }); }, diff --git a/app/assets/javascripts/runner/admin_runner_show/index.js b/app/assets/javascripts/runner/admin_runner_show/index.js index f8a02ecb49a..ea455416648 100644 --- a/app/assets/javascripts/runner/admin_runner_show/index.js +++ b/app/assets/javascripts/runner/admin_runner_show/index.js @@ -1,11 +1,14 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createDefaultClient from '~/lib/graphql'; +import { showAlertFromLocalStorage } from '../local_storage_alert/show_alert_from_local_storage'; import AdminRunnerShowApp from './admin_runner_show_app.vue'; Vue.use(VueApollo); export const initAdminRunnerShow = (selector = '#js-admin-runner-show') => { + showAlertFromLocalStorage(); + const el = document.querySelector(selector); if (!el) { diff --git a/app/assets/javascripts/runner/components/runner_update_form.vue b/app/assets/javascripts/runner/components/runner_update_form.vue index 16381a0a853..a87976d0240 100644 --- a/app/assets/javascripts/runner/components/runner_update_form.vue +++ b/app/assets/javascripts/runner/components/runner_update_form.vue @@ -14,10 +14,12 @@ import { runnerToModel, } from 'ee_else_ce/runner/runner_update_form_utils'; import { createAlert, VARIANT_SUCCESS } from '~/flash'; +import { redirectTo } from '~/lib/utils/url_utility'; import { __ } from '~/locale'; import { captureException } from '~/runner/sentry_utils'; import { ACCESS_LEVEL_NOT_PROTECTED, ACCESS_LEVEL_REF_PROTECTED, PROJECT_TYPE } from '../constants'; import runnerUpdateMutation from '../graphql/details/runner_update.mutation.graphql'; +import { saveAlertToLocalStorage } from '../local_storage_alert/save_alert_to_local_storage'; export default { name: 'RunnerUpdateForm', @@ -46,7 +48,7 @@ export default { required: false, default: false, }, - runnerUrl: { + runnerPath: { type: String, required: false, default: null, @@ -85,24 +87,23 @@ export default { }); if (errors?.length) { - // Validation errors need not be thrown - createAlert({ message: errors[0] }); - return; + this.onError(errors[0]); + } else { + this.onSuccess(); } - - this.onSuccess(); } catch (error) { const { message } = error; - - createAlert({ message }); + this.onError(message); captureException({ error, component: this.$options.name }); - } finally { - this.saving = false; } }, onSuccess() { - createAlert({ message: __('Changes saved.'), variant: VARIANT_SUCCESS }); - this.model = runnerToModel(this.runner); + saveAlertToLocalStorage({ message: __('Changes saved.'), variant: VARIANT_SUCCESS }); + redirectTo(this.runnerPath); + }, + onError(message) { + this.saving = false; + createAlert({ message }); }, }, ACCESS_LEVEL_NOT_PROTECTED, @@ -210,7 +211,7 @@ export default { > {{ __('Save changes') }} </gl-button> - <gl-button :href="runnerUrl"> + <gl-button :href="runnerPath"> {{ __('Cancel') }} </gl-button> </div> |