Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Remove sql/rollback sql code supporting changing sql after creation
天舟14aeb3a4b4fe
diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vueindex 0e07f4ef0e..e74d0d525b 100644--- a/frontend/src/views/IssueDetail.vue+++ b/frontend/src/views/IssueDetail.vue@@ -142,7 +142,6 @@:issue="issue":create="state.create":rollback="false"- :allowEdit="allowEditSql"@update-sql="updateSql"/></section>@@ -151,7 +150,6 @@:issue="issue":create="state.create":rollback="true"- :allowEdit="allowEditSql"@update-sql="updateRollbackSql"/></section>@@ -458,36 +456,13 @@ export default {}};- const updateSql = (- newSql: string,- postUpdated: (updatedIssue: Issue) => void- ) => {- if (state.create) {- state.newIssue!.sql = newSql;- } else {- patchIssue(- {- sql: newSql,- },- postUpdated- );- }+ // We only allow updating sql/rollback upon issue creation.+ const updateSql = (newSql: string) => {+ state.newIssue!.sql = newSql;};- const updateRollbackSql = (- newSql: string,- postUpdated: (updatedIssue: Issue) => void- ) => {- if (state.create) {- state.newIssue!.rollbackSql = newSql;- } else {- patchIssue(- {- rollbackSql: newSql,- },- postUpdated- );- }+ const updateRollbackSql = (newSql: string) => {+ state.newIssue!.rollbackSql = newSql;};const updateDescription = (diff --git a/frontend/src/views/IssueSqlPanel.vue b/frontend/src/views/IssueSqlPanel.vueindex 11e46d9f5a..9a802c79be 100644--- a/frontend/src/views/IssueSqlPanel.vue+++ b/frontend/src/views/IssueSqlPanel.vue@@ -1,80 +1,6 @@<template><div class="flex justify-between"><div class="textlabel">{{ rollback ? "Rollback SQL" : "SQL" }}</div>- <div v-if="!create" class="space-x-2">- <button- v-if="allowEdit && !state.editing"- type="button"- class="btn-icon"- @click.prevent="beginEdit"- >- <!-- Heroicon name: solid/pencil -->- <!-- Use h-5 to avoid flickering when show/hide icon -->- <svg- class="h-5 w-5"- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 20 20"- fill="currentColor"- aria-hidden="true"- >- <path- d="M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"- />- </svg>- </button>- <!-- mt-0.5 is to prevent jiggling betweening switching edit/none-edit -->- <button- v-if="state.editing"- type="button"- class="- mt-0.5- px-3- rounded-sm- text-control- hover:bg-control-bg-hover- disabled:bg-control-bg- disabled:opacity-50- disabled:cursor-not-allowed- text-sm- leading-5- font-normal- focus:ring-control- focus:outline-none- focus-visible:ring-2- focus:ring-offset-2- "- @click.prevent="cancelEdit"- >- Cancel- </button>- <button- v-if="state.editing"- type="button"- class="- mt-0.5- px-3- border border-control-border- rounded-sm- text-control- bg-control-bg- hover:bg-control-bg-hover- disabled:bg-control-bg- disabled:opacity-50- disabled:cursor-not-allowed- text-sm- leading-5- font-normal- focus:ring-control- focus:outline-none- focus-visible:ring-2- focus:ring-offset-2- "- :disabled="!allowSave"- @click.prevent="saveEdit"- >- Save- </button>- </div></div><label class="sr-only">SQL statement</label><template v-if="state.editing">@@ -131,7 +57,6 @@ import {} from "vue";import { Issue } from "../types";import { sizeToFit } from "../utils";-import command from "../store/modules/command";interface LocalState {editing: boolean;@@ -154,10 +79,6 @@ export default {required: true,type: Boolean,},- allowEdit: {- required: true,- type: Boolean,- },},components: {},setup(props, { emit }) {@@ -172,24 +93,6 @@ export default {editSql: effectiveSql(props.issue),});- const keyboardHandler = (e: KeyboardEvent) => {- if (state.editing && editSqlTextArea.value === document.activeElement) {- if (e.code == "Escape") {- cancelEdit();- } else if (e.code == "Enter" && e.metaKey) {- if (props.rollback) {- if (state.editSql != props.issue.rollbackSql) {- saveEdit();- }- } else {- if (state.editSql != props.issue.sql) {- saveEdit();- }- }- }- }- };-const resizeTextAreaHandler = () => {if (state.editing) {sizeToFit(editSqlTextArea.value);@@ -197,7 +100,6 @@ export default {};onMounted(() => {- document.addEventListener("keydown", keyboardHandler);window.addEventListener("resize", resizeTextAreaHandler);if (props.create) {state.editing = true;@@ -208,7 +110,6 @@ export default {});onUnmounted(() => {- document.removeEventListener("keydown", keyboardHandler);window.removeEventListener("resize", resizeTextAreaHandler);});@@ -222,39 +123,9 @@ export default {});- const allowSave = computed(() => {- return props.rollback- ? state.editSql != props.issue.rollbackSql- : state.editSql != props.issue.sql;- });-- const beginEdit = () => {- state.editSql = effectiveSql(props.issue);- state.editing = true;- nextTick(() => {- editSqlTextArea.value.focus();- });- };-- const saveEdit = () => {- emit("update-sql", state.editSql, (updatedIssue: Issue) => {- state.editSql = effectiveSql(updatedIssue);- state.editing = false;- });- };-- const cancelEdit = () => {- state.editSql = effectiveSql(props.issue);- state.editing = false;- };-return {editSqlTextArea,state,- allowSave,- beginEdit,- saveEdit,- cancelEdit,};},};