Skip to content

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

Instance Deletion

Tianzhou Chen43e4579e400e
diff --git a/frontend/src/store/modules/instance.ts b/frontend/src/store/modules/instance.ts
index 2949de28e8..2a94c2b50c 100644
--- a/frontend/src/store/modules/instance.ts
+++ b/frontend/src/store/modules/instance.ts
@@ -76,15 +76,15 @@ const actions = {
async deleteInstanceById(
{ state, commit }: { state: InstanceState; commit: any },
{
- id,
+ instanceId,
}: {
- id: InstanceId;
+ instanceId: InstanceId;
}
) {
- await axios.delete(`/api/instance/${id}`);
+ await axios.delete(`/api/instance/${instanceId}`);
const newList = state.instanceList.filter((item: Instance) => {
- return item.id != id;
+ return item.id != instanceId;
});
commit("setInstanceList", {
diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vue
index 9d80c8dd4c..c0703b5b93 100644
--- a/frontend/src/views/InstanceDetail.vue
+++ b/frontend/src/views/InstanceDetail.vue
@@ -432,8 +432,8 @@ export default {
router.go(-1);
};
- // Both doCreate and doUpdate make instance and data source create/patch in
- // seperate API. In the unlikely event, instance create/patch may succeed while
+ // Both doCreate/Update/Delete make instance and data source create/patch/delete in
+ // seperate API. In the unlikely event, instance operation may succeed while
// the corresponding data source operation failed. We consiciously make this
// trade-off to make instance create/patch API clean without coupling data source logic.
// The logic here to group instance/data source operation together is a shortcut
@@ -502,7 +502,30 @@ export default {
};
const doDelete = () => {
- emit("delete", state.instance);
+ store
+ .dispatch("datasource/deleteDataSourceById", {
+ dataSourceId: {
+ id: state.originalAdminDataSource!.id,
+ instanceId: state.originalInstance!.id,
+ },
+ })
+ .then(() => {
+ store
+ .dispatch("instance/deleteInstanceById", {
+ instanceId: state.originalInstance!.id,
+ })
+ .then(() => {
+ router.push({
+ name: "workspace.instance",
+ });
+ })
+ .catch((error) => {
+ console.log(error);
+ });
+ })
+ .catch((error) => {
+ console.log(error);
+ });
};
return {