mirror of
				https://github.com/Fabio286/antares.git
				synced 2025-06-05 21:59:22 +02:00 
			
		
		
		
	feat: move connections to folders from context menu, related to #773
This commit is contained in:
		| @@ -15,6 +15,43 @@ | ||||
|                :size="18" | ||||
|             /> {{ t('connection.disconnect') }}</span> | ||||
|       </div> | ||||
|       <div v-if="!contextConnection.isFolder" class="context-element"> | ||||
|          <span class="d-flex"> | ||||
|             <BaseIcon | ||||
|                class="text-light mt-1 mr-1" | ||||
|                icon-name="mdiFolderMove" | ||||
|                :size="18" | ||||
|             /> {{ t('general.moveTo') }}</span> | ||||
|          <BaseIcon | ||||
|             class="text-light ml-1" | ||||
|             icon-name="mdiChevronRight" | ||||
|             :size="18" | ||||
|          /> | ||||
|          <div class="context-submenu"> | ||||
|             <div class="context-element" @click.stop="moveToFolder(null)"> | ||||
|                <span class="d-flex"> | ||||
|                   <BaseIcon | ||||
|                      class="text-light mt-1 mr-1" | ||||
|                      icon-name="mdiFolderPlus" | ||||
|                      :size="18" | ||||
|                   /> {{ t('application.newFolder') }}</span> | ||||
|             </div> | ||||
|             <div | ||||
|                v-for="folder in parsedFolders" | ||||
|                :key="folder.uid" | ||||
|                class="context-element" | ||||
|                @click.stop="moveToFolder(folder.uid)" | ||||
|             > | ||||
|                <span class="d-flex"> | ||||
|                   <BaseIcon | ||||
|                      class="text-light mt-1 mr-1" | ||||
|                      icon-name="mdiFolder" | ||||
|                      :size="18" | ||||
|                      :style="`color: ${folder.color}!important`" | ||||
|                   /> {{ folder.name || t('general.folder') }}</span> | ||||
|             </div> | ||||
|          </div> | ||||
|       </div> | ||||
|       <div class="context-element" @click.stop="showAppearanceModal"> | ||||
|          <span class="d-flex"> | ||||
|             <BaseIcon | ||||
| @@ -79,6 +116,7 @@ | ||||
|  | ||||
| <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'; | ||||
|  | ||||
| @@ -98,9 +136,12 @@ const { | ||||
|    getConnectionByUid, | ||||
|    getConnectionName, | ||||
|    addConnection, | ||||
|    deleteConnection | ||||
|    deleteConnection, | ||||
|    addFolder | ||||
| } = connectionsStore; | ||||
|  | ||||
| const { getFolders: folders } = storeToRefs(connectionsStore); | ||||
|  | ||||
| const workspacesStore = useWorkspacesStore(); | ||||
|  | ||||
| const { | ||||
| @@ -121,6 +162,7 @@ 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 confirmDeleteConnection = () => { | ||||
|    if (isConnected.value) | ||||
| @@ -129,6 +171,16 @@ const confirmDeleteConnection = () => { | ||||
|    closeContext(); | ||||
| }; | ||||
|  | ||||
| const moveToFolder = (folderUid?: string) => { | ||||
|    if (!folderUid) { | ||||
|       addFolder({ | ||||
|          connections: [props.contextConnection.uid] | ||||
|       }); | ||||
|    } | ||||
|  | ||||
|    closeContext(); | ||||
| }; | ||||
|  | ||||
| const duplicateConnection = () => { | ||||
|    let connectionCopy = getConnectionByUid(props.contextConnection.uid); | ||||
|    connectionCopy = { | ||||
|   | ||||
| @@ -101,7 +101,13 @@ const props = defineProps({ | ||||
|    selectedField: Object | ||||
| }); | ||||
|  | ||||
| const emit = defineEmits(['close-context', 'duplicate-selected', 'delete-selected', 'add-new-index', 'add-to-index']); | ||||
| const emit = defineEmits([ | ||||
|    'close-context', | ||||
|    'duplicate-selected', | ||||
|    'delete-selected', | ||||
|    'add-new-index', | ||||
|    'add-to-index' | ||||
| ]); | ||||
|  | ||||
| const hasPrimary = computed(() => props.indexes.some(index => index.type === 'PRIMARY')); | ||||
|  | ||||
|   | ||||
| @@ -150,7 +150,13 @@ const props = defineProps({ | ||||
|    mode: String | ||||
| }); | ||||
|  | ||||
| const emit = defineEmits(['add-new-index', 'add-to-index', 'rename-field', 'duplicate-field', 'remove-field']); | ||||
| const emit = defineEmits([ | ||||
|    'add-new-index', | ||||
|    'add-to-index', | ||||
|    'rename-field', | ||||
|    'duplicate-field', | ||||
|    'remove-field' | ||||
| ]); | ||||
|  | ||||
| const workspacesStore = useWorkspacesStore(); | ||||
| const consoleStore = useConsoleStore(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user