fix(tools): keep the Tools tab live while a tool runs
Locking every tab but Tasks is right for install/restart/backup: those jump to the task log, so Tasks is the one tab you need. A tool run deliberately stays where it was launched and brings its result back to Tools — greying Tools out stranded the user on a tab they could no longer return to. disableTabs() now takes the tab to leave alone, chosen per task type by keepTabFor(). Same rule on the page-load path, which also stops yanking a reload mid-tool-run over to the task log.
This commit is contained in:
parent
c26b7190c5
commit
63b3af4cfc
@ -788,8 +788,12 @@ class AppTabbedManager {
|
|||||||
if (this.currentApp) {
|
if (this.currentApp) {
|
||||||
const running = this.getRunningTaskForApp(this.currentApp);
|
const running = this.getRunningTaskForApp(this.currentApp);
|
||||||
if (running) {
|
if (running) {
|
||||||
this.switchTab('tasks');
|
// A tool run is seconds long and surfaces its own result where it was
|
||||||
this.disableTabs();
|
// launched, so a reload mid-run stays on Tools rather than being thrown
|
||||||
|
// at the task log like a long install would be.
|
||||||
|
const keep = this.keepTabFor(running.action);
|
||||||
|
if (!keep) this.switchTab('tasks');
|
||||||
|
this.disableTabs(keep);
|
||||||
this.activeTaskId = running.taskId;
|
this.activeTaskId = running.taskId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1012,9 +1016,22 @@ class AppTabbedManager {
|
|||||||
return 'unknown';
|
return 'unknown';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable config, services and backup tabs when task is running
|
// Which tab a running task of this type leaves usable, if any. Single source
|
||||||
disableTabs() {
|
// of truth for both the live path (disableAppButtons) and the page-load path.
|
||||||
|
keepTabFor(action) {
|
||||||
|
return action === 'tool' ? 'tools' : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable config, services and backup tabs when task is running.
|
||||||
|
//
|
||||||
|
// `keep` names one tab to leave alone — the tab the user is expected to stay
|
||||||
|
// on for this kind of task. Install/restart/backup and friends jump to Tasks,
|
||||||
|
// so leaving only Tasks live is right for them; a tool run stays put on Tools
|
||||||
|
// and brings its result back there, so locking Tools would strand the user on
|
||||||
|
// a tab they can't return to.
|
||||||
|
disableTabs(keep = null) {
|
||||||
const tabs = ['config', 'services', 'tools', 'backups', 'updater']
|
const tabs = ['config', 'services', 'tools', 'backups', 'updater']
|
||||||
|
.filter(name => name !== keep)
|
||||||
.map(name => document.querySelector(`.main-tab-button[data-tab="${name}"], .tab-button[data-tab="${name}"]`))
|
.map(name => document.querySelector(`.main-tab-button[data-tab="${name}"], .tab-button[data-tab="${name}"]`))
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
|
||||||
@ -1045,8 +1062,9 @@ class AppTabbedManager {
|
|||||||
// Disable app buttons during task execution
|
// Disable app buttons during task execution
|
||||||
disableAppButtons(appName, action) {
|
disableAppButtons(appName, action) {
|
||||||
|
|
||||||
// Also disable config and backup tabs
|
// Also disable config and backup tabs — except the one this task reports
|
||||||
this.disableTabs();
|
// back into (Tools, for a tool run).
|
||||||
|
this.disableTabs(this.keepTabFor(action));
|
||||||
|
|
||||||
// Find ALL action buttons in the app content section (config, backup, etc.)
|
// Find ALL action buttons in the app content section (config, backup, etc.)
|
||||||
// This includes install, uninstall, update, backup, and any other action buttons
|
// This includes install, uninstall, update, backup, and any other action buttons
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user