feat: add option to toggle each section on dashboard (#344)
Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import Window from 'types/widgets/window.js';
|
|||||||
import { Attribute, Child } from 'lib/types/widget.js';
|
import { Attribute, Child } from 'lib/types/widget.js';
|
||||||
import options from 'options.js';
|
import options from 'options.js';
|
||||||
|
|
||||||
const { enabled: directoriesEnabled } = options.menus.dashboard.directories;
|
const { controls, shortcuts, stats, directories } = options.menus.dashboard;
|
||||||
|
|
||||||
export default (): Window<Child, Attribute> => {
|
export default (): Window<Child, Attribute> => {
|
||||||
return DropdownMenu({
|
return DropdownMenu({
|
||||||
@@ -22,21 +22,29 @@ export default (): Window<Child, Attribute> => {
|
|||||||
Widget.Box({
|
Widget.Box({
|
||||||
class_name: 'dashboard-content-container',
|
class_name: 'dashboard-content-container',
|
||||||
vertical: true,
|
vertical: true,
|
||||||
children: directoriesEnabled.bind('value').as((isDirectoriesEnabled) => {
|
children: Utils.merge(
|
||||||
|
[
|
||||||
|
controls.enabled.bind('value'),
|
||||||
|
shortcuts.enabled.bind('value'),
|
||||||
|
stats.enabled.bind('value'),
|
||||||
|
directories.enabled.bind('value'),
|
||||||
|
],
|
||||||
|
(isControlsEnabled, isShortcutsEnabled, isStatsEnabled, isDirectoriesEnabled) => {
|
||||||
return [
|
return [
|
||||||
Widget.Box({
|
Widget.Box({
|
||||||
class_name: 'dashboard-content-items',
|
class_name: 'dashboard-content-items',
|
||||||
vertical: true,
|
vertical: true,
|
||||||
children: [
|
children: [
|
||||||
Profile(),
|
Profile(),
|
||||||
Shortcuts(),
|
...(isShortcutsEnabled ? [Shortcuts()] : []),
|
||||||
Controls(),
|
...(isControlsEnabled ? [Controls()] : []),
|
||||||
...(isDirectoriesEnabled ? [Directories()] : []),
|
...(isDirectoriesEnabled ? [Directories()] : []),
|
||||||
Stats(),
|
...(isStatsEnabled ? [Stats()] : []),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1064,9 +1064,14 @@ const options = mkOptions(OPTIONS, {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
stats: {
|
stats: {
|
||||||
|
enabled: opt(true),
|
||||||
enable_gpu: opt(false),
|
enable_gpu: opt(false),
|
||||||
},
|
},
|
||||||
|
controls: {
|
||||||
|
enabled: opt(true),
|
||||||
|
},
|
||||||
shortcuts: {
|
shortcuts: {
|
||||||
|
enabled: opt(true),
|
||||||
left: {
|
left: {
|
||||||
shortcut1: {
|
shortcut1: {
|
||||||
icon: opt(''),
|
icon: opt(''),
|
||||||
|
|||||||
@@ -43,16 +43,18 @@ export const DashboardMenuSettings = (): Scrollable<Child, Attribute> => {
|
|||||||
Option({ opt: options.menus.dashboard.powermenu.reboot, title: 'Reboot Command', type: 'string' }),
|
Option({ opt: options.menus.dashboard.powermenu.reboot, title: 'Reboot Command', type: 'string' }),
|
||||||
Option({ opt: options.menus.dashboard.powermenu.logout, title: 'Logout Command', type: 'string' }),
|
Option({ opt: options.menus.dashboard.powermenu.logout, title: 'Logout Command', type: 'string' }),
|
||||||
Option({ opt: options.menus.dashboard.powermenu.sleep, title: 'Sleep Command', type: 'string' }),
|
Option({ opt: options.menus.dashboard.powermenu.sleep, title: 'Sleep Command', type: 'string' }),
|
||||||
|
Header('Controls'),
|
||||||
|
Option({ opt: options.menus.dashboard.controls.enabled, title: 'Enabled', type: 'boolean' }),
|
||||||
Header('Resource Usage Metrics'),
|
Header('Resource Usage Metrics'),
|
||||||
|
Option({ opt: options.menus.dashboard.stats.enabled, title: 'Enabled', type: 'boolean' }),
|
||||||
Option({
|
Option({
|
||||||
opt: options.menus.dashboard.stats.enable_gpu,
|
opt: options.menus.dashboard.stats.enable_gpu,
|
||||||
title: 'Track GPU',
|
title: 'Track GPU',
|
||||||
subtitle: "NOTE: This is currently only available for NVidia GPUs and requires 'python-gpustat'.",
|
subtitle: "NOTE: This is currently only available for NVidia GPUs and requires 'python-gpustat'.",
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Header('Shortcuts'),
|
Header('Shortcuts'),
|
||||||
|
Option({ opt: options.menus.dashboard.shortcuts.enabled, title: 'Enabled', type: 'boolean' }),
|
||||||
Option({
|
Option({
|
||||||
opt: options.menus.dashboard.shortcuts.left.shortcut1.icon,
|
opt: options.menus.dashboard.shortcuts.left.shortcut1.icon,
|
||||||
title: 'Left - Shortcut 1 (Icon)',
|
title: 'Left - Shortcut 1 (Icon)',
|
||||||
|
|||||||
Reference in New Issue
Block a user