Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
If project is using version control workflow, selecting the database in the alter schema form will navigate user to the corresponding VCS web url
天舟9a9a2fee9a58
diff --git a/frontend/src/components/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm.vueindex df6c650527..96c58d6d6b 100644--- a/frontend/src/components/AlterSchemaPrepForm.vue+++ b/frontend/src/components/AlterSchemaPrepForm.vue@@ -25,7 +25,15 @@ import { computed, reactive, onMounted, onUnmounted, PropType } from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";import DatabaseTable from "../components/DatabaseTable.vue";-import { Database, DatabaseId, Project, ProjectId, UNKNOWN_ID } from "../types";+import {+ baseDirectoryWebURL,+ Database,+ DatabaseId,+ Project,+ ProjectId,+ Repository,+ UNKNOWN_ID,+} from "../types";interface LocalState {project: Project;@@ -112,18 +120,29 @@ export default {const database = store.getters["database/databaseById"](databaseId);- router.push({- name: "workspace.issue.detail",- params: {- issueSlug: "new",- },- query: {- template: "bb.issue.db.schema.update",- name: `[${database.name}] Alter schema`,- project: state.project.id,- databaseList: database.id,- },- });+ if (database.project.workflowType == "UI") {+ router.push({+ name: "workspace.issue.detail",+ params: {+ issueSlug: "new",+ },+ query: {+ template: "bb.issue.db.schema.update",+ name: `[${database.name}] Alter schema`,+ project: state.project.id,+ databaseList: database.id,+ },+ });+ } else if (database.project.workflowType == "VCS") {+ store+ .dispatch(+ "repository/fetchRepositoryByProjectId",+ database.project.id+ )+ .then((repository: Repository) => {+ window.open(baseDirectoryWebURL(repository), "_blank");+ });+ }};const cancel = () => {diff --git a/frontend/src/types/repository.ts b/frontend/src/types/repository.tsindex 097552cc00..b56d334ca6 100644--- a/frontend/src/types/repository.ts+++ b/frontend/src/types/repository.ts@@ -1,3 +1,4 @@+import isEmpty from "lodash-es/isEmpty";import { RepositoryId, VCSId, ProjectId } from "./id";import { Principal } from "./principal";import { Project } from "./project";@@ -70,3 +71,23 @@ export type WebhookInfo = {id: string;url: string;};++export function baseDirectoryWebURL(repository: Repository): string {+ if (repository.vcs.type == "GITLAB_SELF_HOST") {+ // If branchFilter is empty (default branch) or branch filter contains wildcard,+ // then we can't locate to the exact branch name, thus we will just return the repository web url+ if (+ isEmpty(repository.branchFilter) ||+ repository.branchFilter.includes("*")+ ) {+ return repository.webURL;+ }+ let url = `${repository.webURL}/-/tree/${repository.branchFilter}`;+ if (!isEmpty(repository.baseDirectory)) {+ url += `/${repository.baseDirectory}`;+ }+ return url;+ }++ return repository.webURL;+}