mirror of https://github.com/Fabio286/antares.git
feat: move connections out of folder from context menu, related to #773
This commit is contained in:
parent
9aef287a98
commit
62e3115860
|
@ -37,7 +37,7 @@
|
||||||
/> {{ t('application.newFolder') }}</span>
|
/> {{ t('application.newFolder') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="folder in parsedFolders"
|
v-for="folder in filteredFolders"
|
||||||
:key="folder.uid"
|
:key="folder.uid"
|
||||||
class="context-element"
|
class="context-element"
|
||||||
@click.stop="moveToFolder(folder.uid)"
|
@click.stop="moveToFolder(folder.uid)"
|
||||||
|
@ -50,6 +50,19 @@
|
||||||
:style="`color: ${folder.color}!important`"
|
:style="`color: ${folder.color}!important`"
|
||||||
/> {{ folder.name || t('general.folder') }}</span>
|
/> {{ folder.name || t('general.folder') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="isInFolder"
|
||||||
|
class="context-element"
|
||||||
|
@click="outOfFolder"
|
||||||
|
>
|
||||||
|
<span class="d-flex">
|
||||||
|
<BaseIcon
|
||||||
|
class="text-light mt-1 mr-1"
|
||||||
|
icon-name="mdiFolderOff"
|
||||||
|
:size="18"
|
||||||
|
/> {{ t('application.outOfFolder') }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="context-element" @click.stop="showAppearanceModal">
|
<div class="context-element" @click.stop="showAppearanceModal">
|
||||||
|
@ -137,7 +150,9 @@ const {
|
||||||
getConnectionName,
|
getConnectionName,
|
||||||
addConnection,
|
addConnection,
|
||||||
deleteConnection,
|
deleteConnection,
|
||||||
addFolder
|
addFolder,
|
||||||
|
addToFolder,
|
||||||
|
removeFromFolders
|
||||||
} = connectionsStore;
|
} = connectionsStore;
|
||||||
|
|
||||||
const { getFolders: folders } = storeToRefs(connectionsStore);
|
const { getFolders: folders } = storeToRefs(connectionsStore);
|
||||||
|
@ -162,7 +177,8 @@ const isConnectionEdit = ref(false);
|
||||||
|
|
||||||
const connectionName = computed(() => props.contextConnection.name || getConnectionName(props.contextConnection.uid) || t('general.folder', 1));
|
const connectionName = computed(() => props.contextConnection.name || getConnectionName(props.contextConnection.uid) || t('general.folder', 1));
|
||||||
const isConnected = computed(() => getWorkspace(props.contextConnection.uid)?.connectionStatus === 'connected');
|
const isConnected = computed(() => getWorkspace(props.contextConnection.uid)?.connectionStatus === 'connected');
|
||||||
const parsedFolders = computed(() => folders.value.filter(f => !f.connections.includes(props.contextConnection.uid)));
|
const filteredFolders = computed(() => folders.value.filter(f => !f.connections.includes(props.contextConnection.uid)));
|
||||||
|
const isInFolder = computed(() => folders.value.some(f => f.connections.includes(props.contextConnection.uid)));
|
||||||
|
|
||||||
const confirmDeleteConnection = () => {
|
const confirmDeleteConnection = () => {
|
||||||
if (isConnected.value)
|
if (isConnected.value)
|
||||||
|
@ -177,10 +193,21 @@ const moveToFolder = (folderUid?: string) => {
|
||||||
connections: [props.contextConnection.uid]
|
connections: [props.contextConnection.uid]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
addToFolder({
|
||||||
|
folder: folderUid,
|
||||||
|
connection: props.contextConnection.uid
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
closeContext();
|
closeContext();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const outOfFolder = () => {
|
||||||
|
removeFromFolders(props.contextConnection.uid);
|
||||||
|
closeContext();
|
||||||
|
};
|
||||||
|
|
||||||
const duplicateConnection = () => {
|
const duplicateConnection = () => {
|
||||||
let connectionCopy = getConnectionByUid(props.contextConnection.uid);
|
let connectionCopy = getConnectionByUid(props.contextConnection.uid);
|
||||||
connectionCopy = {
|
connectionCopy = {
|
||||||
|
|
|
@ -365,6 +365,7 @@ export const enUS = {
|
||||||
folderName: 'Folder name',
|
folderName: 'Folder name',
|
||||||
deleteFolder: 'Delete folder',
|
deleteFolder: 'Delete folder',
|
||||||
newFolder: 'New folder',
|
newFolder: 'New folder',
|
||||||
|
outOfFolder: 'Out of folder',
|
||||||
editConnectionAppearance: 'Edit connection appearance',
|
editConnectionAppearance: 'Edit connection appearance',
|
||||||
defaultCopyType: 'Default copy type',
|
defaultCopyType: 'Default copy type',
|
||||||
showTableSize: 'Show table size in sidebar',
|
showTableSize: 'Show table size in sidebar',
|
||||||
|
|
|
@ -95,7 +95,7 @@ export const useConnectionsStore = defineStore('connections', {
|
||||||
? this.connectionsOrder.findIndex((conn: SidebarElement) => conn.uid === params.after)
|
? this.connectionsOrder.findIndex((conn: SidebarElement) => conn.uid === params.after)
|
||||||
: this.connectionsOrder.length;
|
: this.connectionsOrder.length;
|
||||||
|
|
||||||
this.removeFromFolders(params.connections);
|
this.removeFromFolders(...params.connections);
|
||||||
|
|
||||||
this.connectionsOrder.splice(index, 0, {
|
this.connectionsOrder.splice(index, 0, {
|
||||||
isFolder: true,
|
isFolder: true,
|
||||||
|
@ -116,6 +116,8 @@ export const useConnectionsStore = defineStore('connections', {
|
||||||
this.clearEmptyFolders();
|
this.clearEmptyFolders();
|
||||||
},
|
},
|
||||||
addToFolder (params: {folder: string; connection: string}) {
|
addToFolder (params: {folder: string; connection: string}) {
|
||||||
|
this.removeFromFolders(params.connection);
|
||||||
|
|
||||||
this.connectionsOrder = this.connectionsOrder.map((conn: SidebarElement) => {
|
this.connectionsOrder = this.connectionsOrder.map((conn: SidebarElement) => {
|
||||||
if (conn.uid === params.folder)
|
if (conn.uid === params.folder)
|
||||||
conn.connections.push(params.connection);
|
conn.connections.push(params.connection);
|
||||||
|
|
Loading…
Reference in New Issue