diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-22 15:10:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-22 15:10:09 +0300 |
commit | 5393d9eb26fb71826e048798806c05906c169e61 (patch) | |
tree | da351541f962a10c7faf7b546946424ddc549c43 /app/assets/javascripts/pipeline_editor | |
parent | 081e00122e3f8d55f04a0a34485256d82a9b8933 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/pipeline_editor')
3 files changed, 13 insertions, 7 deletions
diff --git a/app/assets/javascripts/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql b/app/assets/javascripts/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql index 11bca42fd69..0c58749a8b2 100644 --- a/app/assets/javascripts/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql +++ b/app/assets/javascripts/pipeline_editor/graphql/mutations/commit_ci_file.mutation.graphql @@ -19,7 +19,7 @@ mutation commitCIFileMutation( } ) { commit { - id + sha } errors } diff --git a/app/assets/javascripts/pipeline_editor/index.js b/app/assets/javascripts/pipeline_editor/index.js index 8268a907a29..6479df3dbe3 100644 --- a/app/assets/javascripts/pipeline_editor/index.js +++ b/app/assets/javascripts/pipeline_editor/index.js @@ -14,7 +14,7 @@ export const initPipelineEditor = (selector = '#js-pipeline-editor') => { return null; } - const { ciConfigPath, commitId, defaultBranch, newMergeRequestPath, projectPath } = el?.dataset; + const { ciConfigPath, commitSha, defaultBranch, newMergeRequestPath, projectPath } = el?.dataset; Vue.use(VueApollo); @@ -29,7 +29,7 @@ export const initPipelineEditor = (selector = '#js-pipeline-editor') => { return h(PipelineEditorApp, { props: { ciConfigPath, - commitId, + commitSha, defaultBranch, newMergeRequestPath, projectPath, diff --git a/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue b/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue index d088f33c788..b8d1ed56d21 100644 --- a/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue +++ b/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue @@ -43,7 +43,7 @@ export default { required: false, default: null, }, - commitId: { + commitSha: { type: String, required: false, default: null, @@ -62,6 +62,7 @@ export default { ciConfigData: {}, content: '', contentModel: '', + lastCommitSha: this.commitSha, currentTabIndex: 0, editorIsReady: false, failureType: null, @@ -209,7 +210,7 @@ export default { try { const { data: { - commitCreate: { errors }, + commitCreate: { errors, commit }, }, } = await this.$apollo.mutate({ mutation: commitCiFileMutation, @@ -220,7 +221,7 @@ export default { message, filePath: this.ciConfigPath, content: this.contentModel, - lastCommitId: this.commitId, + lastCommitId: this.lastCommitSha, }, }); @@ -232,7 +233,12 @@ export default { if (openMergeRequest) { this.redirectToNewMergeRequest(branch); } else { - // Refresh the page to ensure commit is updated + this.lastCommitSha = commit.sha; + + // Note: The page should not be refreshed, and we + // would display an alert to notify users the + // commit was succesful. See: + // https://gitlab.com/gitlab-org/gitlab/-/issues/292229 refreshCurrentPage(); } } catch (error) { |