antares/src/renderer/components/SettingBarContext.vue

76 lines
1.9 KiB
Vue
Raw Normal View History

2020-05-23 13:32:14 +02:00
<template>
<BaseContextMenu
:context-event="contextEvent"
@closeContext="$emit('closeContext')"
>
2020-05-23 22:02:09 +02:00
<div class="context-element" @click="showEditModal(contextConnection)">
2020-05-25 15:37:59 +02:00
<i class="material-icons md-18 text-light pr-1">edit</i> {{ $t('word.edit') }}
2020-05-23 13:32:14 +02:00
</div>
<div class="context-element" @click="showConfirmModal">
2020-05-25 15:37:59 +02:00
<i class="material-icons md-18 text-light pr-1">delete</i> {{ $t('word.delete') }}
2020-05-23 13:32:14 +02:00
</div>
<ConfirmModal
v-if="isConfirmModal"
@confirm="deleteConnection(contextConnection)"
@hide="hideConfirmModal"
>
<template :slot="'header'">
2020-05-25 15:37:59 +02:00
{{ $t('message.deleteConnection') }}
2020-05-23 13:32:14 +02:00
</template>
<div :slot="'body'">
<div class="mb-2">
2020-05-31 17:56:33 +02:00
{{ $t('message.deleteConnectionCorfirm') }} <b>{{ connectionName }}</b>?
2020-05-23 13:32:14 +02:00
</div>
</div>
</ConfirmModal>
</BaseContextMenu>
</template>
<script>
2020-05-31 17:56:33 +02:00
import { mapActions, mapGetters } from 'vuex';
2020-05-23 13:32:14 +02:00
import BaseContextMenu from '@/components/BaseContextMenu';
import ConfirmModal from '@/components/BaseConfirmModal';
export default {
name: 'SettingBarContext',
components: {
BaseContextMenu,
2020-05-23 22:02:09 +02:00
ConfirmModal
2020-05-23 13:32:14 +02:00
},
props: {
contextEvent: MouseEvent,
contextConnection: Object
},
data () {
return {
2020-05-23 22:02:09 +02:00
isConfirmModal: false
2020-05-23 13:32:14 +02:00
};
},
2020-05-31 17:56:33 +02:00
computed: {
...mapGetters({
getConnectionName: 'connections/getConnectionName'
}),
connectionName () {
return this.getConnectionName(this.contextConnection.uid);
}
},
2020-05-23 13:32:14 +02:00
methods: {
...mapActions({
2020-05-23 22:02:09 +02:00
deleteConnection: 'connections/deleteConnection',
2020-05-30 12:54:05 +02:00
showEditModal: 'application/showEditConnModal'
2020-05-23 13:32:14 +02:00
}),
showConfirmModal () {
this.isConfirmModal = true;
},
hideConfirmModal () {
this.isConfirmModal = false;
}
}
};
</script>
<style>
</style>