[pve-devel] [PATCH pve_flutter_frontend] fix: spice: replace wrong error message when the VMs or CTs are off
Shan Shaji
s.shaji at proxmox.com
Fri Jul 18 13:21:21 CEST 2025
When trying to open the SPICE app from a guest if the guest is not
running, the error message shown was "Ensure you have VM.Console
Permission". However in the API response the `message` property was
returning guest not running message
Fix the issue by using the `message` property to show the error message.
When checking the same behaviour on web UI the error message shown
matches the string from `message` property.
Signed-off-by: Shan Shaji <s.shaji at proxmox.com>
---
Tested Scenerio 1:
- Created a custom role without the Sys.Console and VM.Console
permissions.
- Tried opening the SPICE Console and the error message shown is
"Permission check failed (/vms/101, VM.Console)"
Tested Scenerio 2:
- Tried opening the spice file without turning on the guest
- The error message shown is "CT 101 not running (500)"
lib/widgets/pve_console_menu_widget.dart | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/widgets/pve_console_menu_widget.dart b/lib/widgets/pve_console_menu_widget.dart
index cd8c314..cbf4f92 100644
--- a/lib/widgets/pve_console_menu_widget.dart
+++ b/lib/widgets/pve_console_menu_widget.dart
@@ -61,9 +61,17 @@ class PveConsoleMenu extends StatelessWidget {
final response = await apiClient.postRequest(apiPath);
final data = json.decode(response.body)['data'];
if (data == null) {
+ String errorDescription =
+ 'Ensure you have "${type == 'node' ? 'Sys' : 'VM'}.Console" permissions.';
+ final message = json.decode(response.body)['message'];
+
+ if (message != null) errorDescription = message;
if (context.mounted) {
- showTextDialog(context, 'Empty reply from SPICE API',
- 'Ensure you have "${type == 'node' ? 'Sys' : 'VM'}.Console" permissions.');
+ showTextDialog(
+ context,
+ 'Empty reply from SPICE API',
+ errorDescription,
+ );
}
return;
}
--
2.39.5
More information about the pve-devel
mailing list