2018-07-10 04:11:04 -04:00
|
|
|
<script>
|
2020-11-05 10:09:04 -05:00
|
|
|
import { GlSprintf, GlTooltipDirective, GlModal } from '@gitlab/ui';
|
|
|
|
import { __, s__ } from '~/locale';
|
2021-02-01 10:08:56 -05:00
|
|
|
import eventHub from '../event_hub';
|
2022-01-05 13:13:30 -05:00
|
|
|
import stopEnvironmentMutation from '../graphql/mutations/stop_environment.mutation.graphql';
|
2018-07-10 04:11:04 -04:00
|
|
|
|
|
|
|
export default {
|
|
|
|
id: 'stop-environment-modal',
|
|
|
|
name: 'StopEnvironmentModal',
|
|
|
|
|
|
|
|
components: {
|
2020-11-05 10:09:04 -05:00
|
|
|
GlModal,
|
2020-09-22 05:09:43 -04:00
|
|
|
GlSprintf,
|
2018-07-10 04:11:04 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
directives: {
|
2018-11-08 10:02:49 -05:00
|
|
|
GlTooltip: GlTooltipDirective,
|
2018-07-10 04:11:04 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
environment: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2022-01-05 13:13:30 -05:00
|
|
|
graphql: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
2018-07-10 04:11:04 -04:00
|
|
|
},
|
|
|
|
|
2020-11-05 10:09:04 -05:00
|
|
|
computed: {
|
|
|
|
primaryProps() {
|
|
|
|
return {
|
|
|
|
text: s__('Environments|Stop environment'),
|
|
|
|
attributes: [{ variant: 'danger' }],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
cancelProps() {
|
|
|
|
return {
|
|
|
|
text: __('Cancel'),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2018-07-10 04:11:04 -04:00
|
|
|
methods: {
|
|
|
|
onSubmit() {
|
2022-01-05 13:13:30 -05:00
|
|
|
if (this.graphql) {
|
|
|
|
this.$apollo.mutate({
|
|
|
|
mutation: stopEnvironmentMutation,
|
|
|
|
variables: { environment: this.environment },
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
eventHub.$emit('stopEnvironment', this.environment);
|
|
|
|
}
|
2018-07-10 04:11:04 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<gl-modal
|
2020-11-05 10:09:04 -05:00
|
|
|
:modal-id="$options.id"
|
|
|
|
:action-primary="primaryProps"
|
|
|
|
:action-cancel="cancelProps"
|
|
|
|
@primary="onSubmit"
|
2018-07-10 04:11:04 -04:00
|
|
|
>
|
2020-11-05 10:09:04 -05:00
|
|
|
<template #modal-title>
|
|
|
|
<gl-sprintf :message="s__('Environments|Stopping %{environmentName}')">
|
|
|
|
<template #environmentName>
|
|
|
|
<span
|
|
|
|
v-gl-tooltip
|
|
|
|
:title="environment.name"
|
2021-06-15 08:10:11 -04:00
|
|
|
class="gl-text-truncate gl-ml-2 gl-mr-2 gl-flex-grow-1"
|
2020-11-05 10:09:04 -05:00
|
|
|
>
|
|
|
|
{{ environment.name }}?
|
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
</gl-sprintf>
|
2018-07-10 04:11:04 -04:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<p>{{ s__('Environments|Are you sure you want to stop this environment?') }}</p>
|
|
|
|
|
2018-11-16 15:07:38 -05:00
|
|
|
<div v-if="!environment.has_stop_action" class="warning_message">
|
2020-09-22 05:09:43 -04:00
|
|
|
<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-07-10 04:11:04 -04:00
|
|
|
<a
|
2020-10-05 05:08:17 -04:00
|
|
|
href="https://docs.gitlab.com/ee/ci/environments/#stopping-an-environment"
|
2018-07-10 04:11:04 -04:00
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
2018-11-16 15:07:38 -05:00
|
|
|
>{{ s__('Environments|Learn more about stopping environments') }}</a
|
|
|
|
>
|
2018-07-10 04:11:04 -04:00
|
|
|
</div>
|
|
|
|
</gl-modal>
|
|
|
|
</template>
|