feat: context shortcut to disconnect from left bar

This commit is contained in:
Fabio Di Stasio 2022-06-29 13:17:33 +02:00
parent 6573fe69ac
commit e97da37103
1 changed files with 18 additions and 1 deletions

View File

@ -3,6 +3,13 @@
:context-event="contextEvent"
@close-context="$emit('close-context')"
>
<div
v-if="isConnected"
class="context-element"
@click="disconnect"
>
<span class="d-flex"><i class="mdi mdi-18px mdi-power text-light pr-1" /> {{ $t('word.disconnect') }}</span>
</div>
<div class="context-element" @click="duplicateConnection">
<span class="d-flex"><i class="mdi mdi-18px mdi-content-duplicate text-light pr-1" /> {{ $t('word.duplicate') }}</span>
</div>
@ -47,7 +54,11 @@ const {
const workspacesStore = useWorkspacesStore();
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
const { selectWorkspace } = workspacesStore;
const {
selectWorkspace,
removeConnected: disconnectWorkspace,
getWorkspace
} = workspacesStore;
const props = defineProps({
contextEvent: MouseEvent,
@ -59,6 +70,7 @@ const emit = defineEmits(['close-context']);
const isConfirmModal = ref(false);
const connectionName = computed(() => getConnectionName(props.contextConnection.uid));
const isConnected = computed(() => getWorkspace(props.contextConnection.uid).connectionStatus === 'connected');
const confirmDeleteConnection = () => {
if (selectedWorkspace.value === props.contextConnection.uid)
@ -88,6 +100,11 @@ const hideConfirmModal = () => {
closeContext();
};
const disconnect = () => {
disconnectWorkspace(props.contextConnection.uid);
closeContext();
};
const closeContext = () => {
emit('close-context');
};