Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Support update task name
天舟03b5f46d7968
diff --git a/frontend/src/miragejs/routes/index.js b/frontend/src/miragejs/routes/index.jsindex dc59e08411..77d5d39de8 100644--- a/frontend/src/miragejs/routes/index.js+++ b/frontend/src/miragejs/routes/index.js@@ -233,6 +233,16 @@ export default function routes() {const changeList = [];+ if (attrs.name) {+ if (task.name != attrs.name) {+ changeList.push({+ fieldId: TaskBuiltinFieldId.NAME,+ oldValue: task.name,+ newValue: attrs.name,+ });+ }+ }+if (attrs.status) {if (task.status != attrs.status) {changeList.push({diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.tsindex 0113bbeabd..05f881d1f2 100644--- a/frontend/src/plugins/types.ts+++ b/frontend/src/plugins/types.ts@@ -4,9 +4,10 @@ import { Environment, Principal, TaskNew } from "../types";export type TaskFieldId = number;export enum TaskBuiltinFieldId {- STATUS = 10000,- ASSIGNEE = 10001,- DESCRIPTION = 10002,+ NAME = 10000,+ STATUS = 10001,+ ASSIGNEE = 10002,+ DESCRIPTION = 10003,}export type TaskFieldType = "String" | "Environment";diff --git a/frontend/src/views/TaskActivityPanel.vue b/frontend/src/views/TaskActivityPanel.vueindex 2720986178..9e3ee376eb 100644--- a/frontend/src/views/TaskActivityPanel.vue+++ b/frontend/src/views/TaskActivityPanel.vue@@ -454,12 +454,16 @@ export default {let name = "Unknown Field";let oldValue = undefined;let newValue = undefined;- if (update.fieldId == TaskBuiltinFieldId.STATUS) {- name = "Status";+ if (update.fieldId == TaskBuiltinFieldId.NAME) {+ name = "name";+ oldValue = update.oldValue;+ newValue = update.newValue;+ } else if (update.fieldId == TaskBuiltinFieldId.STATUS) {+ name = "status";oldValue = update.oldValue;newValue = update.newValue;} else if (update.fieldId == TaskBuiltinFieldId.ASSIGNEE) {- name = "Assignee";+ name = "assignee";if (update.oldValue) {oldValue = store.getters["principal/principalById"](update.oldValue@@ -471,7 +475,7 @@ export default {).name;}} else if (update.fieldId == TaskBuiltinFieldId.DESCRIPTION) {- name = "Description";+ name = "description";} else {const field = fieldFromId(props.taskTemplate, update.fieldId);if (field) {diff --git a/frontend/src/views/TaskDetail.vue b/frontend/src/views/TaskDetail.vueindex 232a927bc6..c0dce5963a 100644--- a/frontend/src/views/TaskDetail.vue+++ b/frontend/src/views/TaskDetail.vue@@ -6,7 +6,11 @@><!-- Highlight Panel --><div class="bg-white px-4 pb-4">- <TaskHighlightPanel :task="state.task" :new="state.new">+ <TaskHighlightPanel+ :task="state.task"+ :new="state.new"+ @update-name="updateName"+ ><template v-if="state.new"><buttontype="button"@@ -368,6 +372,18 @@ export default {) || []);+ const updateName = (+ newName: string,+ postUpdated: (updatedTask: Task) => void+ ) => {+ patchTask(+ {+ name: newName,+ },+ postUpdated+ );+ };+const updateDescription = (newDescription: string,postUpdated: (updatedTask: Task) => void@@ -529,6 +545,7 @@ export default {return {state,modalState,+ updateName,updateDescription,updateTaskStatus,updateAssigneeId,diff --git a/frontend/src/views/TaskHighlightPanel.vue b/frontend/src/views/TaskHighlightPanel.vueindex 2092308db5..8886cab49a 100644--- a/frontend/src/views/TaskHighlightPanel.vue+++ b/frontend/src/views/TaskHighlightPanel.vue@@ -4,15 +4,31 @@<div class="flex items-center"><div><div class="flex items-center">- <TaskStatusIcon- v-if="!$props.new"- :taskStatus="task.status"- :stageStatus="activeStage(task).status"+ <div>+ <TaskStatusIcon+ v-if="!$props.new"+ class="mt-0.5"+ :taskStatus="task.status"+ :stageStatus="activeStage(task).status"+ />+ </div>+ <input+ v-if="state.editing"+ required+ ref="nameTextField"+ id="name"+ name="name"+ type="text"+ class="textfield ml-2 my-0.5 w-full"+ v-model="state.name"+ @blur="trySaveName"/>+ <!-- Extra padding is to prevent flickering when entering the edit mode --><p- class="ml-2 text-xl font-bold leading-7 text-main whitespace-nowrap md:w-96 lg:w-160 truncate"+ v-else+ class="ml-2 mt-2 mb-1.5 text-xl font-bold leading-7 text-main whitespace-nowrap md:w-96 lg:w-160 truncate">- {{ task.name }}+ <span @click.prevent="clickName">{{ state.name }}</span></p></div><div v-if="!$props.new">@@ -37,13 +53,19 @@</template><script lang="ts">-import { PropType } from "vue";+import { reactive, ref, nextTick, PropType } from "vue";import TaskStatusIcon from "../components/TaskStatusIcon.vue";import { activeStage } from "../utils";import { Task } from "../types";+interface LocalState {+ editing: boolean;+ name: string;+}+export default {name: "TaskHighlightPanel",+ emits: ["update-name"],props: {task: {required: true,@@ -55,8 +77,32 @@ export default {},},components: { TaskStatusIcon },- setup(props, ctx) {- return { activeStage };+ setup(props, { emit }) {+ const nameTextField = ref();++ const state = reactive<LocalState>({+ editing: false,+ name: props.task.name,+ });++ const clickName = () => {+ state.editing = true;+ nextTick(() => {+ nameTextField.value.focus();+ });+ };++ const trySaveName = () => {+ if (state.name != props.task.name) {+ emit("update-name", state.name, (updatedTask: Task) => {+ state.editing = false;+ });+ } else {+ state.editing = false;+ }+ };++ return { nameTextField, state, activeStage, clickName, trySaveName };},};</script>