feat(ui): refresh latest ddl on demand
This commit is contained in:
17 files changed
+186
-11
No files matched your search
@@ -246,6 +246,13 @@ const tableConstraintsLoaded = ref(false);
|
||||
const tableConstraintsForTab = computed(() => constraintsForConstraintsTab(tableConstraints.value, tableMetadataCapabilities.value.foreignKeys));
|
||||
const tableInfoSearchQuery = ref("");
|
||||
const tableInfoDdlPreRef = ref<HTMLPreElement | null>(null);
|
||||
const activeTableInfoLoading = computed(() => {
|
||||
if (tableInfoTab.value === "ddl") return tableDdlLoading.value;
|
||||
if (tableInfoTab.value === "columns") return tableColumnsLoading.value;
|
||||
if (tableInfoTab.value === "indexes") return tableIndexesLoading.value;
|
||||
if (tableInfoTab.value === "foreignKeys") return tableForeignKeysLoading.value;
|
||||
return tableInfoTab.value === "triggers" && tableTriggersLoading.value;
|
||||
});
|
||||
const SIDE_PANEL_MIN_WIDTH = 280;
|
||||
const SIDE_PANEL_MAX_WIDTH = 900;
|
||||
const sidePanelWidth = ref(settingsStore.editorSettings.tableInfoDrawerWidth || 420);
|
||||
@@ -1098,7 +1105,7 @@ function tableMetadataRequest(row: ObjectBrowserRow): ObjectDdlRequest {
|
||||
};
|
||||
}
|
||||
|
||||
async function fetchTableDdl(force = false) {
|
||||
async function fetchTableDdl(force = settingsStore.editorSettings.refreshDdlOnOpen) {
|
||||
const row = sidePanelRow.value;
|
||||
if (!row || (tableDdlLoaded.value && !force)) return;
|
||||
const epoch = sidePanelGuard.capture();
|
||||
@@ -3536,14 +3543,17 @@ function getObjectBrowserMenuItems(item: ObjectBrowserRow): ContextMenuItem[] {
|
||||
<span class="block truncate">{{ tab.label }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="px-2 py-1.5 border-b shrink-0 bg-background">
|
||||
<div class="relative">
|
||||
<div class="flex items-center gap-1 px-2 py-1.5 border-b shrink-0 bg-background">
|
||||
<div class="relative min-w-0 flex-1">
|
||||
<Search class="absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground" />
|
||||
<input v-model="tableInfoSearchQuery" :placeholder="t('grid.tableInfoSearch')" class="w-full h-7 pl-7 pr-6 text-xs bg-muted/50 rounded border border-border focus:outline-none focus:border-primary/50" @keydown.escape="tableInfoSearchQuery = ''" />
|
||||
<button v-if="tableInfoSearchQuery" class="absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground" @click="tableInfoSearchQuery = ''">
|
||||
<X class="w-3 h-3" />
|
||||
</button>
|
||||
</div>
|
||||
<Button variant="ghost" size="icon" class="h-7 w-7 shrink-0" :disabled="activeTableInfoLoading" :title="t('structureEditor.refresh')" :aria-label="t('structureEditor.refresh')" @click="refreshActiveTableInfo">
|
||||
<RefreshCw class="h-3.5 w-3.5" :class="{ 'animate-spin': activeTableInfoLoading }" />
|
||||
</Button>
|
||||
</div>
|
||||
<div v-if="tableInfoTab === 'columns'" class="flex-1 min-h-0 overflow-auto">
|
||||
<div v-if="tableColumnsLoading" class="h-full flex items-center justify-center">
|
||||
|
||||
Reference in new issue
Block a user