优化保存恢复功能
This commit is contained in:
parent
08148209e7
commit
d901594c16
Binary file not shown.
@ -12,10 +12,10 @@ export let saveDelay = 1000;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} file
|
* @param {string} file
|
||||||
* @param {*} payload
|
* @param {any} payload
|
||||||
*/
|
*/
|
||||||
export async function saveView(file, payload) {
|
export async function saveView(file, payload) {
|
||||||
if (payload.waves === undefined || payload.waves.length === 0) {
|
if (payload === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mode === 'debug') {
|
if (mode === 'debug') {
|
||||||
@ -47,7 +47,7 @@ function debounceSaveView(delay) {
|
|||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
}
|
}
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
const payload = makeSaveViewPayload(configPool);
|
const payload = makeSaveViewPayload(configPool);
|
||||||
const savePath = globalLookup.originVcdViewFile;
|
const savePath = globalLookup.originVcdViewFile;
|
||||||
saveView(savePath, payload);
|
saveView(savePath, payload);
|
||||||
}, delay);
|
}, delay);
|
||||||
|
@ -5,6 +5,6 @@ import { saveViewApi } from "@/api";
|
|||||||
export function onUpdate() {
|
export function onUpdate() {
|
||||||
globalLookup.render();
|
globalLookup.render();
|
||||||
updateCurrentGroups();
|
updateCurrentGroups();
|
||||||
// 保存视图
|
// 保存视图
|
||||||
saveViewApi({ views: true });
|
saveViewApi({ views: true });
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import { BSON } from "bson";
|
|||||||
import { Id2Pivot, orderedTimes, UserPivots } from "@/components/pivot/pivot-view";
|
import { Id2Pivot, orderedTimes, UserPivots } from "@/components/pivot/pivot-view";
|
||||||
import { TreeviewExpandSignals } from "@/components/treeview/modules";
|
import { TreeviewExpandSignals } from "@/components/treeview/modules";
|
||||||
import { controlPanel } from "@/components/right-nav";
|
import { controlPanel } from "@/components/right-nav";
|
||||||
|
import { saveViewApi } from "@/api";
|
||||||
|
|
||||||
export const recoverConfig = {
|
export const recoverConfig = {
|
||||||
/**
|
/**
|
||||||
@ -228,6 +229,16 @@ export function recoverSession(topModules) {
|
|||||||
recoverConfig.treeviewExpands = null;
|
recoverConfig.treeviewExpands = null;
|
||||||
recoverConfig.waves = null;
|
recoverConfig.waves = null;
|
||||||
recoverConfig.rightNavIndex = null;
|
recoverConfig.rightNavIndex = null;
|
||||||
|
|
||||||
|
// 更新后端缓存
|
||||||
|
saveViewApi({
|
||||||
|
waves: true,
|
||||||
|
views: true,
|
||||||
|
state: true,
|
||||||
|
pivots: true,
|
||||||
|
treeviewExpands: true,
|
||||||
|
rightNavIndex: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -353,7 +364,7 @@ export function makeSaveViewPayload(config) {
|
|||||||
if (defaultFalseWrapper(config, 'waves')) {
|
if (defaultFalseWrapper(config, 'waves')) {
|
||||||
// 有 waves 也一定要有 views
|
// 有 waves 也一定要有 views
|
||||||
config.views = true;
|
config.views = true;
|
||||||
|
|
||||||
const waves = [];
|
const waves = [];
|
||||||
for (const wire of globalLookup.currentWires) {
|
for (const wire of globalLookup.currentWires) {
|
||||||
const option = globalLookup.currentSignalRenderOptions.get(wire.link) || {};
|
const option = globalLookup.currentSignalRenderOptions.get(wire.link) || {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user