Skip to content

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

Removed the unused Input/OutputFieldType

天舟3a3e18b442b2
diff --git a/frontend/src/plugins/issue/DatabaseCreateTemplate.ts b/frontend/src/plugins/issue/DatabaseCreateTemplate.ts
index 7be0686e8b..55af6b7a53 100644
--- a/frontend/src/plugins/issue/DatabaseCreateTemplate.ts
+++ b/frontend/src/plugins/issue/DatabaseCreateTemplate.ts
@@ -50,7 +50,7 @@ const template: IssueTemplate = {
id: INPUT_DATABASE_NAME,
slug: "databaseName",
name: "DB name",
- type: "NewDatabase",
+ type: "String",
resolved: (ctx: IssueContext): boolean => {
const databaseName = ctx.issue.payload[INPUT_DATABASE_NAME];
return !isEmpty(databaseName);
diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.ts
index 25a4847dc8..b4fcc704bd 100644
--- a/frontend/src/plugins/types.ts
+++ b/frontend/src/plugins/types.ts
@@ -32,21 +32,9 @@ export enum IssueBuiltinFieldId {
export const INPUT_CUSTOM_FIELD_ID_BEGIN = "100";
export const OUTPUT_CUSTOM_FIELD_ID_BEGIN = "200";
-export type InputFieldType =
- | "Boolean"
- | "String"
- | "Environment"
- | "Project"
- | "Database"
- | "NewDatabase";
+export type InputFieldType = "Boolean" | "String";
-export type OutputFieldType =
- | "Boolean"
- | "String"
- | "Environment"
- | "Project"
- | "Database"
- | "NewDatabase";
+export type OutputFieldType = "String" | "Database";
export type IssueContext = {
store: Store<any>;
@@ -104,16 +92,6 @@ export type OutputField = {
resolveStatusText: (resolved: boolean) => string;
};
-// Field payload for "Database" and "NewDatabase" field
-export type DatabaseFieldPayload = {
- isNew: boolean;
- // If isNew is true, name stores the new database name, otherwise, is null.
- name?: string;
- // If isNew is false, id stores the database id, otherwise, is null.
- id?: DatabaseId;
- readOnly: boolean;
-};
-
// Template
export type TemplateContext = {
databaseList: Database[];
diff --git a/frontend/src/views/IssueActivityPanel.vue b/frontend/src/views/IssueActivityPanel.vue
index 113f482f3c..94b6beb060 100644
--- a/frontend/src/views/IssueActivityPanel.vue
+++ b/frontend/src/views/IssueActivityPanel.vue
@@ -562,23 +562,6 @@ export default {
update.newValue
).name;
}
- } else if (field.type === "NewDatabase") {
- // Value is the new database name
- oldValue = update.oldValue;
- newValue = update.newValue;
- } else if (field.type === "Environment") {
- if (update.oldValue) {
- const environment: Environment = store.getters[
- "environment/environmentById"
- ](update.oldValue);
- oldValue = environment.name;
- }
- if (update.newValue) {
- const environment: Environment = store.getters[
- "environment/environmentById"
- ](update.newValue);
- newValue = environment.name;
- }
}
}
if (oldValue && newValue) {
diff --git a/frontend/src/views/IssueSidebar.vue b/frontend/src/views/IssueSidebar.vue
index 1409718c9d..c05052f6e8 100644
--- a/frontend/src/views/IssueSidebar.vue
+++ b/frontend/src/views/IssueSidebar.vue
@@ -41,57 +41,6 @@
<div class="col-span-2">
<template v-if="field.type == 'String'">
<BBTextField
- class="mt-4 text-sm"
- :disabled="!allowEdit"
- :required="true"
- :value="fieldValue(field)"
- :placeholder="field.placeholder"
- @end-editing="(text) => trySaveCustomField(field, text)"
- />
- </template>
- <template v-else-if="field.type == 'Environment'">
- <EnvironmentSelect
- :disabled="!allowEdit"
- :name="field.id"
- :selectedId="fieldValue(field)"
- :selectDefault="false"
- @select-environment-id="
- (environmentId) => {
- trySaveCustomField(field, environmentId);
- }
- "
- />
- </template>
- <template v-else-if="field.type == 'Project'">
- <ProjectSelect
- :disabled="!allowEdit"
- :name="field.id"
- :selectedId="fieldValue(field)"
- :selectDefault="false"
- @select-project-id="
- (projectId) => {
- trySaveCustomField(field, projectId);
- }
- "
- />
- </template>
- <template v-else-if="field.type == 'Database'">
- <DatabaseSelect
- class="w-full"
- :disabled="!allowEdit"
- :selectedId="fieldValue(field)"
- :mode="'USER'"
- @select-database-id="
- (databaseId) => {
- trySaveDatabaseId(field, databaseId);
- }
- "
- />
- </template>
- <template v-else-if="field.type == 'NewDatabase'">
- <BBTextField
- type="text"
- class="w-full text-sm"
:disabled="!allowEdit"
:required="true"
:value="fieldValue(field)"
@@ -240,12 +189,10 @@ import EnvironmentSelect from "../components/EnvironmentSelect.vue";
import ProjectSelect from "../components/ProjectSelect.vue";
import PrincipalSelect from "../components/PrincipalSelect.vue";
import IssueStatusIcon from "../components/IssueStatusIcon.vue";
-import { InputField, DatabaseFieldPayload } from "../plugins";
+import { InputField } from "../plugins";
import {
Database,
- DatabaseId,
Environment,
- EnvironmentId,
Principal,
Project,
Issue,
@@ -294,7 +241,7 @@ export default {
const currentUser = computed(() => store.getters["auth/currentUser"]());
- const fieldValue = (field: InputField): string | DatabaseFieldPayload => {
+ const fieldValue = (field: InputField): string => {
return props.issue.payload[field.id];
};
@@ -366,51 +313,12 @@ export default {
);
});
- const trySaveCustomField = (
- field: InputField,
- value: string | EnvironmentId | DatabaseFieldPayload
- ) => {
+ const trySaveCustomField = (field: InputField, value: string | boolean) => {
if (!isEqual(value, fieldValue(field))) {
emit("update-custom-field", field, value);
}
};
- const trySaveDatabaseNew = (field: InputField, isNew: boolean) => {
- // Do a deep clone to prevent caller accidentally changes the original data.
- const payload: DatabaseFieldPayload = cloneDeep(
- fieldValue(field)
- ) as DatabaseFieldPayload;
- payload.isNew = isNew;
- trySaveCustomField(field, payload);
- };
-
- const trySaveDatabaseName = (field: InputField, value: string) => {
- // Do a deep clone to prevent caller accidentally changes the original data.
- const payload: DatabaseFieldPayload = cloneDeep(
- fieldValue(field)
- ) as DatabaseFieldPayload;
- payload.name = value;
- trySaveCustomField(field, payload);
- };
-
- const trySaveDatabaseId = (field: InputField, value: DatabaseId) => {
- // Do a deep clone to prevent caller accidentally changes the original data.
- const payload: DatabaseFieldPayload = cloneDeep(
- fieldValue(field)
- ) as DatabaseFieldPayload;
- payload.id = value;
- trySaveCustomField(field, payload);
- };
-
- const trySaveDatabaseReadOnly = (field: InputField, value: boolean) => {
- // Do a deep clone to prevent caller accidentally changes the original data.
- const payload: DatabaseFieldPayload = cloneDeep(
- fieldValue(field)
- ) as DatabaseFieldPayload;
- payload.readOnly = value;
- trySaveCustomField(field, payload);
- };
-
const toggleSubscription = () => {
const list = cloneDeep((props.issue as Issue).subscriberList);
if (isCurrentUserSubscribed.value) {
@@ -444,10 +352,6 @@ export default {
isCurrentUserSubscribed,
subscriberList,
trySaveCustomField,
- trySaveDatabaseNew,
- trySaveDatabaseName,
- trySaveDatabaseId,
- trySaveDatabaseReadOnly,
toggleSubscription,
};
},