Skip to content

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

chore: show release info in issue page (#14050)

boojack9bede88874a4
diff --git a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue
index b5a027150f..37a7d9477c 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue
@@ -1,31 +1,29 @@
<template>
- <div>
- <div
- v-if="showPreBackupSection"
- class="w-full flex items-center justify-between gap-x-2 gap-y-1 flex-wrap min-h-[34px] whitespace-nowrap"
- >
- <NTooltip>
- <template #trigger>
- <div class="textlabel flex items-center">
- <span>{{ $t("task.prior-backup") }}</span>
- <span
- v-if="showRollbackSection"
- class="ml-1 px-1 py-0.5 rounded-lg text-xs bg-green-100 text-green-800"
- >
- {{ $t("common.on") }}
- </span>
- </div>
- </template>
- <template #default>
- <div class="max-w-[20rem]">
- {{ $t("task.prior-backup-tips") }}
- </div>
- </template>
- </NTooltip>
- <div class="flex items-center">
- <TaskRollbackButton v-if="showRollbackSection" />
- <PreBackupSwitch v-else />
- </div>
+ <div
+ v-if="showPreBackupSection"
+ class="w-full flex items-center justify-between gap-x-2 gap-y-1 flex-wrap min-h-[34px] whitespace-nowrap"
+ >
+ <NTooltip>
+ <template #trigger>
+ <div class="textlabel flex items-center">
+ <span>{{ $t("task.prior-backup") }}</span>
+ <span
+ v-if="showRollbackSection"
+ class="ml-1 px-1 py-0.5 rounded-lg text-xs bg-green-100 text-green-800"
+ >
+ {{ $t("common.on") }}
+ </span>
+ </div>
+ </template>
+ <template #default>
+ <div class="max-w-[20rem]">
+ {{ $t("task.prior-backup-tips") }}
+ </div>
+ </template>
+ </NTooltip>
+ <div class="flex items-center">
+ <TaskRollbackButton v-if="showRollbackSection" />
+ <PreBackupSwitch v-else />
</div>
</div>
</template>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue b/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue
new file mode 100644
index 0000000000..564a5e33ad
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue
@@ -0,0 +1,32 @@
+<template>
+ <div
+ v-if="isValidReleaseName(release.name) && ready"
+ class="text-sm text-control-light flex space-x-1 items-center"
+ >
+ <PackageIcon class="w-5 h-auto" />
+ <EllipsisText>
+ <a :href="`/${release.name}`" target="_blank" class="normal-link">
+ <span>{{ release.title }}</span>
+ </a>
+ </EllipsisText>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { PackageIcon } from "lucide-vue-next";
+import { computed } from "vue";
+import EllipsisText from "@/components/EllipsisText.vue";
+import { useIssueContext } from "@/components/IssueV1";
+import { useReleaseByName } from "@/store";
+import { isValidReleaseName } from "@/types";
+
+const { issue } = useIssueContext();
+
+const { release, ready } = useReleaseByName(
+ issue.value.planEntity?.releaseSource?.release || ""
+);
+
+defineExpose({
+ shown: computed(() => isValidReleaseName(release.value.name)),
+});
+</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue
index d0ff809b92..fb56ab1806 100644
--- a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue
+++ b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue
@@ -1,6 +1,7 @@
<template>
<div class="flex flex-col gap-y-3 py-2 px-3">
<VCSInfo ref="vcsInfoRef" />
+ <ReleaseInfo ref="releaseInfoRef" />
<ReviewSection ref="reviewSectionRef" />
<IssueLabels />
@@ -18,14 +19,16 @@ import EarliestAllowedTime from "./EarliestAllowedTime.vue";
import GhostSection from "./GhostSection";
import IssueLabels from "./IssueLabels.vue";
import PreBackupSection from "./PreBackupSection";
+import ReleaseInfo from "./ReleaseInfo.vue";
import ReviewSection from "./ReviewSection";
import VCSInfo from "./VCSInfo.vue";
const vcsInfoRef = ref<InstanceType<typeof VCSInfo>>();
+const releaseInfoRef = ref<InstanceType<typeof ReleaseInfo>>();
const reviewSectionRef = ref<InstanceType<typeof ReviewSection>>();
const isFirstSectionShown = computed(() => {
- return [vcsInfoRef, reviewSectionRef].some(
+ return [vcsInfoRef, releaseInfoRef, reviewSectionRef].some(
(elemRef) => elemRef.value?.shown
);
});
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
index c24ee67f78..0de3068c0a 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
+++ b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
@@ -324,6 +324,10 @@ const allowEditStatementWhenCreating = computed(() => {
// E.g., rollback DML
return false;
}
+ // Do not allow to edit statement for the plan with release source.
+ if (issue.value.planEntity?.releaseSource) {
+ return false;
+ }
if (selectedTask.value.type === Task_Type.DATABASE_SCHEMA_BASELINE) {
// A baseline issue has actually no SQL statement.
// "-- Establish baseline using current schema" is just a comment.
diff --git a/frontend/src/components/IssueV1/components/StatementSection/useTaskSheet.ts b/frontend/src/components/IssueV1/components/StatementSection/useTaskSheet.ts
index 41eb8dac17..8844f216ed 100644
--- a/frontend/src/components/IssueV1/components/StatementSection/useTaskSheet.ts
+++ b/frontend/src/components/IssueV1/components/StatementSection/useTaskSheet.ts
@@ -29,9 +29,8 @@ export const useTaskSheet = () => {
if (uid.startsWith("-")) {
return getLocalSheetByName(name);
}
-
- // Use any (basic or full) view of sheets here to save data size
- return sheetStore.getOrFetchSheetByName(name);
+ // Use any view(basic or full) of sheets here to save data size.
+ return await sheetStore.getOrFetchSheetByName(name);
},
undefined,
{
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
index 0f0c3a4292..58b724774c 100644
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
@@ -21,9 +21,9 @@
class="w-5 h-5 inline-block mb-0.5"
/>
<span>{{ databaseForTask(issue, task).databaseName }}</span>
- <span v-if="schemaVersion" class="schema-version">
- ({{ schemaVersion }})
- </span>
+ <NTag v-if="schemaVersion" size="small" round>
+ {{ schemaVersion }}
+ </NTag>
</div>
</div>
<TaskExtraActionsButton :task="task" />
@@ -47,13 +47,11 @@
</div>
</div>
</div>
- <div v-if="shouldShowTaskProgress" class="flex flex-col justify-center">
- <TaskProgress :task="task" />
- </div>
</div>
</template>
<script setup lang="ts">
+import { NTag } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { InstanceV1Name } from "@/components/v2";
@@ -64,7 +62,6 @@ import { extractSchemaVersionFromTask } from "@/utils";
import { databaseForTask, isTaskFinished, useIssueContext } from "../../logic";
import TaskStatusIcon from "../TaskStatusIcon.vue";
import TaskExtraActionsButton from "./TaskExtraActionsButton.vue";
-import TaskProgress from "./TaskProgress.vue";
type SecondaryViewMode = "INSTANCE" | "TASK_TITLE";
@@ -98,12 +95,18 @@ const secondaryViewMode = computed((): SecondaryViewMode => {
});
const schemaVersion = computed(() => {
+ const v = extractSchemaVersionFromTask(props.task);
+
+ // Always show the schema version for tasks from a release source.
+ if (issue.value.planEntity?.releaseSource) {
+ return v;
+ }
+
// show the schema version for a task if
// the project is standard mode and VCS workflow
if (isCreating.value) return "";
if (project.value.workflow === Workflow.UI) return "";
-
- return extractSchemaVersionFromTask(props.task);
+ return v;
});
const taskClass = computed(() => {
@@ -116,12 +119,6 @@ const taskClass = computed(() => {
return classes;
});
-const shouldShowTaskProgress = computed(() => {
- return false; // TODO: not implemented yet
-
- // return TaskTypeListWithProgress.includes(props.task.type);
-});
-
const taskTitle = computed(() => {
const type = props.task.type;
if (type === Task_Type.DATABASE_SCHEMA_UPDATE_GHOST_SYNC) {
@@ -145,9 +142,6 @@ const onClickTask = (task: Task) => {
.task .name {
@apply whitespace-pre-wrap break-all;
}
-.task .schema-version {
- @apply text-sm;
-}
.task.active .name {
@apply font-bold;
}
diff --git a/frontend/src/components/MonacoEditor/lsp-client.ts b/frontend/src/components/MonacoEditor/lsp-client.ts
index 1e63bcd57b..4e657501b9 100644
--- a/frontend/src/components/MonacoEditor/lsp-client.ts
+++ b/frontend/src/components/MonacoEditor/lsp-client.ts
@@ -1,4 +1,3 @@
-import dayjs from "dayjs";
import { omit } from "lodash-es";
import {
MonacoLanguageClient,
@@ -278,10 +277,6 @@ const useHeartbeat = (ws: WebSocket) => {
},
})
);
- console.debug(
- `[LSP-Client] counter:${conn.heartbeat.counter} timestamp:${conn.heartbeat.timestamp}(${dayjs(conn.heartbeat.timestamp).toString()})`
- );
-
conn.heartbeat.timer = setTimeout(ping, WEBSOCKET_HEARTBEAT_INTERVAL);
};
diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
index 4d44d6eba7..9bc8ad45a3 100644
--- a/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
+++ b/frontend/src/components/Release/ReleaseDetail/NavBar/ApplyToDatabasePanel.vue
@@ -152,7 +152,7 @@ const handleClickNext = async () => {
: [databaseGroup?.databasePlaceholder]
),
release: release.value.name,
- description: `Apply release [${release.value.title}]`,
+ description: `Apply release "${release.value.title}"`,
};
if (state.targetSelectState.changeSource === "DATABASE") {
query.databaseList = databaseList.map((db) => db.name).join(",");
diff --git a/frontend/src/store/cache.ts b/frontend/src/store/cache.ts
index 95efb14beb..5e498f4870 100644
--- a/frontend/src/store/cache.ts
+++ b/frontend/src/store/cache.ts
@@ -71,7 +71,7 @@ export const useCache = <K extends KeyType[], T>(namespace: string) => {
const getEntity = (keys: K) => {
const key = getKey(keys);
- trace("getEntity", keys, entityCacheMap.has(key));
+ // trace("getEntity", keys, entityCacheMap.has(key));
return entityCacheMap.get(key)?.entity;
};
diff --git a/frontend/src/store/modules/release.ts b/frontend/src/store/modules/release.ts
index f2c6756693..856d917a91 100644
--- a/frontend/src/store/modules/release.ts
+++ b/frontend/src/store/modules/release.ts
@@ -3,7 +3,7 @@ import { defineStore } from "pinia";
import { computed, reactive, ref, unref, watch } from "vue";
import { releaseServiceClient } from "@/grpcweb";
import type { MaybeRef, ComposedRelease, Pagination } from "@/types";
-import { isValidDatabaseName, unknownRelease, unknownUser } from "@/types";
+import { isValidReleaseName, unknownRelease, unknownUser } from "@/types";
import { DEFAULT_PROJECT_NAME } from "@/types";
import type { DeepPartial, Release } from "@/types/proto/v1/release_service";
import { extractUserResourceName } from "@/utils";
@@ -81,12 +81,16 @@ export const useReleaseByName = (name: MaybeRef<string>) => {
const ready = ref(true);
watch(
() => unref(name),
- (name) => {
- if (!isValidDatabaseName(store.getReleaseByName(name).name)) {
+ async (name) => {
+ if (!isValidReleaseName(name)) {
+ return;
+ }
+
+ const cachedRelease = store.getReleaseByName(name);
+ if (!isValidReleaseName(cachedRelease.name)) {
ready.value = false;
- store.fetchReleaseByName(name).then(() => {
- ready.value = true;
- });
+ await store.fetchReleaseByName(name);
+ ready.value = true;
}
},
{ immediate: true }
diff --git a/frontend/src/store/modules/v1/policy.ts b/frontend/src/store/modules/v1/policy.ts
index c0c2fe0487..7486acdd61 100644
--- a/frontend/src/store/modules/v1/policy.ts
+++ b/frontend/src/store/modules/v1/policy.ts
@@ -1,3 +1,4 @@
+import { Status, type ServerError } from "nice-grpc-common";
import { defineStore } from "pinia";
import { computed, unref, watchEffect } from "vue";
import { policyServiceClient } from "@/grpcweb";
@@ -128,8 +129,12 @@ export const usePolicyV1Store = defineStore("policy_v1", {
);
this.policyMapByName.set(policy.name, policy);
return policy;
- } catch {
- return;
+ } catch (error) {
+ const se = error as ServerError;
+ if (se.code === Status.NOT_FOUND) {
+ // To prevent unnecessary requests, cache empty policies if not found.
+ this.policyMapByName.set(name, Policy.fromPartial({ name }));
+ }
}
},
getPolicyByParentAndType({