use of com.thoughtworks.go.server.ui.controller.Redirection in project gocd by gocd.
the class MyGoController method removeNotificationFilter.
@RequestMapping(value = "/tab/mycruise/notification/delete", method = RequestMethod.POST)
public ModelAndView removeNotificationFilter(@RequestParam("filterId") long filterId, HttpServletRequest request) {
try {
Long userId = getUserId(request);
userService.removeNotificationFilter(userId, filterId);
return new Redirection("/mycruise/user").addParameter(MESSAGE_KEY, "Successfully deleted the notification filter.");
} catch (Exception e) {
return render(request, error(MESSAGE_KEY, "Failed to delete: " + e.getMessage()));
}
}
use of com.thoughtworks.go.server.ui.controller.Redirection in project gocd by gocd.
the class MyGoController method addNotificationFilter.
@RequestMapping(value = "/tab/mycruise/notification", method = RequestMethod.POST)
public ModelAndView addNotificationFilter(@RequestParam("pipeline") String pipeline, @RequestParam("stage") String stage, @RequestParam("event") String event, @RequestParam(value = "myCheckin", required = false) Boolean myCheckin, HttpServletRequest request) {
try {
NotificationFilter filter = new NotificationFilter(pipeline, stage, StageEvent.valueOf(event), toBoolean(myCheckin));
userService.addNotificationFilter(getUserId(request), filter);
return new Redirection("/mycruise/user").addParameter(MESSAGE_KEY, "Successfully saved the notification filter.");
} catch (Exception e) {
HashMap<String, Object> data = new HashMap<>();
data.put("pipeline", pipeline);
data.put("stage", stage);
data.put("event", event);
data.put("myCheckin", myCheckin);
return render(request, error(MESSAGE_KEY, "Failed to save: " + e.getMessage()), data);
}
}
use of com.thoughtworks.go.server.ui.controller.Redirection in project gocd by gocd.
the class MyGoController method updateUserSetting.
@RequestMapping(value = "/tab/mycruise/user", method = RequestMethod.POST)
public ModelAndView updateUserSetting(@RequestParam("email") String email, @RequestParam("matchers") String matchers, @RequestParam(value = "emailme", required = false) Boolean emailMe, HttpServletRequest request) {
try {
User user = userService.load(getUserId(request));
user.setEmail(email);
user.setEmailMe(toBoolean(emailMe));
user.setMatcher(matchers);
userService.saveOrUpdate(user);
return new Redirection("/mycruise/user").addParameter(MESSAGE_KEY, "Successfully saved the settings");
} catch (Exception e) {
return render(request, error(MESSAGE_KEY, "Failed to save: " + e.getMessage()));
}
}
Aggregations