Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): batch operations for issue list (#3269)
Liu Ji7313eebabcf7
diff --git a/frontend/package.json b/frontend/package.jsonindex ab8d013b24..71af72baf4 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -42,6 +42,7 @@"qs": "6.11.0","rollup": "3.2.5","scroll-into-view-if-needed": "^2.2.29",+ "scrollparent": "^2.0.1","semver": "7.3.8","slug": "8.2.2","splitpanes": "3.1.5",@@ -75,6 +76,7 @@"@types/papaparse": "5.3.5","@types/prettier": "2.7.1","@types/qs": "6.9.7",+ "@types/scrollparent": "^2.0.1","@types/semver": "7.3.13","@types/slug": "5.0.3","@types/splitpanes": "2.2.1",diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yamlindex d2263c0ce1..f2045a0a49 100644--- a/frontend/pnpm-lock.yaml+++ b/frontend/pnpm-lock.yaml@@ -24,6 +24,7 @@ specifiers:'@types/papaparse': 5.3.5'@types/prettier': 2.7.1'@types/qs': 6.9.7+ '@types/scrollparent': ^2.0.1'@types/semver': 7.3.13'@types/slug': 5.0.3'@types/splitpanes': 2.2.1@@ -65,6 +66,7 @@ specifiers:qs: 6.11.0rollup: 3.2.5scroll-into-view-if-needed: ^2.2.29+ scrollparent: ^2.0.1semver: 7.3.8slug: 8.2.2splitpanes: 3.1.5@@ -120,6 +122,7 @@ dependencies:qs: 6.11.0rollup: 3.2.5scroll-into-view-if-needed: 2.2.29+ scrollparent: 2.0.1semver: 7.3.8slug: 8.2.2splitpanes: 3.1.5@@ -153,6 +156,7 @@ devDependencies:'@types/papaparse': 5.3.5'@types/prettier': 2.7.1'@types/qs': 6.9.7+ '@types/scrollparent': 2.0.1'@types/semver': 7.3.13'@types/slug': 5.0.3'@types/splitpanes': 2.2.1@@ -896,6 +900,10 @@ packages:resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==}dev: true+ /@types/scrollparent/2.0.1:+ resolution: {integrity: sha512-LcvYdxOG83yL0IoJOmdeoCVlJUgf5WA+cxrBPh2mfYy3bsMoY72fOe87vneW4W/NWuqsdGjoK7fVldUkD1xVSw==}+ dev: true+/@types/semver/7.3.13:resolution: {integrity: sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==}dev: true@@ -3393,6 +3401,10 @@ packages:compute-scroll-into-view: 1.0.17dev: false+ /scrollparent/2.0.1:+ resolution: {integrity: sha512-HSdN78VMvFCSGCkh0oYX/tY4R3P1DW61f8+TeZZ4j2VLgfwvw0bpRSOv4PCVKisktIwbzHCfZsx+rLbbDBqIBA==}+ dev: false+/seemly/0.3.6:resolution: {integrity: sha512-lEV5VB8BUKTo/AfktXJcy+JeXns26ylbMkIUco8CYREsQijuz4mrXres2Q+vMLdwkuLxJdIPQ8IlCIxLYm71Yw==}dev: falsediff --git a/frontend/src/components/Issue/BatchIssueActions.vue b/frontend/src/components/Issue/BatchIssueActions.vuenew file mode 100644index 0000000000..84af295baa--- /dev/null+++ b/frontend/src/components/Issue/BatchIssueActions.vue@@ -0,0 +1,308 @@+<template>+ <BBTooltipButton+ type="primary"+ :disabled="!isTransitionApplicableForAllIssues('RESOLVE')"+ tooltip-mode="DISABLED-ONLY"+ @click="startBatchIssueTransition('RESOLVE')"+ >+ {{ $t("issue.batch-transition.resolve") }}+ <template #tooltip>+ <div class="whitespace-nowrap">+ {{+ $t("issue.batch-transition.not-allowed-tips", {+ operation: $t("issue.batch-transition.resolved"),+ })+ }}+ </div>+ </template>+ </BBTooltipButton>++ <BBTooltipButton+ type="normal"+ :disabled="!isTransitionApplicableForAllIssues('CANCEL')"+ tooltip-mode="DISABLED-ONLY"+ @click="startBatchIssueTransition('CANCEL')"+ >+ {{ $t("issue.batch-transition.cancel") }}+ <template #tooltip>+ <div class="whitespace-nowrap">+ {{+ $t("issue.batch-transition.not-allowed-tips", {+ operation: $t("issue.batch-transition.cancelled"),+ })+ }}+ </div>+ </template>+ </BBTooltipButton>++ <BBTooltipButton+ type="normal"+ :disabled="!isTransitionApplicableForAllIssues('REOPEN')"+ tooltip-mode="DISABLED-ONLY"+ @click="startBatchIssueTransition('REOPEN')"+ >+ {{ $t("issue.batch-transition.reopen") }}+ <template #tooltip>+ <div class="whitespace-nowrap">+ {{+ $t("issue.batch-transition.not-allowed-tips", {+ operation: $t("issue.batch-transition.reopened"),+ })+ }}+ </div>+ </template>+ </BBTooltipButton>++ <BBModal+ v-if="state.modal.show"+ :title="state.modal.title"+ class="relative overflow-hidden"+ @close="state.modal.show = false"+ >+ <div+ v-if="state.isRequesting"+ class="absolute inset-0 flex flex-col items-center justify-center bg-white/70"+ >+ <BBSpin />+ <div class="flex items-center textlabel">+ <span>{{ $t("common.updating") }}</span>+ <span v-if="state.stats"+ >({{ state.stats.success }} / {{ state.stats.total }})</span+ >+ </div>+ </div>++ <div>+ <div class="sm:col-span-4 w-112 min-w-full">+ <label for="about" class="textlabel">+ {{ $t("issue.status-transition.form.note") }}+ </label>+ <div class="mt-1">+ <textarea+ ref="commentTextArea"+ v-model="state.modal.comment"+ rows="3"+ class="textarea block w-full resize-none mt-1 text-sm text-control rounded-md whitespace-pre-wrap"+ :placeholder="$t('issue.status-transition.form.placeholder')"+ @input="+ (e) => {+ sizeToFit(e.target as HTMLTextAreaElement);+ }+ "+ @focus="+ (e) => {+ sizeToFit(e.target as HTMLTextAreaElement);+ }+ "+ ></textarea>+ </div>+ </div>+ </div>++ <!-- Update button group -->+ <div class="flex justify-end items-center pt-5">+ <button+ type="button"+ class="btn-normal mt-3 px-4 py-2 sm:mt-0 sm:w-auto"+ @click.prevent="state.modal.show = false"+ >+ {{ $t("common.cancel") }}+ </button>+ <button+ type="button"+ class="ml-3 px-4 py-2"+ :class="state.modal.okButtonClass"+ @click="doBatchIssueTransition(state.modal.transition!)"+ >+ {{ state.modal.okButtonText }}+ </button>+ </div>+ </BBModal>+</template>++<script lang="ts" setup>+import { computed, PropType, reactive } from "vue";+import { useI18n } from "vue-i18n";+import type {+ Issue,+ IssueStatusPatch,+ IssueStatusTransition,+ IssueStatusTransitionType,+} from "@/types";+import {+ ASSIGNEE_APPLICABLE_ACTION_LIST,+ CREATOR_APPLICABLE_ACTION_LIST,+ ISSUE_STATUS_TRANSITION_LIST,+ SYSTEM_BOT_ID,+} from "@/types";+import { allTaskList, hasWorkspacePermission } from "@/utils";+import {+ pushNotification,+ refreshIssueList,+ useCurrentUser,+ useIssueStore,+} from "@/store";++type RequestStats = {+ total: number;+ success: number;+ failed: number;+};++type ModalProps = {+ show: boolean;+ title: string;+ comment: string;+ transition?: IssueStatusTransition;+ okButtonText: string;+ okButtonClass?: string;+};++type LocalState = {+ isRequesting: boolean;+ modal: ModalProps;+ stats?: RequestStats;+};++const props = defineProps({+ issueList: {+ type: Array as PropType<Issue[]>,+ default: () => [],+ },+});++const state = reactive<LocalState>({+ isRequesting: false,+ modal: {+ show: false,+ title: "",+ comment: "",+ okButtonText: "",+ },+});++const currentUser = useCurrentUser();+const issueStore = useIssueStore();+const { t } = useI18n();++const getApplicableIssueStatusTransitionList = (+ issue: Issue+): IssueStatusTransition[] => {+ const actionList: IssueStatusTransitionType[] = [];++ // The current user is the assignee of the issue+ // or the assignee is SYSTEM_BOT and the current user can manage issue+ const isAssignee =+ currentUser.value.id === issue.assignee?.id ||+ (issue.assignee?.id == SYSTEM_BOT_ID &&+ hasWorkspacePermission(+ "bb.permission.workspace.manage-issue",+ currentUser.value.role+ ));+ const isCreator = currentUser.value.id === issue.creator.id;+ if (isAssignee) {+ actionList.push(...ASSIGNEE_APPLICABLE_ACTION_LIST.get(issue.status)!);+ }+ if (isCreator) {+ CREATOR_APPLICABLE_ACTION_LIST.get(issue.status)!.forEach((item) => {+ if (actionList.indexOf(item) === -1) {+ actionList.push(item);+ }+ });+ }++ const applicableActionList: IssueStatusTransition[] = [];++ actionList.forEach((type) => {+ const transition = ISSUE_STATUS_TRANSITION_LIST.get(type)!;+ const taskList = allTaskList(issue.pipeline);+ if (taskList.some((task) => task.status === "RUNNING")) {+ // Disallow any issue status transition if some of the tasks are in RUNNING state.+ return;+ }+ if (type === "RESOLVE") {+ // Disallow to "resolve" issue if some of the tasks are NOT DONE.+ if (taskList.some((task) => task.status !== "DONE")) {+ return;+ }+ }+ applicableActionList.push(transition);+ });++ return applicableActionList;+};++const issueTransitionList = computed(() => {+ return props.issueList.map((issue) => {+ const transitions = getApplicableIssueStatusTransitionList(issue);+ return { issue, transitions };+ });+});++const isTransitionApplicableForAllIssues = (+ type: IssueStatusTransitionType+): boolean => {+ return issueTransitionList.value.every((item) => {+ return (+ item.transitions.findIndex((transition) => transition.type === type) >= 0+ );+ });+};++const startBatchIssueTransition = (type: IssueStatusTransitionType) => {+ const { modal } = state;+ modal.show = true;+ const transition = ISSUE_STATUS_TRANSITION_LIST.get(type)!;+ modal.transition = transition;+ modal.comment = "";+ modal.okButtonClass = transition.buttonClass;+ modal.okButtonText = t(transition.buttonName);+ modal.title = t("issue.batch-transition.action-n-issues", {+ action: t(`issue.batch-transition.${type.toLowerCase()}`),+ n: props.issueList.length,+ });+};++const doBatchIssueTransition = async (transition: IssueStatusTransition) => {+ const issueStatusPatch: IssueStatusPatch = {+ status: transition.to,+ comment: state.modal.comment,+ };++ const stats = reactive<RequestStats>({+ total: props.issueList.length,+ success: 0,+ failed: 0,+ });++ const doSingleIssueTransition = async (issue: Issue, index: number) => {+ const request = issueStore.updateIssueStatus({+ issueId: issue.id,+ issueStatusPatch,+ });+ request.then(+ () => stats.success++,+ () => stats.failed+++ );++ return request;+ };++ state.isRequesting = true;+ state.stats = stats;+ try {+ const requestList = props.issueList.map(doSingleIssueTransition);+ await Promise.allSettled(requestList);+ pushNotification({+ module: "bytebase",+ style: "SUCCESS",+ title: t("issue.batch-transition.successfully-updated-n-issues", {+ n: stats.success,+ }),+ });+ } finally {+ state.isRequesting = false;+ refreshIssueList();+ }+};+</script>diff --git a/frontend/src/components/Issue/IssueTable.vue b/frontend/src/components/Issue/IssueTable.vueindex cb7d352b0a..44d5d36bd8 100644--- a/frontend/src/components/Issue/IssueTable.vue+++ b/frontend/src/components/Issue/IssueTable.vue@@ -1,89 +1,59 @@<template><BBTable+ ref="tableRef":column-list="columnList":section-data-source="issueSectionList":show-header="true"+ :custom-header="true":left-bordered="leftBordered":right-bordered="rightBordered":top-bordered="topBordered":bottom-bordered="bottomBordered"+ v-bind="$attrs"@click-row="clickIssue"><template #header>- <!-- Status -->- <BBTableHeaderCell- :left-padding="4"- class="w-4 table-cell"- :title="$t(columnList[0].title)"- />- <template v-if="mode == 'ALL'">- <!-- Project -->- <BBTableHeaderCell- class="w-12 table-cell"- :title="$t(columnList[1].title)"- />- <!-- Name -->- <BBTableHeaderCell- class="table-cell"- :title="$t(columnList[2].title)"- />- <!-- Environment -->- <BBTableHeaderCell- class="w-36 table-cell"- :title="$t(columnList[3].title)"- />- <!-- Progress -->- <BBTableHeaderCell- class="w-36 hidden sm:table-cell"- :title="$t(columnList[5].title)"- />- <!-- Updated -->- <BBTableHeaderCell- class="w-36 hidden md:table-cell"- :title="$t(columnList[6].title)"- />- <!-- Assignee -->- <BBTableHeaderCell- class="w-36 hidden sm:table-cell"- :title="$t(columnList[7].title)"- />- </template>- <template v-else-if="mode == 'PROJECT'">- <!-- Name -->- <BBTableHeaderCell- class="table-cell"- :title="$t(columnList[1].title)"- />- <!-- Environment -->- <BBTableHeaderCell- class="w-36 table-cell"- :title="$t(columnList[2].title)"- />- <!-- Progress -->- <BBTableHeaderCell- class="w-36 hidden sm:table-cell"- :title="$t(columnList[4].title)"- />- <!-- Updated -->- <BBTableHeaderCell- class="w-36 hidden md:table-cell"- :title="$t(columnList[5].title)"- />- <!-- Assignee -->- <BBTableHeaderCell- class="w-36 hidden sm:table-cell"- :title="$t(columnList[6].title)"- />- </template>+ <th+ v-for="(column, index) in columnList"+ :key="index"+ scope="col"+ class="pl-2 py-2 text-left text-xs font-medium text-gray-500 tracking-wider capitalize"+ :class="[column.center && 'text-center pr-2']"+ >+ <template v-if="index === 0">+ <input+ v-if="issueList.length > 0"+ type="checkbox"+ class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"+ :checked="allSelectionState.checked"+ :indeterminate="allSelectionState.indeterminate"+ @input="+ setAllIssuesSelection(($event.target as HTMLInputElement).checked)+ "+ />+ </template>+ <template v-else>{{ $t(column.title) }}</template>+ </th></template>- <template #body="{ rowData: issue }">- <BBTableCell :left-padding="4" class="table-cell">+ <template #body="{ rowData: issue }: { rowData: Issue }">+ <BBTableCell+ class="w-[1%]"+ @click.stop="setIssueSelection(issue, !isIssueSelected(issue))"+ >+ <!-- width: 1% means as narrow as possible -->+ <input+ type="checkbox"+ class="h-4 w-4 text-accent rounded disabled:cursor-not-allowed border-control-border focus:ring-accent"+ :checked="isIssueSelected(issue)"+ />+ </BBTableCell>+ <BBTableCell :left-padding="4" class="table-cell w-12"><IssueStatusIcon:issue-status="issue.status":task-status="activeTask(issue.pipeline).status"/></BBTableCell>- <BBTableCell v-if="mode == 'ALL'" class="table-cell text-gray-500">+ <BBTableCell v-if="mode == 'ALL'" class="table-cell text-gray-500 w-12"><span>{{ issue.project.key }}</span></BBTableCell><BBTableCell class="table-cell">@@ -92,7 +62,7 @@<div class="truncate">{{ issue.name }}</div></div></BBTableCell>- <BBTableCell class="table-cell">+ <BBTableCell class="table-cell w-36"><div class="flex items-center">{{ activeEnvironmentName(issue) }}<ProtectedEnvironmentIcon@@ -101,7 +71,7 @@/></div></BBTableCell>- <BBTableCell class="hidden sm:table-cell">+ <BBTableCell class="hidden sm:table-cell w-36"><BBStepBar:step-list="taskStepList(issue)"@click-step="@@ -111,10 +81,10 @@"/></BBTableCell>- <BBTableCell class="hidden md:table-cell">+ <BBTableCell class="hidden md:table-cell w-36">{{ humanizeTs(issue.updatedTs) }}</BBTableCell>- <BBTableCell class="hidden sm:table-cell">+ <BBTableCell class="hidden sm:table-cell w-36"><div class="flex flex-row items-center"><BBAvatar:size="'SMALL'"@@ -129,28 +99,37 @@</BBTableCell></template></BBTable>++ <div+ v-if="isTableInViewport && selectedIssueList.length > 0"+ class="sticky bottom-0 w-full bg-white flex items-center gap-x-2 px-2 py-2 border border-t-0"+ >+ <BatchIssueActions :issue-list="selectedIssueList" />+ </div></template>-<script lang="ts">-import { reactive, PropType, defineComponent } from "vue";+<script lang="ts" setup>+import { reactive, PropType, computed, watch, ref } from "vue";import { useRouter } from "vue-router";-import {++import type {BBTableColumn,- BBTableSectionDataSource,BBStep,BBStepStatus,-} from "../../bbkit/types";+ BBTableSectionDataSource,+} from "@/bbkit/types";+import type { Issue, IssueId, Task } from "@/types";import IssueStatusIcon from "./IssueStatusIcon.vue";+import BatchIssueActions from "./BatchIssueActions.vue";import {issueSlug,activeEnvironment,- activeDatabase,activeTask,stageSlug,activeTaskInStage,-} from "../../utils";-import { Issue, Task } from "../../types";+} from "@/utils";import ProtectedEnvironmentIcon from "../Environment/ProtectedEnvironmentIcon.vue";+import { useElementVisibilityInScrollParent } from "@/composables/useElementVisibilityInScrollParent";type Mode = "ALL" | "PROJECT";@@ -170,9 +149,6 @@ const columnListMap: Map<Mode, BBTableColumn[]> = new Map([{title: "issue.table.environment",},- {- title: "issue.table.db",- },{title: "issue.table.progress",},@@ -196,9 +172,6 @@ const columnListMap: Map<Mode, BBTableColumn[]> = new Map([{title: "issue.table.environment",},- {- title: "issue.table.db",- },{title: "issue.table.progress",},@@ -214,107 +187,164 @@ const columnListMap: Map<Mode, BBTableColumn[]> = new Map([interface LocalState {dataSource: any[];+ selectedIssueIdList: Set<IssueId>;}-export default defineComponent({- name: "IssueTable",- components: { IssueStatusIcon, ProtectedEnvironmentIcon },- props: {- issueSectionList: {- required: true,- type: Object as PropType<BBTableSectionDataSource<Issue>[]>,- },- mode: {- default: "ALL",- type: String as PropType<Mode>,- },- leftBordered: {- default: true,- type: Boolean,- },- rightBordered: {- default: true,- type: Boolean,- },- topBordered: {- default: true,- type: Boolean,- },- bottomBordered: {- default: true,- type: Boolean,- },+const props = defineProps({+ title: {+ type: String,+ required: true,+ },+ issueList: {+ type: Array as PropType<Issue[]>,+ default: () => [],},- setup(props) {- const router = useRouter();+ mode: {+ default: "ALL",+ type: String as PropType<Mode>,+ },+ leftBordered: {+ default: true,+ type: Boolean,+ },+ rightBordered: {+ default: true,+ type: Boolean,+ },+ topBordered: {+ default: true,+ type: Boolean,+ },+ bottomBordered: {+ default: true,+ type: Boolean,+ },+});+const router = useRouter();- const state = reactive<LocalState>({- dataSource: [],- });+const state = reactive<LocalState>({+ dataSource: [],+ selectedIssueIdList: new Set(),+});- const activeEnvironmentName = function (issue: Issue) {- return activeEnvironment(issue.pipeline).name;- };+const tableRef = ref<HTMLTableElement>();+const isTableInViewport = useElementVisibilityInScrollParent(tableRef);- const activeDatabaseName = function (issue: Issue) {- return activeDatabase(issue.pipeline)?.name;- };+const columnList = computed((): BBTableColumn[] => {+ return [{ title: "" }, ...columnListMap.get(props.mode)!];+});- const taskStepList = function (issue: Issue): BBStep[] {- return issue.pipeline.stageList.map((stage) => {- const task = activeTaskInStage(stage);- let status: BBStepStatus = task.status;- if (status == "PENDING" || status == "PENDING_APPROVAL") {- if (activeTask(issue.pipeline).id == task.id) {- status =- status == "PENDING"- ? "PENDING_ACTIVE"- : "PENDING_APPROVAL_ACTIVE";- }- }- return {- status,- payload: task,- };- });- };+const issueSectionList = computed((): BBTableSectionDataSource<Issue>[] => {+ return [+ {+ title: props.title,+ list: props.issueList,+ },+ ];+});++const selectedIssueList = computed(() => {+ return props.issueList.filter((issue) =>+ state.selectedIssueIdList.has(issue.id)+ );+});++const activeEnvironmentName = function (issue: Issue) {+ return activeEnvironment(issue.pipeline).name;+};- const clickIssue = (section: number, row: number, e: MouseEvent) => {- const issue = props.issueSectionList[section].list[row];- const url = `/issue/${issueSlug(issue.name, issue.id)}`;- if (e.ctrlKey || e.metaKey) {- window.open(url, "_blank");- } else {- router.push(url);+const taskStepList = function (issue: Issue): BBStep[] {+ return issue.pipeline.stageList.map((stage) => {+ const task = activeTaskInStage(stage);+ let status: BBStepStatus = task.status;+ if (status == "PENDING" || status == "PENDING_APPROVAL") {+ if (activeTask(issue.pipeline).id == task.id) {+ status =+ status == "PENDING" ? "PENDING_ACTIVE" : "PENDING_APPROVAL_ACTIVE";}+ }+ return {+ status,+ payload: task,};+ });+};- const clickIssueStep = (issue: Issue, step: BBStep) => {- const task = step.payload as Task;- const stageIndex = issue.pipeline.stageList.findIndex((item) => {- return item.id == task.stage.id;- });+const isIssueSelected = (issue: Issue): boolean => {+ return state.selectedIssueIdList.has(issue.id);+};- router.push({- name: "workspace.issue.detail",- params: {- issueSlug: issueSlug(issue.name, issue.id),- },- query: { stage: stageSlug(task.stage.name, stageIndex) },- });- };+const allSelectionState = computed(() => {+ const set = state.selectedIssueIdList;- return {- state,- columnList: columnListMap.get(props.mode)!,- activeEnvironment,- activeEnvironmentName,- activeDatabaseName,- taskStepList,- activeTask,- clickIssue,- clickIssueStep,- };- },+ const checked = props.issueList.every((issue) => set.has(issue.id));+ const indeterminate =+ !checked && props.issueList.some((issue) => set.has(issue.id));++ return {+ checked,+ indeterminate,+ };});++const setIssueSelection = (issue: Issue, selected: boolean) => {+ if (selected) {+ state.selectedIssueIdList.add(issue.id);+ } else {+ state.selectedIssueIdList.delete(issue.id);+ }+};+const setAllIssuesSelection = (selected: boolean): void => {+ const set = state.selectedIssueIdList;+ const list = props.issueList;+ if (selected) {+ list.forEach((issue) => {+ set.add(issue.id);+ });+ } else {+ list.forEach((issue) => {+ set.delete(issue.id);+ });+ }+};++const clickIssue = (_: number, row: number, e: MouseEvent) => {+ const issue = props.issueList[row];+ const url = `/issue/${issueSlug(issue.name, issue.id)}`;+ if (e.ctrlKey || e.metaKey) {+ window.open(url, "_blank");+ } else {+ router.push(url);+ }+};++const clickIssueStep = (issue: Issue, step: BBStep) => {+ const task = step.payload as Task;+ const stageIndex = issue.pipeline.stageList.findIndex((item) => {+ return item.id == task.stage.id;+ });++ router.push({+ name: "workspace.issue.detail",+ params: {+ issueSlug: issueSlug(issue.name, issue.id),+ },+ query: { stage: stageSlug(task.stage.name, stageIndex) },+ });+};++watch(+ () => props.issueList,+ (list) => {+ const oldIssueIdList = Array.from(state.selectedIssueIdList.values());+ const newIssueIdList = new Set(list.map((issue) => issue.id));+ oldIssueIdList.forEach((id) => {+ // If a selected issue id doesn't appear in the new IssueList+ // we should cancel its selection state.+ if (!newIssueIdList.has(id)) {+ state.selectedIssueIdList.delete(id);+ }+ });+ }+);</script>diff --git a/frontend/src/components/Issue/PagedIssueTable.vue b/frontend/src/components/Issue/PagedIssueTable.vueindex f9d7a88179..ab31698dd4 100644--- a/frontend/src/components/Issue/PagedIssueTable.vue+++ b/frontend/src/components/Issue/PagedIssueTable.vue@@ -25,14 +25,16 @@</template><script lang="ts" setup>+import { computed, PropType, reactive, watch } from "vue";+import {buildQueryListByIssueFind,useIsLoggedIn,useIssueStore,+ useRefreshIssueList,} from "@/store";import { Issue, IssueFind } from "@/types";import { useSessionStorage } from "@vueuse/core";-import { computed, PropType, reactive, watch } from "vue";type LocalState = {loading: boolean;@@ -176,4 +178,8 @@ watch(isLoggedIn, () => {resetSession();}});++useRefreshIssueList(() => {+ refresh();+});</script>diff --git a/frontend/src/components/ProjectOverviewPanel.vue b/frontend/src/components/ProjectOverviewPanel.vueindex 5f0c833d5c..895411eeba 100644--- a/frontend/src/components/ProjectOverviewPanel.vue+++ b/frontend/src/components/ProjectOverviewPanel.vue@@ -105,9 +105,8 @@<template #table="{ issueList, loading }"><IssueTable:mode="'PROJECT'"- :issue-section-list="[- { title: $t('project.overview.in-progress'), list: issueList },- ]"+ :title="$t('project.overview.in-progress')"+ :issue-list="issueList":show-placeholder="!loading"/></template>@@ -128,12 +127,8 @@<IssueTableclass="-mt-px":mode="'PROJECT'"- :issue-section-list="[- {- title: $t('project.overview.recently-closed'),- list: issueList,- },- ]"+ :title="$t('project.overview.recently-closed')"+ :issue-list="issueList":show-placeholder="!loading"/></template>diff --git a/frontend/src/composables/useElementVisibilityInScrollParent.ts b/frontend/src/composables/useElementVisibilityInScrollParent.tsnew file mode 100644index 0000000000..4ba41271b5--- /dev/null+++ b/frontend/src/composables/useElementVisibilityInScrollParent.ts@@ -0,0 +1,18 @@+import { computed } from "vue";+import type { MaybeElementRef } from "@vueuse/core";+import { unrefElement, useElementVisibility } from "@vueuse/core";+import getScrollParent from "scrollparent";++export const useElementVisibilityInScrollParent = (+ element: MaybeElementRef+) => {+ const scrollTarget = computed((): HTMLElement | null => {+ const elem = unrefElement(element);+ if (!elem) {+ return null;+ }+ return getScrollParent(elem);+ });++ return useElementVisibility(element, { scrollTarget });+};diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 4d257c69d0..e987cb8942 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -517,7 +517,18 @@"upload-sql": "Upload SQL","override-current-statement": "Override current SQL statement","upload-sql-file-max-size-exceeded": "Max file size ({size}) exceeded.",- "waiting-earliest-allowed-time": "Will run after {time}"+ "waiting-earliest-allowed-time": "Will run after {time}",+ "batch-transition": {+ "not-allowed-tips": "Some of selected issues cannot be {operation}",+ "resolve": "Resolve",+ "resolved": "resolved",+ "cancel": "Cancel",+ "cancelled": "cancelled",+ "reopen": "Reopen",+ "reopened": "reopened",+ "action-n-issues": "{action} {n} issue | {action} {n} issues",+ "successfully-updated-n-issues": "Successfully updated {n} issue | Successfully updated {n} issues"+ }},"alter-schema": {"vcs-enabled": "This project has enabled VCS based version control and selecting database below will navigate you to the corresponding Git repository to initiate the change process.",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex b69be5eb21..cd9ec833f5 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -517,7 +517,18 @@"upload-sql": "上传 SQL","override-current-statement": "覆盖当前的 SQL 语句","upload-sql-file-max-size-exceeded": "上传文件大小不能超过 {size}。",- "waiting-earliest-allowed-time": "将于 {time} 之后执行"+ "waiting-earliest-allowed-time": "将于 {time} 之后执行",+ "batch-transition": {+ "not-allowed-tips": "部分选中的工单无法被{operation}",+ "resolve": "解决",+ "resolved": "解决",+ "cancel": "取消",+ "cancelled": "取消",+ "reopen": "重开",+ "reopened": "重开",+ "action-n-issues": "{action} {n} 个工单",+ "successfully-action-n-issues": "成功更新 {n} 个工单"+ }},"alter-schema": {"vcs-enabled": "该项目开启了基于 VCS 的版本管理,选择下面的数据库会将您导航到相应的 Git 仓库以发起变更流程。",diff --git a/frontend/src/store/modules/issue.ts b/frontend/src/store/modules/issue.tsindex 26dc45c20e..1858b564ed 100644--- a/frontend/src/store/modules/issue.ts+++ b/frontend/src/store/modules/issue.ts@@ -1,4 +1,5 @@import { defineStore } from "pinia";+import { ref, watch, WatchCallback } from "vue";import axios from "axios";import {empty,@@ -330,3 +331,12 @@ export const buildQueryListByIssueFind = (return queryList;};++// expose global list refresh features+const REFRESH_ISSUE_LIST = ref(Math.random());+export const refreshIssueList = () => {+ REFRESH_ISSUE_LIST.value = Math.random();+};+export const useRefreshIssueList = (callback: WatchCallback) => {+ watch(REFRESH_ISSUE_LIST, callback);+};diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vueindex 5c87c5c293..2654743ac5 100644--- a/frontend/src/views/Home.vue+++ b/frontend/src/views/Home.vue@@ -27,12 +27,8 @@:left-bordered="false":right-bordered="false":show-placeholder="!loading"- :issue-section-list="[- {- title: $t('common.assigned'),- list: issueList.filter(keywordAndEnvironmentFilter),- },- ]"+ :title="$t('common.assigned')"+ :issue-list="issueList.filter(keywordAndEnvironmentFilter)"/></template></PagedIssueTable>@@ -52,12 +48,8 @@:left-bordered="false":right-bordered="false":show-placeholder="!loading"- :issue-section-list="[- {- title: $t('common.created'),- list: issueList.filter(keywordAndEnvironmentFilter),- },- ]"+ :title="$t('common.created')"+ :issue-list="issueList.filter(keywordAndEnvironmentFilter)"/></template></PagedIssueTable>@@ -77,12 +69,8 @@:left-bordered="false":right-bordered="false":show-placeholder="!loading"- :issue-section-list="[- {- title: $t('common.subscribed'),- list: issueList.filter(keywordAndEnvironmentFilter),- },- ]"+ :title="$t('common.subscribed')"+ :issue-list="issueList.filter(keywordAndEnvironmentFilter)"/></template></PagedIssueTable>@@ -104,12 +92,8 @@:left-bordered="false":right-bordered="false":show-placeholder="!loading"- :issue-section-list="[- {- title: $t('project.overview.recently-closed'),- list: issueList.filter(keywordAndEnvironmentFilter),- },- ]"+ :title="$t('project.overview.recently-closed')"+ :issue-list="issueList.filter(keywordAndEnvironmentFilter)"/></template></PagedIssueTable>diff --git a/frontend/src/views/IssueDashboard.vue b/frontend/src/views/IssueDashboard.vueindex 8849d57e8d..344ddfd346 100644--- a/frontend/src/views/IssueDashboard.vue+++ b/frontend/src/views/IssueDashboard.vue@@ -48,10 +48,9 @@:right-bordered="false":top-bordered="true":bottom-bordered="true"- :issue-section-list="[- { title: $t('issue.table.open'), list: issueList.filter(filter) },- ]":show-placeholder="!loading"+ :title="$t('issue.table.open')"+ :issue-list="issueList.filter(filter)"/></template></PagedIssueTable>@@ -74,10 +73,9 @@:right-bordered="false":top-bordered="true":bottom-bordered="true"- :issue-section-list="[- { title: $t('issue.table.closed'), list: issueList.filter(filter) },- ]":show-placeholder="!loading"+ :title="$t('issue.table.closed')"+ :issue-list="issueList.filter(filter)"/></template></PagedIssueTable>