Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: switch issue stage (#16070)
ecmadaobaa5c36677fc
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vueindex ca226fab98..41ca11d241 100644--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue@@ -16,18 +16,21 @@<template v-for="status in ADVICE_STATUS_FILTERS" :key="status"><NTagv-if="getTaskCount(undefined, status) > 0"- @click="- emit(- 'update:adviceStatusList',- adviceStatusList.includes(status)- ? adviceStatusList.filter((s) => s !== status)- : [...adviceStatusList, status]- )- "+ :disabled="disabled":size="'small'"round- :bordered="adviceStatusList.includes(status)"- :type="adviceStatusList.includes(status) ? 'info' : 'default'"+ checkable+ :checked="adviceStatusList.includes(status)"+ @update:checked="+ (checked) => {+ emit(+ 'update:adviceStatusList',+ checked+ ? [...adviceStatusList, status]+ : adviceStatusList.filter((s) => s !== status)+ );+ }+ "><template #avatar><AdviceStatusIcon :status="status" />@@ -48,18 +51,21 @@<template v-for="status in TASK_STATUS_FILTERS" :key="status"><NTagv-if="getTaskCount(status) > 0"- @click="- emit(- 'update:taskStatusList',- taskStatusList.includes(status)- ? taskStatusList.filter((s) => s !== status)- : [...taskStatusList, status]- )- "+ :disabled="disabled":size="'small'"round- :bordered="taskStatusList.includes(status)"- :type="taskStatusList.includes(status) ? 'info' : 'default'"+ checkable+ :checked="taskStatusList.includes(status)"+ @update:checked="+ (checked) => {+ emit(+ 'update:taskStatusList',+ checked+ ? [...taskStatusList, status]+ : taskStatusList.filter((s) => s !== status)+ );+ }+ "><template #avatar><TaskStatusIconV1 :status="status" :size="'small'" />@@ -84,6 +90,7 @@ import TaskStatusIconV1 from "../TaskStatusIconV1.vue";import { filterTask } from "./filter";defineProps<{+ disabled: boolean;taskStatusList: Task_Status[];adviceStatusList: Advice_Status[];}>();diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vueindex f6ed71217a..7475a71213 100644--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue+++ b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue@@ -5,11 +5,24 @@class="w-full sticky top-0 z-10 bg-white px-4 pt-2 pb-1"><TaskFilter- v-model:task-status-list="state.taskStatusFilters"- v-model:advice-status-list="state.adviceStatusFilters"+ :disabled="stageState.isRequesting || !stageState.initialized"+ :task-status-list="stageState.taskStatusFilters"+ :advice-status-list="stageState.adviceStatusFilters"+ @update:advice-status-list="+ (adviceStatusFilters) => updateStageState({ adviceStatusFilters })+ "+ @update:task-status-list="+ (taskStatusFilters) => updateStageState({ taskStatusFilters })+ "/></div><div class="relative w-full">+ <div+ v-if="!stageState.initialized && stageState.isRequesting"+ class="w-full flex items-center justify-center py-8"+ >+ <BBSpin />+ </div><divref="taskBar"class="task-list gap-2 px-4 py-2 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 3xl:grid-cols-5 4xl:grid-cols-6 overflow-y-auto"@@ -22,19 +35,19 @@}"><TaskCard- v-for="(task, i) in filteredTaskList.slice(0, state.index)"+ v-for="(task, i) in filteredTaskList.slice(0, stageState.index)":key="i":task="task"/><div- v-if="filteredTaskList.length > state.index"+ v-if="filteredTaskList.length > stageState.index"class="col-span-full flex flex-row items-center justify-end"><NButtonsize="small"quaternary- :loading="isRequesting"- @click="state.index += TASK_PER_PAGE"+ :loading="stageState.isRequesting"+ @click="loadNextPage">{{ $t("common.load-more") }}</NButton>@@ -50,6 +63,7 @@import { useDebounceFn } from "@vueuse/core";import { NButton } from "naive-ui";import { computed, ref, reactive, watch } from "vue";+import { BBSpin } from "@/bbkit";import { useVerticalScrollState } from "@/composables/useScrollState";import { batchGetOrFetchDatabases } from "@/store";import type { Task_Status } from "@/types/proto/v1/rollout_service";@@ -62,12 +76,17 @@ import TaskCard from "./TaskCard.vue";import TaskFilter from "./TaskFilter.vue";import { filterTask } from "./filter";-interface LocalState {- // index is the number of tasks to show.- // It is initialized to TASK_PER_PAGE.+interface StageState {+ // Index is the current number of tasks to show.index: number;+ initialized: boolean;taskStatusFilters: Task_Status[];adviceStatusFilters: Advice_Status[];+ isRequesting: boolean;+}++interface LocalState {+ pageStatePerStage: Map<string, StageState>;}const MAX_LIST_HEIGHT = 256;@@ -77,12 +96,8 @@ const MAX_LIST_HEIGHT = 256;const TASK_PER_PAGE = isDev() ? 4 : 20;const state = reactive<LocalState>({- // Index is the current number of tasks to show.- index: TASK_PER_PAGE,- taskStatusFilters: [],- adviceStatusFilters: [],+ pageStatePerStage: new Map<string, StageState>(),});-const isRequesting = ref(false);const issueContext = useIssueContext();const { selectedStage, issue, selectedTask } = issueContext;@@ -94,16 +109,34 @@ const taskList = computed(() => {return selectedStage.value.tasks;});+const stageState = computed(+ () =>+ state.pageStatePerStage.get(selectedStage.value.name) ?? {+ index: 0,+ initialized: false,+ taskStatusFilters: [],+ adviceStatusFilters: [],+ isRequesting: false,+ }+);++const updateStageState = (patch: Partial<StageState>) => {+ state.pageStatePerStage.set(selectedStage.value.name, {+ ...stageState.value,+ ...patch,+ });+};+const filteredTaskList = computed(() => {return taskList.value.filter((task) => {- if (state.taskStatusFilters.length > 0) {- if (!state.taskStatusFilters.includes(task.status)) {+ if (stageState.value.taskStatusFilters.length > 0) {+ if (!stageState.value.taskStatusFilters.includes(task.status)) {return false;}}- if (state.adviceStatusFilters.length > 0) {+ if (stageState.value.adviceStatusFilters.length > 0) {if (- !state.adviceStatusFilters.some((status) =>+ !stageState.value.adviceStatusFilters.some((status) =>filterTask(issueContext, sqlCheckContext, task, {adviceStatus: status,})@@ -128,46 +161,70 @@ const shouldShowCurrentTaskView = computed(() => {});const loadMore = useDebounceFn(async () => {+ const fromIndex = stageState.value.index;+ const toIndex = fromIndex + TASK_PER_PAGE;+const databaseNames = filteredTaskList.value- .slice(0, state.index)+ .slice(fromIndex, toIndex).map((task) => databaseForTask(issue.value, task).name);- await batchGetOrFetchDatabases(databaseNames);++ try {+ await batchGetOrFetchDatabases(databaseNames);+ } catch {+ // Ignore errors+ // If the issue type is create database,+ // the API will throw error cause it cannot found the pending created database.+ } finally {+ updateStageState({+ index: toIndex,+ initialized: true,+ });+ }}, 500);+const loadNextPage = async () => {+ if (stageState.value.isRequesting) {+ return;+ }+ updateStageState({+ isRequesting: true,+ });+ try {+ await loadMore();+ } catch {+ // Ignore errors+ } finally {+ updateStageState({+ isRequesting: false,+ });+ }+};+watch(- [() => state.taskStatusFilters, () => state.adviceStatusFilters],- () => {+ [+ () => stageState.value.taskStatusFilters,+ () => stageState.value.adviceStatusFilters,+ ],+ async () => {// Reset the index when the filters change.- state.index = TASK_PER_PAGE;- },- {- deep: true,+ if (!stageState.value.isRequesting && stageState.value.initialized) {+ updateStageState({+ index: 0,+ });+ await loadNextPage();+ }});watch(- () => state.index,+ () => selectedStage.value.name,async () => {- isRequesting.value = true;- try {- await loadMore();- } catch {- // Ignore errors+ if (!stageState.value.initialized) {+ await loadNextPage();}- isRequesting.value = false;},{ immediate: true });--watch(- () => selectedStage.value.name,- () => {- // Clear the index when the stage changes.- state.index = TASK_PER_PAGE;- state.taskStatusFilters = [];- state.adviceStatusFilters = [];- }-);</script><style scoped lang="postcss">