Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Hide/Show Quickstart panel
Tianzhou Chenfe9425d8b225
diff --git a/frontend/src/bbkit/BBOutline.vue b/frontend/src/bbkit/BBOutline.vueindex 4f3833e3ab..282aa0710d 100644--- a/frontend/src/bbkit/BBOutline.vue+++ b/frontend/src/bbkit/BBOutline.vue@@ -131,7 +131,6 @@ export default {}).catch((error) => {console.log(error);- return;});} else {state.expandState = !state.expandState;diff --git a/frontend/src/components/IntroList.vue b/frontend/src/components/IntroList.vueindex ed494d3c92..d615abb10c 100644--- a/frontend/src/components/IntroList.vue+++ b/frontend/src/components/IntroList.vue@@ -70,6 +70,7 @@</template><script lang="ts">+import { useStore } from "vuex";import { PropType } from "vue";import { RoleType } from "../types";@@ -85,6 +86,8 @@ export default {components: {},props: {},setup() {+ const store = useStore();+const introList: IntroItem[] = [{name: "Add an environment",@@ -113,7 +116,26 @@ export default {},];- const hideQuickstart = () => {};+ const hideQuickstart = () => {+ store+ .dispatch("uistate/saveIntroStateByKey", {+ key: "hidden",+ newState: true,+ })+ .then(() => {+ store.dispatch("notification/pushNotification", {+ module: "bytebase",+ style: "INFO",+ title: `Quickstart guide dismissed`,+ description:+ "You can still bring it back later from the top right menu",+ manualHide: true,+ });+ })+ .catch((error) => {+ console.log(error);+ });+ };return { introList, hideQuickstart };},diff --git a/frontend/src/components/ProfileDropdown.vue b/frontend/src/components/ProfileDropdown.vueindex 265d9b8d20..44fef53b4a 100644--- a/frontend/src/components/ProfileDropdown.vue+++ b/frontend/src/components/ProfileDropdown.vue@@ -48,7 +48,7 @@<div class="py-1"><router-linkto="/setting"- class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"+ class="cursor-pointer block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"role="menuitem">Settings</router-link>@@ -57,13 +57,19 @@<div class="py-1"><ahref="#"- class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"+ class="cursor-pointer block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"role="menuitem">Changelog</a>+ <a+ @click.prevent="showQuickstart"+ class="cursor-pointer block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"+ role="menuitem"+ >Quickstart</a+ ><ahref="#"- class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"+ class="cursor-pointer block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"role="menuitem">Support</a>@@ -109,6 +115,13 @@ export default {});};+ const showQuickstart = () => {+ store.dispatch("uistate/saveIntroStateByKey", {+ key: "hidden",+ newState: false,+ });+ };+const switchToOwner = () => {store.dispatch("auth/login", {email: "[email protected]",@@ -132,6 +145,7 @@ export default {return {currentUser,+ showQuickstart,logout,switchToOwner,switchToDBA,diff --git a/frontend/src/components/ProvideContext.vue b/frontend/src/components/ProvideContext.vueindex f08fe42c24..89bdd8219f 100644--- a/frontend/src/components/ProvideContext.vue+++ b/frontend/src/components/ProvideContext.vue@@ -25,7 +25,8 @@ export default {"bookmark/fetchBookmarkListByUser",currentUser.value.id);- await store.dispatch("uistate/restoreExpandState");++ await store.dispatch("uistate/restoreState");},};</script>diff --git a/frontend/src/layouts/BodyLayout.vue b/frontend/src/layouts/BodyLayout.vueindex f5c1ebc0d8..1a01f90b9c 100644--- a/frontend/src/layouts/BodyLayout.vue+++ b/frontend/src/layouts/BodyLayout.vue@@ -75,6 +75,7 @@<router-view name="leftSidebar" /></div><div+ v-if="showIntro"class="flex-shrink-0 flex justify-center border-t border-block-border py-2"><IntroList />@@ -165,6 +166,7 @@<script lang="ts">import { computed, reactive } from "vue";+import { useStore } from "vuex";import { useRouter } from "vue-router";import Breadcrumb from "../components/Breadcrumb.vue";import IntroList from "../components/IntroList.vue";@@ -182,6 +184,7 @@ export default {QuickActionPanel,},setup(props, ctx) {+ const store = useStore();const router = useRouter();const state = reactive<LocalState>({@@ -201,10 +204,15 @@ export default {return !(name === "workspace.home" || name === "workspace.profile");});+ const showIntro = computed(() => {+ return !store.getters["uistate/introStateByKey"]("hidden");+ });+return {state,quickActionList,showBreadcrumb,+ showIntro,};},};diff --git a/frontend/src/store/modules/uistate.ts b/frontend/src/store/modules/uistate.tsindex c81dc82acf..a2eee478fb 100644--- a/frontend/src/store/modules/uistate.ts+++ b/frontend/src/store/modules/uistate.ts@@ -1,52 +1,69 @@import isUndefined from "lodash-es/isUndefined";+const EXPAND_MODULE = "ui.list.expand";+const INTRO_MODULE = "ui.intro";+export interface UIState {expandStateByKey: Map<string, boolean>;+ introStateByKey: Map<string, boolean>;}const state: () => UIState = () => ({expandStateByKey: new Map(),+ introStateByKey: new Map(),});-const expandStateByKey = function (state: UIState, key: string): boolean {- const expandState = state.expandStateByKey.get(key);- if (!isUndefined(expandState)) {- return expandState;+const stateByKey = function (+ stateMap: Map<string, boolean>,+ module: string,+ key: string+): boolean {+ const memState = stateMap.get(key);+ if (!isUndefined(memState)) {+ return memState;}- const localStorageExpandState = localStorage.getItem("ui.list.expand");- if (localStorageExpandState) {- return JSON.parse(localStorageExpandState)[key];+ const localStorageState = localStorage.getItem(module);+ if (localStorageState) {+ return JSON.parse(localStorageState)[key];}return false;};-const saveExpandStateByKey = function (- commit: any,+const saveStateByKey = function (+ module: string,key: string,- expand: boolean+ state: boolean): boolean {- const item = localStorage.getItem("ui.list.expand");+ const item = localStorage.getItem(module);const fullState = item ? JSON.parse(item) : {};- fullState[key] = expand;- localStorage.setItem("ui.list.expand", JSON.stringify(fullState));- commit("setExpandStateByKey", { key, expand });+ fullState[key] = state;+ localStorage.setItem(module, JSON.stringify(fullState));return fullState[key];};const getters = {expandStateByKey: (state: UIState) => (key: string) => {- return expandStateByKey(state, key);+ return stateByKey(state.expandStateByKey, EXPAND_MODULE, key);+ },++ introStateByKey: (state: UIState) => (key: string) => {+ return stateByKey(state.introStateByKey, INTRO_MODULE, key);},};const actions = {- async restoreExpandState({ commit }: any) {- const item = localStorage.getItem("ui.list.expand");- const fullState = item ? JSON.parse(item) : {};- if (fullState) {- commit("setExpandState", fullState);+ async restoreState({ commit }: any) {+ const storedExpandState = localStorage.getItem(EXPAND_MODULE);+ const expandState = storedExpandState ? JSON.parse(storedExpandState) : {};+ if (expandState) {+ commit("setExpandState", expandState);+ }++ const storedIntroState = localStorage.getItem(INTRO_MODULE);+ const introState = storedIntroState ? JSON.parse(storedIntroState) : {};+ if (introState) {+ commit("setIntroState", introState);}- return fullState;},async saveExpandStateByKey(@@ -59,7 +76,24 @@ const actions = {expand: boolean;}) {- return saveExpandStateByKey(commit, key, expand);+ const state = saveStateByKey(EXPAND_MODULE, key, expand);+ commit("setExpandStateByKey", { key, expand: state });+ return state;+ },++ async saveIntroStateByKey(+ { commit }: any,+ {+ key,+ newState,+ }: {+ key: string;+ newState: boolean;+ }+ ) {+ const state = saveStateByKey(INTRO_MODULE, key, newState);+ commit("setIntroStateByKey", { key, newState });+ return state;},};@@ -84,6 +118,27 @@ const mutations = {) {state.expandStateByKey.set(key, expand);},++ setIntroState(state: UIState, fullState: any) {+ const newMap = new Map();+ for (const key in fullState) {+ newMap.set(key, fullState[key]);+ }+ state.introStateByKey = newMap;+ },++ setIntroStateByKey(+ state: UIState,+ {+ key,+ newState,+ }: {+ key: string;+ newState: boolean;+ }+ ) {+ state.introStateByKey.set(key, newState);+ },};export default {