2018-11-18 11:00:15 +05:30
|
|
|
<script>
|
2021-01-29 00:20:46 +05:30
|
|
|
import { GlSprintf, GlTooltipDirective, GlModal } from '@gitlab/ui';
|
|
|
|
import { __, s__ } from '~/locale';
|
2021-03-11 19:13:27 +05:30
|
|
|
import eventHub from '../event_hub';
|
2022-03-02 08:16:31 +05:30
|
|
|
import stopEnvironmentMutation from '../graphql/mutations/stop_environment.mutation.graphql';
|
2018-11-18 11:00:15 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
id: 'stop-environment-modal',
|
|
|
|
name: 'StopEnvironmentModal',
|
|
|
|
|
|
|
|
components: {
|
2021-01-29 00:20:46 +05:30
|
|
|
GlModal,
|
2021-01-03 14:25:43 +05:30
|
|
|
GlSprintf,
|
2018-11-18 11:00:15 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
directives: {
|
2019-02-15 15:39:39 +05:30
|
|
|
GlTooltip: GlTooltipDirective,
|
2018-11-18 11:00:15 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
environment: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2022-03-02 08:16:31 +05:30
|
|
|
graphql: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
2018-11-18 11:00:15 +05:30
|
|
|
},
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
computed: {
|
|
|
|
primaryProps() {
|
|
|
|
return {
|
|
|
|
text: s__('Environments|Stop environment'),
|
2023-05-27 22:25:52 +05:30
|
|
|
attributes: { variant: 'danger' },
|
2021-01-29 00:20:46 +05:30
|
|
|
};
|
|
|
|
},
|
|
|
|
cancelProps() {
|
|
|
|
return {
|
|
|
|
text: __('Cancel'),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
methods: {
|
|
|
|
onSubmit() {
|
2022-03-02 08:16:31 +05:30
|
|
|
if (this.graphql) {
|
|
|
|
this.$apollo.mutate({
|
|
|
|
mutation: stopEnvironmentMutation,
|
|
|
|
variables: { environment: this.environment },
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
eventHub.$emit('stopEnvironment', this.environment);
|
|
|
|
}
|
2018-11-18 11:00:15 +05:30
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<gl-modal
|
2021-01-29 00:20:46 +05:30
|
|
|
:modal-id="$options.id"
|
|
|
|
:action-primary="primaryProps"
|
|
|
|
:action-cancel="cancelProps"
|
|
|
|
@primary="onSubmit"
|
2018-11-18 11:00:15 +05:30
|
|
|
>
|
2021-01-29 00:20:46 +05:30
|
|
|
<template #modal-title>
|
|
|
|
<gl-sprintf :message="s__('Environments|Stopping %{environmentName}')">
|
|
|
|
<template #environmentName>
|
|
|
|
<span
|
|
|
|
v-gl-tooltip
|
|
|
|
:title="environment.name"
|
2021-09-04 01:27:46 +05:30
|
|
|
class="gl-text-truncate gl-ml-2 gl-mr-2 gl-flex-grow-1"
|
2021-01-29 00:20:46 +05:30
|
|
|
>
|
|
|
|
{{ environment.name }}?
|
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
</gl-sprintf>
|
2018-11-18 11:00:15 +05:30
|
|
|
</template>
|
|
|
|
|
|
|
|
<p>{{ s__('Environments|Are you sure you want to stop this environment?') }}</p>
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
<div v-if="!environment.has_stop_action" class="warning_message">
|
2021-01-03 14:25:43 +05:30
|
|
|
<p>
|
|
|
|
<gl-sprintf
|
|
|
|
:message="
|
|
|
|
s__(`Environments|Note that this action will stop the environment,
|
|
|
|
but it will %{emphasisStart}not%{emphasisEnd} have an effect on any existing deployment
|
|
|
|
due to no “stop environment action” being defined
|
|
|
|
in the %{ciConfigLinkStart}.gitlab-ci.yml%{ciConfigLinkEnd} file.`)
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<template #emphasis="{ content }">
|
|
|
|
<strong>{{ content }}</strong>
|
|
|
|
</template>
|
|
|
|
<template #ciConfigLink="{ content }">
|
|
|
|
<a href="https://docs.gitlab.com/ee/ci/yaml/" target="_blank" rel="noopener noreferrer">
|
|
|
|
{{ content }}</a
|
|
|
|
>
|
|
|
|
</template>
|
|
|
|
</gl-sprintf>
|
|
|
|
</p>
|
2018-11-18 11:00:15 +05:30
|
|
|
<a
|
2021-01-03 14:25:43 +05:30
|
|
|
href="https://docs.gitlab.com/ee/ci/environments/#stopping-an-environment"
|
2018-11-18 11:00:15 +05:30
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
2019-02-15 15:39:39 +05:30
|
|
|
>{{ s__('Environments|Learn more about stopping environments') }}</a
|
|
|
|
>
|
2018-11-18 11:00:15 +05:30
|
|
|
</div>
|
|
|
|
</gl-modal>
|
|
|
|
</template>
|