Skip to content

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

Adjust Database Detail and Database Backup layout spacing to be consistent with other tab layout

天舟08c33cfbefb9
diff --git a/frontend/src/components/DatabaseBackupPanel.vue b/frontend/src/components/DatabaseBackupPanel.vue
index 17b18e6f47..4a38dd77bc 100644
--- a/frontend/src/components/DatabaseBackupPanel.vue
+++ b/frontend/src/components/DatabaseBackupPanel.vue
@@ -1,102 +1,103 @@
<template>
- <div class="pt-6 space-y-4">
- <div class="flex justify-between border-b border-block-border pb-4">
- <div v-if="state.autoBackupEnabled" class="flex flex-col">
- <div class="flex items-center text-lg leading-6 font-medium text-main">
- Automatic weekly backup
- <span class="ml-1 text-success">enabled</span>
- </div>
- <div class="mt-2 text-control">
- Backup will be taken on every
- <span class="text-accent">{{ autoBackupWeekdayText }}</span> at
- <span class="text-accent"> {{ autoBackupHourText }}</span>
+ <div class="max-w-6xl mx-auto px-6 space-y-6 divide-y divide-block-border">
+ <div class="space-y-4">
+ <div class="flex justify-between">
+ <div v-if="state.autoBackupEnabled" class="flex flex-col">
+ <div
+ class="flex items-center text-lg leading-6 font-medium text-main"
+ >
+ Automatic weekly backup
+ <span class="ml-1 text-success">enabled</span>
+ </div>
+ <div class="mt-2 text-control">
+ Backup will be taken on every
+ <span class="text-accent">{{ autoBackupWeekdayText }}</span> at
+ <span class="text-accent"> {{ autoBackupHourText }}</span>
+ </div>
</div>
- </div>
- <div
- v-else
- class="flex items-center text-lg leading-6 font-medium text-control"
- >
- Weekly backup disabled
- <button
- v-if="!state.autoBackupEnabled"
- type="button"
- class="ml-4 btn-primary"
- @click.prevent="toggleAutoBackup(true)"
+ <div
+ v-else
+ class="flex items-center text-lg leading-6 font-medium text-control"
>
- Enable backup
- </button>
+ Weekly backup disabled
+ <button
+ v-if="!state.autoBackupEnabled"
+ type="button"
+ class="ml-4 btn-primary"
+ @click.prevent="toggleAutoBackup(true)"
+ >
+ Enable backup
+ </button>
+ </div>
</div>
- </div>
- <div
- v-if="state.autoBackupEnabled"
- class="space-y-4 border-b border-block-border pb-4"
- >
- <div>
- <label for="auto-backup-path-template" class="textlabel">
- Backup file path template
- </label>
- <div class="mt-1 textinfolabel">
- Backup file path template. TODO: pointing to doc
+ <div v-if="state.autoBackupEnabled" class="space-y-4">
+ <div>
+ <label for="auto-backup-path-template" class="textlabel">
+ Backup file path template
+ </label>
+ <div class="mt-1 textinfolabel">
+ Backup file path template. TODO: pointing to doc
+ </div>
+ <input
+ type="text"
+ id="auto-backup-path-template"
+ name="autoBackupPathTemplate"
+ placeholder="e.g. 0"
+ class="textfield mt-2 w-full"
+ v-model="state.autoBackupPathTemplate"
+ />
+ </div>
+ <div class="flex justify-between">
+ <BBButtonConfirm
+ :style="'DISABLE'"
+ :buttonText="'Disable weekly backup'"
+ :okText="'Disable'"
+ :confirmTitle="`Disable weekly backup for '${database.name}'?`"
+ :confirmDescription="'Existing automatic backups will be kept as is.'"
+ :requireConfirm="true"
+ @confirm="toggleAutoBackup(false)"
+ />
+ <button
+ type="button"
+ class="btn-primary"
+ :disabled="!allowUpdateAutoBackupSetting"
+ @click.prevent="updateAutoBackupSetting"
+ >
+ Update
+ </button>
</div>
- <input
- type="text"
- id="auto-backup-path-template"
- name="autoBackupPathTemplate"
- placeholder="e.g. 0"
- class="textfield mt-2 w-full"
- v-model="state.autoBackupPathTemplate"
- />
</div>
- <div class="flex justify-between">
- <BBButtonConfirm
- :style="'DISABLE'"
- :buttonText="'Disable weekly backup'"
- :okText="'Disable'"
- :confirmTitle="`Disable weekly backup for '${database.name}'?`"
- :confirmDescription="'Existing automatic backups will be kept as is.'"
- :requireConfirm="true"
- @confirm="toggleAutoBackup(false)"
- />
+ </div>
+ <div class="pt-6 space-y-4">
+ <div class="flex justify-between items-center">
+ <div class="text-lg leading-6 font-medium text-main">Backups</div>
<button
+ @click.prevent="state.showCreateBackupModal = true"
type="button"
- class="btn-primary"
- :disabled="!allowUpdateAutoBackupSetting"
- @click.prevent="updateAutoBackupSetting"
+ class="btn-normal whitespace-nowrap items-center"
>
- Update
+ Backup now
</button>
</div>
+ <BackupTable :database="database" :backupList="backupList" />
</div>
+ <BBModal
+ v-if="state.showCreateBackupModal"
+ :title="'Create a manual backup'"
+ @close="state.showCreateBackupModal = false"
+ >
+ <DatabaseBackupCreateForm
+ :database="database"
+ @create="
+ (backupName, backupPath, comment) => {
+ createBackup(backupName, backupPath, comment);
+ state.showCreateBackupModal = false;
+ }
+ "
+ @cancel="state.showCreateBackupModal = false"
+ />
+ </BBModal>
</div>
- <div class="pt-6 space-y-4">
- <div class="flex justify-between items-center">
- <div class="text-lg leading-6 font-medium text-main">Backups</div>
- <button
- @click.prevent="state.showCreateBackupModal = true"
- type="button"
- class="btn-normal whitespace-nowrap items-center"
- >
- Backup now
- </button>
- </div>
- <BackupTable :database="database" :backupList="backupList" />
- </div>
- <BBModal
- v-if="state.showCreateBackupModal"
- :title="'Create a manual backup'"
- @close="state.showCreateBackupModal = false"
- >
- <DatabaseBackupCreateForm
- :database="database"
- @create="
- (backupName, backupPath, comment) => {
- createBackup(backupName, backupPath, comment);
- state.showCreateBackupModal = false;
- }
- "
- @cancel="state.showCreateBackupModal = false"
- />
- </BBModal>
</template>
<script lang="ts">
diff --git a/frontend/src/components/DatabaseOverviewPanel.vue b/frontend/src/components/DatabaseOverviewPanel.vue
index 0b6dfe3569..797aef3445 100644
--- a/frontend/src/components/DatabaseOverviewPanel.vue
+++ b/frontend/src/components/DatabaseOverviewPanel.vue
@@ -1,187 +1,181 @@
<template>
- <div class="mt-6">
- <div class="max-w-6xl mx-auto px-6 space-y-6 divide-y divide-block-border">
- <!-- Description list -->
- <dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
- <div class="col-span-1 col-start-1">
- <dt class="text-sm font-medium text-control-light">Character set</dt>
- <dd class="mt-1 text-sm text-main">
- {{ database.characterSet }}
- </dd>
- </div>
-
- <div class="col-span-1">
- <dt class="text-sm font-medium text-control-light">Collation</dt>
- <dd class="mt-1 text-sm text-main">
- {{ database.collation }}
- </dd>
- </div>
-
- <div class="col-span-1 col-start-1">
- <dt class="text-sm font-medium text-control-light">Sync status</dt>
- <dd class="mt-1 text-sm text-main">
- <span>{{ database.syncStatus }}</span>
- </dd>
- </div>
-
- <div class="col-span-1">
- <dt class="text-sm font-medium text-control-light">
- Last successful sync
- </dt>
- <dd class="mt-1 text-sm text-main">
- {{ humanizeTs(database.lastSuccessfulSyncTs) }}
- </dd>
- </div>
+ <div class="max-w-6xl mx-auto px-6 space-y-6 divide-y divide-block-border">
+ <!-- Description list -->
+ <dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2">
+ <div class="col-span-1 col-start-1">
+ <dt class="text-sm font-medium text-control-light">Character set</dt>
+ <dd class="mt-1 text-sm text-main">
+ {{ database.characterSet }}
+ </dd>
+ </div>
- <div class="col-span-1 col-start-1">
- <dt class="text-sm font-medium text-control-light">Created</dt>
- <dd class="mt-1 text-sm text-main">
- {{ humanizeTs(database.createdTs) }}
- </dd>
- </div>
+ <div class="col-span-1">
+ <dt class="text-sm font-medium text-control-light">Collation</dt>
+ <dd class="mt-1 text-sm text-main">
+ {{ database.collation }}
+ </dd>
+ </div>
- <div class="col-span-1">
- <dt class="text-sm font-medium text-control-light">Updated</dt>
- <dd class="mt-1 text-sm text-main">
- {{ humanizeTs(database.updatedTs) }}
- </dd>
- </div>
- </dl>
+ <div class="col-span-1 col-start-1">
+ <dt class="text-sm font-medium text-control-light">Sync status</dt>
+ <dd class="mt-1 text-sm text-main">
+ <span>{{ database.syncStatus }}</span>
+ </dd>
+ </div>
- <div class="pt-6">
- <div class="text-lg leading-6 font-medium text-main mb-4">Tables</div>
- <TableTable
- :mode="'TABLE'"
- :tableList="tableList.filter((item) => item.type == 'BASE TABLE')"
- />
+ <div class="col-span-1">
+ <dt class="text-sm font-medium text-control-light">
+ Last successful sync
+ </dt>
+ <dd class="mt-1 text-sm text-main">
+ {{ humanizeTs(database.lastSuccessfulSyncTs) }}
+ </dd>
+ </div>
- <div class="mt-6 text-lg leading-6 font-medium text-main mb-4">
- Views
- </div>
- <TableTable
- :mode="'VIEW'"
- :tableList="tableList.filter((item) => item.type == 'VIEW')"
- />
- <div class="mt-6 text-lg leading-6 font-medium text-main mb-4">
- Migration History
- </div>
- <MigrationHistoryTable
- v-if="state.migrationSetupStatus == 'OK'"
- :historySectionList="migrationHistorySectionList"
- />
- <BBAttention
- v-else
- :title="attentionTitle"
- :actionText="'Config instance'"
- @click-action="configInstance"
- />
+ <div class="col-span-1 col-start-1">
+ <dt class="text-sm font-medium text-control-light">Created</dt>
+ <dd class="mt-1 text-sm text-main">
+ {{ humanizeTs(database.createdTs) }}
+ </dd>
</div>
- <!-- Hide data source list for now, as we don't allow adding new data source after creating the database. -->
- <div v-if="false" class="pt-6">
- <DataSourceTable :instance="database.instance" :database="database" />
+ <div class="col-span-1">
+ <dt class="text-sm font-medium text-control-light">Updated</dt>
+ <dd class="mt-1 text-sm text-main">
+ {{ humanizeTs(database.updatedTs) }}
+ </dd>
+ </div>
+ </dl>
+
+ <div class="pt-6">
+ <div class="text-lg leading-6 font-medium text-main mb-4">Tables</div>
+ <TableTable
+ :mode="'TABLE'"
+ :tableList="tableList.filter((item) => item.type == 'BASE TABLE')"
+ />
+
+ <div class="mt-6 text-lg leading-6 font-medium text-main mb-4">Views</div>
+ <TableTable
+ :mode="'VIEW'"
+ :tableList="tableList.filter((item) => item.type == 'VIEW')"
+ />
+ <div class="mt-6 text-lg leading-6 font-medium text-main mb-4">
+ Migration History
</div>
+ <MigrationHistoryTable
+ v-if="state.migrationSetupStatus == 'OK'"
+ :historySectionList="migrationHistorySectionList"
+ />
+ <BBAttention
+ v-else
+ :title="attentionTitle"
+ :actionText="'Config instance'"
+ @click-action="configInstance"
+ />
+ </div>
- <template v-if="allowViewDataSource">
- <template
- v-for="(item, index) of [
- { type: 'RW', list: readWriteDataSourceList },
- { type: 'RO', list: readonlyDataSourceList },
- ]"
- :key="index"
- >
- <div v-if="item.list.length" class="pt-6">
- <div
- v-if="hasDataSourceFeature"
- class="text-lg leading-6 font-medium text-main mb-4"
- >
- <span v-data-source-type>{{ item.type }}</span>
- </div>
- <div class="space-y-4">
- <div v-for="(ds, index) of item.list" :key="index">
- <div v-if="hasDataSourceFeature" class="relative mb-2">
- <div
- class="absolute inset-0 flex items-center"
- aria-hidden="true"
- >
- <div class="w-full border-t border-gray-300"></div>
- </div>
- <div class="relative flex justify-start">
- <router-link
- :to="`/db/${databaseSlug}/datasource/${dataSourceSlug(
- ds
- )}`"
- class="pr-3 bg-white font-medium normal-link"
- >
- {{ ds.name }}
- </router-link>
- </div>
- </div>
+ <!-- Hide data source list for now, as we don't allow adding new data source after creating the database. -->
+ <div v-if="false" class="pt-6">
+ <DataSourceTable :instance="database.instance" :database="database" />
+ </div>
+
+ <template v-if="allowViewDataSource">
+ <template
+ v-for="(item, index) of [
+ { type: 'RW', list: readWriteDataSourceList },
+ { type: 'RO', list: readonlyDataSourceList },
+ ]"
+ :key="index"
+ >
+ <div v-if="item.list.length" class="pt-6">
+ <div
+ v-if="hasDataSourceFeature"
+ class="text-lg leading-6 font-medium text-main mb-4"
+ >
+ <span v-data-source-type>{{ item.type }}</span>
+ </div>
+ <div class="space-y-4">
+ <div v-for="(ds, index) of item.list" :key="index">
+ <div v-if="hasDataSourceFeature" class="relative mb-2">
<div
- v-if="allowChangeDataSource"
- class="flex justify-end space-x-3"
+ class="absolute inset-0 flex items-center"
+ aria-hidden="true"
>
- <template v-if="isEditingDataSource(ds)">
- <button
- type="button"
- class="btn-normal"
- @click.prevent="cancelEditDataSource"
- >
- Cancel
- </button>
- <button
- type="button"
- class="btn-normal"
- :disabled="!allowSaveDataSource"
- @click.prevent="saveEditDataSource"
+ <div class="w-full border-t border-gray-300"></div>
+ </div>
+ <div class="relative flex justify-start">
+ <router-link
+ :to="`/db/${databaseSlug}/datasource/${dataSourceSlug(ds)}`"
+ class="pr-3 bg-white font-medium normal-link"
+ >
+ {{ ds.name }}
+ </router-link>
+ </div>
+ </div>
+ <div
+ v-if="allowChangeDataSource"
+ class="flex justify-end space-x-3"
+ >
+ <template v-if="isEditingDataSource(ds)">
+ <button
+ type="button"
+ class="btn-normal"
+ @click.prevent="cancelEditDataSource"
+ >
+ Cancel
+ </button>
+ <button
+ type="button"
+ class="btn-normal"
+ :disabled="!allowSaveDataSource"
+ @click.prevent="saveEditDataSource"
+ >
+ <!-- Heroicon name: solid/save -->
+ <svg
+ class="-ml-1 mr-2 h-5 w-5 text-control-light"
+ fill="currentColor"
+ viewBox="0 0 20 20"
+ xmlns="http://www.w3.org/2000/svg"
>
- <!-- Heroicon name: solid/save -->
- <svg
- class="-ml-1 mr-2 h-5 w-5 text-control-light"
- fill="currentColor"
- viewBox="0 0 20 20"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M7.707 10.293a1 1 0 10-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 11.586V6h5a2 2 0 012 2v7a2 2 0 01-2 2H4a2 2 0 01-2-2V8a2 2 0 012-2h5v5.586l-1.293-1.293zM9 4a1 1 0 012 0v2H9V4z"
- ></path>
- </svg>
- <span>Save</span>
- </button>
- </template>
- <template v-else>
- <button
- type="button"
- class="btn-normal"
- @click.prevent="editDataSource(ds)"
+ <path
+ d="M7.707 10.293a1 1 0 10-1.414 1.414l3 3a1 1 0 001.414 0l3-3a1 1 0 00-1.414-1.414L11 11.586V6h5a2 2 0 012 2v7a2 2 0 01-2 2H4a2 2 0 01-2-2V8a2 2 0 012-2h5v5.586l-1.293-1.293zM9 4a1 1 0 012 0v2H9V4z"
+ ></path>
+ </svg>
+ <span>Save</span>
+ </button>
+ </template>
+ <template v-else>
+ <button
+ type="button"
+ class="btn-normal"
+ @click.prevent="editDataSource(ds)"
+ >
+ <!-- Heroicon name: solid/pencil -->
+ <svg
+ class="-ml-1 mr-2 h-5 w-5 text-control-light"
+ fill="currentColor"
+ viewBox="0 0 20 20"
+ xmlns="http://www.w3.org/2000/svg"
>
- <!-- Heroicon name: solid/pencil -->
- <svg
- class="-ml-1 mr-2 h-5 w-5 text-control-light"
- fill="currentColor"
- viewBox="0 0 20 20"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"
- ></path>
- </svg>
- <span>Edit</span>
- </button>
- </template>
- </div>
- <DataSourceConnectionPanel
- :editing="isEditingDataSource(ds)"
- :dataSource="
- isEditingDataSource(ds) ? state.editingDataSource : ds
- "
- />
+ <path
+ d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"
+ ></path>
+ </svg>
+ <span>Edit</span>
+ </button>
+ </template>
</div>
+ <DataSourceConnectionPanel
+ :editing="isEditingDataSource(ds)"
+ :dataSource="
+ isEditingDataSource(ds) ? state.editingDataSource : ds
+ "
+ />
</div>
</div>
- </template>
+ </div>
</template>
- </div>
+ </template>
</div>
</template>
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index 83d4065c6b..f5dcb6c308 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -162,7 +162,7 @@
</div>
</BBModal>
<BBTabFilter
- class="px-4 pb-2 border-b border-block-border"
+ class="px-3 pb-2 border-b border-block-border"
:responsive="false"
:tabList="databaseTabItemList.map((item) => item.name)"
:selectedIndex="state.selectedIndex"
@@ -172,7 +172,7 @@
}
"
/>
- <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
+ <div class="max-w-7xl mx-auto py-6 px-6">
<template v-if="state.selectedIndex == OVERVIEW_TAB">
<DatabaseOverviewPanel id="overview" :database="database" />
</template>