mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-01 18:06:53 +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 { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||
const { getConnectionsOrder: connectionsOrder } = storeToRefs(connectionsStore);
|
||||
const { connectionsOrder } = storeToRefs(connectionsStore);
|
||||
const { disableScratchpad } = storeToRefs(settingsStore);
|
||||
|
||||
const { showSettingModal, showScratchpad } = applicationStore;
|
||||
const { updateConnectionsOrder } = connectionsStore;
|
||||
const { updateConnectionsOrder, initConnectionsOrder } = connectionsStore;
|
||||
const { selectWorkspace } = workspacesStore;
|
||||
|
||||
const emit = defineEmits(['show-connections-modal']);
|
||||
@ -150,6 +150,9 @@ watch(selectedWorkspace, (newVal, oldVal) => {
|
||||
}, 150);
|
||||
}
|
||||
});
|
||||
|
||||
if (!connectionsArr.value.length)
|
||||
initConnectionsOrder();
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -56,23 +56,6 @@ export const useConnectionsStore = defineStore('connections', {
|
||||
|
||||
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
|
||||
.find(connection => connection.uid === uid),
|
||||
getFolders: state => state.connectionsOrder.filter(conn => conn.isFolder),
|
||||
@ -88,12 +71,14 @@ export const useConnectionsStore = defineStore('connections', {
|
||||
isFolder: false,
|
||||
uid: connection.uid,
|
||||
client: connection.client,
|
||||
icon: null
|
||||
icon: null,
|
||||
name: null
|
||||
});
|
||||
persistentStore.set('connectionsOrder', this.connectionsOrder);
|
||||
},
|
||||
addFolder (params: {after: string; connections: [string, string]}) {
|
||||
const index = this.connectionsOrder.findIndex((conn: SidebarElement) => conn.uid === params.after);
|
||||
|
||||
this.connectionsOrder.splice(index, 0, {
|
||||
isFolder: true,
|
||||
uid: uidGen('F'),
|
||||
@ -137,6 +122,18 @@ export const useConnectionsStore = defineStore('connections', {
|
||||
this.connections = 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[]) {
|
||||
const invalidElements = connections.reduce<{index: number; uid: string}[]>((acc, curr, i) => {
|
||||
if (typeof curr === 'string')
|
||||
|
Loading…
x
Reference in New Issue
Block a user