Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Make NewXXX model type based on XXX model type
Tianzhou Chen70077ee1f6b8
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.tsindex 9c9bac18b2..424aea7ca1 100644--- a/frontend/src/types/bytebase.ts+++ b/frontend/src/types/bytebase.ts@@ -21,13 +21,13 @@ export type DataSourceId = {// Modelsexport type User = ResourceObject & {};-export type NewUser = Omit<ResourceObject, "id">;+export type NewUser = Omit<User, "id">;export type Bookmark = ResourceObject & {};-export type NewBookmark = Omit<ResourceObject, "id">;+export type NewBookmark = Omit<Bookmark, "id">;export type Activity = ResourceObject & {};-export type NewActivity = Omit<ResourceObject, "id">;+export type NewActivity = Omit<Activity, "id">;export type Pipeline = ResourceObject & {attributes: {@@ -60,7 +60,7 @@ export type Pipeline = ResourceObject & {subscriberIdList: Array<string>;};};-export type NewPipeline = Omit<ResourceObject, "id">;+export type NewPipeline = Omit<Pipeline, "id">;export type Environment = ResourceObject & {attributes: {@@ -73,7 +73,7 @@ export type Environment = ResourceObject & {database: string;};};-export type NewEnvironment = Omit<ResourceObject, "id">;+export type NewEnvironment = Omit<Environment, "id">;export type Instance = ResourceObject & {attributes: {@@ -84,7 +84,7 @@ export type Instance = ResourceObject & {port?: string;};};-export type NewInstance = Omit<ResourceObject, "id">;+export type NewInstance = Omit<Instance, "id">;export type DataSource = ResourceObject & {attributes: {@@ -95,16 +95,16 @@ export type DataSource = ResourceObject & {password?: string;};};-export type NewDataSource = Omit<ResourceObject, "id">;+export type NewDataSource = Omit<DataSource, "id">;export type Group = ResourceObject & {};-export type NewGroup = Omit<ResourceObject, "id">;+export type NewGroup = Omit<Group, "id">;export type Project = ResourceObject & {};-export type NewProject = Omit<ResourceObject, "id">;+export type NewProject = Omit<Project, "id">;export type Repository = ResourceObject & {};-export type NewRepository = Omit<ResourceObject, "id">;+export type NewRepository = Omit<Repository, "id">;export type LoginInfo = Omit<ResourceObject & {diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vueindex 68c4dfec27..9d80c8dd4c 100644--- a/frontend/src/views/InstanceDetail.vue+++ b/frontend/src/views/InstanceDetail.vue@@ -299,6 +299,14 @@ import { urlfy } from "../utils";import EnvironmentSelect from "../components/EnvironmentSelect.vue";import { Instance, NewInstance, DataSource, NewDataSource } from "../types";+const INIT_DATA_SOURCE: NewDataSource = {+ type: "dataSource",+ attributes: {+ type: "ADMIN",+ name: "Admin Data Source",+ },+};+interface LocalState {new: boolean;originalInstance?: Instance;@@ -379,16 +387,12 @@ export default {type: "instance",attributes: {name: "New Instance",+ environmentId: "",host: "127.0.0.1",username: "root",},};- state.adminDataSource = {- type: "dataSource",- attributes: {- type: "ADMIN",- },- };+ state.adminDataSource = INIT_DATA_SOURCE;} else {// Instance is already fetched remotely during routing, so we can just// use store.getters here.@@ -397,12 +401,7 @@ export default {// On the other hand, we need to fetch data source remotely first and// because the operation is async, we need to have a init object to avoid// adding v-if="state.adminDataSource" guard- assignAdminDataSource({- type: "datasource",- attributes: {- type: "ADMIN",- },- });+ assignAdminDataSource(INIT_DATA_SOURCE);store.dispatch("datasource/fetchDataSourceListByInstanceId",