Skip to content

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

Task Description Update

Tianzhou Chene9dd6265ef36
diff --git a/frontend/src/views/TaskContent.vue b/frontend/src/views/TaskContent.vue
index 17c862ebde..21cb9f0a6e 100644
--- a/frontend/src/views/TaskContent.vue
+++ b/frontend/src/views/TaskContent.vue
@@ -39,14 +39,46 @@
</button>
</div>
<!-- Content -->
- <h2 class="sr-only">Description</h2>
- <div class="mt-2 prose max-w-none whitespace-pre-line" ref="taskContent">
- {{ task.attributes.content }}
- </div>
+ <BBAutoResize>
+ <template v-slot:main="{ resize }">
+ <label for="content" class="sr-only">Edit Description</label>
+ <!-- Use border-white focus:border-white to have the invisible border width
+ otherwise it will have 1px jiggling switching between focus/unfocus state -->
+ <textarea
+ ref="editContentTextArea"
+ rows="10"
+ class="mt-4 rounded-md w-full resize-none whitespace-pre-line border-white focus:border-white outline-none"
+ :class="
+ state.edit
+ ? 'focus:ring-control focus-visible:ring-2 focus:ring-offset-4'
+ : ''
+ "
+ :style="
+ state.edit
+ ? ''
+ : '-webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none'
+ "
+ placeholder="Add some description..."
+ :readonly="!state.edit"
+ v-model="editContent"
+ @input="
+ (e) => {
+ resize(e.target);
+ }
+ "
+ @focus="
+ (e) => {
+ resize(e.target);
+ }
+ "
+ ></textarea>
+ </template>
+ </BBAutoResize>
</template>
<script lang="ts">
import { nextTick, onMounted, PropType, ref, reactive } from "vue";
+import { useStore } from "vuex";
import { Task } from "../types";
interface LocalState {
@@ -63,34 +95,48 @@ export default {
},
components: {},
setup(props, ctx) {
- const taskContent = ref(null);
+ const store = useStore();
+ const editContent = ref(props.task.attributes.content);
+ const editContentTextArea = ref();
const state = reactive<LocalState>({
edit: false,
});
- onMounted(() => {
- nextTick(() => {
- // Set focus
- // taskContent.value.focus();
- });
- });
-
const beginEdit = () => {
+ editContent.value = props.task.attributes.content;
state.edit = true;
+ nextTick(() => {
+ editContentTextArea.value.focus();
+ });
};
const saveEdit = () => {
- state.edit = false;
+ store
+ .dispatch("task/patchTask", {
+ taskId: props.task.id,
+ taskPatch: {
+ content: editContent.value,
+ },
+ })
+ .then((updatedTask: Task) => {
+ state.edit = false;
+ editContent.value = updatedTask.attributes.content;
+ })
+ .catch((error) => {
+ console.log(error);
+ });
};
const cancelEdit = () => {
state.edit = false;
+ editContent.value = props.task.attributes.content;
};
return {
state,
- taskContent,
+ editContent,
+ editContentTextArea,
beginEdit,
saveEdit,
cancelEdit,