fix(objects): refresh event editor on selection and fix docs-export manifest
This commit is contained in:
1 parent
c1888a2364
commit
eaad88cc80
6 files changed
+25
-13
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import type { CalendarDateTime } from "@internationalized/date";
|
||||
import { Check, Clock, Eye, Loader2, X } from "@lucide/vue";
|
||||
@@ -19,6 +19,7 @@ const loading = ref(false),
|
||||
saving = ref(false),
|
||||
error = ref(""),
|
||||
preview = ref("");
|
||||
let loadRequestId = 0;
|
||||
const activeTab = ref<"definition" | "schedule" | "comment" | "preview">("definition");
|
||||
const draft = ref<any>({ name: props.name || "", schema: props.schema, schedule: { mode: "every", intervalValue: "1", intervalUnit: "DAY" }, preserve: true, enabled: true, body: "" });
|
||||
const existing = computed(() => !!props.name);
|
||||
@@ -63,6 +64,8 @@ function refreshPreview() {
|
||||
}
|
||||
}
|
||||
async function load() {
|
||||
const requestId = ++loadRequestId;
|
||||
error.value = "";
|
||||
if (!props.name) {
|
||||
refreshPreview();
|
||||
return;
|
||||
@@ -70,6 +73,7 @@ async function load() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const info: MysqlEventInfo = await api.getEventInfo(props.connection.id, props.database, props.schema, props.name);
|
||||
if (requestId !== loadRequestId) return;
|
||||
draft.value = {
|
||||
name: info.name,
|
||||
schema: info.schema,
|
||||
@@ -83,9 +87,10 @@ async function load() {
|
||||
};
|
||||
refreshPreview();
|
||||
} catch (e) {
|
||||
if (requestId !== loadRequestId) return;
|
||||
error.value = e instanceof Error ? e.message : String(e);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
if (requestId === loadRequestId) loading.value = false;
|
||||
}
|
||||
}
|
||||
async function save() {
|
||||
@@ -111,12 +116,13 @@ async function save() {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
watch(() => props.name, load);
|
||||
onMounted(load);
|
||||
</script>
|
||||
<template>
|
||||
<div class="flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4" data-mysql-event-editor>
|
||||
<div class="flex items-center justify-between border-b pb-2">
|
||||
<div class="flex items-center gap-2 text-sm font-semibold"><Clock class="h-4 w-4 text-orange-300" /> {{ t("contextMenu.eventEditorTitle") }}</div>
|
||||
<div class="flex items-center gap-2 text-sm font-semibold"><Clock class="h-4 w-4 text-orange-400" /> {{ t("contextMenu.eventEditorTitle") }}</div>
|
||||
<Button variant="ghost" size="icon" class="h-6 w-6" :aria-label="t('contextMenu.eventCancel')" @click="emit('close')"><X class="h-4 w-4" /></Button>
|
||||
</div>
|
||||
<div v-if="loading" class="flex items-center gap-2 text-sm text-muted-foreground"><Loader2 class="h-4 w-4 animate-spin" /> {{ t("contextMenu.eventLoading") }}</div>
|
||||
|
||||
@@ -982,6 +982,10 @@ function runRowClickAction(clickDetail: number, requestId: number) {
|
||||
return;
|
||||
}
|
||||
if (node.type === "event") {
|
||||
void openObjectBrowser(false, true);
|
||||
return;
|
||||
}
|
||||
if (node.type === "group-events") {
|
||||
void openObjectBrowser();
|
||||
return;
|
||||
}
|
||||
@@ -1343,7 +1347,7 @@ function requestDeleteSelectedNode(): boolean {
|
||||
function onDoubleClick(event: MouseEvent) {
|
||||
if (dataTabOpenModeFromTreeClick(activeNode.value.type, event, settingsStore.editorSettings.shortcuts.openDataInNewTab) === "new-tab") return;
|
||||
if (activeNode.value.type === "event") {
|
||||
void openObjectBrowser();
|
||||
void openObjectBrowser(false, true);
|
||||
return;
|
||||
}
|
||||
if (activeNode.value.type === "group-events") {
|
||||
|
||||
@@ -290,7 +290,7 @@ function getIconInfo(node: TreeNode): { icon: any; colorClass: string } | null {
|
||||
case "trigger":
|
||||
return { icon: Zap, colorClass: "text-orange-300" };
|
||||
case "event":
|
||||
return { icon: Clock, colorClass: "text-orange-300" };
|
||||
return { icon: Clock, colorClass: "text-orange-400" };
|
||||
case "redis-db":
|
||||
return { icon: Database, colorClass: "text-red-400" };
|
||||
case "mq-tenant":
|
||||
|
||||
@@ -71,7 +71,7 @@ export function getTreeNodeIconInfo(node: TreeNode): TreeNodeIconInfo | null {
|
||||
case "group-events":
|
||||
return { icon: Clock, colorClass: "text-orange-400" };
|
||||
case "event":
|
||||
return { icon: Clock, colorClass: "text-orange-300" };
|
||||
return { icon: Clock, colorClass: "text-orange-400" };
|
||||
case "group-constraints":
|
||||
case "constraint":
|
||||
return { icon: Key, colorClass: "text-amber-500" };
|
||||
|
||||
@@ -7,6 +7,7 @@ import tailwindcss from "@tailwindcss/vite";
|
||||
import { connectionTypesPlugin } from "./viteConnectionTypesPlugin.ts";
|
||||
|
||||
const repoRoot = path.resolve(__dirname, "../..");
|
||||
const normalizedRepoRoot = repoRoot.replaceAll(path.sep, "/");
|
||||
const assetsDir = path.join(repoRoot, "crates/dbx-core/assets");
|
||||
const fontPath = path.join(__dirname, "public/fonts/geist-latin-wght-normal.woff2");
|
||||
|
||||
@@ -86,25 +87,26 @@ function exportBundlePlugin() {
|
||||
// Vite tags CSS the same way. The file on disk is the part before the
|
||||
// query; without stripping it every SFC would be missing from the
|
||||
// manifest, which is the failure this whole derivation exists to avoid.
|
||||
const id = rawId.split("?")[0];
|
||||
const id = path.resolve(rawId.split("?")[0]);
|
||||
if (!path.isAbsolute(id)) return;
|
||||
const normalizedId = id.replaceAll(path.sep, "/");
|
||||
|
||||
// `lastIndexOf`: under pnpm a real path is
|
||||
// `<root>/node_modules/.pnpm/marked@18.0.4/node_modules/marked/…`, and
|
||||
// the FIRST occurrence yields the package name `.pnpm`.
|
||||
const nodeModules = id.lastIndexOf("/node_modules/");
|
||||
const nodeModules = normalizedId.lastIndexOf("/node_modules/");
|
||||
if (nodeModules !== -1) {
|
||||
const after = id.slice(nodeModules + "/node_modules/".length);
|
||||
const after = normalizedId.slice(nodeModules + "/node_modules/".length);
|
||||
const name = after.startsWith("@") ? after.split("/").slice(0, 2).join("/") : after.split("/")[0];
|
||||
if (name in deps) return;
|
||||
const manifest = path.join(id.slice(0, nodeModules), "node_modules", name, "package.json");
|
||||
const manifest = path.join(normalizedId.slice(0, nodeModules), "node_modules", name, "package.json");
|
||||
if (!isFile(manifest)) return;
|
||||
deps[name] = JSON.parse(readFileSync(manifest, "utf8")).version;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!id.startsWith(repoRoot) || !isFile(id)) return;
|
||||
sources[path.relative(repoRoot, id)] = sha256(readFileSync(id));
|
||||
if (!normalizedId.startsWith(normalizedRepoRoot) || !isFile(id)) return;
|
||||
sources[path.relative(repoRoot, id).replaceAll(path.sep, "/")] = sha256(readFileSync(id));
|
||||
};
|
||||
|
||||
const stylesheets = new Set<string>();
|
||||
|
||||
Reference in new issue
Block a user