Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Disallow changing environment after creation
天舟2405885b4196
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vueindex e807171f3c..26a78b3666 100644--- a/frontend/src/components/InstanceForm.vue+++ b/frontend/src/components/InstanceForm.vue@@ -17,31 +17,16 @@ input[type="number"] {<div class=""><!-- Instance Name --><div class="grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-3">- <div class="sm:col-span-2 sm:col-start-1">- <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"- :disabled="!allowEdit"- :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>+ Environment <span v-if="create" style="color: red">*</span></label>+ <!-- Disallow changing environment after creation. This is to take the conservative approach to limit capability --><EnvironmentSelectclass="mt-1"id="environment"name="environment"- :disabled="!allowEdit"+ :disabled="!create":selectedId="create? state.instance.environmentId@@ -59,6 +44,22 @@ input[type="number"] {/></div>+ <div class="sm:col-span-2 sm:col-start-1">+ <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"+ :disabled="!allowEdit"+ :value="state.instance.name"+ @input="updateInstance('name', $event.target.value)"+ />+ </div>+<div class="sm:col-span-2 sm:col-start-1"><label for="host" class="textlabel block">Host or Socket <span style="color: red">*</span>@@ -357,11 +358,6 @@ export default {});const updateInstance = (field: string, value: string) => {- if (field == "environmentId") {- (state.instance as Instance).environment = store.getters[- "environment/environmentById"- ](value);- }(state.instance as any)[field] = value;};@@ -428,12 +424,6 @@ export default {const doUpdate = () => {const patchedInstance: InstancePatch = {};- if (- (state.instance as Instance).environment.id !=- state.originalInstance!.environment.id- ) {- patchedInstance.environmentId = (state.instance as Instance).environment.id;- }if (state.instance.name != state.originalInstance!.name) {patchedInstance.name = state.instance.name;}diff --git a/frontend/src/miragejs/routes/instance.js b/frontend/src/miragejs/routes/instance.jsindex e2dbdc919e..b15de3a7c2 100644--- a/frontend/src/miragejs/routes/instance.js+++ b/frontend/src/miragejs/routes/instance.js@@ -99,14 +99,6 @@ export default function configurInstance(route) {});}- if (attrs.environmentId && attrs.environmentId != instance.environmentId) {- changeList.push({- fieldId: InstanceBuiltinFieldId.ENVIRONMENT,- oldValue: instance.environmentId,- newValue: attrs.environmentId,- });- }-if (attrs.externalLink && attrs.externalLink != instance.externalLink) {changeList.push({fieldId: InstanceBuiltinFieldId.EXTERNAL_LINK,diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.tsindex fdb211a344..6d96d72ed7 100644--- a/frontend/src/types/bytebase.ts+++ b/frontend/src/types/bytebase.ts@@ -661,7 +661,6 @@ export type InstanceNew = {export type InstancePatch = {rowStatus?: RowStatus;- environmentId?: EnvironmentId;name?: string;externalLink?: string;host?: string;