Skip to content

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

Add archive to instance

天舟e847d7eb773a
diff --git a/frontend/src/components/DatabaseTable.vue b/frontend/src/components/DatabaseTable.vue
index 29df43012e..0208c9a356 100644
--- a/frontend/src/components/DatabaseTable.vue
+++ b/frontend/src/components/DatabaseTable.vue
@@ -15,7 +15,7 @@
{{ database.name }}
</BBTableCell>
<BBTableCell class="w-24">
- {{ database.instance.name }}
+ {{ instanceName(database.instance) }}
</BBTableCell>
<BBTableCell class="w-8">
{{ database.syncStatus }}
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vue
index 486bc5b337..e807171f3c 100644
--- a/frontend/src/components/InstanceForm.vue
+++ b/frontend/src/components/InstanceForm.vue
@@ -27,6 +27,7 @@ input[type="number"] {
name="name"
type="text"
class="textfield mt-1 w-full"
+ :disabled="!allowEdit"
:value="state.instance.name"
@input="updateInstance('name', $event.target.value)"
/>
@@ -40,6 +41,7 @@ input[type="number"] {
class="mt-1"
id="environment"
name="environment"
+ :disabled="!allowEdit"
:selectedId="
create
? state.instance.environmentId
@@ -68,6 +70,7 @@ input[type="number"] {
name="host"
placeholder="e.g. 127.0.0.1 | localhost | /tmp/mysql.sock"
class="textfield mt-1 w-full"
+ :disabled="!allowEdit"
:value="state.instance.host"
@input="updateInstance('host', $event.target.value)"
/>
@@ -81,6 +84,7 @@ input[type="number"] {
name="port"
placeholder="3306"
class="textfield mt-1 w-full"
+ :disabled="!allowEdit"
:value="state.instance.port"
@input="updateInstance('port', $event.target.value)"
/>
@@ -118,6 +122,7 @@ input[type="number"] {
name="externallink"
type="text"
class="textfield mt-1 w-full"
+ :disabled="!allowEdit"
:value="state.instance.externalLink"
@input="updateInstance('externalLink', $event.target.value)"
/>
@@ -240,18 +245,34 @@ input[type="number"] {
</div>
<!-- Update button group -->
<div v-else class="flex justify-between">
- <BBButtonConfirm
- :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"
- />
+ <template v-if="state.instance.rowStatus == 'NORMAL'">
+ <BBButtonConfirm
+ :style="'ARCHIVE'"
+ :buttonText="'Archive this instance'"
+ :okText="'Archive'"
+ :requireConfirm="true"
+ :confirmTitle="`Archive instance '${state.instance.name}'?`"
+ :confirmDescription="'Archived instsance will not be shown on the normal interface. You can still restore later from the Archive page.'"
+ @confirm="doArchive"
+ />
+ </template>
+ <template v-else-if="state.instance.rowStatus == 'ARCHIVED'">
+ <BBButtonConfirm
+ :style="'RESTORE'"
+ :buttonText="'Restore this instance'"
+ :okText="'Restore'"
+ :requireConfirm="true"
+ :confirmTitle="`Restore instance '${state.instance.name}' to normal state?`"
+ :confirmDescription="''"
+ @confirm="doRestore"
+ />
+ </template>
<button
+ v-if="allowEdit"
type="button"
class="btn-normal ml-3 inline-flex justify-center py-2 px-4"
- :disabled="!allowUpdate"
- @click.prevent="doUpdate(state.instance)"
+ :disabled="!valueChanged"
+ @click.prevent="doUpdate"
>
Update
</button>
@@ -275,6 +296,7 @@ import {
UNKNOWN_ID,
ALL_DATABASE_NAME,
User,
+ InstancePatch,
} from "../types";
interface LocalState {
@@ -326,11 +348,20 @@ export default {
return state.instance.name && state.instance.host;
});
- const allowUpdate = computed(() => {
+ const allowEdit = computed(() => {
+ return props.create || (state.instance as Instance).rowStatus == "NORMAL";
+ });
+
+ const valueChanged = computed(() => {
return !isEqual(state.instance, state.originalInstance);
});
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;
};
@@ -395,9 +426,31 @@ export default {
});
};
- const doUpdate = (updatedInstance: Instance) => {
+ 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;
+ }
+ if (state.instance.externalLink != state.originalInstance!.externalLink) {
+ patchedInstance.externalLink = state.instance.externalLink;
+ }
+ if (state.instance.host != state.originalInstance!.host) {
+ patchedInstance.host = state.instance.host;
+ }
+ if (state.instance.port != state.originalInstance!.port) {
+ patchedInstance.port = state.instance.port;
+ }
store
- .dispatch("instance/patchInstance", updatedInstance)
+ .dispatch("instance/patchInstance", {
+ instanceId: (state.instance as Instance).id,
+ instancePatch: patchedInstance,
+ })
.then((instance) => {
state.originalInstance = instance;
// Make hard copy since we are going to make equal comparsion to determine the update button enable state.
@@ -406,7 +459,7 @@ export default {
store.dispatch("notification/pushNotification", {
module: "bytebase",
style: "SUCCESS",
- title: `Successfully updated instance '${updatedInstance.name}'.`,
+ title: `Successfully updated instance '${instance.name}'.`,
});
})
.catch((error) => {
@@ -414,20 +467,47 @@ export default {
});
};
- const doDelete = () => {
+ const doArchive = () => {
store
- .dispatch(
- "instance/deleteInstanceById",
- (state.instance as Instance).id
- )
- .then(() => {
+ .dispatch("instance/patchInstance", {
+ instanceId: (state.instance as Instance).id,
+ instancePatch: {
+ rowStatus: "ARCHIVED",
+ },
+ })
+ .then((instance) => {
+ state.originalInstance = instance;
+ // Make hard copy since we are going to make equal comparsion to determine the update button enable state.
+ state.instance = cloneDeep(state.originalInstance!);
+
store.dispatch("notification/pushNotification", {
module: "bytebase",
style: "SUCCESS",
- title: `Successfully deleted instance '${state.instance.name}'.`,
+ title: `Successfully archived instance '${instance.name}'.`,
});
- router.push({
- name: "workspace.instance",
+ })
+ .catch((error) => {
+ console.log(error);
+ });
+ };
+
+ const doRestore = () => {
+ store
+ .dispatch("instance/patchInstance", {
+ instanceId: (state.instance as Instance).id,
+ instancePatch: {
+ rowStatus: "NORMAL",
+ },
+ })
+ .then((instance) => {
+ state.originalInstance = instance;
+ // Make hard copy since we are going to make equal comparsion to determine the update button enable state.
+ state.instance = cloneDeep(state.originalInstance!);
+
+ store.dispatch("notification/pushNotification", {
+ module: "bytebase",
+ style: "SUCCESS",
+ title: `Successfully restored instance '${instance.name}'.`,
});
})
.catch((error) => {
@@ -438,12 +518,14 @@ export default {
return {
state,
allowCreate,
- allowUpdate,
+ allowEdit,
+ valueChanged,
updateInstance,
cancel,
doCreate,
doUpdate,
- doDelete,
+ doArchive,
+ doRestore,
};
},
};
diff --git a/frontend/src/components/InstanceSelect.vue b/frontend/src/components/InstanceSelect.vue
index 1180b7fa3c..b100919bbe 100644
--- a/frontend/src/components/InstanceSelect.vue
+++ b/frontend/src/components/InstanceSelect.vue
@@ -56,10 +56,11 @@ export default {
const instanceList = computed(() => {
if (props.environmentId) {
return store.getters["instance/instanceListByEnvironmentId"](
- props.environmentId
+ props.environmentId,
+ "NORMAL"
);
}
- return store.getters["instance/instanceList"]();
+ return store.getters["instance/instanceList"]("NORMAL");
});
watch(
diff --git a/frontend/src/components/InstanceTable.vue b/frontend/src/components/InstanceTable.vue
index e185a27d49..8aaf95f527 100644
--- a/frontend/src/components/InstanceTable.vue
+++ b/frontend/src/components/InstanceTable.vue
@@ -12,10 +12,10 @@
<img class="h-10 w-auto" src="../assets/db-mysql.svg" />
</BBTableCell>
<BBTableCell :leftPadding="4" class="w-16">
- {{ environmentName(instance.environment.id) }}
+ {{ environmentNameFromId(instance.environment.id) }}
</BBTableCell>
<BBTableCell class="w-32">
- {{ instance.name }}
+ {{ instanceName(instance) }}
</BBTableCell>
<BBTableCell class="w-48">
<template v-if="instance.port"
@@ -56,7 +56,7 @@ import { reactive, PropType } from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
import { BBTableColumn } from "../bbkit/types";
-import { urlfy, instanceSlug } from "../utils";
+import { urlfy, instanceSlug, environmentName } from "../utils";
import { EnvironmentId, Instance } from "../types";
interface LocalState {
@@ -107,15 +107,15 @@ export default {
router.push(`/instance/${instanceSlug(instance)}`);
};
- const environmentName = function (id: EnvironmentId) {
- return store.getters["environment/environmentById"](id).name;
+ const environmentNameFromId = function (id: EnvironmentId) {
+ return environmentName(store.getters["environment/environmentById"](id));
};
return {
state,
urlfy,
clickInstance,
- environmentName,
+ environmentNameFromId,
};
},
};
diff --git a/frontend/src/main.js b/frontend/src/main.js
index e6e7cec948..381b39b8c7 100644
--- a/frontend/src/main.js
+++ b/frontend/src/main.js
@@ -41,6 +41,7 @@ import {
urlfy,
environmentName,
environmentSlug,
+ instanceName,
instanceSlug,
databaseSlug,
dataSourceSlug,
@@ -65,6 +66,7 @@ app.config.globalProperties.sizeToFit = sizeToFit;
app.config.globalProperties.urlfy = urlfy;
app.config.globalProperties.environmentName = environmentName;
app.config.globalProperties.environmentSlug = environmentSlug;
+app.config.globalProperties.instanceName = instanceName;
app.config.globalProperties.instanceSlug = instanceSlug;
app.config.globalProperties.databaseSlug = databaseSlug;
app.config.globalProperties.dataSourceSlug = dataSourceSlug;
diff --git a/frontend/src/miragejs/factories/instance.js b/frontend/src/miragejs/factories/instance.js
index fe09ebc843..69e1b903ef 100644
--- a/frontend/src/miragejs/factories/instance.js
+++ b/frontend/src/miragejs/factories/instance.js
@@ -4,8 +4,8 @@ import { UNKNOWN_ID } from "../../types";
export default {
instance: Factory.extend({
- name(i) {
- return "instance " + (i + i);
+ rowStatus(i) {
+ return i > 3 ? "ARCHIVED" : "NORMAL";
},
creatorId() {
return UNKNOWN_ID;
@@ -19,6 +19,9 @@ export default {
lastUpdatedTs(i) {
return Date.now() - i * 3600 * 1000;
},
+ name(i) {
+ return "instance " + (i + i);
+ },
externalLink() {
return "google.com";
},
diff --git a/frontend/src/miragejs/models/index.js b/frontend/src/miragejs/models/index.js
index 3622782927..415997af05 100644
--- a/frontend/src/miragejs/models/index.js
+++ b/frontend/src/miragejs/models/index.js
@@ -67,6 +67,8 @@ export default {
instanceNew: Model,
+ instancePatch: Model,
+
database: Model.extend({
workspace: belongsTo(),
instance: belongsTo(),
diff --git a/frontend/src/miragejs/routes/environment.js b/frontend/src/miragejs/routes/environment.js
index baac0121dc..22718b20ab 100644
--- a/frontend/src/miragejs/routes/environment.js
+++ b/frontend/src/miragejs/routes/environment.js
@@ -121,9 +121,7 @@ export default function configureEnvironment(route) {
});
}
- const updatedEnvironment = schema.environments
- .find(request.params.environmentId)
- .update(attrs);
+ const updatedEnvironment = environment.update(attrs);
// NOTE, in actual implementation, we need to fetch the user from the auth context.
const callerId = OWNER_ID;
@@ -137,7 +135,7 @@ export default function configureEnvironment(route) {
creatorId: callerId,
workspaceId: WORKSPACE_ID,
payload: {
- environmentName: environment.name,
+ environmentName: updatedEnvironment.name,
changeList,
},
};
diff --git a/frontend/src/miragejs/routes/instance.js b/frontend/src/miragejs/routes/instance.js
index 7f442a63ab..e2dbdc919e 100644
--- a/frontend/src/miragejs/routes/instance.js
+++ b/frontend/src/miragejs/routes/instance.js
@@ -1,6 +1,7 @@
import { Response } from "miragejs";
import { postMessageToOwnerAndDBA } from "../utils";
import { WORKSPACE_ID, OWNER_ID } from "./index";
+import { InstanceBuiltinFieldId } from "../../types";
export default function configurInstance(route) {
route.get("/instance", function (schema, request) {
@@ -59,11 +60,113 @@ export default function configurInstance(route) {
});
route.patch("/instance/:instanceId", function (schema, request) {
- const attrs = this.normalizedRequestAttrs("instance");
- return schema.instances.find(request.params.instanceId).update(attrs);
+ const attrs = this.normalizedRequestAttrs("instance-patch");
+ const instance = schema.instances.find(request.params.instanceId);
+
+ if (!instance) {
+ return new Response(
+ 404,
+ {},
+ {
+ errors: "Instance id " + request.params.instanceId + " not found",
+ }
+ );
+ }
+
+ const changeList = [];
+ let type = "bb.msg.instance.update";
+
+ if (attrs.rowStatus && attrs.rowStatus != instance.rowStatus) {
+ if (attrs.rowStatus == "ARCHIVED") {
+ type = "bb.msg.instance.archive";
+ } else if (attrs.rowStatus == "NORMAL") {
+ type = "bb.msg.instance.restore";
+ } else if (attrs.rowStatus == "PENDING_DELETE") {
+ type = "bb.msg.instance.delete";
+ }
+ changeList.push({
+ fieldId: InstanceBuiltinFieldId.ROW_STATUS,
+ oldValue: instance.rowStatus,
+ newValue: attrs.rowStatus,
+ });
+ }
+
+ if (attrs.name && attrs.name != instance.name) {
+ changeList.push({
+ fieldId: InstanceBuiltinFieldId.NAME,
+ oldValue: instance.name,
+ newValue: attrs.name,
+ });
+ }
+
+ 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,
+ oldValue: instance.externalLink,
+ newValue: attrs.externalLink,
+ });
+ }
+
+ if (attrs.host && attrs.host != instance.host) {
+ changeList.push({
+ fieldId: InstanceBuiltinFieldId.HOST,
+ oldValue: instance.host,
+ newValue: attrs.host,
+ });
+ }
+
+ if (attrs.port && attrs.port != instance.port) {
+ changeList.push({
+ fieldId: InstanceBuiltinFieldId.PORT,
+ oldValue: instance.port,
+ newValue: attrs.port,
+ });
+ }
+
+ const updatedInstance = instance.update(attrs);
+
+ // NOTE, in actual implementation, we need to fetch the user from the auth context.
+ const callerId = OWNER_ID;
+ const ts = Date.now();
+ const messageTemplate = {
+ containerId: updatedInstance.id,
+ createdTs: ts,
+ lastUpdatedTs: ts,
+ type,
+ status: "DELIVERED",
+ creatorId: callerId,
+ workspaceId: WORKSPACE_ID,
+ payload: {
+ instanceName: updatedInstance.name,
+ changeList,
+ },
+ };
+ postMessageToOwnerAndDBA(schema, callerId, messageTemplate);
+
+ return updatedInstance;
});
route.delete("/instance/:instanceId", function (schema, request) {
+ const instance = schema.instances.find(request.params.instanceId);
+
+ if (!instance) {
+ return new Response(
+ 404,
+ {},
+ {
+ errors: "Instance id " + request.params.instanceId + " not found",
+ }
+ );
+ }
+
// NOTE, in actual implementation, we need to fetch the user from the auth context.
const callerId = OWNER_ID;
// Delete data source and database before instance itself.
@@ -78,25 +181,21 @@ export default function configurInstance(route) {
});
databaseList.models.forEach((item) => item.destroy());
- const instance = schema.instances.find(request.params.instanceId);
+ instance.destroy();
- if (instance) {
- instance.destroy();
-
- const ts = Date.now();
- const messageTemplate = {
- containerId: instance.id,
- createdTs: ts,
- lastUpdatedTs: ts,
- type: "bb.msg.instance.delete",
- status: "DELIVERED",
- creatorId: callerId,
- workspaceId: WORKSPACE_ID,
- payload: {
- instanceName: instance.name,
- },
- };
- postMessageToOwnerAndDBA(schema, callerId, messageTemplate);
- }
+ const ts = Date.now();
+ const messageTemplate = {
+ containerId: instance.id,
+ createdTs: ts,
+ lastUpdatedTs: ts,
+ type: "bb.msg.instance.delete",
+ status: "DELIVERED",
+ creatorId: callerId,
+ workspaceId: WORKSPACE_ID,
+ payload: {
+ instanceName: instance.name,
+ },
+ };
+ postMessageToOwnerAndDBA(schema, callerId, messageTemplate);
});
}
diff --git a/frontend/src/store/modules/instance.ts b/frontend/src/store/modules/instance.ts
index 45fa643869..38ac1e6eca 100644
--- a/frontend/src/store/modules/instance.ts
+++ b/frontend/src/store/modules/instance.ts
@@ -9,6 +9,8 @@ import {
EnvironmentId,
ResourceIdentifier,
unknown,
+ InstancePatch,
+ RowStatus,
} from "../../types";
function convert(instance: ResourceObject, rootGetters: any): Instance {
@@ -53,10 +55,14 @@ const getters = {
return convert(instance, rootGetters);
},
- instanceList: (state: InstanceState) => (): Instance[] => {
+ instanceList: (state: InstanceState) => (
+ rowStatus?: RowStatus
+ ): Instance[] => {
const list = [];
for (const [_, instance] of state.instanceById) {
- list.push(instance);
+ if (!rowStatus || rowStatus == instance.rowStatus) {
+ list.push(instance);
+ }
}
return list.sort((a: Instance, b: Instance) => {
return b.createdTs - a.createdTs;
@@ -64,12 +70,13 @@ const getters = {
},
instanceListByEnvironmentId: (state: InstanceState, getters: any) => (
- environmentId: EnvironmentId
+ environmentId: EnvironmentId,
+ rowStatus?: RowStatus
): Instance[] => {
- const list = getters["instanceList"]();
- return list.filter(
- (item: Instance) => item.environment.id == environmentId
- );
+ const list = getters["instanceList"](rowStatus);
+ return list.filter((item: Instance) => {
+ return item.environment.id == environmentId;
+ });
},
instanceById: (state: InstanceState) => (
@@ -131,14 +138,22 @@ const actions = {
return createdInstance;
},
- async patchInstance({ commit, rootGetters }: any, instance: Instance) {
- const { id, ...attrs } = instance;
+ async patchInstance(
+ { commit, rootGetters }: any,
+ {
+ instanceId,
+ instancePatch,
+ }: {
+ instanceId: InstanceId;
+ instancePatch: InstancePatch;
+ }
+ ) {
const updatedInstance = convert(
(
- await axios.patch(`/api/instance/${instance.id}`, {
+ await axios.patch(`/api/instance/${instanceId}`, {
data: {
- type: "instance",
- attributes: attrs,
+ type: "instancepatch",
+ attributes: instancePatch,
},
})
).data.data,
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index ae4127e935..fdb211a344 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -71,6 +71,7 @@ export const unknown = (
const UNKNOWN_INSTANCE: Instance = {
id: UNKNOWN_ID,
+ rowStatus: "NORMAL",
environment: UNKNOWN_ENVIRONMENT,
creator: UNKNOWN_PRINCIPAL,
updater: UNKNOWN_PRINCIPAL,
@@ -526,7 +527,10 @@ export type EnvironmentMessageType =
export type InstanceMessageType =
| "bb.msg.instance.create"
- | "bb.msg.instance.delete";
+ | "bb.msg.instance.update"
+ | "bb.msg.instance.delete"
+ | "bb.msg.instance.archive"
+ | "bb.msg.instance.restore";
export type TaskMessageType =
| "bb.msg.task.assign"
@@ -556,6 +560,15 @@ export type EnvironmentMessagePayload = {
}[];
};
+export enum InstanceBuiltinFieldId {
+ ROW_STATUS = "1",
+ NAME = "2",
+ ENVIRONMENT = "3",
+ EXTERNAL_LINK = "4",
+ HOST = "5",
+ PORT = "6",
+}
+
export type InstanceMessagePaylaod = {
instanceName: string;
};
@@ -626,6 +639,7 @@ export type EnvironmentPatch = {
// Instance
export type Instance = {
id: InstanceId;
+ rowStatus: RowStatus;
environment: Environment;
creator: Principal;
updater: Principal;
@@ -645,6 +659,15 @@ export type InstanceNew = {
port?: string;
};
+export type InstancePatch = {
+ rowStatus?: RowStatus;
+ environmentId?: EnvironmentId;
+ name?: string;
+ externalLink?: string;
+ host?: string;
+ port?: string;
+};
+
export type DataSourceType = "RW" | "RO";
// Data Source
export type DataSource = {
diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts
index 33d60e548c..13133b034b 100644
--- a/frontend/src/utils/index.ts
+++ b/frontend/src/utils/index.ts
@@ -1,4 +1,5 @@
export * from "./environment";
+export * from "./instance";
export * from "./database";
export * from "./link";
export * from "./role";
diff --git a/frontend/src/utils/instance.ts b/frontend/src/utils/instance.ts
new file mode 100644
index 0000000000..d34a88b621
--- /dev/null
+++ b/frontend/src/utils/instance.ts
@@ -0,0 +1,9 @@
+import { Instance } from "../types";
+
+export function instanceName(instance: Instance) {
+ let name = instance.name;
+ if (instance.rowStatus == "ARCHIVED") {
+ name += " (Archived)";
+ }
+ return name;
+}
diff --git a/frontend/src/views/Archive.vue b/frontend/src/views/Archive.vue
index 025e4325ea..0b75785af7 100644
--- a/frontend/src/views/Archive.vue
+++ b/frontend/src/views/Archive.vue
@@ -70,7 +70,7 @@ export default {
watchEffect(prepareInstanceList);
const instanceList = computed((): Instance[] => {
- return store.getters["instance/instanceList"]();
+ return store.getters["instance/instanceList"]("ARCHIVED");
});
const environmentList = computed(() => {
diff --git a/frontend/src/views/DataSourceDetail.vue b/frontend/src/views/DataSourceDetail.vue
index 2157d1f441..e5736103a9 100644
--- a/frontend/src/views/DataSourceDetail.vue
+++ b/frontend/src/views/DataSourceDetail.vue
@@ -50,7 +50,7 @@
:to="`/instance/${instanceSlug(dataSource.instance)}`"
class="normal-link"
>
- {{ dataSource.instance.name }}
+ {{ instanceName(dataSource.instance) }}
</router-link>
</dd>
<dt class="sr-only">Database</dt>
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index f0677559c8..0f73b4091f 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -40,7 +40,7 @@
:to="`/instance/${instanceSlug(database.instance)}`"
class="normal-link"
>
- {{ database.instance.name }}
+ {{ instanceName(database.instance) }}
</router-link>
</dd>
<dt class="sr-only">Sync Status</dt>
diff --git a/frontend/src/views/Inbox.vue b/frontend/src/views/Inbox.vue
index 2ac37a2b90..66233ea5ac 100644
--- a/frontend/src/views/Inbox.vue
+++ b/frontend/src/views/Inbox.vue
@@ -68,7 +68,14 @@
{{ message.payload.environmentName }}
</span>
</template>
- <template v-else-if="message.type == 'bb.msg.instance.create'">
+ <template
+ v-else-if="
+ message.type == 'bb.msg.instance.create' ||
+ message.type == 'bb.msg.instance.update' ||
+ message.type == 'bb.msg.instance.archive' ||
+ message.type == 'bb.msg.instance.restore'
+ "
+ >
<router-link
:to="`/instance/${message.containerId}`"
class="normal-link ml-1"
@@ -213,8 +220,14 @@ export default {
return "restored environment";
case "bb.msg.instance.create":
return "created instance";
+ case "bb.msg.instance.update":
+ return "updated instance";
case "bb.msg.instance.delete":
return "deleted instance";
+ case "bb.msg.instance.archive":
+ return "archived instance";
+ case "bb.msg.instance.restore":
+ return "restored instance";
case "bb.msg.task.assign": {
const payload = message.payload as TaskAssignMessagePayload;
if (
diff --git a/frontend/src/views/InstanceDashboard.vue b/frontend/src/views/InstanceDashboard.vue
index 877a9d5f83..d37f3f3372 100644
--- a/frontend/src/views/InstanceDashboard.vue
+++ b/frontend/src/views/InstanceDashboard.vue
@@ -111,7 +111,7 @@ export default {
};
const instanceList = computed(() => {
- return store.getters["instance/instanceList"]();
+ return store.getters["instance/instanceList"]("NORMAL");
});
const filteredList = (list: Instance[]) => {
diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vue
index 7d5763115d..6f28ab3495 100644
--- a/frontend/src/views/InstanceDetail.vue
+++ b/frontend/src/views/InstanceDetail.vue
@@ -1,23 +1,24 @@
<template>
+ <div
+ v-if="instance.rowStatus == 'ARCHIVED'"
+ class="h-10 w-full text-2xl font-bold bg-gray-700 text-white flex justify-center items-center"
+ >
+ Archived
+ </div>
<div class="px-6 space-y-6">
- <InstanceForm :create="false" :instance="state.instance" />
+ <InstanceForm :create="false" :instance="instance" />
<div class="py-6 space-y-4 border-t divide-control-border">
- <DataSourceTable :instance="state.instance" />
+ <DataSourceTable :instance="instance" />
</div>
</div>
</template>
<script lang="ts">
-import { reactive } from "vue";
+import { computed } from "vue";
import { useStore } from "vuex";
import { idFromSlug } from "../utils";
import DataSourceTable from "../components/DataSourceTable.vue";
import InstanceForm from "../components/InstanceForm.vue";
-import { Instance } from "../types";
-
-interface LocalState {
- instance: Instance;
-}
export default {
name: "InstanceDetail",
@@ -34,16 +35,14 @@ export default {
setup(props, { emit }) {
const store = useStore();
- const state = reactive<LocalState>({
- // Instance is already fetched remotely during routing, so we can just
- // use store.getters here.
- instance: store.getters["instance/instanceById"](
+ const instance = computed(() => {
+ return store.getters["instance/instanceById"](
idFromSlug(props.instanceSlug)
- ),
+ );
});
return {
- state,
+ instance,
};
},
};