Skip to content

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

Change expand to collapse so that the default state (which is not set) is expand

天舟c2aa0949e8db
diff --git a/frontend/src/bbkit/BBOutline.vue b/frontend/src/bbkit/BBOutline.vue
index 18b25b09c0..a0abc474e5 100644
--- a/frontend/src/bbkit/BBOutline.vue
+++ b/frontend/src/bbkit/BBOutline.vue
@@ -1,6 +1,6 @@
<template>
<div
- @click.prevent="toggleExpand"
+ @click.prevent="toggleCollapse"
class="outline-title flex py-1"
:class="allowCollapse ? 'collapsible' : ''"
@mouseenter="state.hoverTitle = true"
@@ -9,22 +9,22 @@
<span :class="titleClass()">{{ title }}</span>
<template v-if="allowCollapse && state.hoverTitle">
<svg
- v-if="expandState"
- class="mr-2 h-4 w-4 transform rotate-90 group-hover:text-gray-400 group-focus:text-gray-400 transition-colors ease-in-out duration-150"
+ v-if="collapseState"
+ class="mr-2 h-4 w-4 transform group-hover:text-gray-400 group-focus:text-gray-400 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-4 w-4 transform group-hover:text-gray-400 group-focus:text-gray-400 transition-colors ease-in-out duration-150"
+ class="mr-2 h-4 w-4 transform rotate-90 group-hover:text-gray-400 group-focus:text-gray-400 transition-colors ease-in-out duration-150"
viewBox="0 0 20 20"
>
<path d="M6 6L14 10L6 14V6Z" fill="currentColor" />
</svg>
</template>
</div>
- <div v-if="!allowCollapse || expandState">
+ <div v-if="!allowCollapse || !collapseState">
<div
role="group"
v-for="(item, index) in itemList"
@@ -77,7 +77,7 @@
interface LocalState {
hoverIndex: number;
hoverTitle: boolean;
- expandState: boolean;
+ collapseState: boolean;
}
import { computed, reactive, PropType } from "vue";
@@ -88,8 +88,8 @@ export default {
name: "BBOutline",
emits: ["delete-index"],
props: {
- // Used for storing the expand state.
- // Empty id means not to store expand state.
+ // Used for storing the collapse state.
+ // Empty id means not to store collapse state.
id: {
default: "",
type: String,
@@ -121,30 +121,30 @@ export default {
const state = reactive<LocalState>({
hoverIndex: -1,
hoverTitle: false,
- expandState: true,
+ collapseState: true,
});
- const expandState = computed(() => {
+ const collapseState = computed(() => {
if (props.id) {
- return store.getters["uistate/expandStateByKey"](props.id);
+ return store.getters["uistate/collapseStateByKey"](props.id);
}
- return state.expandState;
+ return state.collapseState;
});
- const toggleExpand = () => {
+ const toggleCollapse = () => {
if (props.allowCollapse) {
if (props.id) {
- const newState = !expandState.value;
+ const newState = !collapseState.value;
store
- .dispatch("uistate/saveExpandStateByKey", {
+ .dispatch("uistate/savecollapseStateByKey", {
key: props.id,
- expand: newState,
+ collapse: newState,
})
.catch((error) => {
console.log(error);
});
} else {
- state.expandState = !state.expandState;
+ state.collapseState = !state.collapseState;
}
}
};
@@ -157,9 +157,9 @@ export default {
return {
state,
- expandState,
+ collapseState,
titleClass,
- toggleExpand,
+ toggleCollapse,
};
},
};
diff --git a/frontend/src/store/modules/uistate.ts b/frontend/src/store/modules/uistate.ts
index a2eee478fb..0ada916cff 100644
--- a/frontend/src/store/modules/uistate.ts
+++ b/frontend/src/store/modules/uistate.ts
@@ -1,15 +1,15 @@
import isUndefined from "lodash-es/isUndefined";
-const EXPAND_MODULE = "ui.list.expand";
+const COLLAPSE_MODULE = "ui.list.collapse";
const INTRO_MODULE = "ui.intro";
export interface UIState {
- expandStateByKey: Map<string, boolean>;
+ collapseStateByKey: Map<string, boolean>;
introStateByKey: Map<string, boolean>;
}
const state: () => UIState = () => ({
- expandStateByKey: new Map(),
+ collapseStateByKey: new Map(),
introStateByKey: new Map(),
});
@@ -42,8 +42,8 @@ const saveStateByKey = function (
};
const getters = {
- expandStateByKey: (state: UIState) => (key: string) => {
- return stateByKey(state.expandStateByKey, EXPAND_MODULE, key);
+ collapseStateByKey: (state: UIState) => (key: string) => {
+ return stateByKey(state.collapseStateByKey, COLLAPSE_MODULE, key);
},
introStateByKey: (state: UIState) => (key: string) => {
@@ -53,10 +53,12 @@ const getters = {
const actions = {
async restoreState({ commit }: any) {
- const storedExpandState = localStorage.getItem(EXPAND_MODULE);
- const expandState = storedExpandState ? JSON.parse(storedExpandState) : {};
- if (expandState) {
- commit("setExpandState", expandState);
+ const storedCollapseState = localStorage.getItem(COLLAPSE_MODULE);
+ const collapseState = storedCollapseState
+ ? JSON.parse(storedCollapseState)
+ : {};
+ if (collapseState) {
+ commit("setCollapseState", collapseState);
}
const storedIntroState = localStorage.getItem(INTRO_MODULE);
@@ -66,18 +68,18 @@ const actions = {
}
},
- async saveExpandStateByKey(
+ async savecollapseStateByKey(
{ commit }: any,
{
key,
- expand,
+ collapse,
}: {
key: string;
- expand: boolean;
+ collapse: boolean;
}
) {
- const state = saveStateByKey(EXPAND_MODULE, key, expand);
- commit("setExpandStateByKey", { key, expand: state });
+ const state = saveStateByKey(COLLAPSE_MODULE, key, collapse);
+ commit("setcollapseStateByKey", { key, collapse: state });
return state;
},
@@ -98,25 +100,25 @@ const actions = {
};
const mutations = {
- setExpandState(state: UIState, fullState: any) {
+ setCollapseState(state: UIState, fullState: any) {
const newMap = new Map();
for (const key in fullState) {
newMap.set(key, fullState[key]);
}
- state.expandStateByKey = newMap;
+ state.collapseStateByKey = newMap;
},
- setExpandStateByKey(
+ setcollapseStateByKey(
state: UIState,
{
key,
- expand,
+ collapse,
}: {
key: string;
- expand: boolean;
+ collapse: boolean;
}
) {
- state.expandStateByKey.set(key, expand);
+ state.collapseStateByKey.set(key, collapse);
},
setIntroState(state: UIState, fullState: any) {
diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vue
index 1a6942c9aa..580574c6ec 100644
--- a/frontend/src/views/SettingSidebar.vue
+++ b/frontend/src/views/SettingSidebar.vue
@@ -118,7 +118,7 @@ import { useStore } from "vuex";
import { useRouter } from "vue-router";
interface LocalState {
- expandState: boolean;
+ collapseState: boolean;
}
export default {
@@ -130,15 +130,15 @@ export default {
const router = useRouter();
const state = reactive<LocalState>({
- expandState: true,
+ collapseState: true,
});
const goBack = () => {
router.push(store.getters["router/backPath"]());
};
- const toggleExpand = () => {
- state.expandState = !state.expandState;
+ const toggleCollapse = () => {
+ state.collapseState = !state.collapseState;
};
const integrationList = [
@@ -152,7 +152,7 @@ export default {
state,
integrationList,
goBack,
- toggleExpand,
+ toggleCollapse,
};
},
};