Skip to content

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

feat(frontend): show PITR restore task progress (#2597)

Liu Ji4efaab18c733
diff --git a/frontend/src/components/Issue/PipelinePITRFlow.vue b/frontend/src/components/Issue/PipelinePITRFlow.vue
index ffa8c65eb5..1ff013a90e 100644
--- a/frontend/src/components/Issue/PipelinePITRFlow.vue
+++ b/frontend/src/components/Issue/PipelinePITRFlow.vue
@@ -36,6 +36,15 @@
{{ taskNameOfTask(task) }}
</div>
</div>
+
+ <TaskProgressPie
+ v-if="
+ !create && task.type === 'bb.task.database.restore.pitr.restore'
+ "
+ :task="(task as Task)"
+ >
+ <template #unit="{ unit }">{{ bytesToString(unit) }}</template>
+ </TaskProgressPie>
</div>
<div
@@ -58,6 +67,7 @@ import {
activeTaskInStage,
extractDatabaseNameFromTask,
taskSlug,
+ bytesToString,
} from "@/utils";
import TaskStatusIcon from "./TaskStatusIcon.vue";
import { useDatabaseStore } from "@/store";
diff --git a/frontend/src/components/Issue/TaskProgressPie.vue b/frontend/src/components/Issue/TaskProgressPie.vue
index 59d287ca6a..1dfd8181a4 100644
--- a/frontend/src/components/Issue/TaskProgressPie.vue
+++ b/frontend/src/components/Issue/TaskProgressPie.vue
@@ -23,21 +23,29 @@
<label class="textlabel">
{{
$t("task.progress.completed-units", {
- units: $t(`task.progress.units.${unitKey}`),
+ units: unitStr,
})
}}
</label>
- <span>{{ progress.completedUnit }}</span>
+ <span>
+ <slot name="unit" :unit="progress.completedUnit">
+ {{ progress.completedUnit }}
+ </slot>
+ </span>
</div>
<div class="flex flex-col items-start">
<label class="textlabel">
{{
$t("task.progress.total-units", {
- units: $t(`task.progress.units.${unitKey}`),
+ units: unitStr,
})
}}
</label>
- <span v-if="progress.totalUnit > 0">{{ progress.totalUnit }}</span>
+ <span v-if="progress.totalUnit > 0">
+ <slot name="unit" :unit="progress.totalUnit">
+ {{ progress.totalUnit }}
+ </slot>
+ </span>
<span v-else class="text-gray-400">
{{ $t("task.progress.counting") }}
</span>
@@ -63,6 +71,7 @@
<script lang="ts" setup>
import { computed, PropType } from "vue";
import { NPopover } from "naive-ui";
+import { useI18n } from "vue-i18n";
import type { Task, TaskProgress } from "@/types";
import { empty } from "@/types";
import { BBProgressPie } from "@/bbkit";
@@ -79,10 +88,12 @@ const props = defineProps({
},
unitKey: {
type: String,
- default: "unit",
+ default: undefined,
},
});
+const { t } = useI18n();
+
const showProgress = computed((): boolean => {
const { status } = props.task;
@@ -134,4 +145,13 @@ const progress = computed((): ProgressSummary => {
const showPopover = computed((): boolean => {
return props.task.status !== "DONE";
});
+
+const unitStr = computed(() => {
+ const { unitKey } = props;
+ if (!unitKey) {
+ return "";
+ }
+
+ return t(`task.progress.units.${unitKey}`);
+});
</script>