Skip to content

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

Fetch the database info remotely if url contain databaseList query parameter when creating the issue.

天舟21c3a7133185
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 5d2ec8d431..909fdc646d 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -789,6 +789,14 @@ router.beforeEach((to, from, next) => {
if (issueSlug) {
if (issueSlug.toLowerCase() == "new") {
+ // For prepraing the database if user visits creating issue url directly.
+ if (to.query.databaseList) {
+ for (const databaseId of (to.query.databaseList as string).split(
+ ","
+ )) {
+ store.dispatch("database/fetchDatabaseById", { databaseId });
+ }
+ }
next();
return;
}
diff --git a/frontend/src/views/IssueSidebar.vue b/frontend/src/views/IssueSidebar.vue
index fb66ee29bb..047230a7e6 100644
--- a/frontend/src/views/IssueSidebar.vue
+++ b/frontend/src/views/IssueSidebar.vue
@@ -316,17 +316,6 @@ export default {
return props.issue.payload[field.id];
};
- const instance = computed((): Instance => {
- if (props.create) {
- const stage = props.selectedStage as StageCreate;
- return store.getters["instance/instanceById"](
- stage.taskList[0].instanceId
- );
- }
- const stage = props.selectedStage as Stage;
- return stage.taskList[0].instance;
- });
-
const database = computed((): Database | undefined => {
if (props.create) {
const stage = props.selectedStage as StageCreate;
@@ -341,6 +330,22 @@ export default {
return stage.taskList[0].database;
});
+ const instance = computed((): Instance => {
+ if (props.create) {
+ // If database is available, then we derive the instance from database because we always fetch database's instance.
+ // On the other hand, instance for stage.taskList[0].instanceId might not be loaded (e.g. when creating an update schema issue)
+ if (database.value) {
+ return database.value.instance;
+ }
+ const stage = props.selectedStage as StageCreate;
+ return store.getters["instance/instanceById"](
+ stage.taskList[0].instanceId
+ );
+ }
+ const stage = props.selectedStage as Stage;
+ return stage.taskList[0].instance;
+ });
+
const environment = computed((): Environment => {
if (props.create) {
const stage = props.selectedStage as StageCreate;