Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Stop slash menu printing disabled-reasons on enabled commands

rcourtman304d4fa90f59
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
index ee08223254..d4e4eb1e67 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/assistantSlashCommands.test.ts
@@ -218,6 +218,23 @@ describe('assistantSlashCommands', () => {
);
});
+ it('drops the availability reason hint on enabled commands', () => {
+ const commands = filterAssistantSlashCommands('compact', undefined, {
+ availability: {
+ compact: {
+ disabled: false,
+ // The availability map always computes a fall-through reason; an
+ // enabled command must not display it as a false statement.
+ reason: 'Unavailable while another session action is running.',
+ },
+ },
+ });
+
+ expect(commands).toHaveLength(1);
+ expect(commands[0].disabled).toBe(false);
+ expect(commands[0].disabledReason).toBeUndefined();
+ });
+
it('exposes canonical and alias tokens for the picker', () => {
const help = filterAssistantSlashCommands('commands')[0];
expect(getAssistantSlashCommandTokens(help)).toEqual(['help', 'commands']);
diff --git a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
index a3a20a30de..c8868ab29f 100644
--- a/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
+++ b/frontend-modern/src/components/AI/Chat/assistantSlashCommands.ts
@@ -248,7 +248,10 @@ const commandWithAvailability = (
return {
...command,
disabled: state.disabled,
- disabledReason: state.reason,
+ // The availability map computes a fall-through reason even when the
+ // command is enabled; carrying it through made the menu show false
+ // statements like "Forking is already running." on enabled commands.
+ disabledReason: state.disabled ? state.reason : undefined,
};
};