Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Move the logic to allow resolve to the resolve button
天舟0b1cab3dc671
diff --git a/frontend/src/components/TaskStatusTransitionForm.vue b/frontend/src/components/TaskStatusTransitionForm.vueindex d0699344b4..7a80ecce0f 100644--- a/frontend/src/components/TaskStatusTransitionForm.vue+++ b/frontend/src/components/TaskStatusTransitionForm.vue@@ -16,6 +16,7 @@<div class="mt-1 flex rounded-md shadow-sm"><inputtype="text"+ disabled="true":name="field.id":id="field.id"v-model="state.outputValueList[index]"@@ -27,6 +28,7 @@<template v-if="field.type == 'Database'"><DatabaseSelectclass="mt-1 w-64"+ :disabled="true":mode="'ENVIRONMENT'":environmentId="environmentId":selectedId="state.outputValueList[index]"@@ -79,7 +81,6 @@type="button"class="ml-3 px-4 py-2"v-bind:class="submitButtonStyle"- :disabled="!allowSubmit"@click.prevent="$emit('submit', state.outputValueList, state.comment)">{{ okText }}@@ -89,17 +90,11 @@</template><script lang="ts">-import { computed, onMounted, reactive, ref, watch, PropType } from "vue";+import { computed, reactive, ref, PropType } from "vue";import cloneDeep from "lodash-es/cloneDeep";-import isEqual from "lodash-es/isEqual";import DatabaseSelect from "../components/DatabaseSelect.vue";-import { DatabaseId, Task, TaskStatusTransition } from "../types";-import {- TaskField,- TaskFieldReferenceProvider,- TaskFieldReferenceProviderContext,- TaskBuiltinFieldId,-} from "../plugins";+import { Task, TaskStatusTransition } from "../types";+import { TaskField, TaskBuiltinFieldId } from "../plugins";interface LocalState {comment: string;@@ -153,25 +148,11 @@ export default {}});- const allowSubmit = computed(() => {- if (props.transition.type != "RESOLVE") {- return true;- }- for (let i = 0; i < props.outputFieldList.length; i++) {- const field = props.outputFieldList[i];- if (field.required && field.isEmpty(state.outputValueList[i])) {- return false;- }- }- return true;- });-return {state,environmentId,commentTextArea,submitButtonStyle,- allowSubmit,};},};diff --git a/frontend/src/plugins/task/DatabaseRequestTemplate.ts b/frontend/src/plugins/task/DatabaseRequestTemplate.tsindex c6edd03071..ed62910751 100644--- a/frontend/src/plugins/task/DatabaseRequestTemplate.ts+++ b/frontend/src/plugins/task/DatabaseRequestTemplate.ts@@ -75,7 +75,7 @@ const template: TaskTemplate = {category: "OUTPUT",id: CUSTOM_FIELD_ID_BEGIN + 1,slug: "database",- name: "Provided database",+ name: "Granted database",type: "Database",required: true,isEmpty: (value: string): boolean => {diff --git a/frontend/src/views/TaskDetail.vue b/frontend/src/views/TaskDetail.vueindex 0d02845a9a..a1069a4bb0 100644--- a/frontend/src/views/TaskDetail.vue+++ b/frontend/src/views/TaskDetail.vue@@ -40,6 +40,7 @@: 'btn-normal': 'btn-normal mr-2'"+ :disabled="transition.type == 'RESOLVE' && !allowResolve"@click.prevent="tryStartTaskStatusTransition(transition.type, () => {})"@@ -582,6 +583,16 @@ export default {return true;});+ const allowResolve = computed(() => {+ for (let i = 0; i < outputFieldList.value.length; i++) {+ const field = outputFieldList.value[i];+ if (field.required && field.isEmpty(state.task.payload[field.id])) {+ return false;+ }+ }+ return true;+ });+// We may consider consolidating all the editing logic in one place. But for now// this controls editing "name, description and all custom fields".// On the other hand:@@ -620,26 +631,29 @@ export default {);});- const applicableStatusTransitionList = computed(() => {- const list: TaskStatusTransitionType[] = [];- if (currentUser.value.id === (state.task as Task).assignee?.id) {- list.push(- ...ASSIGNEE_APPLICABLE_ACTION_LIST.get((state.task as Task).status)!+ const applicableStatusTransitionList = computed(+ (): TaskStatusTransition[] => {+ const list: TaskStatusTransitionType[] = [];+ if (currentUser.value.id === (state.task as Task).assignee?.id) {+ list.push(+ ...ASSIGNEE_APPLICABLE_ACTION_LIST.get((state.task as Task).status)!+ );+ }+ if (currentUser.value.id === (state.task as Task).creator.id) {+ CREATOR_APPLICABLE_ACTION_LIST.get(+ (state.task as Task).status+ )!.forEach((item) => {+ if (list.indexOf(item) == -1) {+ list.push(item);+ }+ });+ }+ return list.map(+ (type: TaskStatusTransitionType) =>+ TASK_STATUS_TRANSITION_LIST.get(type)!);}- if (currentUser.value.id === (state.task as Task).creator.id) {- CREATOR_APPLICABLE_ACTION_LIST.get(- (state.task as Task).status- )!.forEach((item) => {- if (list.indexOf(item) == -1) {- list.push(item);- }- });- }- return list.map((type: TaskStatusTransitionType) =>- TASK_STATUS_TRANSITION_LIST.get(type)- );- });+ );return {updateStatusModalState,@@ -654,6 +668,7 @@ export default {doCreate,changeStageStatus,allowCreate,+ allowResolve,currentUser,taskTemplate,outputFieldList,diff --git a/frontend/src/views/TaskOutputPanel.vue b/frontend/src/views/TaskOutputPanel.vueindex d5e33d958f..3e0bb12178 100644--- a/frontend/src/views/TaskOutputPanel.vue+++ b/frontend/src/views/TaskOutputPanel.vue@@ -1,8 +1,8 @@<template><h2 class="px-4 text-lg font-medium">- Result+ Output<span class="text-base font-normal text-control-light">- (these fields will be filled by the assignee before resolving the task)+ (these fields must be filled by the assignee before resolving the task)</span></h2>