Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: fix scope tags (#11952)

boojack40baa12e9c9f
diff --git a/frontend/src/components/AdvancedSearch/ScopeTags.vue b/frontend/src/components/AdvancedSearch/ScopeTags.vue
index c48fc3e2a0..547eaf8c9d 100644
--- a/frontend/src/components/AdvancedSearch/ScopeTags.vue
+++ b/frontend/src/components/AdvancedSearch/ScopeTags.vue
@@ -10,18 +10,19 @@
style="--n-icon-size: 12px"
v-bind="tagProps(scope)"
@close="$emit('remove-scope', scope.id, scope.value)"
- @click.stop.prevent="$emit('select-scope', scope.id, scope.value)"
+ @click.stop.prevent="handleClick(scope)"
>
<span>{{ scope.id }}</span>
<span>:</span>
<component :is="() => renderValue(scope, i)" />
</NTag>
</template>
-<script setup lang="ts">
+
+<script setup lang="tsx">
import dayjs from "dayjs";
import type { TagProps } from "naive-ui";
import { NTag } from "naive-ui";
-import { computed, h } from "vue";
+import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { UNKNOWN_ID } from "@/types";
import type { SearchParams, SearchScope, SearchScopeId } from "@/utils";
@@ -33,7 +34,7 @@ const props = defineProps<{
readonlyScopes?: SearchScope[];
}>();
-defineEmits<{
+const emit = defineEmits<{
(event: "remove-scope", id: SearchScopeId, value: string): void;
(event: "select-scope", id: SearchScopeId, value: string): void;
}>();
@@ -66,8 +67,16 @@ const renderValue = (scope: SearchScope, index: number) => {
return [dayjs(begin).format("L"), dayjs(end).format("L")].join("-");
}
if (scope.value === `${UNKNOWN_ID}`) {
- return h("span", {}, t("common.all").toLocaleLowerCase());
+ return <span>{t("common.all").toLocaleLowerCase()}</span>;
}
- return h("span", {}, scope.value);
+ return <span>{scope.value}</span>;
+};
+
+const handleClick = (scope: SearchScope) => {
+ if (isReadonlyScope(scope)) {
+ return;
+ }
+
+ emit("select-scope", scope.id, scope.value);
};
</script>