Join Table Name & formatted results with export

This commit is contained in:
Julian Krauser 2024-12-19 10:32:58 +01:00
parent 9206a657c1
commit 604ae30901
7 changed files with 119 additions and 16 deletions

View file

@ -1,6 +1,6 @@
<template>
<div class="flex flex-col border border-gray-300 rounded-md select-none">
<div class="flex flex-row gap-2 border-b border-gray-300 p-2">
<div class="flex flex-row max-lg:flex-wrap gap-2 border-b border-gray-300 p-2">
<div
class="p-1 border border-gray-400 bg-green-200 rounded-md"
title="Abfrage starten"
@ -26,7 +26,10 @@
<TrashIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
</div>
<div class="grow"></div>
<div v-if="allowPredefinedSelect && can('read', 'settings', 'query_store')" class="flex flex-row gap-2">
<div
v-if="allowPredefinedSelect && can('read', 'settings', 'query_store')"
class="flex flex-row gap-2 max-lg:w-full max-lg:order-10"
>
<select v-model="activeQueryId" class="max-h-[34px] !py-0">
<option :value="undefined" disabled>gepeicherte Anfrage auswählen</option>
<option v-for="query in queries" :key="query.id" :value="query.id" @click="value = query.query">
@ -42,8 +45,8 @@
<InboxArrowDownIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
</div>
</div>
<div class="grow"></div>
<div class="flex flex-row overflow-hidden border border-gray-400 rounded-md">
<div class="grow max-lg:hidden"></div>
<div class="flex flex-row min-w-fit overflow-hidden border border-gray-400 rounded-md">
<div
class="p-1"
:class="queryMode == 'structure' ? 'bg-gray-200' : ''"

View file

@ -5,7 +5,7 @@
<select v-model="foreignColumn" class="w-full">
<option value="" disabled>Relation auswählen</option>
<option v-for="relation in activeTable?.relations" :value="relation.column">
{{ relation.column }} -> {{ relation.referencedTableName }}
{{ relation.column }} -> {{ joinTableName(relation.referencedTableName) }}
</option>
</select>
<Table v-model="value" disable-table-select />
@ -24,6 +24,7 @@ import type { DynamicQueryStructure } from "../../types/dynamicQueries";
import { useQueryBuilderStore } from "../../stores/admin/queryBuilder";
import Table from "./Table.vue";
import { TrashIcon } from "@heroicons/vue/24/outline";
import { joinTableName } from "@/helpers/queryFormatter";
</script>
<script lang="ts">
@ -79,7 +80,7 @@ export default defineComponent({
this.$emit("update:model-value", {
...this.modelValue,
foreignColumn: val,
table: relTable?.referencedTableName, // TODO: use dictionary
table: joinTableName(relTable?.referencedTableName ?? ""),
});
},
},