Class MvcController

java.lang.Object
com.nmontytskyi.monitoring.server.web.MvcController

@Controller public class MvcController extends Object
Spring MVC controller that serves the server-side rendered Thymeleaf pages.

Each handler method populates a Model with the data required by the corresponding template and returns the template name. Page data is loaded eagerly on the initial HTTP GET; charts and live metrics are subsequently updated by JavaScript polling of the REST API.

Author:
Nazar Montytskyi
See Also:
  • Constructor Details

    • MvcController

      public MvcController()
  • Method Details

    • dashboard

      @GetMapping("/") public String dashboard(org.springframework.ui.Model model)
    • serviceDetail

      @GetMapping("/services/{id}") public String serviceDetail(@PathVariable Long id, org.springframework.ui.Model model)
    • slaReport

      @GetMapping("/services/{id}/sla") public String slaReport(@PathVariable Long id, @RequestParam(defaultValue="DAY") SlaWindow window, org.springframework.ui.Model model)
    • reports

      @GetMapping("/services/{id}/reports") public String reports(@PathVariable Long id, org.springframework.ui.Model model)
    • alerts

      @GetMapping("/alerts") public String alerts(org.springframework.ui.Model model)
    • createAlertRule

      @PostMapping("/alerts/rules") public String createAlertRule(@RequestParam Long serviceId, @RequestParam String metricType, @RequestParam String comparator, @RequestParam Double threshold, @RequestParam(defaultValue="15") int cooldownMinutes, @RequestParam(required=false,defaultValue="false") boolean enabled, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
    • deleteService

      @PostMapping("/services/{id}/delete") public String deleteService(@PathVariable Long id, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
    • deleteAlertRule

      @PostMapping("/alerts/rules/{id}/delete") public String deleteAlertRule(@PathVariable Long id, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
    • settings

      @GetMapping("/settings") public String settings(org.springframework.ui.Model model)
    • saveDashboard

      @PostMapping("/settings/dashboard") public String saveDashboard(@RequestParam String refreshSeconds, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
    • saveEmail

      @PostMapping("/settings/email") public String saveEmail(@RequestParam(required=false,defaultValue="") String emailTo, @RequestParam(defaultValue="false") String emailEnabled, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
    • saveRetention

      @PostMapping("/settings/retention") public String saveRetention(@RequestParam String retentionEnabled, @RequestParam String metricDays, @RequestParam String alertDays, @RequestParam String reportDays, @RequestParam String retentionFrequency, @RequestParam String retentionTime, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
    • runRetentionNow

      @PostMapping("/settings/retention/run") public String runRetentionNow(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
    • saveSla

      @PostMapping("/settings/sla/{serviceId}") public String saveSla(@PathVariable Long serviceId, @RequestParam double uptimePercent, @RequestParam long maxResponseTimeMs, @RequestParam double maxErrorRatePercent, @RequestParam(required=false) String description, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttrs)
    • handleNotFound

      @ExceptionHandler(ServiceNotFoundException.class) @ResponseStatus(NOT_FOUND) public String handleNotFound()