mirror of
https://github.com/Fabio286/antares.git
synced 2025-05-05 20:28:44 +02:00
fix: empty workspace deleting connections in some conditions
This commit is contained in:
parent
785bc40ad0
commit
0de5ef8a98
@ -55,7 +55,6 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { uidGen } from 'common/libs/uidGen';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, Prop, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
@ -78,10 +77,8 @@ const {
|
||||
} = connectionsStore;
|
||||
|
||||
const workspacesStore = useWorkspacesStore();
|
||||
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||
|
||||
const {
|
||||
selectWorkspace,
|
||||
removeConnected: disconnectWorkspace,
|
||||
getWorkspace
|
||||
} = workspacesStore;
|
||||
@ -101,8 +98,8 @@ const connectionName = computed(() => props.contextConnection.name || getConnect
|
||||
const isConnected = computed(() => getWorkspace(props.contextConnection.uid)?.connectionStatus === 'connected');
|
||||
|
||||
const confirmDeleteConnection = () => {
|
||||
if (selectedWorkspace.value === props.contextConnection.uid)
|
||||
selectWorkspace(null);
|
||||
if (isConnected.value)
|
||||
disconnectWorkspace(props.contextConnection.uid);
|
||||
deleteConnection(props.contextConnection);
|
||||
closeContext();
|
||||
};
|
||||
|
@ -3,6 +3,8 @@ import { uidGen } from 'common/libs/uidGen';
|
||||
import * as crypto from 'crypto';
|
||||
import * as Store from 'electron-store';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import { useWorkspacesStore } from '@/stores/workspaces';
|
||||
const key = localStorage.getItem('key');
|
||||
|
||||
export interface SidebarElement {
|
||||
@ -105,10 +107,12 @@ export const useConnectionsStore = defineStore('connections', {
|
||||
return el;
|
||||
});
|
||||
this.connectionsOrder = (this.connectionsOrder as SidebarElement[]).filter(el => el.uid !== connection.uid);
|
||||
this.lastConnections = (this.lastConnections as SidebarElement[]).filter(el => el.uid !== connection.uid);
|
||||
|
||||
this.connections = (this.connections as SidebarElement[]).filter(el => el.uid !== connection.uid);
|
||||
persistentStore.set('connections', this.connections);
|
||||
this.clearEmptyFolders();
|
||||
useWorkspacesStore().removeWorkspace(connection.uid);
|
||||
},
|
||||
editConnection (connection: ConnectionParams) {
|
||||
const editedConnections = (this.connections as ConnectionParams[]).map(conn => {
|
||||
|
@ -424,6 +424,10 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
|
||||
this.workspaces.push(workspace);
|
||||
},
|
||||
removeWorkspace (uid: string) {
|
||||
this.workspaces = this.workspaces.filter((w: Workspace) => w.uid !== uid);
|
||||
if (uid === this.selectedWorkspace) this.selectedWorkspace = 'NEW';
|
||||
},
|
||||
changeBreadcrumbs (payload: Breadcrumb) {
|
||||
const breadcrumbsObj: Breadcrumb = {
|
||||
schema: null,
|
||||
|
Loading…
x
Reference in New Issue
Block a user