Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-11-24 06:12:33 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-11-24 06:12:33 +0300
commit492f99eac8d349e03e22d9c3eed8923b80bcc297 (patch)
tree0d18b29a4086f9f5b4958687b3ee33ef2df8b5c3 /app/assets/javascripts/pipeline_editor
parent1c27dcaf69cd0181755172d94c87c823e4d5f069 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/pipeline_editor')
-rw-r--r--app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue6
-rw-r--r--app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue4
-rw-r--r--app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue36
3 files changed, 36 insertions, 10 deletions
diff --git a/app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue b/app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue
index 905a5f2d271..9f82d4a5395 100644
--- a/app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue
+++ b/app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue
@@ -73,7 +73,7 @@ export default {
});
},
onReset() {
- this.$emit('cancel');
+ this.$emit('resetContent');
},
scrollIntoView() {
this.$el.scrollIntoView({ behavior: 'smooth' });
@@ -86,7 +86,7 @@ export default {
startMergeRequest: __('Start a %{new_merge_request} with these changes'),
newMergeRequest: __('new merge request'),
commitChanges: __('Commit changes'),
- cancel: __('Cancel'),
+ resetContent: __('Reset'),
},
};
</script>
@@ -148,7 +148,7 @@ export default {
{{ $options.i18n.commitChanges }}
</gl-button>
<gl-button type="reset" category="secondary" class="gl-mr-3">
- {{ $options.i18n.cancel }}
+ {{ $options.i18n.resetContent }}
</gl-button>
</div>
</gl-form>
diff --git a/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue b/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue
index 14c11099756..e11cfc1c65e 100644
--- a/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue
+++ b/app/assets/javascripts/pipeline_editor/components/commit/commit_section.vue
@@ -127,9 +127,6 @@ export default {
this.isSaving = false;
}
},
- onCommitCancel() {
- this.$emit('resetContent');
- },
updateCurrentBranch(currentBranch) {
this.$apollo.mutate({
mutation: updateCurrentBranchMutation,
@@ -153,7 +150,6 @@ export default {
:is-saving="isSaving"
:scroll-to-commit-form="scrollToCommitForm"
v-on="$listeners"
- @cancel="onCommitCancel"
@submit="onCommitSubmit"
/>
</template>
diff --git a/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue b/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
index 55e941ed3f9..db21bc936bf 100644
--- a/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
+++ b/app/assets/javascripts/pipeline_editor/pipeline_editor_app.vue
@@ -1,8 +1,8 @@
<script>
-import { GlLoadingIcon } from '@gitlab/ui';
+import { GlLoadingIcon, GlModal } from '@gitlab/ui';
import { fetchPolicies } from '~/lib/graphql';
import { queryToObject } from '~/lib/utils/url_utility';
-import { s__ } from '~/locale';
+import { __, s__ } from '~/locale';
import { unwrapStagesWithNeeds } from '~/pipelines/components/unwrapping_utils';
@@ -30,6 +30,7 @@ export default {
components: {
ConfirmUnsavedChangesDialog,
GlLoadingIcon,
+ GlModal,
PipelineEditorEmptyState,
PipelineEditorHome,
PipelineEditorMessages,
@@ -54,6 +55,7 @@ export default {
lastCommittedContent: '',
shouldSkipStartScreen: false,
showFailure: false,
+ showResetComfirmationModal: false,
showStartScreen: false,
showSuccess: false,
starterTemplate: '',
@@ -224,6 +226,18 @@ export default {
tabGraph: s__('Pipelines|Visualize'),
tabLint: s__('Pipelines|Lint'),
},
+ resetModal: {
+ actionPrimary: {
+ text: __('Reset file'),
+ },
+ actionCancel: {
+ text: __('Cancel'),
+ },
+ body: s__(
+ 'Pipeline Editor|Are you sure you want to reset the file to its last committed version?',
+ ),
+ title: __('Discard changes'),
+ },
watch: {
isEmpty(flag) {
if (flag) {
@@ -242,6 +256,11 @@ export default {
hideSuccess() {
this.showSuccess = false;
},
+ confirmReset() {
+ if (this.hasUnsavedChanges) {
+ this.showResetComfirmationModal = true;
+ }
+ },
async refetchContent() {
this.$apollo.queries.initialCiFileContent.skip = false;
await this.$apollo.queries.initialCiFileContent.refetch();
@@ -262,6 +281,7 @@ export default {
this.successType = type;
},
resetContent() {
+ this.showResetComfirmationModal = false;
this.currentCiFileContent = this.lastCommittedContent;
},
setAppStatus(appStatus) {
@@ -335,12 +355,22 @@ export default {
:has-unsaved-changes="hasUnsavedChanges"
:is-new-ci-config-file="isNewCiConfigFile"
@commit="updateOnCommit"
- @resetContent="resetContent"
+ @resetContent="confirmReset"
@showError="showErrorAlert"
@refetchContent="refetchContent"
@updateCiConfig="updateCiConfig"
@updateCommitSha="updateCommitSha"
/>
+ <gl-modal
+ v-model="showResetComfirmationModal"
+ modal-id="reset-content"
+ :title="$options.resetModal.title"
+ :action-cancel="$options.resetModal.actionCancel"
+ :action-primary="$options.resetModal.actionPrimary"
+ @primary="resetContent"
+ >
+ {{ $options.resetModal.body }}
+ </gl-modal>
<confirm-unsaved-changes-dialog :has-unsaved-changes="hasUnsavedChanges" />
</div>
</div>