Skip to content

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

feat(frontend): set issue to need assignee attention (#3709)

Liu Jia736065eaf90
diff --git a/frontend/src/components/Issue/IssueSidebar.vue b/frontend/src/components/Issue/IssueSidebar.vue
index 8c4e10c71b..59b5e2e23e 100644
--- a/frontend/src/components/Issue/IssueSidebar.vue
+++ b/frontend/src/components/Issue/IssueSidebar.vue
@@ -19,9 +19,25 @@
</div>
</template>
- <h2 class="textlabel flex items-center col-span-1 col-start-1">
- {{ $t("common.assignee")
- }}<span v-if="create" class="text-red-600">*</span>
+ <h2 class="textlabel flex items-center col-span-1 col-start-1 gap-x-1">
+ <span>{{ $t("common.assignee") }}</span>
+ <span v-if="create" class="text-red-600">*</span>
+ <button
+ v-if="showNotifyAssignee"
+ :disabled="isAssigneeAttentionOn"
+ class="p-0.5 rounded tooltip-wrapper"
+ :class="[
+ !isAssigneeAttentionOn &&
+ 'cursor-pointer hover:bg-control-bg-hover',
+ ]"
+ @click="notifyAssignee"
+ >
+ <heroicons-outline:bell-alert
+ v-if="isAssigneeAttentionOn"
+ class="w-4 h-4"
+ />
+ <heroicons-outline:bell v-else class="w-4 h-4" />
+ </button>
</h2>
<!-- Only DBA can be assigned to the issue -->
<div class="col-span-2" data-label="bb-assignee-select-container">
@@ -278,6 +294,8 @@ import { NDatePicker } from "naive-ui";
import { useRouter } from "vue-router";
import dayjs from "dayjs";
import isSameOrAfter from "dayjs/plugin/isSameOrAfter";
+import { useI18n } from "vue-i18n";
+
import StageSelect from "./StageSelect.vue";
import TaskSelect from "./TaskSelect.vue";
import IssueStatusIcon from "./IssueStatusIcon.vue";
@@ -313,9 +331,11 @@ import {
} from "@/utils";
import {
hasFeature,
+ pushNotification,
useCurrentUser,
useDatabaseStore,
useEnvironmentStore,
+ useIssueStore,
useProjectStore,
} from "@/store";
import {
@@ -343,6 +363,7 @@ const props = defineProps({
},
});
+const { t } = useI18n();
const router = useRouter();
const projectStore = useProjectStore();
@@ -477,6 +498,54 @@ const allowEditAssignee = computed(() => {
return false;
});
+const showNotifyAssignee = computed(() => {
+ if (create.value) {
+ return false;
+ }
+ if (project.value.workflowType === "VCS") {
+ return false;
+ }
+
+ const issueEntity = issue.value as Issue;
+
+ if (issueEntity.status !== "OPEN") {
+ return false;
+ }
+ if (
+ issueEntity.assigneeNeedAttention &&
+ currentUser.value.id === issueEntity.assignee.id
+ ) {
+ // Also show the icon for assignee if need attention.
+ return true;
+ }
+
+ return currentUser.value.id === issueEntity.creator.id;
+});
+
+const isAssigneeAttentionOn = computed(() => {
+ return (issue.value as Issue).assigneeNeedAttention;
+});
+
+const notifyAssignee = () => {
+ if (!showNotifyAssignee.value) return;
+ if (isAssigneeAttentionOn.value) return;
+
+ useIssueStore()
+ .patchIssue({
+ issueId: (issue.value as Issue).id,
+ issuePatch: {
+ assigneeNeedAttention: true,
+ },
+ })
+ .then(() => {
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.updated"),
+ });
+ });
+};
+
const allowEditEarliestAllowedTime = computed(() => {
if (create.value) {
return true;
diff --git a/frontend/src/components/Issue/IssueTable.vue b/frontend/src/components/Issue/IssueTable.vue
index 44d5d36bd8..70cb1ac241 100644
--- a/frontend/src/components/Issue/IssueTable.vue
+++ b/frontend/src/components/Issue/IssueTable.vue
@@ -59,7 +59,18 @@
<BBTableCell class="table-cell">
<div class="flex items-center">
<div class="mr-2 text-control">#{{ issue.id }}</div>
- <div class="truncate">{{ issue.name }}</div>
+ <div
+ class="truncate"
+ :class="{
+ 'font-semibold': isAssigneeAttentionOn(issue),
+ }"
+ >
+ {{ issue.name }}
+ </div>
+ <heroicons-outline:bell-alert
+ v-if="isAssigneeAttentionOn(issue)"
+ class="w-4 h-4 ml-1"
+ />
</div>
</BBTableCell>
<BBTableCell class="table-cell w-36">
@@ -130,6 +141,7 @@ import {
} from "@/utils";
import ProtectedEnvironmentIcon from "../Environment/ProtectedEnvironmentIcon.vue";
import { useElementVisibilityInScrollParent } from "@/composables/useElementVisibilityInScrollParent";
+import { useCurrentUser } from "@/store";
type Mode = "ALL" | "PROJECT";
@@ -226,6 +238,7 @@ const state = reactive<LocalState>({
dataSource: [],
selectedIssueIdList: new Set(),
});
+const currentUser = useCurrentUser();
const tableRef = ref<HTMLTableElement>();
const isTableInViewport = useElementVisibilityInScrollParent(tableRef);
@@ -308,6 +321,21 @@ const setAllIssuesSelection = (selected: boolean): void => {
}
};
+const isAssigneeAttentionOn = (issue: Issue) => {
+ if (issue.project.workflowType === "VCS") {
+ return false;
+ }
+ if (issue.status !== "OPEN") {
+ return false;
+ }
+ if (currentUser.value.id === issue.assignee.id) {
+ // True if current user is the assignee
+ return issue.assigneeNeedAttention;
+ }
+
+ return false;
+};
+
const clickIssue = (_: number, row: number, e: MouseEvent) => {
const issue = props.issueList[row];
const url = `/issue/${issueSlug(issue.name, issue.id)}`;
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index ff363a1edf..f9cd1ab23a 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -70,6 +70,7 @@
"next": "Next",
"edit": "Edit",
"update": "Update",
+ "updated": "Updated",
"visit": "Visit",
"role": {
"dba": "DBA",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 108f9e4dcf..7073100949 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -70,6 +70,7 @@
"next": "下一步",
"edit": "编辑",
"update": "更新",
+ "updated": "已更新",
"visit": "访问",
"role": {
"dba": "DBA",
diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts
index 1835301190..eb7410f936 100644
--- a/frontend/src/types/common.ts
+++ b/frontend/src/types/common.ts
@@ -351,6 +351,7 @@ const makeUnknown = (type: ResourceType) => {
type: "bb.issue.general",
description: "",
assignee: UNKNOWN_PRINCIPAL,
+ assigneeNeedAttention: false,
subscriberList: [],
payload: {},
};
@@ -801,6 +802,7 @@ const makeEmpty = (type: ResourceType) => {
type: "bb.issue.general",
description: "",
assignee: EMPTY_PRINCIPAL,
+ assigneeNeedAttention: false,
subscriberList: [],
payload: {},
};
diff --git a/frontend/src/types/issue.ts b/frontend/src/types/issue.ts
index c6190bd255..40ecdd9782 100644
--- a/frontend/src/types/issue.ts
+++ b/frontend/src/types/issue.ts
@@ -112,6 +112,7 @@ export type Issue = {
type: IssueType;
description: string;
assignee: Principal;
+ assigneeNeedAttention: boolean;
subscriberList: Principal[];
payload: IssuePayload;
};
@@ -150,6 +151,7 @@ export type IssuePatch = {
name?: string;
description?: string;
assigneeId?: PrincipalId;
+ assigneeNeedAttention?: boolean;
payload?: IssuePayload;
};