1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat: move connections out of folder from context menu, related to #773

This commit is contained in:
2024-03-24 11:10:00 +01:00
parent 9aef287a98
commit 62e3115860
3 changed files with 34 additions and 4 deletions

View File

@@ -37,7 +37,7 @@
/> {{ t('application.newFolder') }}</span>
</div>
<div
v-for="folder in parsedFolders"
v-for="folder in filteredFolders"
:key="folder.uid"
class="context-element"
@click.stop="moveToFolder(folder.uid)"
@@ -50,6 +50,19 @@
:style="`color: ${folder.color}!important`"
/> {{ folder.name || t('general.folder') }}</span>
</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 class="context-element" @click.stop="showAppearanceModal">
@@ -137,7 +150,9 @@ const {
getConnectionName,
addConnection,
deleteConnection,
addFolder
addFolder,
addToFolder,
removeFromFolders
} = 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 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 = () => {
if (isConnected.value)
@@ -177,10 +193,21 @@ const moveToFolder = (folderUid?: string) => {
connections: [props.contextConnection.uid]
});
}
else {
addToFolder({
folder: folderUid,
connection: props.contextConnection.uid
});
}
closeContext();
};
const outOfFolder = () => {
removeFromFolders(props.contextConnection.uid);
closeContext();
};
const duplicateConnection = () => {
let connectionCopy = getConnectionByUid(props.contextConnection.uid);
connectionCopy = {