mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 03:45:59 +00:00
tab status bar improved
This commit is contained in:
@@ -1,15 +1,34 @@
|
||||
<script lang="ts" context="module">
|
||||
const statusBarTabInfo = writable({});
|
||||
|
||||
export function updateStatuBarInfo(tabid, info) {
|
||||
statusBarTabInfo.update(x => ({
|
||||
...x,
|
||||
[tabid]: info,
|
||||
}));
|
||||
// export function updateStatuBarInfo(tabid, info) {
|
||||
// statusBarTabInfo.update(x => ({
|
||||
// ...x,
|
||||
// [tabid]: info,
|
||||
// }));
|
||||
// }
|
||||
|
||||
export function updateStatuBarInfoItem(tabid, key, item) {
|
||||
statusBarTabInfo.update(tabs => {
|
||||
const items = tabs[tabid] || [];
|
||||
let newItems;
|
||||
if (item == null) {
|
||||
newItems = items.filter(x => x.key != key);
|
||||
} else if (items.find(x => x.key == key)) {
|
||||
newItems = items.map(x => (x.key == key ? { ...item, key } : x));
|
||||
} else {
|
||||
newItems = [...items, { ...item, key }];
|
||||
}
|
||||
return {
|
||||
...tabs,
|
||||
[tabid]: newItems,
|
||||
};
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import _ from 'lodash';
|
||||
import { writable } from 'svelte/store';
|
||||
import moment from 'moment';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user