Commit c4badc1d authored by Sunjung Park's avatar Sunjung Park Committed by Kushal Pandya

Update stop environment modal to gl-modal

parent b333db1a
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Used in environments table. * Used in environments table.
*/ */
import { GlTooltipDirective, GlButton } from '@gitlab/ui'; import { GlTooltipDirective, GlButton, GlModalDirective } from '@gitlab/ui';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
...@@ -14,6 +14,7 @@ export default { ...@@ -14,6 +14,7 @@ export default {
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
GlModalDirective,
}, },
props: { props: {
environment: { environment: {
...@@ -54,14 +55,13 @@ export default { ...@@ -54,14 +55,13 @@ export default {
<template> <template>
<gl-button <gl-button
v-gl-tooltip="{ id: $options.stopEnvironmentTooltipId }" v-gl-tooltip="{ id: $options.stopEnvironmentTooltipId }"
v-gl-modal-directive="'stop-environment-modal'"
:loading="isLoading" :loading="isLoading"
:title="title" :title="title"
:aria-label="title" :aria-label="title"
icon="stop" icon="stop"
category="primary" category="primary"
variant="danger" variant="danger"
data-toggle="modal"
data-target="#stop-environment-modal"
@click="onClick" @click="onClick"
/> />
</template> </template>
<script> <script>
/* eslint-disable @gitlab/vue-require-i18n-strings */ import { GlSprintf, GlTooltipDirective, GlModal } from '@gitlab/ui';
import { GlSprintf, GlTooltipDirective } from '@gitlab/ui';
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import { __, s__ } from '~/locale';
export default { export default {
id: 'stop-environment-modal', id: 'stop-environment-modal',
name: 'StopEnvironmentModal', name: 'StopEnvironmentModal',
components: { components: {
GlModal: DeprecatedModal2, GlModal,
GlSprintf, GlSprintf,
}, },
...@@ -24,6 +23,20 @@ export default { ...@@ -24,6 +23,20 @@ export default {
}, },
}, },
computed: {
primaryProps() {
return {
text: s__('Environments|Stop environment'),
attributes: [{ variant: 'danger' }],
};
},
cancelProps() {
return {
text: __('Cancel'),
};
},
},
methods: { methods: {
onSubmit() { onSubmit() {
eventHub.$emit('stopEnvironment', this.environment); eventHub.$emit('stopEnvironment', this.environment);
...@@ -34,18 +47,23 @@ export default { ...@@ -34,18 +47,23 @@ export default {
<template> <template>
<gl-modal <gl-modal
:id="$options.id" :modal-id="$options.id"
:footer-primary-button-text="s__('Environments|Stop environment')" :action-primary="primaryProps"
footer-primary-button-variant="danger" :action-cancel="cancelProps"
@submit="onSubmit" @primary="onSubmit"
> >
<template #header> <template #modal-title>
<h4 class="modal-title d-flex mw-100"> <gl-sprintf :message="s__('Environments|Stopping %{environmentName}')">
Stopping <template #environmentName>
<span v-gl-tooltip :title="environment.name" class="text-truncate ml-1 mr-1 flex-fill"> <span
{{ environment.name }}? v-gl-tooltip
</span> :title="environment.name"
</h4> class="gl-text-truncate gl-ml-2 gl-mr-2 gl-flex-fill"
>
{{ environment.name }}?
</span>
</template>
</gl-sprintf>
</template> </template>
<p>{{ s__('Environments|Are you sure you want to stop this environment?') }}</p> <p>{{ s__('Environments|Are you sure you want to stop this environment?') }}</p>
......
...@@ -10427,6 +10427,9 @@ msgstr "" ...@@ -10427,6 +10427,9 @@ msgstr ""
msgid "Environments|Stopping" msgid "Environments|Stopping"
msgstr "" msgstr ""
msgid "Environments|Stopping %{environmentName}"
msgstr ""
msgid "Environments|There was an error fetching the logs. Please try again." msgid "Environments|There was an error fetching the logs. Please try again."
msgstr "" msgstr ""
......
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