debian-mirror-gitlab/app/assets/javascripts/environments/components/environment_pin.vue

37 lines
768 B
Vue
Raw Normal View History

2020-03-13 15:44:24 +05:30
<script>
/**
* Renders a prevent auto-stop button.
* Used in environments table.
*/
2020-11-24 15:15:51 +05:30
import { GlButton, GlTooltipDirective, GlIcon } from '@gitlab/ui';
2020-03-13 15:44:24 +05:30
import { __ } from '~/locale';
import eventHub from '../event_hub';
export default {
components: {
2020-11-24 15:15:51 +05:30
GlIcon,
GlButton,
2020-03-13 15:44:24 +05:30
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
autoStopUrl: {
type: String,
required: true,
},
},
methods: {
onPinClick() {
eventHub.$emit('cancelAutoStop', this.autoStopUrl);
},
},
title: __('Prevent environment from auto-stopping'),
};
</script>
<template>
2020-11-24 15:15:51 +05:30
<gl-button v-gl-tooltip :title="$options.title" :aria-label="$options.title" @click="onPinClick">
<gl-icon name="thumbtack" />
</gl-button>
2020-03-13 15:44:24 +05:30
</template>