2017-08-17 22:00:37 +05:30
|
|
|
<script>
|
|
|
|
import eventHub from '../eventhub';
|
2017-09-10 17:25:29 +05:30
|
|
|
import loadingIcon from '../../vue_shared/components/loading_icon.vue';
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isLoading: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
deployKey: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
btnCssClass: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: 'btn-default',
|
|
|
|
},
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
components: {
|
|
|
|
loadingIcon,
|
|
|
|
},
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
methods: {
|
|
|
|
doAction() {
|
|
|
|
this.isLoading = true;
|
|
|
|
|
|
|
|
eventHub.$emit(`${this.type}.key`, this.deployKey);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
text() {
|
|
|
|
return `${this.type.charAt(0).toUpperCase()}${this.type.slice(1)}`;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<button
|
|
|
|
class="btn btn-sm prepend-left-10"
|
|
|
|
:class="[{ disabled: isLoading }, btnCssClass]"
|
|
|
|
:disabled="isLoading"
|
|
|
|
@click="doAction">
|
|
|
|
{{ text }}
|
2017-09-10 17:25:29 +05:30
|
|
|
<loading-icon v-if="isLoading" />
|
2017-08-17 22:00:37 +05:30
|
|
|
</button>
|
|
|
|
</template>
|