antares/src/renderer/components/SettingBarContext.vue

74 lines
2.0 KiB
Vue
Raw Normal View History

2020-05-23 13:32:14 +02:00
<template>
<BaseContextMenu
:context-event="contextEvent"
2020-08-12 18:11:48 +02:00
@close-context="$emit('close-context')"
2020-05-23 13:32:14 +02:00
>
2020-05-23 22:02:09 +02:00
<div class="context-element" @click="showEditModal(contextConnection)">
2020-10-01 15:08:35 +02:00
<span class="d-flex"><i class="mdi mdi-18px mdi-pencil text-light pr-1" /> {{ $t('word.edit') }}</span>
2020-05-23 13:32:14 +02:00
</div>
<div class="context-element" @click="showConfirmModal">
2020-10-01 15:08:35 +02:00
<span class="d-flex"><i class="mdi mdi-18px mdi-delete text-light pr-1" /> {{ $t('word.delete') }}</span>
2020-05-23 13:32:14 +02:00
</div>
<ConfirmModal
v-if="isConfirmModal"
@confirm="deleteConnection(contextConnection)"
@hide="hideConfirmModal"
>
<template :slot="'header'">
2020-08-12 18:11:48 +02:00
<div class="d-flex">
<i class="mdi mdi-24px mdi-server-remove mr-1" /> {{ $t('message.deleteConnection') }}
</div>
2020-05-23 13:32:14 +02:00
</template>
<div :slot="'body'">
<div class="mb-2">
2020-10-01 15:08:35 +02:00
{{ $t('message.deleteCorfirm') }} <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>