Package sk.iway.iwcm.components.welcome
Class DashboardRestController
java.lang.Object
sk.iway.iwcm.components.welcome.DashboardRestController
@RestController
@RequestMapping("/admin/rest/dashboard")
@PreAuthorize("@WebjetSecurityService.isAdmin()")
public class DashboardRestController
extends Object
Exposes dashboard settings and menu destinations.
The settings owner and active domain are resolved from the request.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeleteSettings(jakarta.servlet.http.HttpServletRequest request) Clears widget preferences across all domains while retaining shortcuts and their migration state.getMenu(jakarta.servlet.http.HttpServletRequest request) invalidSettings(IllegalArgumentException exception) Converts a settings validation failure into the error body of a bad-request response.putSettings(DashboardSettingsDto settings, jakarta.servlet.http.HttpServletRequest request) Saves the shared layout and active-domain options, then clears the user's cached administration settings.resetSettings(DashboardSettingsDto layout, jakarta.servlet.http.HttpServletRequest request) Atomically installs a supplied layout while retaining the account's configured shortcuts.unavailableSettings(IllegalStateException exception) Logs a persistence failure and returns a service-unavailable error without exposing internal details.
-
Constructor Details
-
DashboardRestController
-
-
Method Details
-
putSettings
@PutMapping("/settings") public DashboardSettingsDto putSettings(@RequestBody DashboardSettingsDto settings, jakarta.servlet.http.HttpServletRequest request) Saves the shared layout and active-domain options, then clears the user's cached administration settings.- Parameters:
settings- dashboard settings to validate and persistrequest- request identifying the administrator and active domain- Returns:
- saved settings with the layout and shortcuts marked as configured
-
deleteSettings
@DeleteMapping("/settings") public DashboardSettingsDto deleteSettings(jakarta.servlet.http.HttpServletRequest request) Clears widget preferences across all domains while retaining shortcuts and their migration state. The returned layout is marked as unconfigured so the client can supply default widgets.- Parameters:
request- request identifying the administrator whose settings are reset- Returns:
- retained shortcuts and configuration flags after the reset
-
resetSettings
@PutMapping("/settings/reset") public DashboardSettingsDto resetSettings(@RequestBody DashboardSettingsDto layout, jakarta.servlet.http.HttpServletRequest request) Atomically installs a supplied layout while retaining the account's configured shortcuts.- Parameters:
layout- replacement widgets and active-domain options, including default shortcuts for an unconfigured accountrequest- request identifying the administrator and active domain- Returns:
- persisted layout combined with the retained shortcuts
-
getMenu
-
invalidSettings
@ExceptionHandler(java.lang.IllegalArgumentException.class) @ResponseStatus(BAD_REQUEST) public Map<String,String> invalidSettings(IllegalArgumentException exception) Converts a settings validation failure into the error body of a bad-request response.- Parameters:
exception- validation failure containing a message for the client- Returns:
- response body containing the validation message
-