Skip to content

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

Add activity for changing builtin field status/assignee/description

Tianzhou Chen5f481b1c4670
diff --git a/frontend/src/miragejs/routes/index.js b/frontend/src/miragejs/routes/index.js
index 8467aa57c1..3d0b2da452 100644
--- a/frontend/src/miragejs/routes/index.js
+++ b/frontend/src/miragejs/routes/index.js
@@ -2,6 +2,7 @@
* Mirage JS guide on Routes: https://miragejs.com/docs/route-handlers/functions
*/
import { Response } from "miragejs";
+import { TaskBuiltinFieldId } from "../../plugins";
const WORKSPACE_ID = 1;
@@ -117,6 +118,37 @@ export default function routes() {
}
const changeList = [];
+
+ if (attrs.status) {
+ if (task.status != attrs.status) {
+ changeList.push({
+ fieldId: TaskBuiltinFieldId.STATUS,
+ oldValue: task.status,
+ newValue: attrs.status,
+ });
+ }
+ }
+
+ if (attrs.assignee) {
+ if (task.assignee != attrs.assignee) {
+ changeList.push({
+ fieldId: TaskBuiltinFieldId.ASSIGNEE,
+ oldValue: task.assignee,
+ newValue: attrs.assignee,
+ });
+ }
+ }
+
+ if (attrs.content) {
+ if (task.content != attrs.content) {
+ changeList.push({
+ fieldId: TaskBuiltinFieldId.CONTENT,
+ oldValue: task.content,
+ newValue: attrs.content,
+ });
+ }
+ }
+
for (const fieldId in attrs.payload) {
const oldValue = task.payload[fieldId];
const newValue = attrs.payload[fieldId];
diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.ts
index a91db66e4c..22c0a49bbf 100644
--- a/frontend/src/plugins/types.ts
+++ b/frontend/src/plugins/types.ts
@@ -6,7 +6,7 @@ export type TaskFieldId = number;
export enum TaskBuiltinFieldId {
STATUS = 10000,
ASSIGNEE = 10001,
- REPORTER = 10002,
+ CONTENT = 10002,
}
export type TaskFieldType = "String" | "Environment";
diff --git a/frontend/src/views/TaskActivityPanel.vue b/frontend/src/views/TaskActivityPanel.vue
index 128d74c655..d2d2106394 100644
--- a/frontend/src/views/TaskActivityPanel.vue
+++ b/frontend/src/views/TaskActivityPanel.vue
@@ -300,7 +300,12 @@ import {
Environment,
} from "../types";
import { sizeToFit } from "../utils";
-import { fieldFromId, TaskTemplate, TaskField } from "../plugins";
+import {
+ fieldFromId,
+ TaskTemplate,
+ TaskField,
+ TaskBuiltinFieldId,
+} from "../plugins";
interface LocalState {
showDeleteCommentModal: boolean;
@@ -447,34 +452,46 @@ export default {
const updateInfoList: string[] = [];
for (const update of (activity.attributes
.payload as ActionTaskFieldUpdatePayload)?.changeList || []) {
- const field = fieldFromId(props.taskTemplate, update.fieldId);
let name = "Unknown Field";
let oldValue = undefined;
let newValue = undefined;
- if (field) {
- name = field.name;
- if (field.type === "String") {
- oldValue = update.oldValue;
- newValue = update.newValue;
- } else if (field.type === "Environment") {
- if (update.oldValue) {
- const environment: Environment = store.getters[
- "environment/environmentById"
- ](update.oldValue);
- if (environment) {
- oldValue = environment.attributes.name;
- } else {
- oldValue = "Unknown Environment";
+ if (update.fieldId == TaskBuiltinFieldId.STATUS) {
+ name = "Status";
+ oldValue = update.oldValue;
+ newValue = update.newValue;
+ } else if (update.fieldId == TaskBuiltinFieldId.ASSIGNEE) {
+ name = "Assignee";
+ oldValue = update.oldValue;
+ newValue = update.newValue;
+ } else if (update.fieldId == TaskBuiltinFieldId.CONTENT) {
+ name = "Description";
+ } else {
+ const field = fieldFromId(props.taskTemplate, update.fieldId);
+ if (field) {
+ name = field.name;
+ if (field.type === "String") {
+ oldValue = update.oldValue;
+ newValue = update.newValue;
+ } else if (field.type === "Environment") {
+ if (update.oldValue) {
+ const environment: Environment = store.getters[
+ "environment/environmentById"
+ ](update.oldValue);
+ if (environment) {
+ oldValue = environment.attributes.name;
+ } else {
+ oldValue = "Unknown Environment";
+ }
}
- }
- if (update.newValue) {
- const environment: Environment = store.getters[
- "environment/environmentById"
- ](update.newValue);
- if (environment) {
- newValue = environment.attributes.name;
- } else {
- newValue = "Unknown Environment";
+ if (update.newValue) {
+ const environment: Environment = store.getters[
+ "environment/environmentById"
+ ](update.newValue);
+ if (environment) {
+ newValue = environment.attributes.name;
+ } else {
+ newValue = "Unknown Environment";
+ }
}
}
}
@@ -493,6 +510,8 @@ export default {
updateInfoList.push("unset " + name + ' from "' + oldValue + '"');
} else if (newValue) {
updateInfoList.push("set " + name + ' to "' + newValue + '"');
+ } else {
+ updateInfoList.push("changed " + name);
}
}
if (updateInfoList.length > 0) {