Skip to content

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

Move data source table outside of the form block

天舟ab1b5587e588
diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vue
index 3f113a4656..67e284004e 100644
--- a/frontend/src/views/InstanceDetail.vue
+++ b/frontend/src/views/InstanceDetail.vue
@@ -13,253 +13,257 @@ input[type="number"] {
</style>
<template>
- <form class="px-6 space-y-6">
- <!-- Instance Name -->
- <div class="grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6">
- <div class="sm:col-span-2">
- <label for="name" class="textlabel">
- Instance Name <span style="color: red">*</span>
- </label>
- <input
- required
- id="name"
- name="name"
- type="text"
- class="textfield mt-1 w-full"
- :value="state.instance.name"
- @input="updateInstance('name', $event.target.value)"
- />
- </div>
-
- <div class="sm:col-span-2 sm:col-start-1">
- <label for="environment" class="textlabel">
- Environment <span style="color: red">*</span>
- </label>
- <EnvironmentSelect
- id="environment"
- name="environment"
- :selectedId="state.instance.environmentId"
- @select-environment-id="
- (environmentId) => {
- updateInstance('environmentId', environmentId);
- }
- "
- />
- </div>
-
- <div class="sm:col-span-5">
- <label for="host" class="textlabel block">
- Host or Socket <span style="color: red">*</span>
- </label>
- <div class="mt-1">
+ <div class="px-6 space-y-6">
+ <form>
+ <!-- Instance Name -->
+ <div class="grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6">
+ <div class="sm:col-span-2">
+ <label for="name" class="textlabel">
+ Instance Name <span style="color: red">*</span>
+ </label>
<input
required
+ id="name"
+ name="name"
type="text"
- id="host"
- name="host"
- placeholder="e.g. 127.0.0.1 | localhost | /tmp/mysql.sock"
class="textfield mt-1 w-full"
- :value="state.instance.host"
- @input="updateInstance('host', $event.target.value)"
+ :value="state.instance.name"
+ @input="updateInstance('name', $event.target.value)"
/>
</div>
- </div>
- <div class="sm:col-span-1">
- <label for="port" class="textlabel block"> Port </label>
- <div class="mt-1">
- <input
- type="number"
- id="port"
- name="port"
- placeholder="3306"
- class="textfield mt-1 w-full"
- :value="state.instance.port"
- @input="updateInstance('port', $event.target.value)"
+ <div class="sm:col-span-2 sm:col-start-1">
+ <label for="environment" class="textlabel">
+ Environment <span style="color: red">*</span>
+ </label>
+ <EnvironmentSelect
+ id="environment"
+ name="environment"
+ :selectedId="state.instance.environmentId"
+ @select-environment-id="
+ (environmentId) => {
+ updateInstance('environmentId', environmentId);
+ }
+ "
/>
</div>
- </div>
- <div class="sm:col-span-6 sm:col-start-1">
- <label for="externallink" class="textlabel inline-flex">
- <span class="">External Link</span>
- <button
- class="ml-1 btn-icon"
- :disabled="state.instance.externalLink?.trim().length == 0"
- @click.prevent="
- window.open(urlfy(state.instance.externalLink), '_blank')
- "
- >
- <svg
- class="w-4 h-4"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
- ></path>
- </svg>
- </button>
- </label>
- <input
- required
- id="externallink"
- name="externallink"
- type="text"
- class="textfield mt-1 w-full"
- :value="state.instance.externalLink"
- @input="updateInstance('externalLink', $event.target.value)"
- />
- </div>
- </div>
- <!-- Read/Write Datasource Info -->
- <div v-if="state.new" class="py-6 border-t border-b divide-control-border">
- <div class="flex justify-between">
- <div>
- <h3 class="text-lg leading-6 font-medium text-gray-900">
- Read/Write Data Source Info
- </h3>
- <p class="mt-1 text-sm text-gray-500">
- This is the data source used by bytebase to perform DDL and
- non-SELECT DML operations. Note, bytebase does NOT need admin/SUPER
- privilege. TODO: Add grant statement.
- </p>
- </div>
- </div>
- <div class="mt-4">
- <button type="button" class="btn-normal">Test Connection</button>
- </div>
- <div class="pt-6 grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6">
- <div class="sm:col-span-2 sm:col-start-1">
- <label for="username" class="textlabel block">
- Username <span style="color: red">*</span>
+ <div class="sm:col-span-5">
+ <label for="host" class="textlabel block">
+ Host or Socket <span style="color: red">*</span>
</label>
<div class="mt-1">
- <!-- For mysql, username can be empty indicating anonymous user.
- But it's a very bad practice to use anonymous user for admin operation,
- thus we make it REQUIRED here. -->
<input
required
- id="username"
- name="username"
type="text"
+ id="host"
+ name="host"
+ placeholder="e.g. 127.0.0.1 | localhost | /tmp/mysql.sock"
class="textfield mt-1 w-full"
- :value="state.adminDataSource.username"
- @input="updateDataSource('username', $event.target.value)"
+ :value="state.instance.host"
+ @input="updateInstance('host', $event.target.value)"
/>
</div>
</div>
- <div class="sm:col-span-2 sm:col-start-1">
- <label for="password" class="textlabel block"> Password </label>
- <div class="mt-1 inline-flex">
+ <div class="sm:col-span-1">
+ <label for="port" class="textlabel block"> Port </label>
+ <div class="mt-1">
<input
- id="password"
- name="password"
- autocomplete="off"
- :type="state.showPassword ? 'text' : 'password'"
+ type="number"
+ id="port"
+ name="port"
+ placeholder="3306"
class="textfield mt-1 w-full"
- :value="state.adminDataSource.password"
- @input="updateDataSource('password', $event.target.value)"
+ :value="state.instance.port"
+ @input="updateInstance('port', $event.target.value)"
/>
- <div class="ml-2 flex items-center">
- <button
- class="btn-icon"
- @click.prevent="state.showPassword = !state.showPassword"
+ </div>
+ </div>
+
+ <div class="sm:col-span-6 sm:col-start-1">
+ <label for="externallink" class="textlabel inline-flex">
+ <span class="">External Link</span>
+ <button
+ class="ml-1 btn-icon"
+ :disabled="state.instance.externalLink?.trim().length == 0"
+ @click.prevent="
+ window.open(urlfy(state.instance.externalLink), '_blank')
+ "
+ >
+ <svg
+ class="w-4 h-4"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
>
- <svg
- v-if="state.showPassword"
- class="w-6 h-6"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"
- ></path>
- </svg>
- <svg
- v-else
- class="w-6 h-6"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
+ ></path>
+ </svg>
+ </button>
+ </label>
+ <input
+ required
+ id="externallink"
+ name="externallink"
+ type="text"
+ class="textfield mt-1 w-full"
+ :value="state.instance.externalLink"
+ @input="updateInstance('externalLink', $event.target.value)"
+ />
+ </div>
+ </div>
+ <!-- Read/Write Datasource Info -->
+ <div
+ v-if="state.new"
+ class="py-6 border-t border-b divide-control-border"
+ >
+ <div class="flex justify-between">
+ <div>
+ <h3 class="text-lg leading-6 font-medium text-gray-900">
+ Read/Write Data Source Info
+ </h3>
+ <p class="mt-1 text-sm text-gray-500">
+ This is the data source used by bytebase to perform DDL and
+ non-SELECT DML operations. Note, bytebase does NOT need
+ admin/SUPER privilege. TODO: Add grant statement.
+ </p>
+ </div>
+ </div>
+ <div class="mt-4">
+ <button type="button" class="btn-normal">Test Connection</button>
+ </div>
+ <div class="pt-6 grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6">
+ <div class="sm:col-span-2 sm:col-start-1">
+ <label for="username" class="textlabel block">
+ Username <span style="color: red">*</span>
+ </label>
+ <div class="mt-1">
+ <!-- For mysql, username can be empty indicating anonymous user.
+ But it's a very bad practice to use anonymous user for admin operation,
+ thus we make it REQUIRED here. -->
+ <input
+ required
+ id="username"
+ name="username"
+ type="text"
+ class="textfield mt-1 w-full"
+ :value="state.adminDataSource.username"
+ @input="updateDataSource('username', $event.target.value)"
+ />
+ </div>
+ </div>
+
+ <div class="sm:col-span-2 sm:col-start-1">
+ <label for="password" class="textlabel block"> Password </label>
+ <div class="mt-1 inline-flex">
+ <input
+ id="password"
+ name="password"
+ autocomplete="off"
+ :type="state.showPassword ? 'text' : 'password'"
+ class="textfield mt-1 w-full"
+ :value="state.adminDataSource.password"
+ @input="updateDataSource('password', $event.target.value)"
+ />
+ <div class="ml-2 flex items-center">
+ <button
+ class="btn-icon"
+ @click.prevent="state.showPassword = !state.showPassword"
>
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
- ></path>
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
- ></path>
- </svg>
- </button>
+ <svg
+ v-if="state.showPassword"
+ class="w-6 h-6"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"
+ ></path>
+ </svg>
+ <svg
+ v-else
+ class="w-6 h-6"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
+ ></path>
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
+ ></path>
+ </svg>
+ </button>
+ </div>
</div>
</div>
</div>
</div>
- </div>
- <!-- Action Button Group -->
- <div>
- <!-- Create button group -->
- <div v-if="state.new" class="flex justify-end">
- <button
- type="button"
- class="btn-normal py-2 px-4"
- @click.prevent="goBack"
- >
- Cancel
- </button>
- <button
- type="button"
- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
- @click.prevent="doCreate(state.instance, state.adminDataSource)"
- >
- Create
- </button>
- </div>
- <!-- Update button group -->
- <div v-else class="flex justify-between">
- <BBButtonTrash
- :buttonText="'Delete this entire instance'"
- :requireConfirm="true"
- :confirmTitle="`Are you sure to delete '${state.instance.name}'?`"
- :confirmDescription="'All associated data sources will also be deleted. You cannot undo this action.'"
- @confirm="doDelete"
- />
- <button
- type="button"
- class="btn-normal ml-3 inline-flex justify-center py-2 px-4"
- :disabled="!valueChanged"
- @click.prevent="doUpdate(state.instance)"
- >
- Update
- </button>
+ <!-- Action Button Group -->
+ <div>
+ <!-- Create button group -->
+ <div v-if="state.new" class="flex justify-end">
+ <button
+ type="button"
+ class="btn-normal py-2 px-4"
+ @click.prevent="goBack"
+ >
+ Cancel
+ </button>
+ <button
+ type="button"
+ class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
+ @click.prevent="doCreate(state.instance, state.adminDataSource)"
+ >
+ Create
+ </button>
+ </div>
+ <!-- Update button group -->
+ <div v-else class="flex justify-between">
+ <BBButtonTrash
+ :buttonText="'Delete this entire instance'"
+ :requireConfirm="true"
+ :confirmTitle="`Are you sure to delete '${state.instance.name}'?`"
+ :confirmDescription="'All associated data sources will also be deleted. You cannot undo this action.'"
+ @confirm="doDelete"
+ />
+ <button
+ type="button"
+ class="btn-normal ml-3 inline-flex justify-center py-2 px-4"
+ :disabled="!valueChanged"
+ @click.prevent="doUpdate(state.instance)"
+ >
+ Update
+ </button>
+ </div>
</div>
- </div>
-
+ </form>
<div
v-if="!state.new"
class="py-6 space-y-4 border-t divide-control-border"
>
<DataSourceTable :instance="state.instance" />
</div>
- </form>
+ </div>
<BBAlert
v-if="state.showCancelModal"
:style="'WARN'"