Skip to content

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

Remove Group functionality for now

Tianzhou Chen97b3d58a8729
diff --git a/frontend/src/components/GroupListSidePanel.vue b/frontend/src/components/GroupListSidePanel.vue
deleted file mode 100644
index 10af856269..0000000000
--- a/frontend/src/components/GroupListSidePanel.vue
+++ /dev/null
@@ -1,49 +0,0 @@
-<template>
- <h3
- class="px-3 text-xs leading-4 font-semibold text-control-light uppercase tracking-wider"
- id="group-headline"
- >
- Groups
- </h3>
- <GroupSidePanel v-for="item in groupList" :key="item.id" :group="item" />
-</template>
-
-<script lang="ts">
-import { watchEffect, computed, inject } from "vue";
-import { useStore } from "vuex";
-import GroupSidePanel from "./GroupSidePanel.vue";
-import { User } from "../types";
-
-export default {
- name: "GroupListSidePanel",
- props: {},
- components: {
- GroupSidePanel,
- },
- setup(props, ctx) {
- const store = useStore();
-
- const currentUser: User = computed(() =>
- store.getters["auth/currentUser"]()
- ).value;
-
- const prepareGroupList = () => {
- store
- .dispatch("group/fetchGroupListForUser", currentUser.id)
- .catch((error) => {
- console.log(error);
- });
- };
-
- const groupList = computed(() =>
- store.getters["group/groupListByUser"](currentUser.id)
- );
-
- watchEffect(prepareGroupList);
-
- return {
- groupList,
- };
- },
-};
-</script>
diff --git a/frontend/src/components/GroupSidePanel.vue b/frontend/src/components/GroupSidePanel.vue
deleted file mode 100644
index 047c09f291..0000000000
--- a/frontend/src/components/GroupSidePanel.vue
+++ /dev/null
@@ -1,82 +0,0 @@
-<template>
- <div class="mt-1 space-y-1" role="group" aria-labelledby="groups-headline">
- <button
- @click.prevent="toggleExpand"
- class="outline-item mt-1 group w-full flex items-center pr-2 py-2"
- >
- <svg
- v-if="expandState"
- class="mr-2 h-5 w-5 transform rotate-90 group-hover:text-control-light-hover group-focus:text-control-light-hover transition-colors ease-in-out duration-150"
- viewBox="0 0 20 20"
- >
- <path d="M6 6L14 10L6 14V6Z" fill="currentColor" />
- </svg>
- <svg
- v-else
- class="mr-2 h-5 w-5 transform group-hover:text-control-light-hover group-focus:text-control-light-hover transition-colors ease-in-out duration-150"
- viewBox="0 0 20 20"
- >
- <path d="M6 6L14 10L6 14V6Z" fill="currentColor" />
- </svg>
- {{ group.attributes.name }}
- </button>
- <!-- Expandable link section, show/hide based on state. -->
- <div v-if="expandState" class="mt-1 space-y-1">
- <router-link
- :to="`/${group.attributes.slug}`"
- class="outline-item group w-full flex items-center pl-10 pr-2 py-1"
- >
- Dashboard
- </router-link>
- <router-link
- :to="`/${group.attributes.slug}/setting`"
- class="outline-item group w-full flex items-center pl-10 pr-2 py-1"
- >
- Setting
- </router-link>
- </div>
- </div>
-</template>
-
-<script lang="ts">
-import { computed, PropType } from "vue";
-import { useStore } from "vuex";
-import { Group, GroupId } from "../types";
-
-export default {
- name: "GroupSidePanel",
- props: {
- group: {
- required: true,
- type: Object as PropType<Group>,
- },
- },
- setup(props, ctx) {
- const store = useStore();
-
- const groupId: GroupId = props.group.id;
-
- const expandState = computed(() =>
- store.getters["uistate/expandStateByGroup"](groupId)
- );
-
- const toggleExpand = () => {
- const newState = !expandState.value;
- store
- .dispatch("uistate/saveExpandStateByGroup", {
- groupId,
- expand: newState,
- })
- .catch((error) => {
- console.log(error);
- return;
- });
- };
-
- return {
- expandState,
- toggleExpand,
- };
- },
-};
-</script>
diff --git a/frontend/src/miragejs/factories/group.js b/frontend/src/miragejs/factories/group.js
deleted file mode 100644
index 6e492f3d2f..0000000000
--- a/frontend/src/miragejs/factories/group.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Factory, association } from "miragejs";
-import faker from "faker";
-
-export default {
- group: Factory.extend({
- name(i) {
- return "grp " + (i + 1);
- },
- slug(i) {
- return "grp" + (i + 1);
- },
- namespace() {
- return "";
- },
- afterCreate(group, server) {},
- }),
-};
diff --git a/frontend/src/miragejs/factories/groupRole.js b/frontend/src/miragejs/factories/groupRole.js
deleted file mode 100644
index 5e3393e606..0000000000
--- a/frontend/src/miragejs/factories/groupRole.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import { randomNumber } from "./utils";
-
-/*
- * Mirage JS guide on Factories: https://miragejs.com/docs/data-layer/factories
- */
-import { Factory, trait, association } from "miragejs";
-
-/*
- * Faker Github repository: https://github.com/Marak/Faker.js#readme
- */
-import faker from "faker";
-
-export default {
- groupRole: Factory.extend({
- role() {
- let dice = Math.random();
- if (dice < 0.5) {
- return "OWNER";
- } else {
- return "DEVELOPER";
- }
- },
-
- group: association(),
-
- user: association(),
-
- afterCreate(groupRole, server) {},
- }),
-};
diff --git a/frontend/src/miragejs/factories/index.js b/frontend/src/miragejs/factories/index.js
index 7ffe357eab..131435fef1 100644
--- a/frontend/src/miragejs/factories/index.js
+++ b/frontend/src/miragejs/factories/index.js
@@ -12,7 +12,6 @@ import task from "./task";
import taskPatch from "./taskPatch";
import activity from "./activity";
import activityPatch from "./activityPatch";
-import group from "./group";
import workspace from "./workspace";
import member from "./member";
@@ -35,7 +34,7 @@ export default {
...taskPatch,
...activity,
...activityPatch,
- ...group,
+
...workspace,
...member,
...batchUpdate,
diff --git a/frontend/src/miragejs/models/index.js b/frontend/src/miragejs/models/index.js
index 7cf099af32..92156bc43c 100644
--- a/frontend/src/miragejs/models/index.js
+++ b/frontend/src/miragejs/models/index.js
@@ -15,7 +15,6 @@ export default {
user: Model.extend({}),
workspace: Model.extend({
- group: hasMany(),
member: hasMany(),
activity: hasMany(),
task: hasMany(),
@@ -37,17 +36,6 @@ export default {
activityPatch: Model,
- group: Model.extend({
- workspace: belongsTo(),
-
- groupRole: hasMany(),
- }),
-
- groupRole: Model.extend({
- group: belongsTo(),
- user: belongsTo(),
- }),
-
task: Model.extend({
workspace: belongsTo(),
}),
diff --git a/frontend/src/miragejs/routes/index.js b/frontend/src/miragejs/routes/index.js
index bc33205b68..57947ea4d5 100644
--- a/frontend/src/miragejs/routes/index.js
+++ b/frontend/src/miragejs/routes/index.js
@@ -444,28 +444,4 @@ export default function routes() {
this.delete("/activity/:activityId", function (schema, request) {
return schema.activities.find(request.params.activityId).destroy();
});
-
- // Group
- this.get("/group", function (schema, request) {
- const {
- queryParams: { userid: userId },
- } = request;
-
- if (userId) {
- return schema.groups.where((group) => {
- return (
- group.workspaceId == WORKSPACE_ID &&
- group.groupRoleIds?.find((roleId) => {
- return schema.groupRoles.where({
- userId,
- groupId: group.id,
- });
- })
- );
- });
- }
- return schema.groups.where({
- workspaceId: WORKSPACE_ID,
- });
- });
}
diff --git a/frontend/src/miragejs/seeds/index.js b/frontend/src/miragejs/seeds/index.js
index 937321bc0f..96f4756102 100644
--- a/frontend/src/miragejs/seeds/index.js
+++ b/frontend/src/miragejs/seeds/index.js
@@ -327,70 +327,6 @@ const workspacesSeeder = (server) => {
workspace: workspace2,
});
- // Naming convention
- // xxx <<workspace #>><<group #>>
- // e.g. group 12 (1st workspace and 1st group inside)
-
- // Group
- // Workspace 1
- const group1 = server.create("group", {
- name: "group 11",
- slug: "grp11",
- namepsace: "",
- workspace: workspace1,
- });
- const group2 = server.create("group", {
- name: "group 12",
- slug: "grp12",
- namepsace: "",
- workspace: workspace1,
- });
- const group3 = server.create("group", {
- name: "group 13",
- slug: "grp13",
- namepsace: "",
- workspace: workspace1,
- });
- // Workspace 2
- const group4 = server.create("group", {
- name: "group 24",
- slug: "grp24",
- namepsace: "",
- workspace: workspace2,
- });
-
- // User 1 is owner of group1, developer of group3 and owner of group4
- const user1 = server.schema.users.find(1);
- server.create("groupRole", {
- role: "OWNER",
- user: user1,
- group: group1,
- });
- server.create("groupRole", {
- role: "DEVELOPER",
- user: user1,
- group: group3,
- });
- server.create("groupRole", "owner", {
- role: "OWNER",
- user: user1,
- group: group4,
- });
-
- // User 2 is owner of group3 and developer of group4
- const user2 = server.schema.users.find(2);
- server.create("groupRole", "owner", {
- role: "OWNER",
- user: user2,
- group: group3,
- });
-
- server.create("groupRole", "developer", {
- role: "DEVELOPER",
- user: user2,
- group: group4,
- });
-
// Bookmarks
// Task 1
const task1 = server.schema.tasks.find(1);
diff --git a/frontend/src/store/index.ts b/frontend/src/store/index.ts
index 9ae02696f2..8686447c7c 100644
--- a/frontend/src/store/index.ts
+++ b/frontend/src/store/index.ts
@@ -10,7 +10,6 @@ import dataSource from "./modules/dataSource";
import principal from "./modules/principal";
import repository from "./modules/repository";
import auth from "./modules/auth";
-import group from "./modules/group";
import task from "./modules/task";
// Following states are persisted in local storage
@@ -34,7 +33,6 @@ export const store: Store<any> = createStore({
principal,
repository,
auth,
- group,
task,
uistate,
router,
diff --git a/frontend/src/store/modules/group.ts b/frontend/src/store/modules/group.ts
deleted file mode 100644
index 72772bf39b..0000000000
--- a/frontend/src/store/modules/group.ts
+++ /dev/null
@@ -1,44 +0,0 @@
-import axios from "axios";
-import { UserId, Group, GroupState } from "../../types";
-
-const state: () => GroupState = () => ({
- groupListByUser: new Map(),
-});
-
-const getters = {
- groupListByUser: (state: GroupState) => (userId: UserId) => {
- return state.groupListByUser.get(userId);
- },
-};
-
-const actions = {
- async fetchGroupListForUser({ commit }: any, userId: UserId) {
- const groupList = (await axios.get(`/api/group?userid=${userId}`)).data
- .data;
- commit("setGroupListForUser", { userId, groupList });
- return groupList;
- },
-};
-
-const mutations = {
- setGroupListForUser(
- state: GroupState,
- {
- userId,
- groupList,
- }: {
- userId: UserId;
- groupList: Group[];
- }
- ) {
- state.groupListByUser.set(userId, groupList);
- },
-};
-
-export default {
- namespaced: true,
- state,
- getters,
- actions,
- mutations,
-};
diff --git a/frontend/src/store/modules/uistate.ts b/frontend/src/store/modules/uistate.ts
index 4091f5178c..c81dc82acf 100644
--- a/frontend/src/store/modules/uistate.ts
+++ b/frontend/src/store/modules/uistate.ts
@@ -1,5 +1,4 @@
import isUndefined from "lodash-es/isUndefined";
-import { GroupId, ProjectId } from "../../types";
export interface UIState {
expandStateByKey: Map<string, boolean>;
@@ -38,11 +37,6 @@ const getters = {
expandStateByKey: (state: UIState) => (key: string) => {
return expandStateByKey(state, key);
},
-
- expandStateByGroup: (state: UIState) => (groupId: GroupId) => {
- const key = ["grp", groupId].join(".");
- return expandStateByKey(state, key);
- },
};
const actions = {
@@ -67,20 +61,6 @@ const actions = {
) {
return saveExpandStateByKey(commit, key, expand);
},
-
- async saveExpandStateByGroup(
- { commit }: any,
- {
- groupId,
- expand,
- }: {
- groupId: GroupId;
- expand: boolean;
- }
- ) {
- const key = ["grp", groupId].join(".");
- return saveExpandStateByKey(commit, key, expand);
- },
};
const mutations = {
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index 169338a2c7..a9a3e9c9cf 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -19,9 +19,6 @@ export type TaskId = string;
export type ActivityId = string;
-export type GroupId = string;
-
-
export type EnvironmentId = string;
export type InstanceId = string;
@@ -228,11 +225,6 @@ export type DataSource = {
};
export type DataSourceNew = Omit<DataSource, "id">;
-// Group
-export type Group = ResourceObject & {};
-export type GroupNew = Omit<Group, "id">;
-
-
// Repository
export type Repository = ResourceObject & {};
export type RepositoryNew = Omit<Repository, "id">;
@@ -304,10 +296,6 @@ export interface TaskState {
taskById: Map<TaskId, Task>;
}
-export interface GroupState {
- groupListByUser: Map<UserId, Group[]>;
-}
-
export interface EnvironmentState {
environmentList: Environment[];
}
diff --git a/frontend/src/views/DashboardSidebar.vue b/frontend/src/views/DashboardSidebar.vue
index e280034d5e..544ea867d6 100644
--- a/frontend/src/views/DashboardSidebar.vue
+++ b/frontend/src/views/DashboardSidebar.vue
@@ -26,16 +26,12 @@
<div>
<BookmarkListSidePanel />
</div>
- <div class="mt-4">
- <GroupListSidePanel />
- </div> -->
</nav>
</template>
<script lang="ts">
import { reactive } from "vue";
import BookmarkListSidePanel from "../components/BookmarkListSidePanel.vue";
-// import GroupListSidePanel from "../components/GroupListSidePanel.vue";
interface LocalState {
hasUnreadMessage: boolean;
@@ -46,7 +42,6 @@ export default {
props: {},
components: {
BookmarkListSidePanel,
- // GroupListSidePanel,
},
setup(props, ctx) {
const state = reactive<LocalState>({