api-client/components/environments/environment.vue

58 lines
1.4 KiB
Vue
Raw Normal View History

2020-02-23 16:38:15 +00:00
<template>
<div class="flex-wrap">
<div>
2020-02-24 18:44:50 +00:00
<button class="icon" @click="$emit('select-environment')" v-tooltip="$t('use_environment')">
2020-02-23 16:38:15 +00:00
<i class="material-icons">insert_drive_file</i>
<span>{{ environment.name }}</span>
</button>
</div>
<v-popover>
<button class="tooltip-target icon" v-tooltip="$t('more')">
<i class="material-icons">more_vert</i>
</button>
<template slot="popover">
<div>
2020-02-24 18:44:50 +00:00
<button class="icon" @click="$emit('edit-environment')" v-close-popover>
2020-02-23 16:38:15 +00:00
<i class="material-icons">create</i>
<span>{{ $t("edit") }}</span>
2020-02-23 16:38:15 +00:00
</button>
</div>
<div>
<button class="icon" @click="removeEnvironment" v-close-popover>
<i class="material-icons">delete</i>
<span>{{ $t("delete") }}</span>
2020-02-23 16:38:15 +00:00
</button>
</div>
</template>
</v-popover>
</div>
</template>
<style scoped lang="scss">
ul {
display: flex;
flex-direction: column;
}
ul li {
display: flex;
padding-left: 16px;
border-left: 1px solid var(--brd-color);
}
</style>
<script>
export default {
props: {
environment: Object,
2020-02-24 18:44:50 +00:00
environmentIndex: Number,
2020-02-23 16:38:15 +00:00
},
methods: {
removeEnvironment() {
if (!confirm("Are you sure you want to remove this environment?")) return
this.$store.commit("postwoman/removeEnvironment", this.environmentIndex)
2020-02-24 18:44:50 +00:00
},
},
}
2020-02-23 16:38:15 +00:00
</script>