Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/store/interface/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface GlobalState {
device: DeviceType;
lastFilePath: string;
currentDB: string;
currentPgDB: string;
currentRedisDB: string;
showEntranceWarn: boolean;
defaultNetwork: string;
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/store/modules/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const GlobalStore = defineStore({
device: DeviceType.Desktop,
lastFilePath: '',
currentDB: '',
currentPgDB: '',
currentRedisDB: '',
showEntranceWarn: true,
defaultNetwork: 'all',
Expand Down Expand Up @@ -110,6 +111,9 @@ const GlobalStore = defineStore({
setCurrentDB(name: string) {
this.currentDB = name;
},
setCurrentPgDB(name: string) {
this.currentPgDB = name;
},
setCurrentRedisDB(name: string) {
this.currentRedisDB = name;
},
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/views/database/mysql/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ const changeDatabase = async () => {
for (const item of dbOptionsLocal.value) {
if (item.database == currentDBName.value) {
currentDB.value = item;
globalStore.setCurrentDB(currentDB.value.database);
appKey.value = item.type;
appName.value = item.database;
search();
Expand All @@ -409,6 +410,7 @@ const changeDatabase = async () => {
if (item.database == currentDBName.value) {
maskShow.value = false;
currentDB.value = item;
globalStore.setCurrentDB(currentDB.value.database);
break;
}
}
Expand Down Expand Up @@ -532,7 +534,6 @@ const loadDBOptions = async () => {
if (currentDB.value?.from === 'remote') {
maskShow.value = false;
}
globalStore.setCurrentDB('');
search();
return;
}
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/views/database/postgresql/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ const onChangeConn = async () => {

const goRemoteDB = async () => {
if (currentDB.value) {
globalStore.setCurrentDB(currentDB.value.database);
globalStore.setCurrentPgDB(currentDB.value.database);
}
routerToName('PostgreSQL-Remote');
};
Expand All @@ -348,7 +348,7 @@ const passwordRef = ref();

const onSetting = async () => {
if (currentDB.value) {
globalStore.setCurrentDB(currentDB.value.database);
globalStore.setCurrentPgDB(currentDB.value.database);
}
routerToNameWithParams('PostgreSQL-Setting', { type: currentDB.value.type, database: currentDB.value.database });
};
Expand All @@ -357,6 +357,7 @@ const changeDatabase = async () => {
for (const item of dbOptionsLocal.value) {
if (item.database == currentDBName.value) {
currentDB.value = item;
globalStore.setCurrentPgDB(currentDB.value.database);
appKey.value = item.type;
appName.value = item.database;
search();
Expand All @@ -368,6 +369,7 @@ const changeDatabase = async () => {
if (item.database == currentDBName.value) {
maskShow.value = false;
currentDB.value = item;
globalStore.setCurrentPgDB(currentDB.value.database);
break;
}
}
Expand Down Expand Up @@ -461,7 +463,7 @@ const loadDBOptions = async () => {
let datas = res.data || [];
dbOptionsLocal.value = [];
dbOptionsRemote.value = [];
currentDBName.value = globalStore.currentDB;
currentDBName.value = globalStore.currentPgDB;
for (const item of datas) {
if (currentDBName.value && item.database === currentDBName.value) {
currentDB.value = item;
Expand All @@ -480,7 +482,6 @@ const loadDBOptions = async () => {
if (currentDB.value?.from === 'remote') {
maskShow.value = false;
}
globalStore.setCurrentDB('');
search();
return;
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/views/database/redis/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ const changeDatabase = async () => {
for (const item of dbOptionsLocal.value) {
if (item.database == currentDBName.value) {
currentDB.value = item;
globalStore.setCurrentRedisDB(currentDB.value.database);
appKey.value = item.type;
appName.value = item.database;
appStatusRef.value?.onCheck(appKey.value, appName.value);
Expand All @@ -236,6 +237,7 @@ const changeDatabase = async () => {
for (const item of dbOptionsRemote.value) {
if (item.database == currentDBName.value) {
currentDB.value = item;
globalStore.setCurrentRedisDB(currentDB.value.database);
break;
}
}
Expand All @@ -248,7 +250,7 @@ const loadDBOptions = async () => {
let datas = res.data || [];
dbOptionsLocal.value = [];
dbOptionsRemote.value = [];
currentDBName.value = globalStore.currentDB;
currentDBName.value = globalStore.currentRedisDB;
for (const item of datas) {
if (currentDBName.value && item.database === currentDBName.value) {
currentDB.value = item;
Expand Down
Loading