Skip to content

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

refactor(frontend): redesign issue list from table to flex-based layout (#19405)

boojack60a7e5e0230b
diff --git a/frontend/src/components/IssueV1/components/CurrentApproverV1.vue b/frontend/src/components/IssueV1/components/CurrentApproverV1.vue
deleted file mode 100644
index b805cd81d3..0000000000
--- a/frontend/src/components/IssueV1/components/CurrentApproverV1.vue
+++ /dev/null
@@ -1,125 +0,0 @@
-<template>
- <div class="flex flex-row items-center gap-x-2 overflow-hidden">
- <template
- v-if="
- issue.status !== IssueStatus.OPEN || rolloutReady || !approvalFlowReady
- "
- >
- <span>-</span>
- </template>
- <template
- v-else-if="issue.approvalStatus === Issue_ApprovalStatus.REJECTED"
- >
- <NTooltip :disabled="!rejectedApprover">
- <template #trigger>
- <div class="flex flex-row items-center gap-x-2">
- <div
- class="w-6 h-6 rounded-full flex items-center justify-center text-sm shrink-0 bg-warning"
- >
- <heroicons:pause-solid class="w-5 h-5 text-white" />
- </div>
- <span class="text-warning">
- {{ $t("custom-approval.approval-flow.issue-review.sent-back") }}
- </span>
- </div>
- </template>
- <template #default>
- <i18n-t
- keypath="custom-approval.approval-flow.issue-review.review-sent-back-by"
- >
- <template #user>{{ rejectedApprover?.title }}</template>
- </i18n-t>
- </template>
- </NTooltip>
- </template>
- <UserNameCell v-else-if="currentApprover"
- size="small"
- :user="currentApprover"
- :link="false"
- :allow-edit="false"
- :show-email="false"
- :show-mfa-enabled="false"
- :show-source="false"
- />
- <template v-else>
- <span>-</span>
- </template>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computedAsync } from "@vueuse/core";
-import { NTooltip } from "naive-ui";
-import { computed } from "vue";
-import { UserNameCell } from "@/components/v2/Model/cells";
-import {
- candidatesOfApprovalStepV1,
- useCurrentUserV1,
- userNamePrefix,
- useUserStore,
-} from "@/store";
-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
-import {
- Issue_ApprovalStatus,
- Issue_Approver_Status,
- IssueStatus,
-} from "@/types/proto-es/v1/issue_service_pb";
-
-const props = defineProps<{
- issue: Issue;
-}>();
-
-const me = useCurrentUserV1();
-const userStore = useUserStore();
-
-const approvalFlowReady = computed(() => {
- return props.issue.approvalStatus !== Issue_ApprovalStatus.CHECKING;
-});
-
-const rolloutReady = computed(() => {
- const approvalStatus = props.issue.approvalStatus;
- return (
- approvalStatus === Issue_ApprovalStatus.APPROVED ||
- approvalStatus === Issue_ApprovalStatus.SKIPPED
- );
-});
-
-const rejectedApprover = computedAsync(() => {
- if (props.issue.approvalStatus !== Issue_ApprovalStatus.REJECTED) {
- return undefined;
- }
- const rejectedApproval = props.issue.approvers.find(
- (ap) => ap.status === Issue_Approver_Status.REJECTED
- );
- if (!rejectedApproval?.principal) return undefined;
- return userStore.getOrFetchUserByIdentifier({
- identifier: rejectedApproval.principal,
- });
-});
-
-const currentApprover = computedAsync(() => {
- if (props.issue.approvalStatus !== Issue_ApprovalStatus.PENDING) {
- return undefined;
- }
-
- const { approvalTemplate, approvers } = props.issue;
- if (!approvalTemplate) return undefined;
-
- const currentRoleIndex = approvers.length;
- const roles = approvalTemplate.flow?.roles || [];
- const role = roles[currentRoleIndex];
- if (!role) return undefined;
-
- const candidates = candidatesOfApprovalStepV1(props.issue, role);
- const currentUserName = `${userNamePrefix}${me.value.email}`;
-
- // Show currentUser if currentUser is one of the valid approver candidates.
- if (candidates.includes(currentUserName)) return me.value;
-
- // Show the first approver candidate otherwise.
- if (candidates.length === 0) return undefined;
- return userStore.getOrFetchUserByIdentifier({
- identifier: candidates[0],
- });
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueListV1.vue b/frontend/src/components/IssueV1/components/IssueListV1.vue
new file mode 100644
index 0000000000..5053af2464
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/IssueListV1.vue
@@ -0,0 +1,400 @@
+<template>
+ <div
+ v-if="title"
+ class="text-left pl-4 pt-4 pb-2 text-base leading-6 font-medium text-gray-900"
+ >
+ {{ title }}
+ </div>
+ <div ref="listRef">
+ <NSpin :show="loading">
+ <div
+ v-for="issue in sortedIssueList"
+ :key="issue.name"
+ class="flex items-start gap-x-2 px-3 sm:px-4 py-3 cursor-pointer border-b hover:bg-gray-50"
+ @click="onRowClick(issue, $event)"
+ >
+ <!-- Checkbox -->
+ <NCheckbox
+ v-if="showSelection"
+ class="shrink-0 mt-1"
+ :checked="state.selectedIssueNameList.has(issue.name)"
+ @update:checked="toggleSelection(issue)"
+ @click.stop
+ />
+
+ <!-- Content + Approval: column on mobile, row on sm+ -->
+ <div
+ class="flex-1 min-w-0 flex flex-col sm:flex-row sm:items-start sm:gap-x-2"
+ >
+ <!-- Left: issue content -->
+ <div class="flex-1 min-w-0">
+ <!-- Line 1: status icon + title + labels -->
+ <div class="flex items-center gap-x-1.5">
+ <div class="h-6 flex justify-center items-center">
+ <IssueStatusIcon
+ class="shrink-0"
+ :issue-status="issue.status"
+ />
+ </div>
+ <a
+ :href="issueUrl(issue)"
+ class="font-medium text-main text-base truncate"
+ @click.stop
+ v-html="highlight(issue.title)"
+ ></a>
+ <span
+ v-for="label in validLabels(issue)"
+ :key="label.value"
+ class="inline-flex items-center gap-x-1 px-1.5 py-0.5 rounded text-xs whitespace-nowrap border shrink-0"
+ >
+ <span
+ class="w-2.5 h-2.5 rounded-sm shrink-0"
+ :style="{ backgroundColor: label.color }"
+ ></span>
+ {{ label.value }}
+ </span>
+ </div>
+ <!-- Line 2: metadata -->
+ <div
+ class="flex items-center flex-wrap gap-x-1 text-xs text-control-light mt-1"
+ >
+ <span class="opacity-80">
+ #{{ extractIssueUID(issue.name) }}
+ </span>
+ <span>&middot;</span>
+ <span>{{
+ humanizeTs(
+ getTimeForPbTimestampProtoEs(issue.updateTime, 0) / 1000
+ )
+ }}</span>
+ <span>&middot;</span>
+ <span>{{ creatorName(issue) }}</span>
+ <template v-if="showProject">
+ <span>&middot;</span>
+ <router-link
+ :to="{
+ name: PROJECT_V1_ROUTE_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(
+ projectOfIssue(issue).name
+ ),
+ },
+ }"
+ class="hover:underline"
+ @click.stop
+ >
+ {{ projectOfIssue(issue).title }}
+ </router-link>
+ </template>
+ </div>
+ <!-- Expanded description for search highlights -->
+ <div
+ v-if="isIssueExpanded(issue)"
+ class="mt-2 max-h-80 overflow-auto whitespace-pre-wrap wrap-break-word break-all text-sm text-control-light"
+ v-html="highlight(issue.description)"
+ ></div>
+ </div>
+
+ <!-- Right: approval status tag -->
+ <NTag
+ v-if="issue.approvalStatus === Issue_ApprovalStatus.CHECKING"
+ size="small"
+ round
+ class="shrink-0 mt-0.5"
+ >
+ {{ t("custom-approval.issue-review.generating-approval-flow") }}
+ </NTag>
+ <NTag
+ v-else-if="
+ issue.approvalStatus === Issue_ApprovalStatus.APPROVED
+ "
+ size="small"
+ round
+ type="success"
+ class="shrink-0 mt-0.5"
+ >
+ {{ t("issue.table.approved") }}
+ </NTag>
+ <NTag
+ v-else-if="
+ issue.approvalStatus === Issue_ApprovalStatus.REJECTED
+ "
+ size="small"
+ round
+ type="warning"
+ class="shrink-0 mt-0.5"
+ >
+ {{ t("custom-approval.approval-flow.issue-review.sent-back") }}
+ </NTag>
+ <div
+ v-else-if="
+ issue.approvalStatus === Issue_ApprovalStatus.PENDING &&
+ totalSteps(issue) > 0
+ "
+ class="shrink-0 flex flex-row sm:flex-col items-center sm:items-end gap-x-1.5 sm:gap-x-0 mt-0.5"
+ >
+ <NTag size="small" round>
+ {{
+ t("issue.table.approval-progress", {
+ approved: issue.approvers.length,
+ total: totalSteps(issue),
+ })
+ }}
+ </NTag>
+ <span
+ v-if="currentRoleName(issue)"
+ class="text-xs text-control-light whitespace-nowrap sm:mt-0.5"
+ >
+ {{
+ t("issue.table.waiting-role", {
+ role: currentRoleName(issue),
+ })
+ }}
+ </span>
+ </div>
+ <NTag v-else size="small" round class="shrink-0 mt-0.5">
+ {{ t("custom-approval.approval-flow.skip") }}
+ </NTag>
+ </div>
+ </div>
+ </NSpin>
+ </div>
+
+ <div
+ v-if="isListInViewport && selectedIssueList.length > 0"
+ class="sticky -bottom-4 w-full bg-white flex items-center gap-x-2 px-3 sm:px-4 py-2 border-y"
+ :class="bordered && 'border-x'"
+ >
+ <BatchIssueActionsV1 :issue-list="selectedIssueList" />
+ </div>
+</template>
+
+<script lang="ts" setup>
+import { orderBy } from "lodash-es";
+import { NCheckbox, NSpin, NTag } from "naive-ui";
+import { computed, reactive, ref, watch } from "vue";
+import { useI18n } from "vue-i18n";
+import { useRouter } from "vue-router";
+import { useElementVisibilityInScrollParent } from "@/composables/useElementVisibilityInScrollParent";
+import { PROJECT_V1_ROUTE_DETAIL } from "@/router/dashboard/projectV1";
+import { useUserStore } from "@/store";
+import { getTimeForPbTimestampProtoEs, unknownUser } from "@/types";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
+import { Issue_ApprovalStatus } from "@/types/proto-es/v1/issue_service_pb";
+import {
+ displayRoleTitle,
+ extractIssueUID,
+ extractProjectResourceName,
+ getHighlightHTMLByRegExp,
+ getIssueRoute,
+ humanizeTs,
+ projectOfIssue,
+} from "@/utils";
+import BatchIssueActionsV1 from "./BatchIssueActionsV1.vue";
+import { getValidIssueLabels } from "./IssueLabelSelector.vue";
+import IssueStatusIcon from "./IssueStatusIcon.vue";
+
+interface LocalState {
+ selectedIssueNameList: Set<string>;
+}
+
+const props = withDefaults(
+ defineProps<{
+ issueList: Issue[];
+ bordered?: boolean;
+ title?: string;
+ highlightText?: string;
+ loading?: boolean;
+ showProject?: boolean;
+ showSelection?: boolean;
+ }>(),
+ {
+ title: "",
+ highlightText: "",
+ loading: true,
+ bordered: false,
+ showSelection: true,
+ }
+);
+
+const { t } = useI18n();
+const router = useRouter();
+const userStore = useUserStore();
+const state = reactive<LocalState>({
+ selectedIssueNameList: new Set(),
+});
+
+const listRef = ref<HTMLDivElement>();
+const isListInViewport = useElementVisibilityInScrollParent(listRef);
+
+// Sorting: matching issues first when searching, then by ID descending
+const sortedIssueList = computed(() => {
+ if (!props.highlightText) {
+ return props.issueList;
+ }
+ return orderBy(
+ props.issueList,
+ [
+ (issue) =>
+ `${issue.title} ${issue.description}`.includes(props.highlightText)
+ ? 1
+ : 0,
+ (issue) => parseInt(extractIssueUID(issue.name)),
+ ],
+ ["desc", "desc"]
+ );
+});
+
+// Selection
+const selectedIssueList = computed(() => {
+ return props.issueList.filter((issue) =>
+ state.selectedIssueNameList.has(issue.name)
+ );
+});
+
+const toggleSelection = (issue: Issue) => {
+ if (state.selectedIssueNameList.has(issue.name)) {
+ state.selectedIssueNameList.delete(issue.name);
+ } else {
+ state.selectedIssueNameList.add(issue.name);
+ }
+};
+
+watch(
+ () => props.issueList,
+ (list) => {
+ const oldIssueNames = Array.from(state.selectedIssueNameList.values());
+ const newIssueNames = new Set(list.map((issue) => issue.name));
+ oldIssueNames.forEach((name) => {
+ if (!newIssueNames.has(name)) {
+ state.selectedIssueNameList.delete(name);
+ }
+ });
+ }
+);
+
+// Navigation
+const issueUrl = (issue: Issue) => {
+ const issueRoute = getIssueRoute(issue);
+ const route = router.resolve({
+ name: issueRoute.name,
+ params: issueRoute.params,
+ });
+ return route.fullPath;
+};
+
+const onRowClick = (issue: Issue, e: MouseEvent) => {
+ const url = issueUrl(issue);
+ if (e.ctrlKey || e.metaKey) {
+ window.open(url, "_blank");
+ } else {
+ router.push(url);
+ }
+};
+
+// Labels
+const validLabels = (issue: Issue) => {
+ const project = projectOfIssue(issue);
+ const validValues = getValidIssueLabels(issue.labels, project.issueLabels);
+ return project.issueLabels.filter((label) =>
+ validValues.includes(label.value)
+ );
+};
+
+// Creator display
+const creatorName = (issue: Issue) => {
+ const creator =
+ userStore.getUserByIdentifier(issue.creator) || unknownUser(issue.creator);
+ return creator.title;
+};
+
+// Approval progress helpers
+const totalSteps = (issue: Issue): number => {
+ return issue.approvalTemplate?.flow?.roles?.length ?? 0;
+};
+
+const currentRoleName = (issue: Issue): string => {
+ const currentRoleIndex = issue.approvers.length;
+ const role = issue.approvalTemplate?.flow?.roles?.[currentRoleIndex];
+ if (!role) return "";
+ return displayRoleTitle(role);
+};
+
+// Search highlighting
+interface IssueNameSection {
+ text: string;
+ highlight: boolean;
+}
+
+const highlights = computed(() => {
+ if (!props.highlightText) {
+ return [];
+ }
+ return props.highlightText.toLowerCase().split(" ");
+});
+
+const highlight = (content: string) => {
+ return getHighlightHTMLByRegExp(
+ content,
+ highlights.value,
+ false,
+ "bg-yellow-100"
+ );
+};
+
+const issueHighlightSections = (
+ text: string,
+ highlights: string[]
+): IssueNameSection[] => {
+ if (!text) {
+ return [];
+ }
+ if (highlights.length === 0) {
+ return [{ text, highlight: false }];
+ }
+
+ for (let i = 0; i < highlights.length; i++) {
+ const highlight = highlights[i];
+ const sections = text.toLowerCase().split(highlight);
+ if (sections.length === 0) {
+ continue;
+ }
+
+ const resp: IssueNameSection[] = [];
+ let pos = 0;
+ const nextHighlights = [
+ ...highlights.slice(0, i),
+ ...highlights.slice(i + 1),
+ ];
+ for (const section of sections) {
+ if (section.length) {
+ resp.push(
+ ...issueHighlightSections(
+ text.slice(pos, pos + section.length),
+ nextHighlights
+ )
+ );
+ pos += section.length;
+ }
+ if (i < sections.length - 1) {
+ const t = text.slice(pos, pos + highlight.length);
+ if (t) {
+ resp.push({ text: t, highlight: true });
+ }
+ pos += highlight.length;
+ }
+ }
+ return resp;
+ }
+
+ return [{ text, highlight: false }];
+};
+
+const isIssueExpanded = (issue: Issue): boolean => {
+ if (!props.highlightText || !issue.description) {
+ return false;
+ }
+ const sections = issueHighlightSections(issue.description, highlights.value);
+ return sections.some((item) => item.highlight);
+};
+</script>
diff --git a/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue b/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue
index f7e1c0fada..7fbfe6ce03 100644
--- a/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue
+++ b/frontend/src/components/IssueV1/components/IssueSearch/IssueSearch.vue
@@ -21,21 +21,12 @@
<slot name="default" />
- <!-- Preset Buttons + Status Row -->
- <div
+ <!-- Preset Buttons -->
+ <PresetButtons
v-if="components.includes('presets') && !componentProps?.presets?.hidden"
- class="flex items-center justify-between"
- >
- <PresetButtons
- :params="params"
- @update:params="$emit('update:params', $event)"
- />
- <Status
- v-if="components.includes('status')"
- :params="params"
- @update:params="$emit('update:params', $event)"
- />
- </div>
+ :params="params"
+ @update:params="$emit('update:params', $event)"
+ />
<slot name="primary" />
</div>
@@ -48,10 +39,9 @@ import TimeRange from "@/components/AdvancedSearch/TimeRange.vue";
import type { SearchParams, SearchScopeId } from "@/utils";
import PresetButtons from "./PresetButtons.vue";
-import Status from "./Status.vue";
import { useIssueSearchScopeOptions } from "./useIssueSearchScopeOptions";
-export type SearchComponent = "searchbox" | "presets" | "status" | "time-range";
+export type SearchComponent = "searchbox" | "presets" | "time-range";
const props = withDefaults(
defineProps<{
@@ -64,7 +54,7 @@ const props = withDefaults(
}>(),
{
overrideScopeIdList: () => [],
- components: () => ["searchbox", "time-range", "presets", "status"],
+ components: () => ["searchbox", "time-range", "presets"],
componentProps: undefined,
defaultParams: undefined,
}
diff --git a/frontend/src/components/IssueV1/components/IssueSearch/PresetButtons.vue b/frontend/src/components/IssueV1/components/IssueSearch/PresetButtons.vue
index a824e9cd8f..cbedce09f3 100644
--- a/frontend/src/components/IssueV1/components/IssueSearch/PresetButtons.vue
+++ b/frontend/src/components/IssueV1/components/IssueSearch/PresetButtons.vue
@@ -23,9 +23,13 @@ import {
IssueStatus,
} from "@/types/proto-es/v1/issue_service_pb";
import type { SearchParams } from "@/utils";
-import { getValueFromSearchParams, upsertScope } from "@/utils";
+import {
+ getValueFromSearchParams,
+ getValuesFromSearchParams,
+ upsertScope,
+} from "@/utils";
-type PresetValue = "WAITING_APPROVAL" | "CREATED" | "ALL";
+type PresetValue = "WAITING_APPROVAL" | "OPEN" | "CLOSED" | "ALL";
interface Preset {
value: PresetValue;
@@ -49,8 +53,12 @@ const presets = computed((): Preset[] => [
label: t("issue.waiting-approval"),
},
{
- value: "CREATED",
- label: t("common.created"),
+ value: "OPEN",
+ label: t("issue.table.open"),
+ },
+ {
+ value: "CLOSED",
+ label: t("issue.table.closed"),
},
{
value: "ALL",
@@ -64,8 +72,6 @@ const activePreset = computed((): PresetValue | "" => {
});
const isActive = (preset: PresetValue): boolean => {
- const myEmail = me.value.email;
-
if (preset === "WAITING_APPROVAL") {
return (
getValueFromSearchParams(props.params, "approval") ===
@@ -73,8 +79,18 @@ const isActive = (preset: PresetValue): boolean => {
);
}
- if (preset === "CREATED") {
- return getValueFromSearchParams(props.params, "creator") === myEmail;
+ if (preset === "OPEN") {
+ const status = getValueFromSearchParams(props.params, "status");
+ const approval = getValueFromSearchParams(props.params, "approval");
+ return status === IssueStatus[IssueStatus.OPEN] && !approval;
+ }
+
+ if (preset === "CLOSED") {
+ const statuses = getValuesFromSearchParams(props.params, "status");
+ return (
+ statuses.includes(IssueStatus[IssueStatus.DONE]) &&
+ !statuses.includes(IssueStatus[IssueStatus.OPEN])
+ );
}
if (preset === "ALL") {
@@ -105,13 +121,19 @@ const selectPreset = (preset: PresetValue) => {
{ id: "current-approver", value: myEmail },
],
});
- } else if (preset === "CREATED") {
+ } else if (preset === "OPEN") {
+ newParams = upsertScope({
+ params: newParams,
+ scopes: [{ id: "status", value: IssueStatus[IssueStatus.OPEN] }],
+ });
+ } else if (preset === "CLOSED") {
newParams = upsertScope({
params: newParams,
scopes: [
- { id: "status", value: IssueStatus[IssueStatus.OPEN] },
- { id: "creator", value: myEmail },
+ { id: "status", value: IssueStatus[IssueStatus.DONE] },
+ { id: "status", value: IssueStatus[IssueStatus.CANCELED] },
],
+ allowMultiple: true,
});
}
// "ALL" preset keeps only readonly scopes (already done above)
diff --git a/frontend/src/components/IssueV1/components/IssueSearch/Status.vue b/frontend/src/components/IssueV1/components/IssueSearch/Status.vue
deleted file mode 100644
index 7ae11c5bb6..0000000000
--- a/frontend/src/components/IssueV1/components/IssueSearch/Status.vue
+++ /dev/null
@@ -1,128 +0,0 @@
-<template>
- <div class="shrink-0">
- <NTabs
- :value="tab"
- :type="'line'"
- :size="'small'"
- @update:value="updateStatus"
- >
- <NTab v-for="item in tabItemList" :key="item.value" :name="item.value">
- {{ item.label }}
- </NTab>
- </NTabs>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { NTab, NTabs } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useCurrentUserV1 } from "@/store";
-import {
- Issue_ApprovalStatus,
- IssueStatus,
-} from "@/types/proto-es/v1/issue_service_pb";
-import type { SearchParams, SearchScope } from "@/utils";
-import { getValuesFromSearchParams, upsertScope } from "@/utils";
-
-const props = defineProps<{
- params: SearchParams;
-}>();
-
-const emit = defineEmits<{
- (event: "update:params", params: SearchParams): void;
-}>();
-
-const { t } = useI18n();
-const me = useCurrentUserV1();
-
-const tabItemList = computed(() => {
- return [
- {
- value: IssueStatus.OPEN,
- label: t("issue.table.open"),
- },
- {
- value: IssueStatus.DONE,
- label: t("issue.table.closed"),
- },
- ] as {
- value: IssueStatus;
- label: string;
- }[];
-});
-
-const tab = computed((): IssueStatus => {
- const statusList = getValuesFromSearchParams(props.params, "status").map(
- (status) => IssueStatus[status as keyof typeof IssueStatus]
- );
-
- switch (statusList.length) {
- case 0:
- return IssueStatus.ISSUE_STATUS_UNSPECIFIED;
- case 1:
- if (statusList[0] === IssueStatus.OPEN) {
- return IssueStatus.OPEN;
- }
- return IssueStatus.DONE;
- default:
- if (!statusList.includes(IssueStatus.OPEN)) {
- return IssueStatus.DONE;
- }
- return IssueStatus.ISSUE_STATUS_UNSPECIFIED;
- }
-});
-
-const updateStatus = (value: IssueStatus) => {
- const scopes: SearchScope[] = [];
- let allowMultiple = false;
- if (value === IssueStatus.OPEN) {
- scopes.push(
- {
- id: "status",
- value: IssueStatus[IssueStatus.OPEN],
- },
- // inject approver/approval filter
- {
- id: "current-approver",
- value: me.value.email,
- },
- {
- id: "approval",
- value: Issue_ApprovalStatus[Issue_ApprovalStatus.PENDING],
- }
- );
- } else {
- scopes.push(
- {
- id: "status",
- value: IssueStatus[IssueStatus.DONE],
- },
- {
- id: "status",
- value: IssueStatus[IssueStatus.CANCELED],
- },
- // clear approver/approval filter
- {
- id: "current-approver",
- value: "",
- },
- {
- id: "approval",
- value: "",
- }
- );
- allowMultiple = true;
- }
-
- const updated = upsertScope({
- params: {
- ...props.params,
- scopes: props.params.scopes.filter((scope) => scope.id !== "status"),
- },
- scopes,
- allowMultiple,
- });
- emit("update:params", updated);
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueTableV1.vue b/frontend/src/components/IssueV1/components/IssueTableV1.vue
deleted file mode 100644
index 708508f050..0000000000
--- a/frontend/src/components/IssueV1/components/IssueTableV1.vue
+++ /dev/null
@@ -1,391 +0,0 @@
-<template>
- <div
- v-if="title"
- class="text-left pl-4 pt-4 pb-2 py-text-base leading-6 font-medium text-gray-900"
- >
- {{ title }}
- </div>
- <div ref="tableRef">
- <NDataTable
- size="small"
- :columns="columnList"
- :data="sortedIssueList"
- :striped="true"
- :bordered="bordered"
- :loading="loading"
- :row-key="(issue: Issue) => issue.name"
- :default-expand-all="true"
- :expanded-row-keys="
- issueList.filter(isIssueExpanded).map((issue) => issue.name)
- "
- :checked-row-keys="Array.from(state.selectedIssueNameList)"
- :row-props="rowProps"
- :render-expand-icon="() => h('span', { class: 'hidden' })"
- class="issue-table-list"
- @update:checked-row-keys="
- (val) => (state.selectedIssueNameList = new Set(val as string[]))
- "
- />
- </div>
-
- <div
- v-if="isTableInViewport && selectedIssueList.length > 0"
- class="sticky -bottom-4 w-full bg-white flex items-center gap-x-2 px-4 py-2 border-y"
- :class="bordered && 'border-x'"
- >
- <BatchIssueActionsV1 :issue-list="selectedIssueList" />
- </div>
-</template>
-
-<script lang="tsx" setup>
-import { useElementSize } from "@vueuse/core";
-import { orderBy } from "lodash-es";
-import type { DataTableColumn } from "naive-ui";
-import { NDataTable, NPerformantEllipsis } from "naive-ui";
-import { computed, h, reactive, ref, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import BatchIssueActionsV1 from "@/components/IssueV1/components/BatchIssueActionsV1.vue";
-import CurrentApproverV1 from "@/components/IssueV1/components/CurrentApproverV1.vue";
-import { UserNameCell } from "@/components/v2/Model/cells";
-import { useElementVisibilityInScrollParent } from "@/composables/useElementVisibilityInScrollParent";
-import { useUserStore } from "@/store";
-import { getTimeForPbTimestampProtoEs, unknownUser } from "@/types";
-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
-import {
- extractIssueUID,
- getHighlightHTMLByRegExp,
- getIssueRoute,
- humanizeTs,
- projectOfIssue,
- TailwindBreakpoints,
-} from "@/utils";
-import IssueLabelSelector, {
- getValidIssueLabels,
-} from "./IssueLabelSelector.vue";
-import IssueStatusIcon from "./IssueStatusIcon.vue";
-
-interface LocalState {
- selectedIssueNameList: Set<string>;
-}
-
-const props = withDefaults(
- defineProps<{
- issueList: Issue[];
- bordered?: boolean;
- title?: string;
- highlightText?: string;
- loading?: boolean;
- showProject?: boolean;
- showSelection?: boolean;
- }>(),
- {
- title: "",
- highlightText: "",
- loading: true,
- bordered: false,
- showSelection: true,
- }
-);
-
-const { t } = useI18n();
-const router = useRouter();
-const userStore = useUserStore();
-const state = reactive<LocalState>({
- selectedIssueNameList: new Set(),
-});
-
-const tableRef = ref<HTMLDivElement>();
-const isTableInViewport = useElementVisibilityInScrollParent(tableRef);
-const { width: tableWidth } = useElementSize(tableRef);
-const showExtendedColumns = computed(() => {
- return tableWidth.value > TailwindBreakpoints.md;
-});
-
-const sortedIssueList = computed(() => {
- if (!props.highlightText) {
- return props.issueList;
- }
-
- return orderBy(
- props.issueList,
- [
- (issue) =>
- `${issue.title} ${issue.description}`.includes(props.highlightText)
- ? 1
- : 0,
- (issue) => parseInt(extractIssueUID(issue.name)),
- ],
- ["desc", "desc"]
- );
-});
-
-const selectedIssueList = computed(() => {
- return props.issueList.filter((issue) =>
- state.selectedIssueNameList.has(issue.name)
- );
-});
-
-const columnList = computed((): DataTableColumn<Issue>[] => {
- const columns: (DataTableColumn<Issue> & { hide?: boolean })[] = [
- {
- type: "selection",
- width: 40,
- cellProps: () => {
- return {
- onClick: (e: MouseEvent) => {
- e.stopPropagation();
- },
- };
- },
- hide: !props.showSelection,
- },
- {
- type: "expand",
- width: 0,
- expandable: (issue) => isIssueExpanded(issue),
- hide: !props.highlightText,
- renderExpand: (issue) => (
- <div
- class="max-h-80 overflow-auto whitespace-pre-wrap wrap-break-word break-all"
- innerHTML={highlight(issue.description)}
- ></div>
- ),
- },
- {
- key: "title",
- title: t("issue.table.name"),
- ellipsis: true,
- render: (issue) => {
- const projectEntity = projectOfIssue(issue);
- const labels = getValidIssueLabels(
- issue.labels,
- projectEntity.issueLabels
- );
- return (
- <div class="flex items-center gap-x-2">
- <IssueStatusIcon issueStatus={issue.status} />
- <a
- href={issueUrl(issue)}
- class="flex items-center gap-x-2 select-none truncate"
- onClick={(e: MouseEvent) => {
- e.stopPropagation();
- }}
- >
- <div class="whitespace-nowrap text-control text-opacity-80">
- {`#${extractIssueUID(issue.name)} `}
- </div>
- <NPerformantEllipsis>
- {{
- default: () => (
- <span
- class="min-w-32 shrink"
- innerHTML={highlight(issue.title)}
- ></span>
- ),
- tooltip: () => issue.title,
- }}
- </NPerformantEllipsis>
- </a>
- {labels.length > 0 && (
- <IssueLabelSelector
- class="w-auto! shrink-0"
- size="small"
- selected={labels}
- maxTagCount={3}
- project={projectOfIssue(issue)}
- disabled
- />
- )}
- </div>
- );
- },
- },
- {
- key: "project",
- title: t("common.project"),
- width: 150,
- hide: !showExtendedColumns.value || !props.showProject,
- render: (issue) => projectOfIssue(issue).title,
- },
- {
- key: "updateTime",
- title: t("issue.table.updated"),
- width: 150,
- hide: !showExtendedColumns.value,
- render: (issue) =>
- humanizeTs(getTimeForPbTimestampProtoEs(issue.updateTime, 0) / 1000),
- },
- {
- key: "approver",
- width: 150,
- title: t("issue.table.current-approver"),
- hide: !showExtendedColumns.value,
- render: (issue) => <CurrentApproverV1 issue={issue} />,
- },
- {
- key: "creator",
- width: 150,
- title: t("issue.table.creator"),
- hide: !showExtendedColumns.value,
- render: (issue) => {
- const creator =
- userStore.getUserByIdentifier(issue.creator) ||
- unknownUser(issue.creator);
- return (
- <UserNameCell
- user={creator}
- size="small"
- link={false}
- allowEdit={false}
- showMfaEnabled={false}
- showSource={false}
- showEmail={false}
- />
- );
- },
- },
- ];
- return columns.filter((column) => !column.hide);
-});
-
-const issueUrl = (issue: Issue) => {
- const issueRoute = getIssueRoute(issue);
- const route = router.resolve({
- name: issueRoute.name,
- params: issueRoute.params,
- });
- return route.fullPath;
-};
-
-const rowProps = (issue: Issue) => {
- return {
- style: "cursor: pointer;",
- onClick: (e: MouseEvent) => {
- const url = issueUrl(issue);
- if (e.ctrlKey || e.metaKey) {
- window.open(url, "_blank");
- } else {
- router.push(url);
- }
- },
- };
-};
-
-watch(
- () => props.issueList,
- (list) => {
- const oldIssueNames = Array.from(state.selectedIssueNameList.values());
- const newIssueNames = new Set(list.map((issue) => issue.name));
- oldIssueNames.forEach((name) => {
- // If a selected issue name doesn't appear in the new IssueList
- // we should cancel its selection state.
- if (!newIssueNames.has(name)) {
- state.selectedIssueNameList.delete(name);
- }
- });
- }
-);
-
-interface IssueNameSection {
- text: string;
- highlight: boolean;
-}
-
-const highlights = computed(() => {
- if (!props.highlightText) {
- return [];
- }
- return props.highlightText.toLowerCase().split(" ");
-});
-
-const highlight = (content: string) => {
- return getHighlightHTMLByRegExp(
- content,
- highlights.value,
- /* !caseSensitive */ false,
- /* className */ "bg-yellow-100"
- );
-};
-
-const issueHighlightSections = (
- text: string,
- highlights: string[]
-): IssueNameSection[] => {
- if (!text) {
- return [];
- }
- if (highlights.length === 0) {
- return [
- {
- text,
- highlight: false,
- },
- ];
- }
-
- for (let i = 0; i < highlights.length; i++) {
- const highlight = highlights[i];
- const sections = text.toLowerCase().split(highlight);
- if (sections.length === 0) {
- continue;
- }
-
- const resp: IssueNameSection[] = [];
- let pos = 0;
- const nextHighlights = [
- ...highlights.slice(0, i),
- ...highlights.slice(i + 1),
- ];
- for (const section of sections) {
- if (section.length) {
- resp.push(
- ...issueHighlightSections(
- text.slice(pos, pos + section.length),
- nextHighlights
- )
- );
- pos += section.length;
- }
- if (i < sections.length - 1) {
- const t = text.slice(pos, pos + highlight.length);
- if (t) {
- resp.push({
- text: t,
- highlight: true,
- });
- }
- pos += highlight.length;
- }
- }
- return resp;
- }
-
- return [
- {
- text,
- highlight: false,
- },
- ];
-};
-
-const isIssueExpanded = (issue: Issue): boolean => {
- if (!props.highlightText || !issue.description) {
- return false;
- }
- const sections = issueHighlightSections(issue.description, highlights.value);
- return sections.some((item) => item.highlight);
-};
-</script>
-
-<style scoped lang="postcss">
-:deep(.n-base-selection-tags) {
- background-color: transparent !important;
- padding: 0 !important;
-}
-:deep(.n-base-suffix),
-:deep(.n-base-selection__border),
-:deep(.n-base-selection__state-border) {
- display: none !important;
-}
-</style>
diff --git a/frontend/src/components/Project/ProjectIssuesPanel.vue b/frontend/src/components/Project/ProjectIssuesPanel.vue
index 0c0e1f15d8..b88d1737b8 100644
--- a/frontend/src/components/Project/ProjectIssuesPanel.vue
+++ b/frontend/src/components/Project/ProjectIssuesPanel.vue
@@ -1,6 +1,6 @@
<template>
<div class="flex flex-col">
- <div class="px-4 flex flex-col gap-y-2 pb-2">
+ <div class="px-4 flex flex-col gap-y-2">
<NAlert
v-if="!hideHint"
type="info"
@@ -11,7 +11,7 @@
</NAlert>
<IssueSearch
v-model:params="state.params"
- :components="['searchbox', 'time-range', 'presets', 'status']"
+ :components="['searchbox', 'time-range', 'presets']"
/>
</div>
<PagedTable
@@ -21,7 +21,7 @@
:fetch-list="fetchIssueList"
>
<template #table="{ list, loading }">
- <IssueTableV1
+ <IssueListV1
class="border-x-0"
:loading="loading"
:issue-list="list"
@@ -37,7 +37,7 @@ import { NAlert } from "naive-ui";
import { computed, reactive, ref, watch } from "vue";
import type { ComponentExposed } from "vue-component-type-helpers";
import { useRoute, useRouter } from "vue-router";
-import IssueTableV1 from "@/components/IssueV1/components/IssueTableV1.vue";
+import IssueListV1 from "@/components/IssueV1/components/IssueListV1.vue";
import PagedTable from "@/components/v2/Model/PagedTable.vue";
import {
useCurrentUserV1,
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 824c836316..13422a18c2 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1040,7 +1040,9 @@
"name": "Name",
"updated": "Updated",
"creator": "Creator",
- "current-approver": "Current approver"
+ "approved": "Approved",
+ "approval-progress": "{approved}/{total} Approvals",
+ "waiting-role": "Waiting: {role}"
},
"migration-mode": {
"online": {
@@ -2627,8 +2629,7 @@
},
"skip": "No approval required",
"issue-review": {
- "sent-back": "Sent back",
- "review-sent-back-by": "Review sent back by {user}"
+ "sent-back": "Sent back"
},
"add-rule": "Add rule",
"edit-rule": "Edit rule",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 90cadb5a4f..2e69e8080c 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1040,7 +1040,9 @@
"name": "Nombre",
"updated": "Actualizado",
"creator": "Creador",
- "current-approver": "Aprobador actual"
+ "approved": "Approved",
+ "approval-progress": "{approved}/{total} Approvals",
+ "waiting-role": "Waiting: {role}"
},
"migration-mode": {
"online": {
@@ -2627,8 +2629,7 @@
},
"skip": "No se requiere aprobación",
"issue-review": {
- "sent-back": "Devuelto",
- "review-sent-back-by": "Reseña enviada por {user}"
+ "sent-back": "Devuelto"
},
"add-rule": "Agregar regla",
"edit-rule": "Editar regla",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 2e3b797be1..d7a6d70a40 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -1040,7 +1040,9 @@
"name": "名前",
"updated": "更新日時",
"creator": "作成者",
- "current-approver": "現在の承認者"
+ "approved": "Approved",
+ "approval-progress": "{approved}/{total} Approvals",
+ "waiting-role": "Waiting: {role}"
},
"migration-mode": {
"online": {
@@ -2627,8 +2629,7 @@
},
"skip": "承認不要",
"issue-review": {
- "sent-back": "戻ってきた",
- "review-sent-back-by": "{user} から承認が返されました"
+ "sent-back": "戻ってきた"
},
"add-rule": "ルールを追加",
"edit-rule": "ルールを編集",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 9f524b447b..e2f30e5c97 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -1040,7 +1040,9 @@
"name": "Tên",
"updated": "Đã cập nhật",
"creator": "Người tạo",
- "current-approver": "Người phê duyệt hiện tại"
+ "approved": "Approved",
+ "approval-progress": "{approved}/{total} Approvals",
+ "waiting-role": "Waiting: {role}"
},
"migration-mode": {
"online": {
@@ -2627,8 +2629,7 @@
},
"skip": "Không cần phê duyệt",
"issue-review": {
- "sent-back": "Đã gửi lại",
- "review-sent-back-by": "Đánh giá đã gửi lại bởi {user}"
+ "sent-back": "Đã gửi lại"
},
"add-rule": "Thêm quy tắc",
"edit-rule": "Chỉnh sửa quy tắc",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 8f9609c397..9694906dd1 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1040,7 +1040,9 @@
"name": "名称",
"updated": "更新于",
"creator": "创建人",
- "current-approver": "当前审批人"
+ "approved": "已审批",
+ "approval-progress": "{approved}/{total} 已审批",
+ "waiting-role": "等待: {role}"
},
"migration-mode": {
"online": {
@@ -2627,8 +2629,7 @@
},
"skip": "无需审批",
"issue-review": {
- "sent-back": "被退回",
- "review-sent-back-by": "审批被 {user} 退回"
+ "sent-back": "被退回"
},
"add-rule": "添加规则",
"edit-rule": "编辑规则",
diff --git a/frontend/src/views/ExportCenter/index.vue b/frontend/src/views/ExportCenter/index.vue
index 4164dff9ac..4235ee1edb 100644
--- a/frontend/src/views/ExportCenter/index.vue
+++ b/frontend/src/views/ExportCenter/index.vue
@@ -1,6 +1,6 @@
<template>
<div class="py-4 w-full flex flex-col">
- <div class="px-4 pb-2">
+ <div class="px-4">
<div
class="w-full flex flex-col lg:flex-row items-start lg:items-center justify-between gap-2"
>
@@ -41,7 +41,7 @@
:fetch-list="fetchIssueList"
>
<template #table="{ list, loading }">
- <IssueTableV1
+ <IssueListV1
class="border-x-0"
:loading="loading"
:issue-list="list"
@@ -69,8 +69,8 @@ import { NButton } from "naive-ui";
import { computed, reactive, ref, watch } from "vue";
import type { ComponentExposed } from "vue-component-type-helpers";
import DataExportPrepForm from "@/components/DataExportPrepForm";
+import IssueListV1 from "@/components/IssueV1/components/IssueListV1.vue";
import IssueSearch from "@/components/IssueV1/components/IssueSearch/IssueSearch.vue";
-import IssueTableV1 from "@/components/IssueV1/components/IssueTableV1.vue";
import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";
import { Drawer } from "@/components/v2";
import PagedTable from "@/components/v2/Model/PagedTable.vue";
diff --git a/frontend/src/views/MyIssues.vue b/frontend/src/views/MyIssues.vue
index 31e42ea35f..0217d0ff8f 100644
--- a/frontend/src/views/MyIssues.vue
+++ b/frontend/src/views/MyIssues.vue
@@ -2,9 +2,9 @@
<div :key="viewId" class="py-4 flex flex-col">
<IssueSearch
v-model:params="state.params"
- :components="['searchbox', 'time-range', 'presets', 'status']"
+ :components="['searchbox', 'time-range', 'presets']"
:default-params="computedDefaultParams"
- class="px-4 pb-2"
+ class="px-4"
/>
<PagedTable
@@ -14,7 +14,7 @@
:fetch-list="fetchIssueList"
>
<template #table="{ list, loading }">
- <IssueTableV1
+ <IssueListV1
class="border-x-0"
:loading="loading"
:issue-list="list"
@@ -32,7 +32,7 @@ import { computed, reactive, ref, watch } from "vue";
import type { ComponentExposed } from "vue-component-type-helpers";
import { useRoute, useRouter } from "vue-router";
import { IssueSearch } from "@/components/IssueV1/components";
-import IssueTableV1 from "@/components/IssueV1/components/IssueTableV1.vue";
+import IssueListV1 from "@/components/IssueV1/components/IssueListV1.vue";
import PagedTable from "@/components/v2/Model/PagedTable.vue";
import {
useCurrentUserV1,