Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): byt-871 show a guide when editing sql in vcs workflow (#1830)
Liu Jif02478b4ebf3
diff --git a/frontend/src/components/Issue/IssueTaskStatementPanel.vue b/frontend/src/components/Issue/IssueTaskStatementPanel.vueindex 3768696ad4..94597ae254 100644--- a/frontend/src/components/Issue/IssueTaskStatementPanel.vue+++ b/frontend/src/components/Issue/IssueTaskStatementPanel.vue@@ -72,6 +72,19 @@{{ $t("common.save") }}</button></template>+ <template v-if="issue.project.workflowType === 'VCS'">+ <!--+ Show a virtual pencil icon in VCS workflow which opens a guide+ when clicked.+ -->+ <button+ type="button"+ class="btn-icon"+ @click.prevent="state.showVCSGuideModal = true"+ >+ <heroicons-solid:pencil class="h-5 w-5" />+ </button>+ </template></template></div></div>@@ -90,6 +103,32 @@@ready="handleMonacoEditorReady"/></div>++ <BBModal+ v-if="state.showVCSGuideModal"+ :title="$t('issue.edit-sql-statement')"+ @close="state.showVCSGuideModal = false"+ >+ <div class="space-y-4 max-w-[32rem] divide-y divide-block-border">+ <div class="whitespace-pre-wrap">+ {{ $t("issue.edit-sql-statement-in-vcs") }}+ </div>++ <div class="flex justify-end pt-4 gap-x-2">+ <button+ type="button"+ class="btn-normal"+ @click.prevent="state.showVCSGuideModal = false"+ >+ {{ $t("common.cancel") }}+ </button>++ <button type="button" class="btn-primary" @click.prevent="goToVCS">+ {{ $t("common.go-now") }}+ </button>+ </div>+ </div>+ </BBModal></template><script lang="ts">@@ -100,14 +139,17 @@ import {defineComponent,computed,ref,+ Ref,} from "vue";-import { useTableStore, useUIStateStore } from "@/store";+import { useRepositoryStore, useTableStore, useUIStateStore } from "@/store";import { useIssueLogic } from "./logic";import MonacoEditor from "../MonacoEditor/MonacoEditor.vue";+import { baseDirectoryWebUrl, Issue, Repository } from "@/types";interface LocalState {editing: boolean;editStatement: string;+ showVCSGuideModal: boolean;}const EDITOR_MIN_HEIGHT = {@@ -129,6 +171,7 @@ export default defineComponent({},setup(props, { emit }) {const {+ issue,create,allowEditStatement,selectedStatement: statement,@@ -142,6 +185,7 @@ export default defineComponent({const state = reactive<LocalState>({editing: false,editStatement: statement.value,+ showVCSGuideModal: false,});const editorRef = ref<InstanceType<typeof MonacoEditor>>();@@ -224,7 +268,19 @@ export default defineComponent({updateEditorHeight();};+ const goToVCS = () => {+ const issueEntity = issue.value as Issue;+ useRepositoryStore()+ .fetchRepositoryByProjectId(issueEntity.project.id)+ .then((repository: Repository) => {+ window.open(baseDirectoryWebUrl(repository), "_blank");++ state.showVCSGuideModal = false;+ });+ };+return {+ issue: issue as Ref<Issue>,create,allowEditStatement,statement,@@ -238,6 +294,7 @@ export default defineComponent({saveEdit,cancelEdit,onStatementChange,+ goToVCS,handleMonacoEditorReady,};},diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 151b63d510..29444f31a6 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -201,7 +201,8 @@"view-doc": "View doc","backup-and-restore": "Backup and restore","write-only": "write only",- "pitr": "PITR"+ "pitr": "PITR",+ "go-now": "Go now"},"error-page": {"go-back-home": "Go back home"@@ -484,7 +485,9 @@},"new-issue": "@:common.new @:common.issue","format-on-save": "Format on save",- "action-to-current-stage": "{action} current stage"+ "action-to-current-stage": "{action} current stage",+ "edit-sql-statement-in-vcs": "This project has enabled VCS based version control. Please modify the SQL file in the corresponding Git repository, and commit it to create a new issue.",+ "edit-sql-statement": "Edit SQL statement"},"alter-schema": {"vcs-enabled": "This project has enabled VCS based version control and selecting database below will navigate you to the corresponding Git repository to initiate the change process.",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex bf1d94e65e..1bfadbfeb2 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -201,7 +201,8 @@"view-doc": "查看文档","backup-and-restore": "备份与恢复","write-only": "仅写入",- "pitr": "PITR"+ "pitr": "PITR",+ "go-now": "立即前往"},"error-page": {"go-back-home": "回到主页"@@ -485,7 +486,9 @@},"new-issue": "@:common.new@:common.issue","format-on-save": "保存时格式化",- "action-to-current-stage": "{action}当前阶段"+ "action-to-current-stage": "{action}当前阶段",+ "edit-sql-statement-in-vcs": "该项目开启了基于 VCS 的版本管理。请在对应的 Git 仓库修改 SQL 文件并提交,开启新的工单。",+ "edit-sql-statement": "编辑 SQL 语句"},"alter-schema": {"vcs-enabled": "该项目开启了基于 VCS 的版本管理,选择下面的数据库会将您导航到相应的 Git 仓库以发起变更流程。",