Commit 5d27b8a8 authored by Sunjung Park's avatar Sunjung Park Committed by Miguel Rincon

Replace the deprecatedmodal 2 in the pipeline stop modal

parent 14c0ac9a
<script> <script>
/* eslint-disable vue/no-v-html */ /* eslint-disable vue/no-v-html */
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { GlLink } from '@gitlab/ui'; import { GlLink, GlModal } from '@gitlab/ui';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import CiIcon from '~/vue_shared/components/ci_icon.vue'; import CiIcon from '~/vue_shared/components/ci_icon.vue';
import { s__, sprintf } from '~/locale'; import { __, s__, sprintf } from '~/locale';
/** /**
* Pipeline Stop Modal. * Pipeline Stop Modal.
...@@ -13,7 +12,7 @@ import { s__, sprintf } from '~/locale'; ...@@ -13,7 +12,7 @@ import { s__, sprintf } from '~/locale';
*/ */
export default { export default {
components: { components: {
GlModal: DeprecatedModal2, GlModal,
GlLink, GlLink,
CiIcon, CiIcon,
}, },
...@@ -46,6 +45,17 @@ export default { ...@@ -46,6 +45,17 @@ export default {
hasRef() { hasRef() {
return !isEmpty(this.pipeline.ref); return !isEmpty(this.pipeline.ref);
}, },
primaryProps() {
return {
text: s__('Pipeline|Stop pipeline'),
attributes: [{ variant: 'danger' }],
};
},
cancelProps() {
return {
text: __('Cancel'),
};
},
}, },
methods: { methods: {
emitSubmit(event) { emitSubmit(event) {
...@@ -56,11 +66,11 @@ export default { ...@@ -56,11 +66,11 @@ export default {
</script> </script>
<template> <template>
<gl-modal <gl-modal
id="confirmation-modal" modal-id="confirmation-modal"
:header-title-text="modalTitle" :title="modalTitle"
:footer-primary-button-text="s__('Pipeline|Stop pipeline')" :action-primary="primaryProps"
footer-primary-button-variant="danger" :action-cancel="cancelProps"
@submit="emitSubmit($event)" @primary="emitSubmit($event)"
> >
<p v-html="modalText"></p> <p v-html="modalText"></p>
......
<script> <script>
import { GlButton, GlTooltipDirective } from '@gitlab/ui'; import { GlButton, GlTooltipDirective, GlModalDirective } from '@gitlab/ui';
import eventHub from '../../event_hub'; import eventHub from '../../event_hub';
import { __ } from '~/locale'; import { __ } from '~/locale';
import PipelinesActionsComponent from './pipelines_actions.vue'; import PipelinesActionsComponent from './pipelines_actions.vue';
...@@ -24,6 +24,7 @@ export default { ...@@ -24,6 +24,7 @@ export default {
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
GlModalDirective,
}, },
components: { components: {
PipelinesActionsComponent, PipelinesActionsComponent,
...@@ -366,12 +367,11 @@ export default { ...@@ -366,12 +367,11 @@ export default {
<gl-button <gl-button
v-if="pipeline.flags.cancelable" v-if="pipeline.flags.cancelable"
v-gl-tooltip.hover v-gl-tooltip.hover
v-gl-modal-directive="'confirmation-modal'"
:aria-label="$options.i18n.cancelTitle" :aria-label="$options.i18n.cancelTitle"
:title="$options.i18n.cancelTitle" :title="$options.i18n.cancelTitle"
:loading="isCancelling" :loading="isCancelling"
:disabled="isCancelling" :disabled="isCancelling"
data-toggle="modal"
data-target="#confirmation-modal"
icon="close" icon="close"
variant="danger" variant="danger"
category="primary" category="primary"
......
...@@ -118,7 +118,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -118,7 +118,7 @@ RSpec.describe 'Pipelines', :js do
context 'when canceling' do context 'when canceling' do
before do before do
find('.js-pipelines-cancel-button').click find('.js-pipelines-cancel-button').click
find('.js-modal-primary-action').click click_button 'Stop pipeline'
wait_for_requests wait_for_requests
end end
...@@ -407,7 +407,7 @@ RSpec.describe 'Pipelines', :js do ...@@ -407,7 +407,7 @@ RSpec.describe 'Pipelines', :js do
context 'when canceling' do context 'when canceling' do
before do before do
find('.js-pipelines-cancel-button').click find('.js-pipelines-cancel-button').click
find('.js-modal-primary-action').click click_button 'Stop pipeline'
end end
it 'indicates that pipeline was canceled', :sidekiq_might_not_need_inline do it 'indicates that pipeline was canceled', :sidekiq_might_not_need_inline do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment