chore(task-board): disable feature during refactor

This commit is contained in:
shiyue
2026-08-21 16:59:37 +08:00
parent d234189a86
commit 6c565f0ffe
10 changed files with 305 additions and 12 deletions

View File

@@ -305,6 +305,7 @@
let usageDashboardRequestSeq = 0;
const taskBoardViewState = {
open: false,
enabled: false,
savedFocus: null,
};
let taskBoardController = null;
@@ -4587,6 +4588,16 @@
}
}
function setTaskBoardFeatureEnabled(enabled) {
taskBoardViewState.enabled = enabled === true;
if (taskBoardOpen) taskBoardOpen.hidden = !taskBoardViewState.enabled;
if (taskTrackingControl) taskTrackingControl.hidden = true;
if (!taskBoardViewState.enabled) {
if (taskBoardViewState.open) closeTaskBoard({ restoreFocus: false });
taskTrackingController?.setState({ sessionId: '', disabled: true });
}
}
function setUsageDashboardState(state, message = '') {
const loading = state === 'loading';
usageDashboardState.loading = loading;
@@ -5417,7 +5428,7 @@
}
function openTaskBoard() {
if (!taskBoardPanel || !taskBoardRoot || !window.CcwebTaskBoard) return;
if (!taskBoardViewState.enabled || !taskBoardPanel || !taskBoardRoot || !window.CcwebTaskBoard) return;
if (usageDashboardState.open) closeUsageDashboard({ restoreFocus: false });
if (advancedSessionSearchState.open) closeAdvancedSessionSearch({ restoreFocus: false });
taskBoardViewState.savedFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
@@ -5444,6 +5455,11 @@
function syncTaskTrackingControl(snapshot = null) {
if (!taskTrackingControl || !window.CcwebTaskBoard) return;
if (!taskBoardViewState.enabled) {
taskTrackingControl.hidden = true;
taskTrackingController?.setState({ sessionId: '', disabled: true });
return;
}
const sessionId = snapshot?.sessionId || currentSessionId || '';
const tracking = snapshot?.taskTracking || {};
if (!sessionId) {
@@ -6969,6 +6985,7 @@
loginOverlay.hidden = true;
app.hidden = false;
setUsageDashboardFeatureEnabled(msg.features?.usageStatistics === true);
setTaskBoardFeatureEnabled(msg.features?.taskBoard === true);
const flushedSessionSwitch = flushPendingSessionSwitch();
const flushedSessionResume = flushedSessionSwitch ? false : flushPendingSessionResume();
if (!flushedSessionSwitch &&
@@ -6996,6 +7013,7 @@
authToken = null;
wsAuthenticated = false;
setUsageDashboardFeatureEnabled(false);
setTaskBoardFeatureEnabled(false);
localStorage.removeItem('cc-web-token');
document.dispatchEvent(new CustomEvent('cc-web-auth-failed'));
loginOverlay.hidden = false;
@@ -11515,6 +11533,8 @@
setUsageDashboardFeatureEnabled(false);
}
setTaskBoardFeatureEnabled(false);
if (taskBoardOpen && taskBoardPanel && taskBoardRoot) {
taskBoardOpen.addEventListener('click', openTaskBoard);
taskBoardClose?.addEventListener('click', () => closeTaskBoard());