show changes detected

This commit is contained in:
Julian Krauser 2025-04-15 10:45:15 +02:00
parent fc1185d1c8
commit 9a7785917c

View file

@ -30,6 +30,9 @@
v-if="allowPredefinedSelect && can('read', 'configuration', 'query_store')" v-if="allowPredefinedSelect && can('read', 'configuration', 'query_store')"
class="flex flex-row gap-2 max-lg:w-full max-lg:order-10" class="flex flex-row gap-2 max-lg:w-full max-lg:order-10"
> >
<div v-if="!isAsStored" class="p-1 border border-gray-400 bg-gray-100 rounded-md" title="Änderung erkannt">
<DocumentCurrencyRupeeIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
</div>
<select v-model="activeQueryId" class="max-h-[34px] py-0!"> <select v-model="activeQueryId" class="max-h-[34px] py-0!">
<option :value="undefined" disabled>gepeicherte Anfrage auswählen</option> <option :value="undefined" disabled>gepeicherte Anfrage auswählen</option>
<option v-for="query in queries" :key="query.id" :value="query.id"> <option v-for="query in queries" :key="query.id" :value="query.id">
@ -88,6 +91,7 @@ import {
RectangleGroupIcon, RectangleGroupIcon,
TrashIcon, TrashIcon,
SparklesIcon, SparklesIcon,
DocumentCurrencyRupeeIcon,
} from "@heroicons/vue/24/outline"; } from "@heroicons/vue/24/outline";
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder"; import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
import { useModalStore } from "@/stores/modal"; import { useModalStore } from "@/stores/modal";
@ -95,6 +99,7 @@ import Table from "./Table.vue";
import { useAbilityStore } from "@/stores/ability"; import { useAbilityStore } from "@/stores/ability";
import { useQueryStoreStore } from "@/stores/admin/configuration/queryStore"; import { useQueryStoreStore } from "@/stores/admin/configuration/queryStore";
import { v4 as uuid } from "uuid"; import { v4 as uuid } from "uuid";
import cloneDeep from "lodash.clonedeep";
</script> </script>
<script lang="ts"> <script lang="ts">
@ -128,7 +133,7 @@ export default defineComponent({
} else { } else {
this.queryMode = "builder"; this.queryMode = "builder";
} }
this.value = query; this.value = cloneDeep(query);
} }
}, },
value() { value() {
@ -156,6 +161,11 @@ export default defineComponent({
this.$emit("update:model-value", val); this.$emit("update:model-value", val);
}, },
}, },
isAsStored() {
let stored = this.queries.find((q) => q.id == this.activeQueryId);
if (!stored) return true;
return JSON.stringify(this.value) == JSON.stringify(stored.query);
},
}, },
mounted() { mounted() {
this.fetchTableMetas(); this.fetchTableMetas();