feat: redesign the web console with Vue and isolated account workspaces
This commit is contained in:
@@ -111,11 +111,21 @@ export class PageView {
|
||||
clearError() { this.errorBox.hidden = true; }
|
||||
|
||||
setQuery(key, value) {
|
||||
if (this.query[key] === value) return;
|
||||
if (this.destroyed || this.query[key] === value) return;
|
||||
this.query[key] = value;
|
||||
this.generation = (this.generation || 0) + 1;
|
||||
clearTimeout(this.queryTimer);
|
||||
this.queryTimer = setTimeout(() => this.options.load(this, true), key === 'search' ? 220 : 0);
|
||||
this.queryTimer = setTimeout(() => { if (!this.destroyed) this.options.load(this, true); }, key === 'search' ? 220 : 0);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.destroyed = true;
|
||||
clearTimeout(this.queryTimer);
|
||||
this.generation = (this.generation || 0) + 1;
|
||||
this.table?.destroy?.();
|
||||
this.statisticsTable?.destroy();
|
||||
this.login?.clearPassword();
|
||||
this.root.remove();
|
||||
}
|
||||
|
||||
updateFilters(filters) {
|
||||
@@ -197,6 +207,7 @@ export class PageView {
|
||||
}
|
||||
|
||||
render(data, loading = false) {
|
||||
if (this.destroyed) return;
|
||||
if (!data) { this.loading.textContent = '正在读取…'; this.loading.dataset.loading = 'true'; return; }
|
||||
this.data = data;
|
||||
this.loading.dataset.loading = String(loading);
|
||||
@@ -224,6 +235,8 @@ export class PageView {
|
||||
const mode = this.key === 'statistics' ? 'statistics' : grouped ? 'grouped' : 'table';
|
||||
if (this.contentMode !== mode) {
|
||||
if (this.content.contains(document.activeElement)) return;
|
||||
this.table?.destroy?.();
|
||||
this.statisticsTable?.destroy();
|
||||
this.content.replaceChildren();
|
||||
this.contentMode = mode;
|
||||
this.table = mode === 'grouped' ? new GroupedTables(this.content, this.context, {collapsed: this.key === 'maps'}) : mode === 'table' ? new DataTable(this.content, this.context, {emptyMessage: this.key === 'plans' ? '当前没有执行计划。请配置策略并刷新 / 预览,查看下一步或等待原因。' : '当前筛选下没有条目。可调整筛选,或登录后刷新状态。'}) : null;
|
||||
|
||||
Reference in New Issue
Block a user