api-client/components/collections/request.vue

60 lines
1.6 KiB
Vue
Raw Normal View History

2019-10-01 22:20:23 +00:00
<template>
2019-10-22 09:13:54 +00:00
<div class="flex-wrap">
<div>
<button class="icon" @click="selectRequest()">
<i class="material-icons">star</i>
<span>{{request.name}}</span>
</button>
</div>
<div>
2019-10-22 12:02:26 +00:00
<button class="icon" @click="editRequest" v-tooltip="'Edit request'">
2019-10-22 09:13:54 +00:00
<i class="material-icons">edit</i>
</button>
2019-10-22 12:02:26 +00:00
<button class="icon" @click="removeRequest" v-tooltip="'Delete collection'">
2019-10-22 09:13:54 +00:00
<i class="material-icons">delete</i>
</button>
</div>
2019-10-01 22:20:23 +00:00
</div>
</template>
2019-10-17 15:23:26 +00:00
<style scoped>
2019-10-22 12:02:26 +00:00
ul {
display: flex;
flex-direction: column;
}
ul li {
display: flex;
padding-left: 16px;
border-left: 1px solid var(--brd-color);
2019-10-17 15:23:26 +00:00
}
</style>
2019-10-01 22:20:23 +00:00
<script>
export default {
props: {
request: Object,
2019-10-17 15:23:26 +00:00
collectionIndex: Number,
folderIndex: Number,
requestIndex: Number,
2019-10-01 22:20:23 +00:00
},
methods: {
selectRequest() {
this.$store.commit('postwoman/selectRequest', { request: this.request });
},
2019-10-17 16:56:19 +00:00
editRequest() {
this.request.requestIndex = this.requestIndex;
this.$store.commit('postwoman/editRequest', { request: this.request });
},
2019-10-17 15:23:26 +00:00
removeRequest() {
if (!confirm("Are you sure you want to remove this request?")) return;
this.$store.commit('postwoman/removeRequest', {
collectionIndex: this.collectionIndex,
folderIndex: this.folderIndex,
requestIndex: this.requestIndex,
});
},
},
};
2019-10-22 09:13:54 +00:00
</script>