debian-mirror-gitlab/app/assets/javascripts/deploy_keys/components/action_btn.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
999 B
Vue
Raw Normal View History

2017-08-17 22:00:37 +05:30
<script>
2021-06-08 01:23:25 +05:30
import { GlButton } from '@gitlab/ui';
2018-10-15 14:42:47 +05:30
import eventHub from '../eventhub';
2017-08-17 22:00:37 +05:30
2018-10-15 14:42:47 +05:30
export default {
2018-12-13 13:39:08 +05:30
components: {
2021-06-08 01:23:25 +05:30
GlButton,
2018-12-13 13:39:08 +05:30
},
2018-10-15 14:42:47 +05:30
props: {
deployKey: {
type: Object,
required: true,
2017-08-17 22:00:37 +05:30
},
2018-10-15 14:42:47 +05:30
type: {
type: String,
required: true,
2017-08-17 22:00:37 +05:30
},
2021-06-08 01:23:25 +05:30
category: {
2018-10-15 14:42:47 +05:30
type: String,
required: false,
2021-06-08 01:23:25 +05:30
default: 'tertiary',
},
variant: {
type: String,
required: false,
default: 'default',
},
icon: {
type: String,
required: false,
default: '',
2018-03-17 18:26:18 +05:30
},
2018-10-15 14:42:47 +05:30
},
data() {
return {
isLoading: false,
};
},
methods: {
doAction() {
this.isLoading = true;
2017-08-17 22:00:37 +05:30
2018-10-15 14:42:47 +05:30
eventHub.$emit(`${this.type}.key`, this.deployKey, () => {
this.isLoading = false;
});
2017-08-17 22:00:37 +05:30
},
2018-10-15 14:42:47 +05:30
},
};
2017-08-17 22:00:37 +05:30
</script>
<template>
2021-06-08 01:23:25 +05:30
<gl-button
:category="category"
:variant="variant"
:icon="icon"
:loading="isLoading"
2018-11-08 19:23:39 +05:30
class="btn"
2019-02-15 15:39:39 +05:30
@click="doAction"
>
2018-10-15 14:42:47 +05:30
<slot></slot>
2021-06-08 01:23:25 +05:30
</gl-button>
2017-08-17 22:00:37 +05:30
</template>