mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-08 07:48:40 +01:00
fix: missing sidebar data after update
This commit is contained in:
parent
e7da5a7040
commit
0a1f50a9b9
@ -103,11 +103,11 @@ const settingsStore = useSettingsStore();
|
|||||||
|
|
||||||
const { updateStatus } = storeToRefs(applicationStore);
|
const { updateStatus } = storeToRefs(applicationStore);
|
||||||
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||||
const { getConnectionsOrder: connectionsOrder } = storeToRefs(connectionsStore);
|
const { connectionsOrder } = storeToRefs(connectionsStore);
|
||||||
const { disableScratchpad } = storeToRefs(settingsStore);
|
const { disableScratchpad } = storeToRefs(settingsStore);
|
||||||
|
|
||||||
const { showSettingModal, showScratchpad } = applicationStore;
|
const { showSettingModal, showScratchpad } = applicationStore;
|
||||||
const { updateConnectionsOrder } = connectionsStore;
|
const { updateConnectionsOrder, initConnectionsOrder } = connectionsStore;
|
||||||
const { selectWorkspace } = workspacesStore;
|
const { selectWorkspace } = workspacesStore;
|
||||||
|
|
||||||
const emit = defineEmits(['show-connections-modal']);
|
const emit = defineEmits(['show-connections-modal']);
|
||||||
@ -150,6 +150,9 @@ watch(selectedWorkspace, (newVal, oldVal) => {
|
|||||||
}, 150);
|
}, 150);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!connectionsArr.value.length)
|
||||||
|
initConnectionsOrder();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
@ -56,23 +56,6 @@ export const useConnectionsStore = defineStore('connections', {
|
|||||||
|
|
||||||
return connectionName;
|
return connectionName;
|
||||||
},
|
},
|
||||||
getConnectionsOrder: state => {
|
|
||||||
if (state.connectionsOrder.length)
|
|
||||||
return state.connectionsOrder;
|
|
||||||
else {
|
|
||||||
const connectionsOrder = state.connections.map<SidebarElement>(conn => {
|
|
||||||
return {
|
|
||||||
isFolder: false,
|
|
||||||
uid: conn.uid,
|
|
||||||
client: conn.client,
|
|
||||||
icon: null,
|
|
||||||
name: null
|
|
||||||
};
|
|
||||||
});
|
|
||||||
persistentStore.set('connectionsOrder', connectionsOrder);
|
|
||||||
return connectionsOrder;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getConnectionOrderByUid: state => (uid:string) => state.connectionsOrder
|
getConnectionOrderByUid: state => (uid:string) => state.connectionsOrder
|
||||||
.find(connection => connection.uid === uid),
|
.find(connection => connection.uid === uid),
|
||||||
getFolders: state => state.connectionsOrder.filter(conn => conn.isFolder),
|
getFolders: state => state.connectionsOrder.filter(conn => conn.isFolder),
|
||||||
@ -88,12 +71,14 @@ export const useConnectionsStore = defineStore('connections', {
|
|||||||
isFolder: false,
|
isFolder: false,
|
||||||
uid: connection.uid,
|
uid: connection.uid,
|
||||||
client: connection.client,
|
client: connection.client,
|
||||||
icon: null
|
icon: null,
|
||||||
|
name: null
|
||||||
});
|
});
|
||||||
persistentStore.set('connectionsOrder', this.connectionsOrder);
|
persistentStore.set('connectionsOrder', this.connectionsOrder);
|
||||||
},
|
},
|
||||||
addFolder (params: {after: string; connections: [string, string]}) {
|
addFolder (params: {after: string; connections: [string, string]}) {
|
||||||
const index = this.connectionsOrder.findIndex((conn: SidebarElement) => conn.uid === params.after);
|
const index = this.connectionsOrder.findIndex((conn: SidebarElement) => conn.uid === params.after);
|
||||||
|
|
||||||
this.connectionsOrder.splice(index, 0, {
|
this.connectionsOrder.splice(index, 0, {
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
uid: uidGen('F'),
|
uid: uidGen('F'),
|
||||||
@ -137,6 +122,18 @@ export const useConnectionsStore = defineStore('connections', {
|
|||||||
this.connections = connections;
|
this.connections = connections;
|
||||||
persistentStore.set('connections', this.connections);
|
persistentStore.set('connections', this.connections);
|
||||||
},
|
},
|
||||||
|
initConnectionsOrder () {
|
||||||
|
this.connectionsOrder = (this.connections as ConnectionParams[]).map<SidebarElement>(conn => {
|
||||||
|
return {
|
||||||
|
isFolder: false,
|
||||||
|
uid: conn.uid,
|
||||||
|
client: conn.client,
|
||||||
|
icon: null,
|
||||||
|
name: null
|
||||||
|
};
|
||||||
|
});
|
||||||
|
persistentStore.set('connectionsOrder', this.connectionsOrder);
|
||||||
|
},
|
||||||
updateConnectionsOrder (connections: SidebarElement[]) {
|
updateConnectionsOrder (connections: SidebarElement[]) {
|
||||||
const invalidElements = connections.reduce<{index: number; uid: string}[]>((acc, curr, i) => {
|
const invalidElements = connections.reduce<{index: number; uid: string}[]>((acc, curr, i) => {
|
||||||
if (typeof curr === 'string')
|
if (typeof curr === 'string')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user