2017-08-17 22:00:37 +05:30
|
|
|
<script>
|
2018-03-17 18:26:18 +05:30
|
|
|
/**
|
|
|
|
* Renders Rollback or Re deploy button in environments table depending
|
|
|
|
* of the provided property `isLastDeployment`.
|
|
|
|
*
|
|
|
|
* Makes a post request when the button is clicked.
|
|
|
|
*/
|
|
|
|
import eventHub from '../event_hub';
|
|
|
|
import loadingIcon from '../../vue_shared/components/loading_icon.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
loadingIcon,
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2018-03-17 18:26:18 +05:30
|
|
|
props: {
|
|
|
|
retryUrl: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
isLastDeployment: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isLoading: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClick() {
|
|
|
|
this.isLoading = true;
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
eventHub.$emit('postAction', this.retryUrl);
|
|
|
|
},
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
2018-03-17 18:26:18 +05:30
|
|
|
};
|
2017-08-17 22:00:37 +05:30
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<button
|
|
|
|
type="button"
|
2017-09-10 17:25:29 +05:30
|
|
|
class="btn hidden-xs hidden-sm"
|
2017-08-17 22:00:37 +05:30
|
|
|
@click="onClick"
|
2018-03-17 18:26:18 +05:30
|
|
|
:disabled="isLoading"
|
|
|
|
>
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
<span v-if="isLastDeployment">
|
2018-03-17 18:26:18 +05:30
|
|
|
{{ s__("Environments|Re-deploy") }}
|
2017-08-17 22:00:37 +05:30
|
|
|
</span>
|
|
|
|
<span v-else>
|
2018-03-17 18:26:18 +05:30
|
|
|
{{ s__("Environments|Rollback") }}
|
2017-08-17 22:00:37 +05:30
|
|
|
</span>
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
<loading-icon v-if="isLoading" />
|
2017-08-17 22:00:37 +05:30
|
|
|
</button>
|
|
|
|
</template>
|