Skip to content

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

chore: changelog in changelist (#14799)

boojack74faba60b350
diff --git a/frontend/src/components/ChangeHistory/AffectedTableSelect.vue b/frontend/src/components/ChangeHistory/AffectedTableSelect.vue
deleted file mode 100644
index 3207e586d0..0000000000
--- a/frontend/src/components/ChangeHistory/AffectedTableSelect.vue
+++ /dev/null
@@ -1,103 +0,0 @@
-<template>
- <NSelect
- :value="selectedKey"
- :options="affectedTableOptions"
- :filter="filterByTitle"
- filterable
- :render-label="renderLabel"
- @update:value="updateSelectedKey"
- />
-</template>
-
-<script setup lang="tsx">
-import { isEqual, orderBy, uniqBy } from "lodash-es";
-import { NSelect } from "naive-ui";
-import type { SelectOption } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import type { AffectedTable } from "@/types";
-import { EmptyAffectedTable } from "@/types";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
-import {
- getAffectedTablesOfChangeHistory,
- stringifyAffectedTable,
-} from "@/utils";
-
-type AffectedTableSelectOption = SelectOption & {
- affectedTable: AffectedTable;
- value: string;
-};
-
-const props = defineProps<{
- changeHistoryList: ChangeHistory[];
- affectedTable?: AffectedTable;
-}>();
-const emit = defineEmits<{
- (event: "update:affected-table", affectedTable?: AffectedTable): void;
-}>();
-
-const { t } = useI18n();
-
-const affectedTables = computed(() => {
- return [
- EmptyAffectedTable,
- ...orderBy(
- uniqBy(
- props.changeHistoryList
- .map((changeHistory) =>
- getAffectedTablesOfChangeHistory(changeHistory)
- )
- .flat(),
- (affectedTable) => `${affectedTable.schema}.${affectedTable.table}`
- ),
- ["dropped", "table", "schema"]
- ),
- ];
-});
-
-const filterByTitle = (pattern: string, option: SelectOption) => {
- const { affectedTable } = option as AffectedTableSelectOption;
- pattern = pattern.toLowerCase();
- return affectedTable.table.toLowerCase().includes(pattern);
-};
-
-const affectedTableOptions = computed(() => {
- return affectedTables.value.map<AffectedTableSelectOption>((item) => {
- const key = isEqual(item, EmptyAffectedTable) ? "" : JSON.stringify(item);
- return {
- value: key,
- affectedTable: item,
- };
- });
-});
-
-const renderLabel = (option: SelectOption) => {
- const { affectedTable } = option as AffectedTableSelectOption;
- if (!affectedTable || isEqual(affectedTable, EmptyAffectedTable)) {
- return t("change-history.all-tables");
- }
- const name = stringifyAffectedTable(affectedTable);
- if (affectedTable.dropped) {
- return (
- <div class="w-full flex flex-row justify-between items-center gap-1">
- <span class="truncate">{name}</span>
- <span class="shrink-0">(Dropped)</span>
- </div>
- );
- }
- return <span class="truncate">{name}</span>;
-};
-
-const selectedKey = computed(() => {
- return props.affectedTable ? JSON.stringify(props.affectedTable) : "";
-});
-
-const updateSelectedKey = (_: string, opt: AffectedTableSelectOption) => {
- emit(
- "update:affected-table",
- isEqual(opt.affectedTable, EmptyAffectedTable)
- ? undefined
- : opt.affectedTable
- );
-};
-</script>
diff --git a/frontend/src/components/ChangeHistory/AffectedTablesSelect.vue b/frontend/src/components/ChangeHistory/AffectedTablesSelect.vue
deleted file mode 100644
index cee63245f5..0000000000
--- a/frontend/src/components/ChangeHistory/AffectedTablesSelect.vue
+++ /dev/null
@@ -1,98 +0,0 @@
-<template>
- <NSelect
- :value="selectedKeys"
- :options="affectedTableOptions"
- filterable
- multiple
- tag
- :placeholder="$t('change-history.select-affection-tables')"
- :render-label="renderLabel"
- @update:value="updateSelectedKey"
- />
-</template>
-
-<script setup lang="tsx">
-import { NSelect } from "naive-ui";
-import type { SelectOption } from "naive-ui";
-import { computed } from "vue";
-import { useDBSchemaV1Store } from "@/store";
-import { type ComposedDatabase, type Table } from "@/types";
-
-type AffectedTablesSelectOption = SelectOption & {
- table: Table;
- value: string;
-};
-
-const props = defineProps<{
- database: ComposedDatabase;
- tables?: Table[];
-}>();
-const emit = defineEmits<{
- (event: "update:tables", tables?: Table[]): void;
-}>();
-
-const dbSchemaStore = useDBSchemaV1Store();
-
-const metadata = computed(() => {
- return dbSchemaStore.getDatabaseMetadata(props.database.name);
-});
-
-const affectedTables = computed((): Table[] => {
- return metadata.value.schemas
- .map((schema) =>
- schema.tables.map((table) => ({
- schema: schema.name,
- table: table.name,
- }))
- )
- .flat();
-});
-
-const affectedTableOptions = computed(() => {
- return affectedTables.value.map<AffectedTablesSelectOption>((table) => {
- return {
- value: stringifyTable(table),
- table: table,
- };
- });
-});
-
-const renderLabel = (option: SelectOption) => {
- const { table, label } = option as AffectedTablesSelectOption;
- if (!table) return String(label);
- return <span class="truncate">{stringifyTable(table)}</span>;
-};
-
-const selectedKeys = computed(() => {
- return props.tables?.map((table) => stringifyTable(table)) || [];
-});
-
-const updateSelectedKey = (
- _: string,
- options: AffectedTablesSelectOption[]
-) => {
- emit(
- "update:tables",
- options.map((option) => {
- const { table, label } = option;
- if (table) return table;
-
- let schema = "";
- let tableName = String(label);
- if (tableName.includes(".")) {
- schema = tableName.split(".")[0];
- tableName = tableName.split(".").slice(1).join(".");
- }
- return { schema, table: tableName };
- })
- );
-};
-
-const stringifyTable = (table: Table) => {
- const { schema, table: tableName } = table;
- if (schema !== "") {
- return `${schema}.${tableName}`;
- }
- return tableName;
-};
-</script>
diff --git a/frontend/src/components/ChangeHistory/ChangeHistoryDataTable.vue b/frontend/src/components/ChangeHistory/ChangeHistoryDataTable.vue
deleted file mode 100644
index 6cf8588e74..0000000000
--- a/frontend/src/components/ChangeHistory/ChangeHistoryDataTable.vue
+++ /dev/null
@@ -1,233 +0,0 @@
-<template>
- <NDataTable
- key="change-history-table"
- size="small"
- :columns="columnList"
- :data="changeHistories"
- :row-key="(history: ChangeHistory) => history.name"
- :striped="true"
- :row-props="rowProps"
- :checked-row-keys="selectedChangeHistoryNames"
- @update:checked-row-keys="(keys) => $emit('update:selected-change-history-names', keys as string[])"
- />
-</template>
-
-<script lang="tsx" setup>
-import { type DataTableColumn, NDataTable } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { RouterLink } from "vue-router";
-import { BBAvatar } from "@/bbkit";
-import { getDateForPbTimestamp } from "@/types";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
-import {
- ChangeHistory_Status,
- ChangeHistory_Type,
- changeHistory_TypeToJSON,
-} from "@/types/proto/v1/database_service";
-import {
- extractIssueUID,
- changeHistoryLink,
- getAffectedTablesOfChangeHistory,
- getHistoryChangeType,
- getAffectedTableDisplayName,
- extractChangeHistoryUID,
- creatorOfChangeHistory,
-} from "@/utils";
-import HumanizeDate from "../misc/HumanizeDate.vue";
-import ChangeHistoryStatusIcon from "./ChangeHistoryStatusIcon.vue";
-
-const props = defineProps<{
- changeHistories: ChangeHistory[];
- selectedChangeHistoryNames?: string[];
- customClick?: boolean;
- showSelection?: boolean;
-}>();
-
-const emit = defineEmits<{
- (event: "update:selected-change-history-names", value: string[]): void;
- (event: "row-click", id: string): void;
-}>();
-
-const router = useRouter();
-const { t } = useI18n();
-
-const columnList = computed(() => {
- const columns: (DataTableColumn<ChangeHistory> & { hide?: boolean })[] = [
- {
- type: "selection",
- hide: !props.showSelection,
- width: "2rem",
- disabled: (history) => {
- return !allowToSelectChangeHistory(history);
- },
- cellProps: () => {
- return {
- onClick: (e: MouseEvent) => {
- e.stopPropagation();
- },
- };
- },
- },
- {
- key: "status",
- width: "2rem",
- render: (history) => {
- return (
- <ChangeHistoryStatusIcon class="mx-auto" status={history.status} />
- );
- },
- },
- {
- key: "type",
- title: t("change-history.change-type"),
- width: "4rem",
- render: (history) => {
- return (
- <div class="flex items-center gap-x-1">
- {getHistoryChangeType(history.type)}
- </div>
- );
- },
- },
- {
- key: "version",
- title: t("common.version"),
- width: "15rem",
- resizable: true,
- render: (history) => {
- const historyType =
- history.type === ChangeHistory_Type.BASELINE ? (
- <span class="textinfolabel">
- ({changeHistory_TypeToJSON(history.type)})
- </span>
- ) : null;
- return (
- <>
- <span>{history.version}</span>
- {historyType}
- </>
- );
- },
- },
- {
- key: "issue",
- title: t("common.issue"),
- width: "5rem",
- resizable: true,
- render: (history) => {
- const uid = extractIssueUID(history.issue);
- if (!uid) return null;
- return (
- <RouterLink
- to={{
- path: `/${history.issue}`,
- }}
- custom={true}
- >
- {{
- default: ({ href }: { href: string }) => (
- <a
- href={href}
- class="normal-link"
- onClick={(e: MouseEvent) => e.stopPropagation()}
- >
- #{uid}
- </a>
- ),
- }}
- </RouterLink>
- );
- },
- },
- {
- key: "tables",
- title: t("db.tables"),
- width: "15rem",
- resizable: true,
- ellipsis: true,
- render: (history) => {
- const tables = getAffectedTablesOfChangeHistory(history);
- return (
- <p class="space-x-2 truncate">
- {tables.map((table) => (
- <span class={table.dropped ? "text-gray-400 italic" : ""}>
- {getAffectedTableDisplayName(table)}
- </span>
- ))}
- </p>
- );
- },
- },
- {
- key: "SQL",
- title: "SQL",
- resizable: true,
- minWidth: "13rem",
- ellipsis: true,
- render: (history) => {
- return <p class="truncate whitespace-nowrap">{history.statement}</p>;
- },
- },
- {
- key: "created",
- title: t("common.created-at"),
- width: "7rem",
- resizable: true,
- ellipsis: true,
- render: (history) => {
- return (
- <HumanizeDate date={getDateForPbTimestamp(history.createTime)} />
- );
- },
- },
- {
- key: "creator",
- title: t("common.creator"),
- width: "8rem",
- resizable: true,
- ellipsis: true,
- render: (history) => {
- const creator = creatorOfChangeHistory(history);
- if (!creator) return null;
- return (
- <div class="flex flex-row items-center overflow-hidden gap-x-1">
- <BBAvatar size="SMALL" username={creator.title} />
- <span class="truncate">{creator.title}</span>
- </div>
- );
- },
- },
- ];
- return columns.filter((col) => !col.hide);
-});
-
-const rowProps = (history: ChangeHistory) => {
- return {
- onClick: (e: MouseEvent) => {
- if (props.customClick) {
- emit("row-click", extractChangeHistoryUID(history.name));
- return;
- }
-
- const url = changeHistoryLink(history);
- if (e.ctrlKey || e.metaKey) {
- window.open(url, "_blank");
- } else {
- router.push(url);
- }
- },
- };
-};
-
-const allowToSelectChangeHistory = (history: ChangeHistory) => {
- return (
- history.status === ChangeHistory_Status.DONE &&
- (history.type === ChangeHistory_Type.BASELINE ||
- history.type === ChangeHistory_Type.MIGRATE ||
- history.type === ChangeHistory_Type.MIGRATE_SDL ||
- history.type === ChangeHistory_Type.DATA)
- );
-};
-</script>
diff --git a/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue b/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
deleted file mode 100644
index 63c4102802..0000000000
--- a/frontend/src/components/ChangeHistory/ChangeHistoryDetail.vue
+++ /dev/null
@@ -1,568 +0,0 @@
-<template>
- <div class="focus:outline-none" tabindex="0" v-bind="$attrs">
- <NoPermissionPlaceholder v-if="!hasPermission" />
- <main v-else-if="changeHistory" class="flex flex-col relative gap-y-6">
- <!-- Highlight Panel -->
- <div
- class="pb-4 border-b border-block-border md:flex md:items-center md:justify-between"
- >
- <div class="flex-1 min-w-0 space-y-3">
- <!-- Summary -->
- <div class="flex items-center space-x-2">
- <ChangeHistoryStatusIcon :status="changeHistory.status" />
- <h1 class="text-xl font-bold leading-6 text-main truncate">
- {{ $t("common.version") }} {{ changeHistory.version }}
- </h1>
- <NTag round>
- {{ changeHistory_TypeToJSON(changeHistory.type) }}
- </NTag>
- </div>
- <dl
- class="flex flex-col space-y-1 md:space-y-0 md:flex-row md:flex-wrap"
- >
- <dt class="sr-only">{{ $t("common.issue") }}</dt>
- <dd class="flex items-center text-sm md:mr-4">
- <span class="textlabel"
- >{{ $t("common.issue") }}&nbsp;-&nbsp;</span
- >
- <router-link
- :to="{
- path: `/${changeHistory.issue}`,
- }"
- class="normal-link"
- >
- #{{ extractIssueUID(changeHistory.issue) }}
- </router-link>
- </dd>
- <dt class="sr-only">{{ $t("common.creator") }}</dt>
- <dd v-if="creator" class="flex items-center text-sm md:mr-4">
- <span class="textlabel"
- >{{ $t("common.creator") }}&nbsp;-&nbsp;</span
- >
- {{ creator.title }}
- </dd>
- <dt class="sr-only">{{ $t("common.created-at") }}</dt>
- <dd class="flex items-center text-sm md:mr-4">
- <span class="textlabel"
- >{{ $t("common.created-at") }}&nbsp;-&nbsp;</span
- >
- {{
- humanizeDate(getDateForPbTimestamp(changeHistory.createTime))
- }}
- </dd>
- </dl>
- </div>
- </div>
-
- <div v-if="affectedTables.length > 0">
- <span class="flex items-center text-lg text-main capitalize">
- {{ $t("change-history.affected-tables") }}
- </span>
- <div>
- <span
- v-for="(affectedTable, i) in affectedTables"
- :key="`${i}.${affectedTable.schema}.${affectedTable.table}`"
- :class="[
- 'mr-3 mb-2',
- !affectedTable.dropped
- ? 'text-blue-600 cursor-pointer hover:opacity-80'
- : 'mb-2 text-gray-400 italic',
- ]"
- @click="handleAffectedTableClick(affectedTable)"
- >{{ getAffectedTableDisplayName(affectedTable) }}</span
- >
- </div>
- </div>
-
- <div class="flex flex-col gap-y-6">
- <div class="flex flex-col gap-y-2">
- <a
- id="statement"
- href="#statement"
- class="w-auto flex items-center text-lg text-main mb-2 hover:underline"
- >
- {{ $t("common.statement") }}
- <button
- tabindex="-1"
- class="btn-icon ml-1"
- @click.prevent="copyStatement"
- >
- <heroicons-outline:clipboard class="w-6 h-6" />
- </button>
- </a>
- <MonacoEditor
- class="h-auto max-h-[480px] min-h-[120px] border rounded-[3px] text-sm overflow-clip relative"
- :content="changeHistoryStatement"
- :readonly="true"
- :auto-height="{ min: 120, max: 480 }"
- />
- <div v-if="guessedIsBasicView">
- <NButton
- quaternary
- size="small"
- :disabled="state.loading"
- @click="fetchFullHistory"
- >
- <template #icon>
- <BBSpin v-if="state.loading" />
- <ChevronDownIcon v-else class="w-5" />
- </template>
- {{ $t("change-history.view-full") }}
- </NButton>
- </div>
- </div>
- <div v-if="showSchemaSnapshot" class="flex flex-col gap-y-2">
- <a
- id="schema"
- href="#schema"
- class="flex items-center text-lg text-main hover:underline capitalize"
- >
- Schema {{ $t("common.snapshot") }}
- <button
- tabindex="-1"
- class="btn-icon ml-1"
- @click.prevent="copySchema"
- >
- <heroicons-outline:clipboard class="w-6 h-6" />
- </button>
- </a>
-
- <div v-if="hasDrift" class="flex items-center gap-x-2">
- <div class="flex items-center text-sm font-normal">
- <heroicons-outline:exclamation-circle
- class="w-5 h-5 mr-0.5 text-error"
- />
- <span>{{ $t("change-history.schema-drift-detected") }}</span>
- </div>
- <div
- class="normal-link text-sm"
- data-label="bb-change-history-view-drift-button"
- @click="state.viewDrift = true"
- >
- {{ $t("change-history.view-drift") }}
- </div>
- </div>
-
- <div class="flex flex-row items-center gap-x-2">
- <div v-if="allowShowDiff" class="flex space-x-1 items-center">
- <NSwitch
- :value="state.showDiff"
- size="small"
- :disabled="state.loading"
- data-label="bb-change-history-diff-switch"
- @update:value="switchShowDiff"
- />
- <span class="text-sm font-semibold">
- {{ $t("change-history.show-diff") }}
- </span>
- </div>
- <div class="textinfolabel">
- <i18n-t
- v-if="state.showDiff"
- tag="span"
- keypath="change-history.left-vs-right"
- >
- <template #prevLink>
- <router-link
- v-if="previousHistory"
- class="normal-link"
- :to="previousHistoryLink"
- >
- ({{ previousHistory.version }})
- </router-link>
- </template>
- </i18n-t>
- <template v-else>
- {{ $t("change-history.schema-snapshot-after-change") }}
- </template>
- </div>
- <div v-if="!allowShowDiff" class="text-sm font-normal text-accent">
- ({{ $t("change-history.no-schema-change") }})
- </div>
- </div>
-
- <DiffEditor
- v-if="state.showDiff"
- class="h-auto max-h-[600px] min-h-[120px] border rounded-md text-sm overflow-clip"
- :original="changeHistory.prevSchema"
- :modified="changeHistory.schema"
- :readonly="true"
- :auto-height="{ min: 120, max: 600 }"
- />
- <template v-else>
- <div v-if="changeHistory.schema" class="space-y-2">
- <MonacoEditor
- class="h-auto max-h-[600px] min-h-[120px] border rounded-md text-sm overflow-clip relative"
- :content="changeHistorySchema"
- :readonly="true"
- :auto-height="{ min: 120, max: 600 }"
- />
- <div
- v-if="
- getStatementSize(changeHistory.schema).ne(
- changeHistory.schemaSize
- )
- "
- >
- <NButton
- quaternary
- size="small"
- :disabled="state.loading"
- @click="fetchFullHistory"
- >
- <template #icon>
- <BBSpin v-if="state.loading" />
- <ChevronDownIcon v-else class="w-5" />
- </template>
- {{ $t("change-history.view-full") }}
- </NButton>
- </div>
- </div>
- <div v-else>
- {{ $t("change-history.current-schema-empty") }}
- </div>
- </template>
- </div>
- </div>
- </main>
-
- <BBModal
- v-if="changeHistory && previousHistory && state.viewDrift"
- @close="state.viewDrift = false"
- >
- <template #title>
- <span>{{ $t("change-history.schema-drift") }}</span>
- <span class="mx-2">-</span>
- <i18n-t tag="span" keypath="change-history.left-vs-right">
- <template #prevLink>
- <router-link class="normal-link" :to="previousHistoryLink">
- ({{ previousHistory.version }})
- </router-link>
- </template>
- </i18n-t>
- </template>
-
- <div
- class="space-y-4 flex flex-col overflow-hidden"
- style="width: calc(100vw - 10rem); height: calc(100vh - 12rem)"
- >
- <DiffEditor
- class="flex-1 w-full border rounded-md overflow-clip"
- :original="previousHistory.schema"
- :modified="changeHistory.schema"
- :readonly="true"
- />
- <div class="flex justify-end">
- <NButton type="primary" @click.prevent="state.viewDrift = false">
- {{ $t("common.close") }}
- </NButton>
- </div>
- </div>
- </BBModal>
- </div>
-
- <TableDetailDrawer
- :show="!!selectedAffectedTable"
- :database-name="database.name"
- :schema-name="selectedAffectedTable?.schema ?? ''"
- :table-name="selectedAffectedTable?.table ?? ''"
- :classification-config="classificationConfig"
- @dismiss="selectedAffectedTable = undefined"
- />
-</template>
-
-<script lang="ts" setup>
-import { useTitle } from "@vueuse/core";
-import { ChevronDownIcon } from "lucide-vue-next";
-import { NButton, NSwitch, NTag } from "naive-ui";
-import { computed, reactive, watch, ref, unref } from "vue";
-import { BBModal, BBSpin } from "@/bbkit";
-import ChangeHistoryStatusIcon from "@/components/ChangeHistory/ChangeHistoryStatusIcon.vue";
-import { DiffEditor, MonacoEditor } from "@/components/MonacoEditor";
-import TableDetailDrawer from "@/components/TableDetailDrawer.vue";
-import {
- pushNotification,
- useChangeHistoryStore,
- useDBSchemaV1Store,
- useUserStore,
- useSettingV1Store,
- useDatabaseV1ByName,
-} from "@/store";
-import { getDateForPbTimestamp, type AffectedTable } from "@/types";
-import { Engine } from "@/types/proto/v1/common";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
-import {
- ChangeHistory_Type,
- changeHistory_TypeToJSON,
- ChangeHistoryView,
-} from "@/types/proto/v1/database_service";
-import {
- changeHistoryLink,
- extractIssueUID,
- extractUserResourceName,
- getAffectedTablesOfChangeHistory,
- toClipboard,
- getStatementSize,
- hasProjectPermissionV2,
- getAffectedTableDisplayName,
- extractChangeHistoryUID,
-} from "@/utils";
-import NoPermissionPlaceholder from "../misc/NoPermissionPlaceholder.vue";
-
-interface LocalState {
- showDiff: boolean;
- viewDrift: boolean;
- loading: boolean;
-}
-
-const props = defineProps<{
- instance: string;
- database: string;
- changeHistoryId: string;
-}>();
-
-const state = reactive<LocalState>({
- showDiff: false,
- viewDrift: false,
- loading: false,
-});
-
-const dbSchemaStore = useDBSchemaV1Store();
-const settingStore = useSettingV1Store();
-const changeHistoryStore = useChangeHistoryStore();
-const selectedAffectedTable = ref<AffectedTable | undefined>();
-
-const { database } = useDatabaseV1ByName(props.database);
-
-const hasPermission = computed(() =>
- hasProjectPermissionV2(database.value.projectEntity, "bb.changeHistories.get")
-);
-
-const classificationConfig = computed(() => {
- return settingStore.getProjectClassification(
- database.value.projectEntity.dataClassificationConfigId
- );
-});
-
-const changeHistoryName = computed(() => {
- return `${props.database}/changeHistories/${props.changeHistoryId}`;
-});
-
-const affectedTables = computed(() => {
- if (changeHistory.value === undefined) {
- return [];
- }
- return getAffectedTablesOfChangeHistory(changeHistory.value);
-});
-
-const showSchemaSnapshot = computed(() => {
- return database.value.instanceResource.engine !== Engine.RISINGWAVE;
-});
-
-watch(
- [database.value.name, changeHistoryName],
- async ([_, name]) => {
- await Promise.all([
- dbSchemaStore.getOrFetchDatabaseMetadata({
- database: database.value.name,
- skipCache: false,
- }),
- changeHistoryStore.getOrFetchChangeHistoryByName(
- unref(name),
- ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL
- ),
- ]);
- },
- { immediate: true }
-);
-
-const switchShowDiff = async (showDiff: boolean) => {
- await fetchFullHistory();
- state.showDiff = showDiff;
-};
-
-const handleAffectedTableClick = (affectedTable: AffectedTable): void => {
- if (affectedTable.dropped) {
- return;
- }
- selectedAffectedTable.value = affectedTable;
-};
-
-// get all change histories before (include) the one of given id, ordered by descending version.
-const prevChangeHistoryList = computed(() => {
- const changeHistoryList = changeHistoryStore.changeHistoryListByDatabase(
- database.value.name
- );
-
- // The returned change history list has been ordered by `id` DESC or (`namespace` ASC, `sequence` DESC) .
- // We can obtain prevChangeHistoryList by cutting up the array by the `changeHistoryId`.
- const idx = changeHistoryList.findIndex(
- (history) => extractChangeHistoryUID(history.name) === props.changeHistoryId
- );
- if (idx === -1) {
- return [];
- }
- return changeHistoryList.slice(idx);
-});
-
-// changeHistory is the latest migration NOW.
-const changeHistory = computed((): ChangeHistory | undefined => {
- if (prevChangeHistoryList.value.length > 0) {
- const current = prevChangeHistoryList.value[0];
- return changeHistoryStore.getChangeHistoryByName(current.name) ?? current;
- }
- return changeHistoryStore.getChangeHistoryByName(changeHistoryName.value);
-});
-
-const changeHistorySchema = computed(() => {
- if (!changeHistory.value) {
- return "";
- }
- let schema = changeHistory.value.schema;
- if (guessedIsBasicView.value) {
- schema = `${schema}${schema.endsWith("\n") ? "" : "\n"}...`;
- }
- return schema;
-});
-
-const changeHistoryStatement = computed(() => {
- if (!changeHistory.value) {
- return "";
- }
- let statement = changeHistory.value.statement;
- if (
- getStatementSize(changeHistory.value.statement).lt(
- changeHistory.value.statementSize
- )
- ) {
- statement = `${statement}${statement.endsWith("\n") ? "" : "\n"}...`;
- }
- return statement;
-});
-
-// previousHistory is the last change history before the one of given id.
-// Only referenced if hasDrift is true.
-const previousHistory = computed((): ChangeHistory | undefined => {
- const prev = prevChangeHistoryList.value[1];
- if (!prev) return undefined;
- return changeHistoryStore.getChangeHistoryByName(prev.name) ?? prev;
-});
-
-const fetchFullPreviousHistory = async () => {
- const prev = previousHistory.value;
- if (!prev) return;
- await changeHistoryStore.getOrFetchChangeHistoryByName(
- prev.name,
- ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL
- );
-};
-
-const fetchFullHistory = async () => {
- if (state.loading) {
- return;
- }
- state.loading = true;
- try {
- await Promise.all([
- changeHistoryStore.getOrFetchChangeHistoryByName(
- changeHistoryName.value,
- ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL
- ),
- fetchFullPreviousHistory(),
- ]);
- } finally {
- state.loading = false;
- }
-};
-
-const guessedIsBasicView = computed(() => {
- const history = changeHistory.value;
- if (!history) return true;
- return getStatementSize(history.statement).ne(history.statementSize);
-});
-
-// "Show diff" feature is enabled when current migration has changed the schema.
-const allowShowDiff = computed((): boolean => {
- if (!changeHistory.value) {
- return false;
- }
- return true;
-});
-
-// A schema drift is detected when the schema AFTER previousHistory has been
-// changed unexpectedly BEFORE current changeHistory.
-const hasDrift = computed((): boolean => {
- if (!changeHistory.value) {
- return false;
- }
- if (changeHistory.value.type === ChangeHistory_Type.BASELINE) {
- return false;
- }
- if (guessedIsBasicView.value) {
- return false;
- }
-
- return (
- prevChangeHistoryList.value.length > 1 && // no drift if no previous change history
- previousHistory.value?.schema !== changeHistory.value.prevSchema
- );
-});
-
-const creator = computed(() => {
- if (!changeHistory.value) {
- return undefined;
- }
- const email = extractUserResourceName(changeHistory.value.creator);
- return useUserStore().getUserByEmail(email);
-});
-
-const previousHistoryLink = computed(() => {
- const previous = previousHistory.value;
- if (!previous) return "";
- return changeHistoryLink(previous);
-});
-
-const copyStatement = async () => {
- await fetchFullHistory();
-
- if (!changeHistoryStatement.value) {
- return false;
- }
- toClipboard(changeHistoryStatement.value).then(() => {
- pushNotification({
- module: "bytebase",
- style: "INFO",
- title: `Statement copied to clipboard.`,
- });
- });
-};
-
-const copySchema = async () => {
- await fetchFullHistory();
-
- if (!changeHistorySchema.value) {
- return false;
- }
- toClipboard(changeHistorySchema.value).then(() => {
- pushNotification({
- module: "bytebase",
- style: "INFO",
- title: `Schema copied to clipboard.`,
- });
- });
-};
-
-watch(
- guessedIsBasicView,
- (basic) => {
- if (!basic) {
- fetchFullPreviousHistory();
- }
- },
- {
- immediate: true,
- }
-);
-
-useTitle(changeHistory.value?.version || "Change History");
-</script>
diff --git a/frontend/src/components/ChangeHistory/ChangeHistoryStatusIcon.vue b/frontend/src/components/ChangeHistory/ChangeHistoryStatusIcon.vue
deleted file mode 100644
index dd6ec6d754..0000000000
--- a/frontend/src/components/ChangeHistory/ChangeHistoryStatusIcon.vue
+++ /dev/null
@@ -1,48 +0,0 @@
-<template>
- <span
- class="flex items-center justify-center rounded-full select-none"
- :class="iconClass()"
- >
- <template v-if="status === ChangeHistory_Status.PENDING">
- <span
- class="h-2 w-2 bg-info rounded-full"
- style="animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"
- aria-hidden="true"
- ></span>
- </template>
- <template v-else-if="status === ChangeHistory_Status.DONE">
- <heroicons-solid:check class="w-4 h-4" />
- </template>
- <template v-else-if="status === ChangeHistory_Status.FAILED">
- <span
- class="h-2 w-2 rounded-full text-center pb-6 font-normal text-base"
- aria-hidden="true"
- >!</span
- >
- </template>
- </span>
-</template>
-
-<script lang="ts" setup>
-import type { PropType } from "vue";
-import { ChangeHistory_Status } from "@/types/proto/v1/database_service";
-
-const props = defineProps({
- status: {
- required: true,
- type: String as PropType<ChangeHistory_Status>,
- },
-});
-
-const iconClass = () => {
- const iconClass = "w-5 h-5";
- switch (props.status) {
- case ChangeHistory_Status.PENDING:
- return iconClass + " bg-white border-2 border-info text-info";
- case ChangeHistory_Status.DONE:
- return iconClass + " bg-success text-white";
- case ChangeHistory_Status.FAILED:
- return iconClass + " bg-error text-white";
- }
-};
-</script>
diff --git a/frontend/src/components/ChangeHistory/ChangeTypeSelect.vue b/frontend/src/components/ChangeHistory/ChangeTypeSelect.vue
deleted file mode 100644
index 6665dcb383..0000000000
--- a/frontend/src/components/ChangeHistory/ChangeTypeSelect.vue
+++ /dev/null
@@ -1,39 +0,0 @@
-<template>
- <NSelect
- clearable
- :value="changeType"
- :options="options"
- :placeholder="$t('issue.advanced-search.scope.type.title')"
- @update:value="updateSelectedKey"
- />
-</template>
-
-<script setup lang="tsx">
-import { NSelect } from "naive-ui";
-import { computed } from "vue";
-
-defineProps<{
- changeType?: string;
-}>();
-
-const emit = defineEmits<{
- (event: "update:change-type", changeType?: string): void;
-}>();
-
-const options = computed(() => {
- return [
- {
- value: "MIGRATE",
- label: "DDL",
- },
- {
- value: "DATA",
- label: "DML",
- },
- ];
-});
-
-const updateSelectedKey = (value: string) => {
- emit("update:change-type", value);
-};
-</script>
diff --git a/frontend/src/components/ChangeHistory/PagedChangeHistoryTable.vue b/frontend/src/components/ChangeHistory/PagedChangeHistoryTable.vue
deleted file mode 100644
index b39730801b..0000000000
--- a/frontend/src/components/ChangeHistory/PagedChangeHistoryTable.vue
+++ /dev/null
@@ -1,195 +0,0 @@
-<template>
- <slot name="table" :list="state.changeHistoryList" :loading="state.loading" />
-
- <div
- v-if="state.loading"
- class="flex items-center justify-center py-2 text-gray-400 text-sm"
- >
- <BBSpin />
- </div>
-
- <slot
- v-if="!state.loading"
- name="more"
- :has-more="!!state.paginationToken"
- :fetch-next-page="fetchNextPage"
- >
- <div
- v-if="!hideLoadMore && pageSize > 0 && state.paginationToken"
- class="flex items-center justify-center py-2 text-gray-400 text-sm hover:bg-gray-200 cursor-pointer"
- @click="fetchNextPage"
- >
- {{ $t("common.load-more") }}
- </div>
- </slot>
-</template>
-
-<script lang="ts" setup>
-import { useSessionStorage } from "@vueuse/core";
-import { stringify } from "qs";
-import type { PropType } from "vue";
-import { computed, reactive, watch } from "vue";
-import { BBSpin } from "@/bbkit";
-import { databaseServiceClient } from "@/grpcweb";
-import { useIsLoggedIn } from "@/store";
-import type { ComposedDatabase, SearchChangeHistoriesParams } from "@/types";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
-
-type LocalState = {
- loading: boolean;
- changeHistoryList: ChangeHistory[];
- paginationToken: string;
-};
-
-type SessionState = {
- // How many times the user clicks the "load more" button.
- page: number;
- // Help us to check if the session is outdated.
- updatedTs: number;
-};
-
-const MAX_PAGE_SIZE = 1000;
-const SESSION_LIFE = 1 * 60 * 1000; // 1 minute
-
-const props = defineProps({
- // A unique key to identify the session state.
- sessionKey: {
- type: String,
- required: true,
- },
- database: {
- type: Object as PropType<ComposedDatabase>,
- required: true,
- },
- searchChangeHistories: {
- type: Object as PropType<SearchChangeHistoriesParams>,
- default: () => ({}),
- },
- pageSize: {
- type: Number,
- default: 20, // Default to 20.
- },
- hideLoadMore: {
- type: Boolean,
- default: false,
- },
-});
-
-const emit = defineEmits<{
- (event: "list:update", list: ChangeHistory[]): void;
-}>();
-
-const state = reactive<LocalState>({
- loading: false,
- changeHistoryList: [],
- paginationToken: "",
-});
-
-const sessionState = useSessionStorage<SessionState>(props.sessionKey, {
- page: 1,
- updatedTs: 0,
-});
-
-const isLoggedIn = useIsLoggedIn();
-
-const limit = computed(() => {
- if (props.pageSize <= 0) return MAX_PAGE_SIZE;
- return props.pageSize;
-});
-
-const condition = computed(() => {
- const searchChangeHistories = {
- ...props.searchChangeHistories,
- limit: limit.value,
- };
- return stringify(searchChangeHistories, {
- arrayFormat: "repeat",
- });
-});
-
-const buildFilter = (search: SearchChangeHistoriesParams): string => {
- const filter: string[] = [];
- if (search.types && search.types.length > 0) {
- filter.push(`type = "${search.types.join(" | ")}"`);
- }
- if (search.tables && search.tables.length > 0) {
- filter.push(
- `table = "${search.tables.map((table) => `tableExists('${props.database.databaseName}', '${table.schema}', '${table.table}')`).join(" || ")}"`
- );
- }
- return filter.join(" && ");
-};
-
-const fetchData = async (refresh = false) => {
- state.loading = true;
-
- const isFirstFetch = state.paginationToken === "";
- const expectedRowCount = isFirstFetch
- ? // Load one or more page for the first fetch to restore the session
- limit.value * sessionState.value.page
- : // Always load one page if NOT the first fetch
- limit.value;
-
- try {
- const { nextPageToken, changeHistories } =
- await databaseServiceClient.listChangeHistories({
- parent: props.database.name,
- filter: buildFilter(props.searchChangeHistories),
- pageSize: expectedRowCount,
- pageToken: state.paginationToken,
- });
- if (refresh) {
- state.changeHistoryList = changeHistories;
- } else {
- state.changeHistoryList.push(...changeHistories);
- }
-
- if (!isFirstFetch && changeHistories.length === expectedRowCount) {
- // If we didn't reach the end, memorize we've clicked the "load more" button.
- sessionState.value.page++;
- }
-
- sessionState.value.updatedTs = Date.now();
- state.paginationToken = nextPageToken;
- } catch (e) {
- console.error(e);
- } finally {
- state.loading = false;
- }
-};
-
-const resetSession = () => {
- sessionState.value = {
- page: 1,
- updatedTs: 0,
- };
-};
-
-const refresh = () => {
- state.paginationToken = "";
- resetSession();
- fetchData(true);
-};
-
-const fetchNextPage = () => {
- fetchData(false);
-};
-
-if (Date.now() - sessionState.value.updatedTs > SESSION_LIFE) {
- // Reset session if it's outdated.
- resetSession();
-}
-fetchData(true);
-watch(condition, refresh);
-watch(isLoggedIn, () => {
- // Reset session when logged out.
- if (!isLoggedIn.value) {
- resetSession();
- }
-});
-
-watch(
- () => state.changeHistoryList,
- (list) => emit("list:update", list)
-);
-</script>
diff --git a/frontend/src/components/ChangeHistory/index.ts b/frontend/src/components/ChangeHistory/index.ts
deleted file mode 100644
index 2572f40556..0000000000
--- a/frontend/src/components/ChangeHistory/index.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import AffectedTableSelect from "./AffectedTableSelect.vue";
-import AffectedTablesSelect from "./AffectedTablesSelect.vue";
-import ChangeHistoryDataTable from "./ChangeHistoryDataTable.vue";
-import ChangeHistoryDetail from "./ChangeHistoryDetail.vue";
-import ChangeHistoryStatusIcon from "./ChangeHistoryStatusIcon.vue";
-import ChangeTypeSelect from "./ChangeTypeSelect.vue";
-import PagedChangeHistoryTable from "./PagedChangeHistoryTable.vue";
-
-export {
- ChangeHistoryDetail,
- ChangeTypeSelect,
- ChangeHistoryStatusIcon,
- AffectedTableSelect,
- ChangeHistoryDataTable,
- PagedChangeHistoryTable,
- AffectedTablesSelect,
-};
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue
index 560aa66213..897583050c 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/AddChangePanel.vue
@@ -16,22 +16,22 @@
{{ $t("changelist.change-source.self") }}
</div>
<NRadioGroup v-model:value="changeSource">
- <NRadio value="CHANGE_HISTORY">
+ <NRadio value="CHANGELOG">
<div class="flex items-center">
- <History :size="16" class="mr-1" />
- {{ $t("common.change-history") }}
+ <HistoryIcon :size="16" class="mr-1" />
+ {{ $t("common.changelog") }}
</div>
</NRadio>
<NRadio value="RAW_SQL">
<div class="flex items-center">
- <File :size="16" class="mr-1" />
+ <FileIcon :size="16" class="mr-1" />
{{ $t("changelist.change-source.raw-sql") }}
</div>
</NRadio>
</NRadioGroup>
</div>
- <ChangeHistoryForm v-if="changeSource === 'CHANGE_HISTORY'" />
+ <ChangelogForm v-if="changeSource === 'CHANGELOG'" />
<RawSQLForm v-if="changeSource === 'RAW_SQL'" />
</div>
@@ -73,24 +73,22 @@
<script setup lang="ts">
import { asyncComputed } from "@vueuse/core";
-import { File, History } from "lucide-vue-next";
+import { FileIcon, HistoryIcon } from "lucide-vue-next";
import { NButton, NRadio, NRadioGroup } from "naive-ui";
import { zindexable as vZindexable } from "vdirs";
import { computed, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import { BBSpin } from "@/bbkit";
import { Drawer, DrawerContent, ErrorTipsButton } from "@/components/v2";
-import { branchServiceClient } from "@/grpcweb";
import {
pushNotification,
- useChangeHistoryStore,
useChangelistStore,
+ useChangelogStore,
useLocalSheetStore,
- useSettingV1Store,
} from "@/store";
-import { useBranchStore } from "@/store/modules/branch";
import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
import { Changelist } from "@/types/proto/v1/changelist_service";
+import { ChangelogView } from "@/types/proto/v1/database_service";
import {
getChangelistChangeSourceType,
getSheetStatement,
@@ -100,27 +98,20 @@ import {
import { fallbackVersionForChange } from "../../common";
import { useChangelistDetailContext } from "../context";
import { provideAddChangeContext } from "./context";
-import { ChangeHistoryForm, RawSQLForm } from "./form";
+import { ChangelogForm, RawSQLForm } from "./form";
import { emptyRawSQLChange } from "./utils";
const { t } = useI18n();
-const settingStore = useSettingV1Store();
const { project, changelist, showAddChangePanel } =
useChangelistDetailContext();
-const {
- changeSource,
- changesFromChangeHistory,
- changesFromBranch,
- changeFromRawSQL,
-} = provideAddChangeContext();
+const { changeSource, changesFromChangelog, changeFromRawSQL } =
+ provideAddChangeContext();
const isLoading = ref(false);
const pendingAddChanges = computed(() => {
switch (changeSource.value) {
- case "CHANGE_HISTORY":
- return changesFromChangeHistory.value;
- case "BRANCH":
- return changesFromBranch.value;
+ case "CHANGELOG":
+ return changesFromChangelog.value;
case "RAW_SQL":
return [changeFromRawSQL.value];
}
@@ -156,44 +147,24 @@ const doAddChange = async () => {
const localSheetStore = useLocalSheetStore();
const sheet = localSheetStore.getOrCreateSheetByName(change.sheet);
const sourceType = getChangelistChangeSourceType(change);
- if (sourceType === "CHANGE_HISTORY") {
- const { changeHistory, statement } =
- await useChangeHistoryStore().exportChangeHistoryFullStatementByName(
- change.source
- );
- setSheetStatement(sheet, statement);
- change.version = changeHistory?.version || "";
- }
- if (sourceType === "BRANCH") {
- // For branch changes, use its diff DDL
- const branch = await useBranchStore().fetchBranchByName(
+ if (sourceType === "CHANGELOG") {
+ const changelog = await useChangelogStore().getOrFetchChangelogByName(
change.source,
- false /* !useCache */
- );
-
- const classificationConfig = settingStore.getProjectClassification(
- project.value.dataClassificationConfigId
+ ChangelogView.CHANGELOG_VIEW_FULL
);
- const { diff } = await branchServiceClient.diffMetadata({
- sourceMetadata: branch.baselineSchemaMetadata,
- targetMetadata: branch.schemaMetadata,
- engine: branch.engine,
- classificationFromConfig:
- classificationConfig?.classificationFromConfig ?? false,
- });
- setSheetStatement(sheet, diff);
+ setSheetStatement(sheet, changelog?.statement || "");
+ change.version = changelog?.version || "";
}
const created = await localSheetStore.saveLocalSheetToRemote(sheet);
change.sheet = created.name;
}
const sourceType = getChangelistChangeSourceType(change);
- if (sourceType === "CHANGE_HISTORY") {
- const { changeHistory } =
- await useChangeHistoryStore().exportChangeHistoryFullStatementByName(
- change.source
- );
- change.version = changeHistory?.version || "";
+ if (sourceType === "CHANGELOG") {
+ const changelog = await useChangelogStore().getOrFetchChangelogByName(
+ change.source
+ );
+ change.version = changelog?.version || "";
}
if (change.version === "") {
change.version = fallbackVersionForChange();
@@ -225,9 +196,8 @@ const doAddChange = async () => {
};
const reset = () => {
- changeSource.value = "CHANGE_HISTORY";
- changesFromChangeHistory.value = [];
- changesFromBranch.value = [];
+ changeSource.value = "CHANGELOG";
+ changesFromChangelog.value = [];
changeFromRawSQL.value = emptyRawSQLChange(project.value.name);
};
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/context.ts b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/context.ts
index e5a0db9209..752da386cb 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/context.ts
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/context.ts
@@ -11,8 +11,7 @@ export type AddChangeEvents = Emittery<{}>;
export type AddChangeContext = {
changeSource: Ref<ChangeSource>;
- changesFromChangeHistory: Ref<Change[]>;
- changesFromBranch: Ref<Change[]>;
+ changesFromChangelog: Ref<Change[]>;
changeFromRawSQL: Ref<Change>;
events: AddChangeEvents;
@@ -30,9 +29,8 @@ export const provideAddChangeContext = () => {
const { project } = useChangelistDetailContext();
const context: AddChangeContext = {
- changeSource: ref("CHANGE_HISTORY"),
- changesFromChangeHistory: ref([]),
- changesFromBranch: ref([]),
+ changeSource: ref("CHANGELOG"),
+ changesFromChangelog: ref([]),
changeFromRawSQL: ref(emptyRawSQLChange(project.value.name)),
events: new Emittery(),
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/BranchChangeItem.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/BranchChangeItem.vue
deleted file mode 100644
index 040a3e0c38..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/BranchChangeItem.vue
+++ /dev/null
@@ -1,69 +0,0 @@
-<template>
- <div class="flex flex-row items-center justify-between gap-x-2 group">
- <div class="flex flex-row items-center gap-x-2">
- <div
- class="flex flex-row items-center gap-x-1 border-b border-transparent group-hover:border-control-border cursor-pointer"
- @click="$emit('click-item', change)"
- >
- <RichDatabaseName
- :database="database"
- :show-instance="false"
- :show-arrow="false"
- :show-production-environment-icon="false"
- tooltip="instance"
- />
- <span>@</span>
- <div>
- {{ branch.branchId }}
- </div>
- </div>
- </div>
- <div
- class="flex flex-row items-center justify-end gap-x-1 invisible group-hover:visible"
- >
- <NButton
- size="small"
- quaternary
- style="--n-padding: 0 6px"
- @click.stop="$emit('remove-item', change)"
- >
- <template #icon>
- <heroicons:x-mark />
- </template>
- </NButton>
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { NButton } from "naive-ui";
-import { computed } from "vue";
-import { RichDatabaseName } from "@/components/v2";
-import { useDatabaseV1Store } from "@/store";
-import { Branch } from "@/types/proto/v1/branch_service";
-import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
-
-const props = defineProps<{
- change: Change;
- branch: Branch | undefined;
-}>();
-
-defineEmits<{
- (event: "click-item", change: Change): void;
- (event: "remove-item", change: Change): void;
-}>();
-
-const branch = computed(() => {
- return (
- props.branch ??
- Branch.fromPartial({
- name: props.change.source,
- branchId: "<<Unknown Branch>>",
- })
- );
-});
-
-const database = computed(() => {
- return useDatabaseV1Store().getDatabaseByName(branch.value.baselineDatabase);
-});
-</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryForm.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryForm.vue
deleted file mode 100644
index bf757ef5a2..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryForm.vue
+++ /dev/null
@@ -1,264 +0,0 @@
-<template>
- <div class="flex flex-col items-stretch gap-y-4 overflow-x-hidden">
- <div class="flex flex-col gap-y-2 max-w-max">
- <div
- v-if="changes.length === 0"
- class="text-control-placeholder text-sm leading-[28px]"
- >
- {{
- $t(
- "changelist.add-change.change-history.select-at-least-one-history-below"
- )
- }}
- </div>
- <ChangeHistoryChangeItem
- v-for="change in changes"
- :key="change.source"
- :change="change"
- @click-item="handleClickChange($event)"
- @remove-item="handleRemoveChange($event)"
- />
- </div>
- <div class="flex flex-row items-center justify-between py-0.5">
- <div class="flex flex-row items-center justify-start gap-x-2">
- <DatabaseSelect
- v-model:database-name="state.databaseName"
- :project-name="project.name"
- />
- <AffectedTableSelect
- v-model:affected-table="state.affectedTable"
- :change-history-list="state.changeHistoryList"
- style="width: 12rem"
- />
- <NCheckboxGroup v-model:value="state.changeHistoryTypes">
- <NCheckbox :value="ChangeHistory_Type.MIGRATE">DDL</NCheckbox>
- <NCheckbox :value="ChangeHistory_Type.DATA">DML</NCheckbox>
- </NCheckboxGroup>
- </div>
- <div class="flex flex-row items-center justify-end gap-x-2">
- <SearchBox
- v-model:value="state.keyword"
- :placeholder="$t('changelist.change-source.filter')"
- />
- </div>
- </div>
- <ChangeHistoryTable
- v-model:selected="selectedChangeHistoryList"
- :change-history-list="filteredChangeHistoryList"
- :is-fetching="state.isLoading"
- :keyword="state.keyword"
- @click-item="state.detailChangeHistoryName = $event.name"
- />
-
- <ChangeHistoryDetailPanel
- :change-history-name="state.detailChangeHistoryName"
- @close="state.detailChangeHistoryName = undefined"
- />
- </div>
-</template>
-
-<script setup lang="ts">
-import { first, isEqual, orderBy } from "lodash-es";
-import { NCheckbox, NCheckboxGroup } from "naive-ui";
-import { computed, reactive, watch } from "vue";
-import { AffectedTableSelect } from "@/components/ChangeHistory";
-import { DatabaseSelect, SearchBox } from "@/components/v2";
-import { issueServiceClient } from "@/grpcweb";
-import {
- useChangeHistoryStore,
- useDBSchemaV1Store,
- useDatabaseV1Store,
-} from "@/store";
-import {
- isValidDatabaseName,
- type AffectedTable,
- EmptyAffectedTable,
-} from "@/types";
-import { type ComposedChangeHistory } from "@/types";
-import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
-import {
- ChangeHistory_Status,
- ChangeHistory_Type,
-} from "@/types/proto/v1/database_service";
-import type { Issue } from "@/types/proto/v1/issue_service";
-import {
- extractDatabaseResourceName,
- extractIssueUID,
- getAffectedTablesOfChangeHistory,
-} from "@/utils";
-import ChangeHistoryDetailPanel from "../../ChangeHistoryDetailPanel";
-import { useChangelistDetailContext } from "../../context";
-import { useAddChangeContext } from "../context";
-import ChangeHistoryChangeItem from "./ChangeHistoryChangeItem.vue";
-import ChangeHistoryTable from "./ChangeHistoryTable";
-import { semanticChangeHistoryType } from "./utils";
-
-type LocalState = {
- isLoading: boolean;
- keyword: string;
- databaseName: string | undefined;
- changeHistoryList: ComposedChangeHistory[];
- affectedTable: AffectedTable;
- changeHistoryTypes: ChangeHistory_Type[];
- detailChangeHistoryName: string | undefined;
-};
-
-const changeHistoryStore = useChangeHistoryStore();
-const { project } = useChangelistDetailContext();
-const { changesFromChangeHistory: changes } = useAddChangeContext();
-
-const state = reactive<LocalState>({
- isLoading: false,
- keyword: "",
- databaseName: undefined,
- changeHistoryList: [],
- affectedTable: EmptyAffectedTable,
- changeHistoryTypes: [ChangeHistory_Type.DATA, ChangeHistory_Type.MIGRATE],
- detailChangeHistoryName: undefined,
-});
-
-const database = computed(() => {
- const name = state.databaseName;
- if (!isValidDatabaseName(name)) return undefined;
- return useDatabaseV1Store().getDatabaseByName(name);
-});
-
-const filteredChangeHistoryList = computed(() => {
- const types = state.changeHistoryTypes;
- let list = state.changeHistoryList.filter((changeHistory) => {
- const semanticType = semanticChangeHistoryType(changeHistory.type);
- return (
- types.includes(semanticType) &&
- changeHistory.status === ChangeHistory_Status.DONE
- );
- });
-
- const kw = state.keyword.trim().toLowerCase();
- if (kw) {
- list = list.filter((changeHistory) => {
- return (
- changeHistory.version.toLowerCase().includes(kw) ||
- changeHistory.issueEntity?.title?.toLowerCase()?.includes(kw)
- );
- });
- }
- const { affectedTable: table } = state;
- if (!isEqual(table, EmptyAffectedTable)) {
- list = list.filter((changeHistory) => {
- const affectedTables = getAffectedTablesOfChangeHistory(changeHistory);
- return affectedTables.find((item) => isEqual(item, table));
- });
- }
-
- return list;
-});
-
-const selectedChangeHistoryList = computed<string[]>({
- get() {
- return changes.value.map((change) => {
- return change.source;
- });
- },
- set(selected) {
- const changeHistories: ComposedChangeHistory[] = [];
- for (let i = 0; i < selected.length; i++) {
- const name = selected[i];
- const changeHistory = changeHistoryStore.getChangeHistoryByName(name);
- if (changeHistory) {
- changeHistories.push(changeHistory);
- }
- }
-
- const updatedChanges = orderBy(
- changeHistories,
- [(ch) => parseInt(extractIssueUID(ch.issue), 10)],
- ["asc"]
- ).map<Change>((changeHistory) => ({
- sheet: changeHistory.statementSheet,
- source: changeHistory.name,
- version: changeHistory.version,
- }));
- changes.value = updatedChanges;
- },
-});
-
-const composeChangeHistory = async (
- history: ComposedChangeHistory
-): Promise<ComposedChangeHistory> => {
- let issue: Issue | undefined = history.issueEntity;
- if (!issue && history.issue) {
- issue = await issueServiceClient.getIssue(
- {
- name: history.issue,
- },
- { silent: true }
- );
- }
- return {
- ...history,
- issueEntity: issue,
- };
-};
-
-const fetchChangeHistoryList = async () => {
- const db = database.value;
- if (!db) {
- state.changeHistoryList = [];
- return;
- }
-
- state.isLoading = true;
- const name = db.name;
- await useDBSchemaV1Store().getOrFetchDatabaseMetadata({
- database: name,
- skipCache: false,
- silent: true,
- });
- const changeHistoryList =
- await changeHistoryStore.getOrFetchChangeHistoryListOfDatabase(name);
- const composedHistories = await Promise.all(
- changeHistoryList.map((history) => composeChangeHistory(history))
- );
- // Check if the state is still valid
- if (name === database.value?.name) {
- state.changeHistoryList = composedHistories;
- }
- state.isLoading = false;
-};
-
-const handleRemoveChange = (change: Change) => {
- const index = changes.value.findIndex((c) => c.source === change.source);
- if (index >= 0) {
- changes.value.splice(index, 1);
- }
-};
-
-const handleClickChange = (change: Change) => {
- const changeHistoryName = change.source;
- const database = useDatabaseV1Store().getDatabaseByName(
- extractDatabaseResourceName(changeHistoryName).database
- );
- state.databaseName = database.name;
- state.detailChangeHistoryName = changeHistoryName;
-};
-
-// Select the first database automatically
-watch(
- () => project.value.name,
- (project) => {
- const databaseList = useDatabaseV1Store().databaseListByProject(project);
- state.databaseName = first(databaseList)?.name;
- },
- { immediate: true }
-);
-
-watch(() => database.value?.name, fetchChangeHistoryList, { immediate: true });
-
-watch(
- () => state.changeHistoryList,
- () => {
- state.affectedTable = EmptyAffectedTable;
- },
- { immediate: true }
-);
-</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/ChangeHistoryTable.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/ChangeHistoryTable.vue
deleted file mode 100644
index e0b63202aa..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/ChangeHistoryTable.vue
+++ /dev/null
@@ -1,137 +0,0 @@
-<template>
- <NDataTable
- :columns="dataTableColumns"
- :data="changeHistoryList"
- :row-key="(history: ComposedChangeHistory) => history.name"
- :bordered="true"
- :checked-row-keys="props.selected"
- :loading="isFetching"
- :row-props="rowProps"
- @update:checked-row-keys="handleSelection"
- />
-</template>
-
-<script setup lang="tsx">
-import { escape } from "lodash-es";
-import type { DataTableColumn, DataTableRowKey } from "naive-ui";
-import { NDataTable } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { type ComposedChangeHistory } from "@/types";
-import { getHighlightHTMLByRegExp } from "@/utils";
-import { displaySemanticType } from "../utils";
-import IssueUID from "./IssueUID.vue";
-import SQL from "./SQL.vue";
-import Tables from "./Tables.vue";
-
-const props = defineProps<{
- selected: string[];
- changeHistoryList: ComposedChangeHistory[];
- isFetching: boolean;
- keyword: string;
-}>();
-
-const emit = defineEmits<{
- (event: "update:selected", selected: string[]): void;
- (event: "click-item", change: ComposedChangeHistory): void;
-}>();
-
-const { t } = useI18n();
-
-const dataTableColumns = computed(() => {
- return [
- {
- type: "selection",
- cellProps: () => {
- return {
- onClick: (e: MouseEvent) => {
- e.stopPropagation();
- },
- };
- },
- },
- {
- key: "type",
- title: t("common.type"),
- width: "5rem",
- render: (changeHistory) => displaySemanticType(changeHistory.type),
- },
- {
- key: "version",
- title: t("common.version"),
- width: "14rem",
- resizable: true,
- render: (changeHistory) => {
- return (
- <span
- class="whitespace-nowrap"
- innerHTML={renderVersion(changeHistory)}
- />
- );
- },
- },
- {
- key: "issueId",
- title: t("common.issue"),
- minWidth: "10rem",
- resizable: true,
- render: (changeHistory) => {
- return (
- <IssueUID changeHistory={changeHistory} keyword={props.keyword} />
- );
- },
- },
- {
- key: "tables",
- title: t("changelist.change-source.change-history.tables"),
- minWidth: "10rem",
- maxWidth: "30rem",
- className: "truncate",
- resizable: true,
- render: (changeHistory) => {
- return <Tables changeHistory={changeHistory} />;
- },
- },
- {
- key: "sql",
- title: t("common.sql"),
- minWidth: "10rem",
- maxWidth: "30rem",
- className: "truncate",
- resizable: true,
- render: (changeHistory) => {
- return <SQL changeHistory={changeHistory} />;
- },
- },
- ] as DataTableColumn<ComposedChangeHistory>[];
-});
-
-const handleSelection = (rowKeys: DataTableRowKey[]) => {
- const keys = rowKeys as string[];
- emit("update:selected", Array.from(keys));
-};
-
-const rowProps = (history: ComposedChangeHistory) => {
- return {
- onClick: () => {
- emit("click-item", history);
- },
- };
-};
-
-const renderVersion = (item: ComposedChangeHistory) => {
- const keyword = props.keyword.trim().toLowerCase();
-
- const { version } = item;
-
- if (!keyword) {
- return escape(version);
- }
-
- return getHighlightHTMLByRegExp(
- escape(version),
- escape(keyword),
- false /* !caseSensitive */
- );
-};
-</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/IssueUID.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/IssueUID.vue
deleted file mode 100644
index 388c4651ef..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/IssueUID.vue
+++ /dev/null
@@ -1,50 +0,0 @@
-<template>
- <div
- v-if="changeHistory.issueEntity"
- class="flex items-center overflow-hidden space-x-1"
- >
- <router-link
- :to="{
- path: `/${changeHistory.issueEntity.name}`,
- }"
- class="normal-link"
- target="_blank"
- @click.stop
- >
- #{{ extractIssueUID(changeHistory.issueEntity.name) }}
- </router-link>
- <NPerformantEllipsis class="flex-1 truncate">
- <!-- eslint-disable-next-line vue/no-v-html -->
- <span class="textinfo" v-html="issueTitle" />
- </NPerformantEllipsis>
- </div>
- <span v-else>-</span>
-</template>
-
-<script setup lang="ts">
-import { escape } from "lodash-es";
-import { NPerformantEllipsis } from "naive-ui";
-import { computed } from "vue";
-import { type ComposedChangeHistory } from "@/types";
-import { extractIssueUID, getHighlightHTMLByRegExp } from "@/utils";
-
-const props = defineProps<{
- changeHistory: ComposedChangeHistory;
- keyword: string;
-}>();
-
-const issueTitle = computed(() => {
- const keyword = props.keyword.trim().toLowerCase();
- const title = props.changeHistory.issueEntity?.title ?? "";
-
- if (!keyword) {
- return title;
- }
-
- return getHighlightHTMLByRegExp(
- title,
- escape(keyword),
- false /* !caseSensitive */
- );
-});
-</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/SQL.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/SQL.vue
deleted file mode 100644
index 3e80ac112e..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/SQL.vue
+++ /dev/null
@@ -1,17 +0,0 @@
-<template>
- <TextOverflowPopover
- :content="changeHistory.statement"
- :max-length="100"
- content-class="whitespace-nowrap w-full truncate"
- placement="bottom"
- />
-</template>
-
-<script setup lang="ts">
-import TextOverflowPopover from "@/components/misc/TextOverflowPopover.vue";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
-
-defineProps<{
- changeHistory: ChangeHistory;
-}>();
-</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/Tables.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/Tables.vue
deleted file mode 100644
index 1e9547b083..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/Tables.vue
+++ /dev/null
@@ -1,27 +0,0 @@
-<template>
- <TextOverflowPopover
- :content="content"
- :max-length="100"
- placement="bottom"
- />
-</template>
-
-<script setup lang="ts">
-import { computed } from "vue";
-import TextOverflowPopover from "@/components/misc/TextOverflowPopover.vue";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
-import {
- getAffectedTableDisplayName,
- getAffectedTablesOfChangeHistory,
-} from "@/utils";
-
-const props = defineProps<{
- changeHistory: ChangeHistory;
-}>();
-
-const content = computed(() => {
- return getAffectedTablesOfChangeHistory(props.changeHistory)
- .map(getAffectedTableDisplayName)
- .join(", ");
-});
-</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/index.ts b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/index.ts
deleted file mode 100644
index 446adf5c9b..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryTable/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import ChangeHistoryTable from "./ChangeHistoryTable.vue";
-
-export default ChangeHistoryTable;
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryChangeItem.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangelogChangeItem.vue
similarity index 76%
rename from frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryChangeItem.vue
rename to frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangelogChangeItem.vue
index 0fab352fd0..57bc0dee55 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangeHistoryChangeItem.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangelogChangeItem.vue
@@ -3,7 +3,7 @@
<div class="flex flex-row items-center gap-x-2">
<NTag>
<span class="inline-block w-[30px] text-center">
- {{ displaySemanticType(changeHistory.type) }}
+ {{ getChangelogChangeType(changelog.type) }}
</span>
</NTag>
<div
@@ -18,16 +18,16 @@
tooltip="instance"
/>
<span>@</span>
- <span class="text-sm">{{ changeHistory.version }}</span>
+ <span class="text-sm">{{ changelog.version }}</span>
<router-link
:to="{
- path: `/${changeHistory.issue}`,
+ path: `/${changelog.issue}`,
}"
class="normal-link text-sm hover:!no-underline"
target="_blank"
@click.stop
>
- #{{ extractIssueUID(changeHistory.issue) }}
+ #{{ extractIssueUID(changelog.issue) }}
</router-link>
</div>
</div>
@@ -52,11 +52,11 @@
import { NButton, NTag } from "naive-ui";
import { computed } from "vue";
import { RichDatabaseName } from "@/components/v2";
-import { useChangeHistoryStore, useDatabaseV1Store } from "@/store";
+import { useChangelogStore, useDatabaseV1Store } from "@/store";
import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
-import { ChangeHistory } from "@/types/proto/v1/database_service";
+import { Changelog } from "@/types/proto/v1/database_service";
import { extractDatabaseResourceName, extractIssueUID } from "@/utils";
-import { displaySemanticType } from "./utils";
+import { getChangelogChangeType } from "@/utils/v1/changelog";
const props = defineProps<{
change: Change;
@@ -67,19 +67,19 @@ defineEmits<{
(event: "remove-item", change: Change): void;
}>();
-const changeHistory = computed(() => {
+const changelog = computed(() => {
const name = props.change.source;
return (
- useChangeHistoryStore().getChangeHistoryByName(name) ??
- ChangeHistory.fromPartial({
+ useChangelogStore().getChangelogByName(name) ??
+ Changelog.fromPartial({
name,
- version: "<<Unknown Change History>>",
+ version: "<<Unknown Changelog>>",
})
);
});
const database = computed(() => {
- const { database } = extractDatabaseResourceName(changeHistory.value.name);
+ const { database } = extractDatabaseResourceName(changelog.value.name);
return useDatabaseV1Store().getDatabaseByName(database);
});
</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangelogForm.vue b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangelogForm.vue
new file mode 100644
index 0000000000..105dcb7f52
--- /dev/null
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/ChangelogForm.vue
@@ -0,0 +1,198 @@
+<template>
+ <div class="flex flex-col items-stretch gap-y-4 overflow-x-hidden">
+ <div class="flex flex-col gap-y-2 max-w-max">
+ <div
+ v-if="changes.length === 0"
+ class="text-control-placeholder text-sm leading-[28px]"
+ >
+ {{
+ $t(
+ "changelist.add-change.change-history.select-at-least-one-history-below"
+ )
+ }}
+ </div>
+ <ChangelogChangeItem
+ v-for="change in changes"
+ :key="change.source"
+ :change="change"
+ @click-item="handleClickChange($event)"
+ @remove-item="handleRemoveChange($event)"
+ />
+ </div>
+ <div class="flex flex-row items-center justify-start gap-x-2">
+ <DatabaseSelect
+ v-model:database-name="state.databaseName"
+ :project-name="project.name"
+ />
+ <NCheckboxGroup v-model:value="state.changelogTypes">
+ <NCheckbox :value="Changelog_Type.MIGRATE">DDL</NCheckbox>
+ <NCheckbox :value="Changelog_Type.DATA">DML</NCheckbox>
+ </NCheckboxGroup>
+ </div>
+ <ChangelogDataTable
+ v-model:selected-changelogs="selectedChangelogList"
+ :changelogs="filteredChangelogList"
+ :show-selection="true"
+ :custom-click="true"
+ @row-click="state.detailChangelogName = $event.name"
+ />
+ <ChangelogDetailPanel
+ :changelog-name="state.detailChangelogName"
+ @close="state.detailChangelogName = undefined"
+ />
+ </div>
+</template>
+
+<script setup lang="ts">
+import { first, orderBy } from "lodash-es";
+import { NCheckbox, NCheckboxGroup } from "naive-ui";
+import { computed, reactive, watch } from "vue";
+import { ChangelogDataTable } from "@/components/Changelog";
+import { DatabaseSelect } from "@/components/v2";
+import {
+ useChangelogStore,
+ useDBSchemaV1Store,
+ useDatabaseV1Store,
+} from "@/store";
+import {
+ isValidDatabaseName,
+ type AffectedTable,
+ EmptyAffectedTable,
+} from "@/types";
+import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
+import {
+ Changelog,
+ Changelog_Status,
+ Changelog_Type,
+} from "@/types/proto/v1/database_service";
+import { extractDatabaseResourceName, extractIssueUID } from "@/utils";
+import ChangelogDetailPanel from "../../ChangelogDetailPanel";
+import { useChangelistDetailContext } from "../../context";
+import { useAddChangeContext } from "../context";
+import ChangelogChangeItem from "./ChangelogChangeItem.vue";
+
+type LocalState = {
+ isLoading: boolean;
+ databaseName: string | undefined;
+ changelogList: Changelog[];
+ affectedTable: AffectedTable;
+ changelogTypes: Changelog_Type[];
+ detailChangelogName: string | undefined;
+};
+
+const changelogStore = useChangelogStore();
+const { project } = useChangelistDetailContext();
+const { changesFromChangelog: changes } = useAddChangeContext();
+
+const state = reactive<LocalState>({
+ isLoading: false,
+ databaseName: undefined,
+ changelogList: [],
+ affectedTable: EmptyAffectedTable,
+ changelogTypes: [Changelog_Type.DATA, Changelog_Type.MIGRATE],
+ detailChangelogName: undefined,
+});
+
+const database = computed(() => {
+ const name = state.databaseName;
+ if (!isValidDatabaseName(name)) return undefined;
+ return useDatabaseV1Store().getDatabaseByName(name);
+});
+
+const filteredChangelogList = computed(() => {
+ return state.changelogList.filter((changelog) => {
+ return (
+ state.changelogTypes.includes(changelog.type) &&
+ changelog.status === Changelog_Status.DONE
+ );
+ });
+});
+
+const selectedChangelogList = computed<string[]>({
+ get() {
+ return changes.value.map((change) => {
+ return change.source;
+ });
+ },
+ set(selected) {
+ const changelogs: Changelog[] = [];
+ for (let i = 0; i < selected.length; i++) {
+ const name = selected[i];
+ const changelog = changelogStore.getChangelogByName(name);
+ if (changelog) {
+ changelogs.push(changelog);
+ }
+ }
+
+ const updatedChanges = orderBy(
+ changelogs,
+ [(c) => parseInt(extractIssueUID(c.issue), 10)],
+ ["asc"]
+ ).map<Change>((changelog) => ({
+ sheet: changelog.statementSheet,
+ source: changelog.name,
+ version: changelog.version,
+ }));
+ changes.value = updatedChanges;
+ },
+});
+
+const fetchChangelogList = async () => {
+ const db = database.value;
+ if (!db) {
+ state.changelogList = [];
+ return;
+ }
+
+ state.isLoading = true;
+ const name = db.name;
+ await useDBSchemaV1Store().getOrFetchDatabaseMetadata({
+ database: name,
+ skipCache: false,
+ silent: true,
+ });
+ const changelogList =
+ await changelogStore.getOrFetchChangelogListOfDatabase(name);
+ // Check if the state is still valid
+ if (name === database.value?.name) {
+ state.changelogList = changelogList;
+ }
+ state.isLoading = false;
+};
+
+const handleRemoveChange = (change: Change) => {
+ const index = changes.value.findIndex((c) => c.source === change.source);
+ if (index >= 0) {
+ changes.value.splice(index, 1);
+ }
+};
+
+const handleClickChange = (change: Change) => {
+ const changelogName = change.source;
+ const database = useDatabaseV1Store().getDatabaseByName(
+ extractDatabaseResourceName(changelogName).database
+ );
+ state.databaseName = database.name;
+ state.detailChangelogName = changelogName;
+};
+
+// Select the first database automatically
+watch(
+ () => project.value.name,
+ (project) => {
+ const databaseList = useDatabaseV1Store().databaseListByProject(project);
+ state.databaseName = first(databaseList)?.name;
+ },
+ { immediate: true }
+);
+
+watch(() => database.value?.name, fetchChangelogList, { immediate: true });
+
+watch(
+ () => state.changelogList,
+ () => {
+ state.affectedTable = EmptyAffectedTable;
+ },
+ { immediate: true }
+);
+</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/index.ts b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/index.ts
index 6a384a1833..9f498750c1 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/index.ts
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/index.ts
@@ -1,4 +1,4 @@
-import ChangeHistoryForm from "./ChangeHistoryForm.vue";
+import ChangelogForm from "./ChangelogForm.vue";
import RawSQLForm from "./RawSQLForm.vue";
-export { ChangeHistoryForm, RawSQLForm };
+export { ChangelogForm, RawSQLForm };
diff --git a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/utils.ts b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/utils.ts
index 59a1f2ac5a..e69de29bb2 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/utils.ts
+++ b/frontend/src/components/Changelist/ChangelistDetail/AddChangePanel/form/utils.ts
@@ -1,45 +0,0 @@
-import { orderBy, uniqBy } from "lodash-es";
-import { EmptyAffectedTable } from "@/types";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
-import { ChangeHistory_Type } from "@/types/proto/v1/database_service";
-import { getAffectedTablesOfChangeHistory } from "@/utils";
-
-export const getAffectedTablesFromChangeHistoryList = (
- changeHistoryList: ChangeHistory[]
-) => {
- return [
- EmptyAffectedTable,
- ...orderBy(
- uniqBy(
- changeHistoryList
- .map((changeHistory) =>
- getAffectedTablesOfChangeHistory(changeHistory)
- )
- .flat(),
- (affectedTable) => `${affectedTable.schema}.${affectedTable.table}`
- ),
- ["dropped", "table", "schema"]
- ),
- ];
-};
-
-export const semanticChangeHistoryType = (type: ChangeHistory_Type) => {
- switch (type) {
- case ChangeHistory_Type.BASELINE:
- case ChangeHistory_Type.MIGRATE:
- case ChangeHistory_Type.MIGRATE_SDL:
- case ChangeHistory_Type.MIGRATE_GHOST:
- return ChangeHistory_Type.MIGRATE;
- case ChangeHistory_Type.DATA:
- return ChangeHistory_Type.DATA;
- default:
- return ChangeHistory_Type.UNRECOGNIZED;
- }
-};
-
-export const displaySemanticType = (type: ChangeHistory_Type) => {
- const semanticType = semanticChangeHistoryType(type);
- if (semanticType === ChangeHistory_Type.MIGRATE) return "DDL";
- if (semanticType === ChangeHistory_Type.DATA) return "DML";
- return "-";
-};
diff --git a/frontend/src/components/Changelist/ChangelistDetail/BranchDetailPanel/BranchBaseline.vue b/frontend/src/components/Changelist/ChangelistDetail/BranchDetailPanel/BranchBaseline.vue
deleted file mode 100644
index 7086c38bf8..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/BranchDetailPanel/BranchBaseline.vue
+++ /dev/null
@@ -1,26 +0,0 @@
-<template>
- <div class="flex flex-row justify-start items-center opacity-80">
- <span class="mr-4 shrink-0"
- >{{ $t("schema-designer.baseline-version") }}:</span
- >
- <DatabaseInfo
- class="flex-nowrap mr-4 shrink-0"
- :database="baselineDatabase"
- />
- </div>
-</template>
-
-<script setup lang="ts">
-import { computed } from "vue";
-import DatabaseInfo from "@/components/DatabaseInfo.vue";
-import { useDatabaseV1Store } from "@/store";
-import type { Branch } from "@/types/proto/v1/branch_service";
-
-const props = defineProps<{
- branch: Branch;
-}>();
-
-const baselineDatabase = computed(() => {
- return useDatabaseV1Store().getDatabaseByName(props.branch.baselineDatabase);
-});
-</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue b/frontend/src/components/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue
deleted file mode 100644
index 3866a202ec..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/BranchDetailPanel/BranchDetailPanel.vue
+++ /dev/null
@@ -1,82 +0,0 @@
-<template>
- <Drawer :show="show" @close="$emit('close')">
- <DrawerContent
- :title="title"
- style="width: 75vw; max-width: calc(100vw - 8rem)"
- >
- <div class="h-full flex flex-col gap-y-2">
- <div class="w-full flex flex-row justify-between items-center gap-2">
- <BranchBaseline v-if="branch" :branch="branch" />
- </div>
- <SchemaDesignEditorLite
- v-if="editorBindings"
- class="flex-1"
- :readonly="true"
- :project="editorBindings.project"
- :branch="editorBindings.branch"
- :hide-s-q-l-check-button="true"
- />
- </div>
- </DrawerContent>
- </Drawer>
-</template>
-
-<script setup lang="ts">
-import { asyncComputed } from "@vueuse/core";
-import { computed, ref, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import SchemaDesignEditorLite from "@/components/Branch/SchemaDesignEditorLite.vue";
-import { Drawer, DrawerContent } from "@/components/v2";
-import { useDatabaseV1Store } from "@/store";
-import { useBranchStore } from "@/store/modules/branch";
-import BranchBaseline from "./BranchBaseline.vue";
-
-const props = defineProps<{
- branchName?: string;
-}>();
-
-defineEmits<{
- (event: "close"): void;
-}>();
-
-const { t } = useI18n();
-const title = ref(t("common.branch"));
-
-const branch = asyncComputed(async () => {
- const { branchName } = props;
- if (!branchName) {
- return undefined;
- }
- return await useBranchStore().fetchBranchByName(
- branchName,
- true /* useCache */
- );
-}, undefined);
-
-const editorBindings = computed(() => {
- if (!branch.value) {
- return undefined;
- }
-
- const db = useDatabaseV1Store().getDatabaseByName(
- branch.value.baselineDatabase
- );
- const project = db.projectEntity;
-
- return {
- readonly: true,
- project,
- branch: branch.value,
- };
-});
-
-const show = computed(() => {
- return branch.value !== undefined;
-});
-
-watch(branch, (branch) => {
- if (branch) {
- title.value = branch.branchId;
- }
-});
-</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/BranchDetailPanel/index.ts b/frontend/src/components/Changelist/ChangelistDetail/BranchDetailPanel/index.ts
deleted file mode 100644
index f4cd81c3ff..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/BranchDetailPanel/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import BranchDetailPanel from "./BranchDetailPanel.vue";
-
-export default BranchDetailPanel;
diff --git a/frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/index.ts b/frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/index.ts
deleted file mode 100644
index 773ae2d5e4..0000000000
--- a/frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import ChangeHistoryDetailPanel from "./ChangeHistoryDetailPanel.vue";
-
-export default ChangeHistoryDetailPanel;
diff --git a/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/DatabaseForChange.vue b/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/DatabaseForChange.vue
index 616d381d79..96d45d367b 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/DatabaseForChange.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/DatabaseForChange.vue
@@ -12,13 +12,9 @@
<script setup lang="ts">
import { asyncComputed } from "@vueuse/core";
import { RichDatabaseName } from "@/components/v2";
-import { useDatabaseV1Store, useBranchStore } from "@/store";
+import { useDatabaseV1Store } from "@/store";
import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
-import {
- extractDatabaseResourceName,
- isBranchChangeSource,
- isChangeHistoryChangeSource,
-} from "@/utils";
+import { extractDatabaseResourceName, isChangelogChangeSource } from "@/utils";
const props = defineProps<{
change: Change;
@@ -27,18 +23,9 @@ const props = defineProps<{
const database = asyncComputed(async () => {
const { change } = props;
const { source } = change;
- if (isChangeHistoryChangeSource(change)) {
+ if (isChangelogChangeSource(change)) {
const { database } = extractDatabaseResourceName(source);
return useDatabaseV1Store().getDatabaseByName(database);
- } else if (isBranchChangeSource(change)) {
- const branch = await useBranchStore().fetchBranchByName(
- source,
- true /* useCache */
- );
-
- return await useDatabaseV1Store().getOrFetchDatabaseByName(
- branch.baselineDatabase
- );
} else {
// Raw SQL
return undefined;
diff --git a/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/Source.vue b/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/Source.vue
index 87c84d43e8..16e479120a 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/Source.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/ChangeTable/Source.vue
@@ -1,37 +1,28 @@
<template>
<div>
- <template v-if="type === 'CHANGE_HISTORY'">
+ <template v-if="type === 'CHANGELOG'">
<div class="flex items-center gap-x-1">
- <History :size="16" />
+ <HistoryIcon :size="16" />
<span>{{ $t("common.change-history") }}</span>
- <span v-if="changeHistory" class="textinfolabel">
- {{ changeHistory.version }}
+ <span v-if="changelog" class="textinfolabel">
+ {{ changelog.version }}
</span>
<router-link
- v-if="changeHistory"
+ v-if="changelog"
:to="{
- path: `/${changeHistory.issue}`,
+ path: `/${changelog.issue}`,
}"
class="normal-link text-sm hover:!no-underline"
target="_blank"
@click.stop
>
- #{{ extractIssueUID(changeHistory.issue) }}
+ #{{ extractIssueUID(changelog.issue) }}
</router-link>
</div>
</template>
- <template v-if="type === 'BRANCH'">
- <div class="flex items-center gap-x-1">
- <GitBranch :size="16" />
- <span>{{ $t("common.branch") }}</span>
- <span v-if="branch" class="textinfolabel">
- {{ branch.branchId }}
- </span>
- </div>
- </template>
<template v-if="type === 'RAW_SQL'">
<div class="flex items-center gap-x-1">
- <File :size="16" />
+ <FileIcon :size="16" />
<span>{{ $t("changelist.change-source.raw-sql") }}</span>
</div>
</template>
@@ -39,10 +30,9 @@
</template>
<script setup lang="ts">
-import { asyncComputed } from "@vueuse/core";
-import { File, GitBranch, History } from "lucide-vue-next";
+import { FileIcon, HistoryIcon } from "lucide-vue-next";
import { computed } from "vue";
-import { useChangeHistoryStore, useBranchStore } from "@/store";
+import { useChangelogStore } from "@/store";
import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
import { extractIssueUID, getChangelistChangeSourceType } from "@/utils";
@@ -54,16 +44,8 @@ const type = computed(() => {
return getChangelistChangeSourceType(props.change);
});
-const changeHistory = computed(() => {
- if (type.value !== "CHANGE_HISTORY") return undefined;
- return useChangeHistoryStore().getChangeHistoryByName(props.change.source);
+const changelog = computed(() => {
+ if (type.value !== "CHANGELOG") return undefined;
+ return useChangelogStore().getChangelogByName(props.change.source);
});
-
-const branch = asyncComputed(() => {
- if (type.value !== "BRANCH") return undefined;
- return useBranchStore().fetchBranchByName(
- props.change.source,
- true /* useCache */
- );
-}, undefined);
</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/ChangelistDetail.vue b/frontend/src/components/Changelist/ChangelistDetail/ChangelistDetail.vue
index 5d430b4646..14e806b223 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/ChangelistDetail.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/ChangelistDetail.vue
@@ -23,13 +23,9 @@
<BBSpin />
</div>
- <ChangeHistoryDetailPanel
- :change-history-name="state.detailChangeHistoryName"
- @close="state.detailChangeHistoryName = undefined"
- />
- <BranchDetailPanel
- :branch-name="state.detailBranchName"
- @close="state.detailBranchName = undefined"
+ <ChangelogDetailPanel
+ :changelog-name="state.detailChangelogName"
+ @close="state.detailChangelogName = undefined"
/>
<RawSQLPanel
:sheet-name="state.detailRawSQLSheetName"
@@ -53,8 +49,7 @@ import { Changelist } from "@/types/proto/v1/changelist_service";
import { getChangelistChangeSourceType } from "@/utils";
import AddChangePanel from "./AddChangePanel";
import ApplyToDatabasePanel from "./ApplyToDatabasePanel";
-import BranchDetailPanel from "./BranchDetailPanel";
-import ChangeHistoryDetailPanel from "./ChangeHistoryDetailPanel";
+import ChangelogDetailPanel from "./ChangelogDetailPanel";
import ChangeTable from "./ChangeTable";
import DeleteChangelistButton from "./DeleteChangelistButton.vue";
import NavBar from "./NavBar";
@@ -68,8 +63,7 @@ const { changelist, reorderMode, isUpdating, events, allowDelete } =
const state = reactive({
changes: [] as Change[],
- detailChangeHistoryName: undefined as string | undefined,
- detailBranchName: undefined as string | undefined,
+ detailChangelogName: undefined as string | undefined,
detailRawSQLSheetName: undefined as string | undefined,
});
@@ -102,11 +96,8 @@ const handleRemoveChange = async (change: Change) => {
};
const handleSelectChange = async (change: Change) => {
const sourceType = getChangelistChangeSourceType(change);
- if (sourceType === "CHANGE_HISTORY") {
- state.detailChangeHistoryName = change.source;
- }
- if (sourceType === "BRANCH") {
- state.detailBranchName = change.source;
+ if (sourceType === "CHANGELOG") {
+ state.detailChangelogName = change.source;
}
if (sourceType === "RAW_SQL") {
state.detailRawSQLSheetName = change.sheet;
diff --git a/frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue b/frontend/src/components/Changelist/ChangelistDetail/ChangelogDetailPanel/ChangelogDetailPanel.vue
similarity index 55%
rename from frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue
rename to frontend/src/components/Changelist/ChangelistDetail/ChangelogDetailPanel/ChangelogDetailPanel.vue
index 35473266d0..3789b2500e 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/ChangeHistoryDetailPanel/ChangeHistoryDetailPanel.vue
+++ b/frontend/src/components/Changelist/ChangelistDetail/ChangelogDetailPanel/ChangelogDetailPanel.vue
@@ -4,7 +4,7 @@
style="width: 75vw; max-width: calc(100vw - 8rem)"
:title="$t('common.change-history')"
>
- <ChangeHistoryDetail v-if="detailBindings" v-bind="detailBindings" />
+ <ChangelogDetail v-if="detailBindings" v-bind="detailBindings" />
</DrawerContent>
</Drawer>
</template>
@@ -12,13 +12,14 @@
<script setup lang="ts">
import { computed } from "vue";
import { Drawer, DrawerContent } from "@/components/v2";
-import { useChangeHistoryStore } from "@/store";
-import { extractChangeHistoryUID, extractDatabaseResourceName } from "@/utils";
-import ChangeHistoryDetail from "@/views/DatabaseDetail/ChangeHistoryDetail.vue";
+import { useChangelogStore } from "@/store";
+import { extractDatabaseResourceName } from "@/utils";
+import { extractChangelogUID } from "@/utils/v1/changelog";
+import ChangelogDetail from "@/views/DatabaseDetail/ChangelogDetail.vue";
import { provideChangelistDetailContext } from "../context";
const props = defineProps<{
- changeHistoryName?: string;
+ changelogName?: string;
}>();
defineEmits<{
@@ -27,30 +28,30 @@ defineEmits<{
const { project } = provideChangelistDetailContext();
-const changeHistory = computed(() => {
- const { changeHistoryName } = props;
- if (!changeHistoryName) {
+const changelog = computed(() => {
+ const { changelogName } = props;
+ if (!changelogName) {
return undefined;
}
- return useChangeHistoryStore().getChangeHistoryByName(changeHistoryName);
+ return useChangelogStore().getChangelogByName(changelogName);
});
const detailBindings = computed(() => {
- if (!changeHistory.value) {
+ if (!changelog.value) {
return undefined;
}
const { instance, database } = extractDatabaseResourceName(
- changeHistory.value.name
+ changelog.value.name
);
return {
project: project.value.name,
instance,
database,
- changeHistoryId: extractChangeHistoryUID(changeHistory.value.name),
+ changelogId: extractChangelogUID(changelog.value.name),
};
});
const show = computed(() => {
- return changeHistory.value !== undefined;
+ return changelog.value !== undefined;
});
</script>
diff --git a/frontend/src/components/Changelist/ChangelistDetail/ChangelogDetailPanel/index.ts b/frontend/src/components/Changelist/ChangelistDetail/ChangelogDetailPanel/index.ts
new file mode 100644
index 0000000000..3f9715c676
--- /dev/null
+++ b/frontend/src/components/Changelist/ChangelistDetail/ChangelogDetailPanel/index.ts
@@ -0,0 +1,3 @@
+import ChangelogDetailPanel from "./ChangelogDetailPanel.vue";
+
+export default ChangelogDetailPanel;
diff --git a/frontend/src/components/Changelist/ChangelistDetail/NavBar/export.ts b/frontend/src/components/Changelist/ChangelistDetail/NavBar/export.ts
index 96194b9cff..68210e8fde 100644
--- a/frontend/src/components/Changelist/ChangelistDetail/NavBar/export.ts
+++ b/frontend/src/components/Changelist/ChangelistDetail/NavBar/export.ts
@@ -1,10 +1,13 @@
+import dayjs from "dayjs";
import type JSZip from "jszip";
import { padStart } from "lodash-es";
-import { useChangeHistoryStore, useSheetV1Store } from "@/store";
-import { useBranchStore } from "@/store/modules/branch";
-import type { Changelist_Change_Source as ChangeSource } from "@/types";
+import { useChangelogStore, useSheetV1Store } from "@/store";
+import {
+ getDateForPbTimestamp,
+ type Changelist_Change_Source as ChangeSource,
+} from "@/types";
import type { Changelist_Change as Change } from "@/types/proto/v1/changelist_service";
-import { ChangeHistoryView } from "@/types/proto/v1/database_service";
+import { ChangelogView } from "@/types/proto/v1/database_service";
import {
escapeFilename,
getChangelistChangeSourceType,
@@ -21,7 +24,7 @@ const buildFileName = (type: ChangeSource, name: string, index: number) => {
return `${basename}.sql`;
};
-const zipFileForChangeHistory = async (
+const zipFileForChangelog = async (
zip: JSZip,
change: Change,
index: number
@@ -30,37 +33,24 @@ const zipFileForChangeHistory = async (
if (!sheet) {
return;
}
- const changeHistory =
- await useChangeHistoryStore().getOrFetchChangeHistoryByName(
- change.source,
- ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL
- );
- if (!changeHistory) {
- return;
- }
-
- const filename = buildFileName(
- "CHANGE_HISTORY",
- changeHistory.version,
- index
- );
- zip.file(filename, getSheetStatement(sheet));
-};
-
-const zipFileForBranch = async (zip: JSZip, change: Change, index: number) => {
- const sheet = await useSheetV1Store().fetchSheetByName(change.sheet, "FULL");
- if (!sheet) {
- return;
- }
- const branch = await useBranchStore().fetchBranchByName(
+ const changelog = await useChangelogStore().getOrFetchChangelogByName(
change.source,
- false /* !useCache */
+ ChangelogView.CHANGELOG_VIEW_FULL
);
- if (!branch) {
+ if (!changelog) {
return;
}
- const filename = buildFileName("BRANCH", branch.branchId, index);
+ const parts: string[] = [
+ dayjs(getDateForPbTimestamp(changelog.createTime)).format(
+ "YYYY-MM-DD HH:mm:ss"
+ ),
+ ];
+ if (changelog.version) {
+ parts.push(changelog.version);
+ }
+
+ const filename = buildFileName("CHANGELOG", parts.join("-"), index);
zip.file(filename, getSheetStatement(sheet));
};
@@ -80,11 +70,8 @@ export const zipFileForChange = async (
index: number
) => {
const type = getChangelistChangeSourceType(change);
- if (type === "CHANGE_HISTORY") {
- await zipFileForChangeHistory(zip, change, index);
- }
- if (type === "BRANCH") {
- await zipFileForBranch(zip, change, index);
+ if (type === "CHANGELOG") {
+ await zipFileForChangelog(zip, change, index);
}
if (type === "RAW_SQL") {
await zipFileForRawSQL(zip, change, index);
diff --git a/frontend/src/components/Changelog/ChangelogDataTable.vue b/frontend/src/components/Changelog/ChangelogDataTable.vue
index 40b559eac9..06ae481b83 100644
--- a/frontend/src/components/Changelog/ChangelogDataTable.vue
+++ b/frontend/src/components/Changelog/ChangelogDataTable.vue
@@ -33,7 +33,6 @@ import {
} from "@/utils";
import {
changelogLink,
- extractChangelogUID,
getAffectedTablesOfChangelog,
getChangelogChangeType,
} from "@/utils/v1/changelog";
@@ -49,7 +48,7 @@ const props = defineProps<{
const emit = defineEmits<{
(event: "update:selected-changelogs", value: string[]): void;
- (event: "row-click", id: string): void;
+ (event: "row-click", changelog: Changelog): void;
}>();
const router = useRouter();
@@ -199,7 +198,7 @@ const rowProps = (changelog: Changelog) => {
return {
onClick: (e: MouseEvent) => {
if (props.customClick) {
- emit("row-click", extractChangelogUID(changelog.name));
+ emit("row-click", changelog);
return;
}
diff --git a/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue b/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue
deleted file mode 100644
index 2be28e480e..0000000000
--- a/frontend/src/components/Database/DatabaseChangeHistoryPanel.vue
+++ /dev/null
@@ -1,302 +0,0 @@
-<template>
- <div class="flex flex-col space-y-4" v-bind="$attrs">
- <div
- class="w-full flex flex-row justify-between items-center text-lg leading-6 font-medium text-main space-x-2"
- >
- <div class="flex flex-row justify-start items-center space-x-4">
- <div class="w-56">
- <AffectedTablesSelect
- v-model:tables="state.selectedAffectedTables"
- :database="database"
- />
- </div>
- <div class="w-44">
- <ChangeTypeSelect
- v-model:change-type="state.selectedChangeType"
- :change-history-list="changeHistoryList"
- />
- </div>
- </div>
- <div class="flex flex-row justify-end items-center grow space-x-2">
- <BBSpin
- v-if="state.loading"
- :size="20"
- :title="$t('change-history.refreshing-history')"
- />
- <TooltipButton
- tooltip-mode="DISABLED-ONLY"
- :disabled="!allowExportChangeHistory"
- :loading="state.isExporting"
- @click="handleExportChangeHistory"
- >
- <template #default>
- {{ $t("change-history.export") }}
- </template>
- <template #tooltip>
- <div class="whitespace-pre-line">
- {{ $t("change-history.need-to-select-first") }}
- </div>
- </template>
- </TooltipButton>
- <TooltipButton
- v-if="allowAlterSchema"
- tooltip-mode="DISABLED-ONLY"
- :disabled="
- !selectedChangeHistory ||
- getHistoryChangeType(selectedChangeHistory.type) !== 'DDL'
- "
- @click="rollback"
- >
- <template #default>
- {{ $t("common.rollback") }}
- </template>
- <template #tooltip>
- <div class="whitespace-pre-line">
- {{ $t("change-history.rollback-tip") }}
- </div>
- </template>
- </TooltipButton>
- <TooltipButton
- v-if="allowEstablishBaseline"
- tooltip-mode="DISABLED-ONLY"
- :disabled="false"
- type="primary"
- @click="state.showBaselineModal = true"
- >
- <template #default>
- {{ $t("change-history.establish-baseline") }}
- </template>
- <template v-if="database.project === DEFAULT_PROJECT_NAME" #tooltip>
- <div class="whitespace-pre-line">
- {{
- $t("issue.not-allowed-to-operate-unassigned-database", {
- operation: $t(
- "change-history.establish-baseline"
- ).toLowerCase(),
- })
- }}
- </div>
- </template>
- </TooltipButton>
- </div>
- </div>
-
- <PagedChangeHistoryTable
- :database="database"
- :search-change-histories="{
- tables: state.selectedAffectedTables,
- types: state.selectedChangeType
- ? [state.selectedChangeType]
- : undefined,
- }"
- session-key="bb.paged-change-history-table"
- >
- <template #table="{ list, loading }">
- <ChangeHistoryDataTable
- :key="`change-history-table.${database.name}`"
- v-model:selected-change-history-names="
- state.selectedChangeHistoryNameList
- "
- :loading="loading"
- :change-histories="list"
- :show-selection="true"
- />
- </template>
- </PagedChangeHistoryTable>
- </div>
-
- <BBAlert
- v-model:show="state.showBaselineModal"
- data-label="bb-change-history-establish-baseline-alert"
- type="info"
- :ok-text="$t('change-history.establish-baseline')"
- :cancel-text="$t('common.cancel')"
- :title="
- $t('change-history.establish-database-baseline', {
- name: database.databaseName,
- })
- "
- :description="$t('change-history.establish-baseline-description')"
- @ok="doCreateBaseline"
- @cancel="state.showBaselineModal = false"
- />
-</template>
-
-<script lang="ts" setup>
-import dayjs from "dayjs";
-import saveAs from "file-saver";
-import JSZip from "jszip";
-import { computed, onBeforeMount, reactive } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { BBAlert, BBSpin } from "@/bbkit";
-import {
- ChangeHistoryDataTable,
- PagedChangeHistoryTable,
- ChangeTypeSelect,
- AffectedTablesSelect,
-} from "@/components/ChangeHistory";
-import { useDatabaseDetailContext } from "@/components/Database/context";
-import { TooltipButton } from "@/components/v2";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_SYNC_SCHEMA,
-} from "@/router/dashboard/projectV1";
-import { useChangeHistoryStore, useDBSchemaV1Store } from "@/store";
-import { DEFAULT_PAGE_SIZE } from "@/store/modules/common";
-import type { ComposedDatabase, Table } from "@/types";
-import { DEFAULT_PROJECT_NAME } from "@/types";
-import {
- ChangeHistory_Status,
- ChangeHistory_Type,
- ChangeHistoryView,
-} from "@/types/proto/v1/database_service";
-import { extractProjectResourceName, getHistoryChangeType } from "@/utils";
-
-interface LocalState {
- showBaselineModal: boolean;
- loading: boolean;
- selectedChangeHistoryNameList: string[];
- isExporting: boolean;
- selectedAffectedTables: Table[];
- selectedChangeType?: string;
-}
-
-const props = defineProps<{
- database: ComposedDatabase;
-}>();
-
-const { t } = useI18n();
-
-const changeHistoryStore = useChangeHistoryStore();
-const router = useRouter();
-
-const state = reactive<LocalState>({
- showBaselineModal: false,
- loading: false,
- selectedChangeHistoryNameList: [],
- isExporting: false,
- selectedAffectedTables: [],
-});
-
-const { allowAlterSchema } = useDatabaseDetailContext();
-
-const prepareChangeHistoryList = async () => {
- state.loading = true;
- await changeHistoryStore.fetchChangeHistoryList({
- parent: props.database.name,
- pageSize: DEFAULT_PAGE_SIZE,
- });
- // prepare database metadata for getting affected tables.
- await useDBSchemaV1Store().getOrFetchDatabaseMetadata({
- database: props.database.name,
- skipCache: true, // Skip cache to get the latest metadata.
- });
- state.loading = false;
-};
-
-onBeforeMount(prepareChangeHistoryList);
-
-const allowExportChangeHistory = computed(() => {
- return state.selectedChangeHistoryNameList.length > 0;
-});
-
-const allowEstablishBaseline = computed(() => {
- return allowAlterSchema.value;
-});
-
-const changeHistoryList = computed(() => {
- return changeHistoryStore.changeHistoryListByDatabase(props.database.name);
-});
-
-const selectedChangeHistory = computed(() => {
- if (state.selectedChangeHistoryNameList.length !== 1) {
- return;
- }
- return changeHistoryStore.getChangeHistoryByName(
- state.selectedChangeHistoryNameList[0]
- );
-});
-
-const rollback = () => {
- if (!selectedChangeHistory.value) {
- return;
- }
-
- router.push({
- name: PROJECT_V1_ROUTE_SYNC_SCHEMA,
- params: {
- projectId: extractProjectResourceName(props.database.project),
- },
- query: {
- version: selectedChangeHistory.value.name,
- target: props.database.name,
- },
- });
-};
-
-const handleExportChangeHistory = async () => {
- if (state.isExporting) {
- return;
- }
-
- state.isExporting = true;
- const zip = new JSZip();
- for (const name of state.selectedChangeHistoryNameList) {
- const changeHistory = await changeHistoryStore.fetchChangeHistory({
- name,
- view: ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL,
- });
-
- if (changeHistory) {
- if (changeHistory.status !== ChangeHistory_Status.DONE) {
- continue;
- }
-
- if (
- changeHistory.type === ChangeHistory_Type.MIGRATE ||
- changeHistory.type === ChangeHistory_Type.MIGRATE_SDL ||
- changeHistory.type === ChangeHistory_Type.DATA
- ) {
- zip.file(`${changeHistory.version}.sql`, changeHistory.statement);
- } else if (changeHistory.type === ChangeHistory_Type.BASELINE) {
- zip.file(`${changeHistory.version}_baseline.sql`, changeHistory.schema);
- } else {
- // NOT SUPPORTED.
- }
- }
- }
-
- try {
- const content = await zip.generateAsync({ type: "blob" });
- const fileName = `${props.database.databaseName}_${dayjs().format(
- "YYYYMMDD"
- )}.zip`;
- saveAs(content, fileName);
- } catch (error) {
- console.error(error);
- }
-
- state.selectedChangeHistoryNameList = [];
- state.isExporting = false;
-};
-
-const doCreateBaseline = () => {
- state.showBaselineModal = false;
-
- router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(props.database.project),
- issueSlug: "create",
- },
- query: {
- template: "bb.issue.database.schema.baseline",
- name: t("change-history.establish-database-baseline", {
- name: props.database.databaseName,
- }),
- databaseList: props.database.name,
- },
- });
-};
-</script>
diff --git a/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue b/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue
deleted file mode 100644
index 3cbbdf0b6e..0000000000
--- a/frontend/src/components/DatabaseDetail/ChangeHistoryBrief.vue
+++ /dev/null
@@ -1,132 +0,0 @@
-<template>
- <div class="w-full space-y-4 text-sm">
- <div class="flex items-center gap-x-4">
- <label class="w-1/4 flex justify-start textlabel">
- {{ $t("common.version") }}
- </label>
- <div class="flex-1">
- <a
- :href="link"
- target="__BLANK"
- class="normal-link flex items-center gap-x-1"
- >
- {{ changeHistory.version }}
- </a>
- </div>
- </div>
-
- <div v-if="changeHistory" class="flex items-center gap-x-4">
- <label class="w-1/4 flex justify-start textlabel">
- {{ $t("common.issue") }}
- </label>
- <div class="flex-1">
- <router-link
- :to="{
- path: `/${changeHistory.issue}`,
- }"
- target="_blank"
- class="normal-link flex items-center gap-x-1"
- >
- #{{ extractIssueUID(changeHistory.issue) }}
- </router-link>
- </div>
- </div>
-
- <div class="flex items-start gap-x-4">
- <label class="w-1/4 flex justify-start textlabel">
- {{ $t("common.sql") }}
- </label>
- <div class="flex-1">
- <NPopover
- :disabled="changeHistory.statement.length < MAX_SQL_LENGTH"
- style="max-height: 300px"
- placement="bottom"
- overlap
- width="trigger"
- scrollable
- >
- <highlight-code-block
- :code="changeHistory.statement"
- class="whitespace-pre-wrap"
- />
-
- <template #trigger>
- <div class="w-full">
- {{ displayStatement }}
- </div>
- </template>
- </NPopover>
- </div>
- </div>
-
- <div class="flex items-center gap-x-4">
- <label class="w-1/4 flex justify-start textlabel">
- {{ $t("common.created-at") }}
- </label>
- <div class="flex-1">
- <span>{{ createdAt }}</span>
- <span class="textinfolabel ml-1">({{ timezone }})</span>
- </div>
- </div>
-
- <div class="flex items-center gap-x-4">
- <label class="w-1/4 flex justify-start textlabel">
- {{ $t("common.creator") }}
- </label>
- <div v-if="creator" class="flex-1">
- {{ creator.title }} ({{ creator.email }})
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import dayjs from "dayjs";
-import { NPopover } from "naive-ui";
-import type { PropType } from "vue";
-import { computed } from "vue";
-import { useUserStore } from "@/store";
-import { getDateForPbTimestamp, type ComposedDatabase } from "@/types";
-import type { ChangeHistory } from "@/types/proto/v1/database_service";
-import {
- extractUserResourceName,
- extractIssueUID,
- changeHistoryLink as makeChangeHistoryLink,
-} from "@/utils";
-
-const props = defineProps({
- database: {
- type: Object as PropType<ComposedDatabase>,
- required: true,
- },
- changeHistory: {
- type: Object as PropType<ChangeHistory>,
- required: true,
- },
-});
-
-const MAX_SQL_LENGTH = 100;
-
-const link = computed(() => {
- return makeChangeHistoryLink(props.changeHistory);
-});
-
-const createdAt = computed(() => {
- return dayjs(getDateForPbTimestamp(props.changeHistory.createTime)).format(
- "YYYY-MM-DD HH:mm:ss"
- );
-});
-const timezone = computed(() => "UTC" + dayjs().format("ZZ"));
-
-const displayStatement = computed((): string => {
- const { changeHistory } = props;
- return changeHistory.statement.length > MAX_SQL_LENGTH
- ? changeHistory.statement.substring(0, MAX_SQL_LENGTH) + "..."
- : changeHistory.statement;
-});
-
-const creator = computed(() => {
- const email = extractUserResourceName(props.changeHistory.creator);
- return useUserStore().getUserByEmail(email);
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/StatementSection/SDLView/useSDLState.ts b/frontend/src/components/IssueV1/components/StatementSection/SDLView/useSDLState.ts
index e9cd2832e2..17e29427bf 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/SDLView/useSDLState.ts
+++ b/frontend/src/components/IssueV1/components/StatementSection/SDLView/useSDLState.ts
@@ -2,8 +2,8 @@ import Emittery from "emittery";
import { computed, reactive, watch } from "vue";
import { sqlServiceClient } from "@/grpcweb";
import { useSilentRequest } from "@/plugins/silent-request";
-import { useChangeHistoryStore, useDatabaseV1Store } from "@/store";
-import { ChangeHistoryView } from "@/types/proto/v1/database_service";
+import { useChangelogStore, useDatabaseV1Store } from "@/store";
+import { ChangelogView } from "@/types/proto/v1/database_service";
import type { Task } from "@/types/proto/v1/rollout_service";
import { TaskRun_Status, Task_Status } from "@/types/proto/v1/rollout_service";
import { extractTaskUID } from "@/utils";
@@ -44,7 +44,7 @@ export const useSDLState = () => {
const map = reactive(new Map<string, SDLState>());
- const findLatestChangeHistoryName = (task: Task) => {
+ const findLatestChangelogName = (task: Task) => {
if (task.status !== Task_Status.DONE) return undefined;
const taskRunList = issue.value.rolloutTaskRunList.filter((taskRun) => {
return extractTaskUID(taskRun.name) === extractTaskUID(task.name);
@@ -52,15 +52,15 @@ export const useSDLState = () => {
for (let i = taskRunList.length - 1; i >= 0; i--) {
const taskRun = taskRunList[i];
if (taskRun.status === TaskRun_Status.DONE) {
- return taskRun.changeHistory;
+ return taskRun.changelog;
}
}
return undefined;
};
- const changeHistoryName = computed(() => {
+ const changelogName = computed(() => {
const task = selectedTask.value;
- return findLatestChangeHistoryName(task);
+ return findLatestChangelogName(task);
});
const fetchOngoingSDLDetail = async (
@@ -111,42 +111,37 @@ export const useSDLState = () => {
};
};
- const fetchSDLDetailFromChangeHistory = async (
+ const fetchSDLDetailFromChangelog = async (
task: Task,
- changeHistoryName: string | undefined
+ changelogName: string | undefined
): Promise<SDLDetail | undefined> => {
- if (!changeHistoryName) {
+ if (!changelogName) {
return undefined;
}
- const history = await useChangeHistoryStore().fetchChangeHistory({
- name: changeHistoryName,
+ const changelog = await useChangelogStore().fetchChangelog({
+ name: changelogName,
sdlFormat: true,
- view: ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL,
+ view: ChangelogView.CHANGELOG_VIEW_FULL,
});
- // The latestChangeHistoryName might change during fetching the
- // ChangeHistory.
+ // The latestChangelogName might change during fetching the
+ // Changelog.
// Should give up the result.
- const latestChangeHistoryName = findLatestChangeHistoryName(task);
- if (history.name !== latestChangeHistoryName) {
+ const latestChangelogName = findLatestChangelogName(task);
+ if (changelog.name !== latestChangelogName) {
throw new Error();
}
return {
error: "",
- previousSDL: history.prevSchema,
- prettyExpectedSDL: history.schema,
- expectedSDL: history.schema,
- diffDDL: history.statement,
+ previousSDL: changelog.prevSchema,
+ prettyExpectedSDL: changelog.schema,
+ expectedSDL: changelog.schema,
+ diffDDL: changelog.statement,
};
};
watch(
- [
- () => selectedTask.value.name,
- sheetStatement,
- sheetReady,
- changeHistoryName,
- ],
- async ([taskName, statement, sheetReady, changeHistoryName]) => {
+ [() => selectedTask.value.name, sheetStatement, sheetReady, changelogName],
+ async ([taskName, statement, sheetReady, changelogName]) => {
if (!sheetReady) return;
const task = selectedTask.value;
@@ -161,10 +156,7 @@ export const useSDLState = () => {
};
try {
if (task.status === Task_Status.DONE) {
- const detail = await fetchSDLDetailFromChangeHistory(
- task,
- changeHistoryName
- );
+ const detail = await fetchSDLDetailFromChangelog(task, changelogName);
finish(detail);
} else {
const detail = await fetchOngoingSDLDetail(task, statement);
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
index c2946a42f8..86fb66a0b8 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
@@ -37,12 +37,8 @@ import {
getTimeForPbTimestamp,
} from "@/types";
import { TaskRun_Status, Task_Type } from "@/types/proto/v1/rollout_service";
-import {
- databaseV1Url,
- extractChangeHistoryUID,
- extractTaskUID,
- flattenTaskV1List,
-} from "@/utils";
+import { databaseV1Url, extractTaskUID, flattenTaskV1List } from "@/utils";
+import { extractChangelogUID } from "@/utils/v1/changelog";
import { databaseForTask, specForTask, useIssueContext } from "../../logic";
import { displayTaskRunLogEntryType } from "./TaskRunLogTable/common";
@@ -140,7 +136,7 @@ const commentLink = computed((): CommentLink => {
const db = databaseForTask(issue.value, task);
const link = `${databaseV1Url(
db
- )}/change-histories/${extractChangeHistoryUID(taskRun.changeHistory)}`;
+ )}/changelogs/${extractChangelogUID(taskRun.changelog)}`;
return {
title: t("task.view-change"),
link,
diff --git a/frontend/src/components/IssueV1/logic/poll.ts b/frontend/src/components/IssueV1/logic/poll.ts
index d1ca814a78..d5bae8e040 100644
--- a/frontend/src/components/IssueV1/logic/poll.ts
+++ b/frontend/src/components/IssueV1/logic/poll.ts
@@ -3,9 +3,9 @@ import { databaseForTask } from "@/components/IssueV1/logic";
import { useProgressivePoll } from "@/composables/useProgressivePoll";
import {
experimentalFetchIssueByUID,
- useChangeHistoryStore,
useInstanceV1Store,
useDBSchemaV1Store,
+ useChangelogStore,
} from "@/store";
import { useListCache } from "@/store/modules/v1/cache";
import type { ComposedIssue } from "@/types";
@@ -16,7 +16,7 @@ import { flattenTaskV1List } from "@/utils";
import { useIssueContext } from "./context";
const clearCache = (issue: ComposedIssue) => {
- const changeHistoryStore = useChangeHistoryStore();
+ const changelogStore = useChangelogStore();
const tasks = flattenTaskV1List(issue.rolloutEntity);
for (const task of tasks) {
@@ -36,11 +36,11 @@ const clearCache = (issue: ComposedIssue) => {
case Task_Type.TYPE_UNSPECIFIED:
continue;
case Task_Type.DATABASE_DATA_UPDATE:
- changeHistoryStore.clearCache(database.name);
+ changelogStore.clearCache(database.name);
break;
default:
useDBSchemaV1Store().removeCache(database.name);
- changeHistoryStore.clearCache(database.name);
+ changelogStore.clearCache(database.name);
}
}
};
diff --git a/frontend/src/components/Project/ProjectSidebarV1.vue b/frontend/src/components/Project/ProjectSidebarV1.vue
index 2a2e7f45bc..c297392419 100644
--- a/frontend/src/components/Project/ProjectSidebarV1.vue
+++ b/frontend/src/components/Project/ProjectSidebarV1.vue
@@ -26,7 +26,7 @@ const props = defineProps<{
projectId?: string;
instanceId?: string;
databaseName?: string;
- changeHistoryId?: string;
+ changelogId?: string;
issueSlug?: string;
}>();
@@ -39,7 +39,7 @@ const params = computed(() => {
projectId: props.projectId,
instanceId: props.instanceId,
databaseName: props.databaseName,
- changeHistoryId: props.changeHistoryId,
+ changelogId: props.changelogId,
issueSlug: props.issueSlug,
};
});
diff --git a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue
index 115f4803dc..0be2ce3959 100644
--- a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue
+++ b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchContent.vue
@@ -117,7 +117,7 @@ const params = computed(() => {
issueSlug: route.params.issueSlug as string | undefined,
instanceId: route.params.instanceId as string | undefined,
databaseName: route.params.databaseName as string | undefined,
- changeHistoryId: route.params.changeHistoryId as string | undefined,
+ changelogId: route.params.changelogId as string | undefined,
};
});
diff --git a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchPopover.vue b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchPopover.vue
index c445c00bce..57463157e3 100644
--- a/frontend/src/components/Project/ProjectSwitch/ProjectSwitchPopover.vue
+++ b/frontend/src/components/Project/ProjectSwitch/ProjectSwitchPopover.vue
@@ -57,7 +57,7 @@ const params = computed(() => {
issueSlug: route.params.issueSlug as string | undefined,
instanceId: route.params.instanceId as string | undefined,
databaseName: route.params.databaseName as string | undefined,
- changeHistoryId: route.params.changeHistoryId as string | undefined,
+ changelogId: route.params.changelogId as string | undefined,
};
});
diff --git a/frontend/src/components/Project/useCurrentProject.ts b/frontend/src/components/Project/useCurrentProject.ts
index 1c47e7e943..b2ee5874c5 100644
--- a/frontend/src/components/Project/useCurrentProject.ts
+++ b/frontend/src/components/Project/useCurrentProject.ts
@@ -21,7 +21,7 @@ export const useCurrentProject = (
issueSlug?: string;
instanceId?: string;
databaseName?: string;
- changeHistoryId?: string;
+ changelogId?: string;
}>
) => {
const route = useRoute();
@@ -37,7 +37,7 @@ export const useCurrentProject = (
});
const database = computed(() => {
- if (unref(params).changeHistoryId) {
+ if (unref(params).changelogId) {
const parent = `${instanceNamePrefix}${route.params.instanceId}/${databaseNamePrefix}${route.params.databaseName}`;
return useDatabaseV1Store().getDatabaseByName(parent);
} else if (unref(params).databaseName) {
@@ -55,7 +55,7 @@ export const useCurrentProject = (
return useProjectV1Store().getProjectByName(
`${projectNamePrefix}${unref(params).projectId}`
);
- } else if (unref(params).databaseName || unref(params).changeHistoryId) {
+ } else if (unref(params).databaseName || unref(params).changelogId) {
return database.value.projectEntity;
} else if (issueUID.value !== String(UNKNOWN_ID)) {
if (issueUID.value === String(EMPTY_ID)) {
diff --git a/frontend/src/components/SyncDatabaseSchemaV1/index.vue b/frontend/src/components/SyncDatabaseSchemaV1/index.vue
index d9fa54ed7d..1e6126e708 100644
--- a/frontend/src/components/SyncDatabaseSchemaV1/index.vue
+++ b/frontend/src/components/SyncDatabaseSchemaV1/index.vue
@@ -45,7 +45,7 @@
"
:project="project"
:source-schema="changelogSourceSchemaState"
- @update="handleChangeHistorySchemaVersionChanges"
+ @update="handleChangelogSchemaVersionChanges"
/>
<RawSQLEditor
v-if="state.sourceSchemaType === SourceSchemaType.RAW_SQL"
@@ -176,7 +176,7 @@ const sourceEngine = computed(() => {
}
});
-const handleChangeHistorySchemaVersionChanges = (
+const handleChangelogSchemaVersionChanges = (
schemaVersion: ChangelogSourceSchema
) => {
Object.assign(changelogSourceSchemaState, schemaVersion);
@@ -192,7 +192,7 @@ onMounted(async () => {
);
const { databaseName } = extractDatabaseNameAndChangelogUID(changelogName);
const database = await databaseStore.getOrFetchDatabaseByName(databaseName);
- handleChangeHistorySchemaVersionChanges({
+ handleChangelogSchemaVersionChanges({
environmentName: database.effectiveEnvironment,
databaseName: databaseName,
changelogName: changelogName,
diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.ts
index aa5f4f1ee0..fa138d6bb1 100644
--- a/frontend/src/router/dashboard/projectV1.ts
+++ b/frontend/src/router/dashboard/projectV1.ts
@@ -484,27 +484,6 @@ const projectV1Routes: RouteRecordRaw[] = [
component: () => import("@/views/DatabaseDetail"),
props: true,
},
- {
- path: "change-histories/:changeHistoryId",
- name: PROJECT_V1_ROUTE_DATABASE_CHANGE_HISTORY_DETAIL,
- meta: {
- overrideTitle: true,
- requiredProjectPermissionList: () => [
- "bb.projects.get",
- "bb.databases.get",
- "bb.changeHistories.get",
- ],
- },
- component: () =>
- import("@/views/DatabaseDetail/ChangeHistoryDetail.vue"),
- props: (route) => ({
- ...route.params,
- project: `projects/${route.params.projectId}`,
- instance: `instances/${route.params.instanceId}`,
- database: `instances/${route.params.instanceId}/databases/${route.params.databaseName}`,
- changeHistoryId: route.params.changeHistoryId,
- }),
- },
{
path: "changelogs/:changelogId",
name: PROJECT_V1_ROUTE_DATABASE_CHANGELOG_DETAIL,
diff --git a/frontend/src/store/modules/v1/changeHistory.ts b/frontend/src/store/modules/v1/changeHistory.ts
deleted file mode 100644
index ab3b4dcced..0000000000
--- a/frontend/src/store/modules/v1/changeHistory.ts
+++ /dev/null
@@ -1,168 +0,0 @@
-import { defineStore } from "pinia";
-import { reactive } from "vue";
-import { databaseServiceClient } from "@/grpcweb";
-import { useCache } from "@/store/cache";
-import { UNKNOWN_ID } from "@/types";
-import type {
- ChangeHistory,
- GetChangeHistoryRequest,
- ListChangeHistoriesRequest,
-} from "@/types/proto/v1/database_service";
-import {
- ChangeHistoryView,
- ChangeHistory_Type,
-} from "@/types/proto/v1/database_service";
-import { extractChangeHistoryUID } from "@/utils";
-import { DEFAULT_PAGE_SIZE } from "../common";
-
-type CacheKeyType = [string /* name */, ChangeHistoryView];
-
-export const useChangeHistoryStore = defineStore("changeHistory_v1", () => {
- const cache = useCache<CacheKeyType, ChangeHistory>(
- "bb.change-history.by-name"
- );
- const changeHistoryListMapByDatabase = reactive(
- new Map<string, ChangeHistory[]>()
- );
-
- const upsertChangeHistoryListMap = async (
- parent: string,
- historyList: ChangeHistory[]
- ) => {
- changeHistoryListMapByDatabase.set(parent, historyList);
- historyList.forEach((entity) => {
- cache.setEntity(
- [entity.name, ChangeHistoryView.CHANGE_HISTORY_VIEW_BASIC],
- entity
- );
- });
- };
-
- const clearCache = (parent: string) => {
- changeHistoryListMapByDatabase.delete(parent);
- };
-
- const fetchChangeHistoryList = async (
- params: Partial<ListChangeHistoriesRequest>
- ) => {
- const { parent } = params;
- if (!parent) throw new Error('"parent" field is required');
- const { changeHistories } =
- await databaseServiceClient.listChangeHistories(params);
- await upsertChangeHistoryListMap(parent, changeHistories);
- return changeHistories;
- };
- const getOrFetchChangeHistoryListOfDatabase = async (
- databaseName: string
- ) => {
- if (changeHistoryListMapByDatabase.has(databaseName)) {
- return changeHistoryListMapByDatabase.get(databaseName) ?? [];
- }
- return fetchChangeHistoryList({
- parent: databaseName,
- pageSize: DEFAULT_PAGE_SIZE,
- });
- };
- const changeHistoryListByDatabase = (name: string) => {
- return changeHistoryListMapByDatabase.get(name) ?? [];
- };
- const fetchChangeHistory = async (
- params: Partial<GetChangeHistoryRequest>
- ) => {
- const changeHistory = await databaseServiceClient.getChangeHistory(params);
- cache.setEntity(
- [
- changeHistory.name,
- params.view ?? ChangeHistoryView.CHANGE_HISTORY_VIEW_BASIC,
- ],
- changeHistory
- );
- return changeHistory;
- };
- const getOrFetchChangeHistoryByName = async (
- name: string,
- view: ChangeHistoryView
- ) => {
- const uid = extractChangeHistoryUID(name);
- if (!uid || uid === String(UNKNOWN_ID)) {
- return undefined;
- }
- const entity = cache.getEntity([name, view]);
- if (entity) {
- return entity;
- }
- const request = cache.getRequest([name, view]);
- if (request) {
- return request;
- }
- const promise = fetchChangeHistory({ name, view });
- cache.setRequest([name, view], promise);
- return promise;
- };
- /**
- *
- * @param name
- * @param view default undefined to any view (full -> basic)
- * @returns
- */
- const getChangeHistoryByName = (
- name: string,
- view: ChangeHistoryView | undefined = undefined
- ) => {
- if (view === undefined) {
- return (
- cache.getEntity([name, ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL]) ??
- cache.getEntity([name, ChangeHistoryView.CHANGE_HISTORY_VIEW_BASIC])
- );
- }
- return cache.getEntity([name, view]);
- };
- const exportChangeHistoryFullStatementByName = async (
- name: string
- ): Promise<{
- changeHistory: ChangeHistory | undefined;
- type: "MIGRATE" | "BASELINE" | "UNSUPPORTED";
- statement: string;
- }> => {
- const changeHistory = await databaseServiceClient.getChangeHistory({
- name,
- view: ChangeHistoryView.CHANGE_HISTORY_VIEW_FULL,
- });
- if (changeHistory) {
- if (
- changeHistory.type === ChangeHistory_Type.MIGRATE ||
- changeHistory.type === ChangeHistory_Type.MIGRATE_SDL ||
- changeHistory.type === ChangeHistory_Type.MIGRATE_GHOST ||
- changeHistory.type === ChangeHistory_Type.DATA
- ) {
- return {
- changeHistory,
- type: "MIGRATE",
- statement: changeHistory.statement,
- };
- } else if (changeHistory.type === ChangeHistory_Type.BASELINE) {
- return {
- changeHistory,
- type: "BASELINE",
- statement: changeHistory.schema,
- };
- }
- }
- return {
- changeHistory,
- type: "UNSUPPORTED",
- statement: "",
- };
- };
-
- return {
- clearCache,
- fetchChangeHistoryList,
- getOrFetchChangeHistoryListOfDatabase,
- changeHistoryListByDatabase,
- fetchChangeHistory,
- getOrFetchChangeHistoryByName,
- getChangeHistoryByName,
- exportChangeHistoryFullStatementByName,
- };
-});
diff --git a/frontend/src/store/modules/v1/changelist.ts b/frontend/src/store/modules/v1/changelist.ts
index 21e710ab73..305a7e0db5 100644
--- a/frontend/src/store/modules/v1/changelist.ts
+++ b/frontend/src/store/modules/v1/changelist.ts
@@ -8,14 +8,13 @@ import type {
DeepPartial,
ListChangelistsRequest,
} from "@/types/proto/v1/changelist_service";
-import { ChangeHistoryView } from "@/types/proto/v1/database_service";
import {
ResourceComposer,
isBranchChangeSource,
- isChangeHistoryChangeSource,
+ isChangelogChangeSource,
} from "@/utils";
import { useBranchStore } from "../branch";
-import { useChangeHistoryStore } from "./changeHistory";
+import { useChangelogStore } from "./changelog";
import { useSheetV1Store } from "./sheet";
export const useChangelistStore = defineStore("changelist", () => {
@@ -100,12 +99,9 @@ export const useChangelistStore = defineStore("changelist", () => {
};
const composeChange = (change: Change, composer: ResourceComposer) => {
const { sheet, source } = change;
- if (isChangeHistoryChangeSource(change)) {
+ if (isChangelogChangeSource(change)) {
composer.collect(source, () =>
- useChangeHistoryStore().getOrFetchChangeHistoryByName(
- source,
- ChangeHistoryView.CHANGE_HISTORY_VIEW_BASIC
- )
+ useChangelogStore().getOrFetchChangelogByName(source)
);
} else if (isBranchChangeSource(change)) {
composer.collect(source, () =>
diff --git a/frontend/src/store/modules/v1/index.ts b/frontend/src/store/modules/v1/index.ts
index 2d8b417abb..0813feec2c 100644
--- a/frontend/src/store/modules/v1/index.ts
+++ b/frontend/src/store/modules/v1/index.ts
@@ -18,7 +18,6 @@ export * from "./actuator";
export * from "./sql";
export * from "./vcs_provider";
export * from "./vcs_connector";
-export * from "./changeHistory";
export * from "./dbSchema";
export * from "./databaseCatalog";
export * from "./anomaly";
diff --git a/frontend/src/types/changeHistory.ts b/frontend/src/types/changeHistory.ts
deleted file mode 100644
index 1ee136931e..0000000000
--- a/frontend/src/types/changeHistory.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import type { Table } from "./changelog";
-
-export interface SearchChangeHistoriesParams {
- tables?: Table[];
- types?: string[];
-}
diff --git a/frontend/src/types/changelog.ts b/frontend/src/types/changelog.ts
index 61972cdcac..d4e0b0e6b8 100644
--- a/frontend/src/types/changelog.ts
+++ b/frontend/src/types/changelog.ts
@@ -1,6 +1,3 @@
-import { ChangeHistory } from "@/types/proto/v1/database_service";
-import { Issue } from "@/types/proto/v1/issue_service";
-
export interface Table {
schema: string;
table: string;
@@ -16,10 +13,6 @@ export const EmptyAffectedTable: AffectedTable = {
dropped: false,
};
-export interface ComposedChangeHistory extends ChangeHistory {
- issueEntity?: Issue;
-}
-
export interface SearchChangeLogParams {
tables?: Table[];
types?: string[];
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
index 61c8772932..eea46ad335 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -24,7 +24,6 @@ export * from "./review";
export * from "./slowQuery";
export * from "./dbGroup";
export * from "./setting";
-export * from "./changeHistory";
export * from "./changelog";
export * from "./semanticTypes";
export * from "./iam";
diff --git a/frontend/src/types/v1/changelist.ts b/frontend/src/types/v1/changelist.ts
index 75749218d2..1f1d27eb31 100644
--- a/frontend/src/types/v1/changelist.ts
+++ b/frontend/src/types/v1/changelist.ts
@@ -13,7 +13,7 @@ export const unknownChangelist = () => {
};
export const Changelist_Change_Source_List = [
- "CHANGE_HISTORY",
+ "CHANGELOG",
"BRANCH",
"RAW_SQL",
] as const;
diff --git a/frontend/src/utils/v1/changeHistory.ts b/frontend/src/utils/v1/changeHistory.ts
deleted file mode 100644
index 405de32857..0000000000
--- a/frontend/src/utils/v1/changeHistory.ts
+++ /dev/null
@@ -1,145 +0,0 @@
-import { isEqual, isUndefined, orderBy, uniqBy } from "lodash-es";
-import Long from "long";
-import { t } from "@/plugins/i18n";
-import { useDBSchemaV1Store, useDatabaseV1Store, useUserStore } from "@/store";
-import type { ComposedDatabase } from "@/types";
-import {
- EMPTY_ID,
- UNKNOWN_ID,
- EmptyAffectedTable,
- type AffectedTable,
-} from "@/types";
-import type { DatabaseSchema } from "@/types/proto/v1/database_service";
-import {
- ChangeHistory,
- ChangeHistory_Type,
-} from "@/types/proto/v1/database_service";
-import { extractUserResourceName } from ".";
-import { databaseV1Url, extractDatabaseResourceName } from "./database";
-
-export const extractChangeHistoryUID = (name: string) => {
- const pattern = /(?:^|\/)changeHistories\/([^/]+)(?:$|\/)/;
- const matches = name.match(pattern);
- return matches?.[1] ?? "";
-};
-
-export const extractDatabaseNameAndChangeHistoryUID = (
- changeHistoryName: string
-) => {
- const parts = changeHistoryName.split("/changeHistories/");
- if (parts.length !== 2) {
- throw new Error("Invalid change history name");
- }
- return {
- databaseName: parts[0],
- uid: extractChangeHistoryUID(parts[1]),
- };
-};
-
-export const isValidChangeHistoryName = (name: string | undefined) => {
- if (!name) {
- return false;
- }
- const uid = extractChangeHistoryUID(name);
- return uid && uid !== String(EMPTY_ID) && uid !== String(UNKNOWN_ID);
-};
-
-export const changeHistoryLinkRaw = (parent: string, uid: string) => {
- const { database } = extractDatabaseResourceName(parent);
- const composedDatabase = useDatabaseV1Store().getDatabaseByName(database);
- const path = [databaseV1Url(composedDatabase), "change-histories", uid].join(
- "/"
- );
- return path;
-};
-
-export const changeHistoryLink = (changeHistory: ChangeHistory): string => {
- const { name } = changeHistory;
- return changeHistoryLinkRaw(name, extractChangeHistoryUID(name));
-};
-
-export const getAffectedTablesOfChangeHistory = (
- changeHistory: ChangeHistory
-): AffectedTable[] => {
- const { databaseName } = extractDatabaseNameAndChangeHistoryUID(
- changeHistory.name
- );
- const database = useDatabaseV1Store().getDatabaseByName(databaseName);
- const metadata = useDBSchemaV1Store().getDatabaseMetadata(database.name);
- return uniqBy(
- orderBy(
- changeHistory.changedResources?.databases
- .find((db) => db.name === database.databaseName)
- ?.schemas.map((schema) => {
- return schema.tables.map((table) => {
- const dropped = isUndefined(
- metadata.schemas
- .find((s) => s.name === schema.name)
- ?.tables.find((t) => t.name === table.name)
- );
- return {
- schema: schema.name,
- table: table.name,
- dropped,
- };
- });
- })
- .flat() || [],
- ["dropped"]
- ),
- (affectedTable) => `${affectedTable.schema}.${affectedTable.table}`
- );
-};
-
-export const stringifyAffectedTable = (affectedTable: AffectedTable) => {
- const { schema, table } = affectedTable;
- if (schema !== "") {
- return `${schema}.${table}`;
- }
- return table;
-};
-
-export const getAffectedTableDisplayName = (affectedTable: AffectedTable) => {
- if (isEqual(affectedTable, EmptyAffectedTable)) {
- return t("change-history.all-tables");
- }
-
- let name = stringifyAffectedTable(affectedTable);
- if (affectedTable.dropped) {
- name = `${name}(deleted)`;
- }
- return name;
-};
-
-export const getHistoryChangeType = (type: ChangeHistory_Type) => {
- switch (type) {
- case ChangeHistory_Type.BASELINE:
- case ChangeHistory_Type.MIGRATE:
- case ChangeHistory_Type.MIGRATE_SDL:
- case ChangeHistory_Type.MIGRATE_GHOST:
- return "DDL";
- case ChangeHistory_Type.DATA:
- return "DML";
- default:
- return "-";
- }
-};
-
-export const mockLatestSchemaChangeHistory = (
- database: ComposedDatabase,
- schema: DatabaseSchema | undefined = undefined
-) => {
- return ChangeHistory.fromPartial({
- name: `${database.name}/changeHistories/${UNKNOWN_ID}`,
- schema: schema?.schema,
- schemaSize: Long.fromNumber(
- new TextEncoder().encode(schema?.schema).length
- ),
- version: "Latest version",
- });
-};
-
-export const creatorOfChangeHistory = (history: ChangeHistory) => {
- const email = extractUserResourceName(history.creator);
- return useUserStore().getUserByEmail(email);
-};
diff --git a/frontend/src/utils/v1/changelist.ts b/frontend/src/utils/v1/changelist.ts
index afcf0087e2..336ccbaac9 100644
--- a/frontend/src/utils/v1/changelist.ts
+++ b/frontend/src/utils/v1/changelist.ts
@@ -9,8 +9,8 @@ export const extractChangelistResourceName = (name: string) => {
return matches?.[1] ?? "";
};
-export const isChangeHistoryChangeSource = (change: Change) => {
- return change.source.match(/(^|\/)changeHistories\//);
+export const isChangelogChangeSource = (change: Change) => {
+ return change.source.match(/(^|\/)changelogs\//);
};
export const isBranchChangeSource = (change: Change) => {
return change.source.match(/(^|\/)branches\//);
@@ -19,8 +19,8 @@ export const isBranchChangeSource = (change: Change) => {
export const getChangelistChangeSourceType = (
change: Change
): Changelist_Change_Source => {
- if (isChangeHistoryChangeSource(change)) {
- return "CHANGE_HISTORY";
+ if (isChangelogChangeSource(change)) {
+ return "CHANGELOG";
} else if (isBranchChangeSource(change)) {
return "BRANCH";
} else {
diff --git a/frontend/src/utils/v1/database.ts b/frontend/src/utils/v1/database.ts
index 8938a3b15f..45b8bd7ecd 100644
--- a/frontend/src/utils/v1/database.ts
+++ b/frontend/src/utils/v1/database.ts
@@ -60,10 +60,6 @@ export const sortDatabaseV1List = (databaseList: ComposedDatabase[]) => {
};
export const isArchivedDatabaseV1 = (db: ComposedDatabase): boolean => {
- // TODO(steven): check if the related instance is deleted.
- // if (db.instanceEntity.state === State.DELETED) {
- // return true;
- // }
if (db.effectiveEnvironmentEntity.state === State.DELETED) {
return true;
}
diff --git a/frontend/src/utils/v1/index.ts b/frontend/src/utils/v1/index.ts
index fb03b092b0..ec348e45b8 100644
--- a/frontend/src/utils/v1/index.ts
+++ b/frontend/src/utils/v1/index.ts
@@ -12,8 +12,8 @@ export * from "./sql";
export * from "./sheet";
export * from "./worksheet";
export * from "./issue";
-export * from "./changeHistory";
export * from "./changelist";
+export * from "./changelog";
export * from "./cel";
export * from "./advanced-search";
export * from "./iam";
diff --git a/frontend/src/views/DashboardHeader.vue b/frontend/src/views/DashboardHeader.vue
index bb31416c20..379e0e0e7a 100644
--- a/frontend/src/views/DashboardHeader.vue
+++ b/frontend/src/views/DashboardHeader.vue
@@ -158,7 +158,7 @@ const params = computed(() => {
issueSlug: route.params.issueSlug as string | undefined,
instanceId: route.params.instanceId as string | undefined,
databaseName: route.params.databaseName as string | undefined,
- changeHistoryId: route.params.changeHistoryId as string | undefined,
+ changelogId: route.params.changelogId as string | undefined,
};
});
diff --git a/frontend/src/views/DatabaseDetail/ChangeHistoryDetail.vue b/frontend/src/views/DatabaseDetail/ChangeHistoryDetail.vue
deleted file mode 100644
index ec36bdf244..0000000000
--- a/frontend/src/views/DatabaseDetail/ChangeHistoryDetail.vue
+++ /dev/null
@@ -1,42 +0,0 @@
-<template>
- <NBreadcrumb class="mb-4">
- <NBreadcrumbItem @click="router.push(`/${props.project}/databases`)">
- {{ $t("common.databases") }}
- </NBreadcrumbItem>
- <NBreadcrumbItem @click="router.push(databaseV1Url(database))">
- {{ database.databaseName }}
- </NBreadcrumbItem>
- <NBreadcrumbItem
- @click="router.push(`${databaseV1Url(database)}#change-history`)"
- >
- {{ $t("change-history.self") }}
- </NBreadcrumbItem>
- <NBreadcrumbItem :clickable="false">
- {{ changeHistoryId }}
- </NBreadcrumbItem>
- </NBreadcrumb>
- <ChangeHistoryDetailView
- :instance="instance"
- :database="database.name"
- :change-history-id="changeHistoryId"
- />
-</template>
-
-<script lang="ts" setup>
-import { NBreadcrumb, NBreadcrumbItem } from "naive-ui";
-import { useRouter } from "vue-router";
-import { ChangeHistoryDetail as ChangeHistoryDetailView } from "@/components/ChangeHistory";
-import { useDatabaseV1ByName } from "@/store";
-import { databaseV1Url } from "@/utils";
-
-const props = defineProps<{
- project: string;
- instance: string;
- database: string;
- changeHistoryId: string;
-}>();
-
-const router = useRouter();
-
-const { database } = useDatabaseV1ByName(props.database);
-</script>
diff --git a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
index faff999e5b..8fcd99d8f3 100644
--- a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue
@@ -120,18 +120,6 @@
databaseChangeMode === DatabaseChangeMode.PIPELINE &&
allowListChangeHistories
"
- name="change-history"
- :tab="$t('change-history.self')"
- >
- <DatabaseChangeHistoryPanel class="mt-2" :database="database" />
- </NTabPane>
- <NTabPane
- v-if="
- // TODO: Remove me please.
- isDev() &&
- databaseChangeMode === DatabaseChangeMode.PIPELINE &&
- allowListChangeHistories
- "
name="changelog"
:tab="'Changelog'"
>
@@ -220,7 +208,6 @@ import { computed, reactive, watch, ref, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import { BBModal } from "@/bbkit";
import SchemaEditorModal from "@/components/AlterSchemaPrepForm/SchemaEditorModal.vue";
-import DatabaseChangeHistoryPanel from "@/components/Database/DatabaseChangeHistoryPanel.vue";
import DatabaseChangelogPanel from "@/components/Database/DatabaseChangelogPanel.vue";
import DatabaseOverviewPanel from "@/components/Database/DatabaseOverviewPanel.vue";
import DatabaseRevisionPanel from "@/components/Database/DatabaseRevisionPanel.vue";
@@ -266,7 +253,6 @@ import {
const databaseHashList = [
"overview",
- "change-history",
"changelog",
"revision",
"slow-query",
diff --git a/frontend/src/views/DatabaseDetail/index.ts b/frontend/src/views/DatabaseDetail/index.ts
index 9c686cf03e..507c0c1b8b 100644
--- a/frontend/src/views/DatabaseDetail/index.ts
+++ b/frontend/src/views/DatabaseDetail/index.ts
@@ -1,7 +1,7 @@
-import ChangeHistoryDetail from "./ChangeHistoryDetail.vue";
+import ChangelogDetail from "./ChangelogDetail.vue";
import DatabaseDetail from "./DatabaseDetail.vue";
import RevisionDetail from "./RevisionDetail.vue";
-export { ChangeHistoryDetail, RevisionDetail };
+export { RevisionDetail, ChangelogDetail };
export default DatabaseDetail;