|
@@ -36,16 +36,12 @@ class BugController(
|
|
|
val worList = Status.WorkedType.values()
|
|
|
val wStList = Status.WorkedStatusType.values()
|
|
|
val dStList = Status.DevStatusType.values()
|
|
|
- var global:String = ""
|
|
|
+ var global: String = ""
|
|
|
|
|
|
private fun getProject(): MutableList<Project> {
|
|
|
return this.projectRepository.findAll()
|
|
|
}
|
|
|
|
|
|
- private fun getPlatform(): MutableList<Platform> {
|
|
|
- return this.platformRepository.findAll()
|
|
|
- }
|
|
|
-
|
|
|
private fun getUser(): MutableList<User> {
|
|
|
return this.userRepository.findAll()
|
|
|
}
|
|
@@ -140,8 +136,9 @@ class BugController(
|
|
|
): String {
|
|
|
val listBugs = this.listBugRepository.done(pForm ?: "", programmer ?: "", proj).sortedBy { it.date }
|
|
|
val url = request.requestURL.split("/")
|
|
|
+ val plat = this.platformRepository.findPlatformById(proj)
|
|
|
model.addAttribute("project", url.last())
|
|
|
- model.addAttribute("platform", getPlatform())
|
|
|
+ model.addAttribute("platform", plat)
|
|
|
model.addAttribute("user", getUser())
|
|
|
model.addAttribute("listBugs", listBugs)
|
|
|
return "index"
|
|
@@ -157,19 +154,23 @@ class BugController(
|
|
|
): String {
|
|
|
val listBugs = this.listBugRepository.inPro(pForm ?: "", programmer ?: "", proj).sortedBy { it.date }
|
|
|
val url = request.requestURL.split("/")
|
|
|
+ val plat = this.platformRepository.findPlatformById(proj)
|
|
|
model.addAttribute("project", url.last())
|
|
|
- model.addAttribute("platform", getPlatform())
|
|
|
+ model.addAttribute("platform", plat)
|
|
|
model.addAttribute("user", getUser())
|
|
|
model.addAttribute("listBugs", listBugs)
|
|
|
return "inPro"
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = ["/new"])
|
|
|
- fun showNewBugForm(model: Model): String {
|
|
|
+ fun showNewBugForm(model: Model, httpServletRequest: HttpServletRequest, @RequestParam page: String): String {
|
|
|
+ global = page
|
|
|
+ val referer = httpServletRequest.getHeader("referer")
|
|
|
val bug = ListBug()
|
|
|
+ val plat = this.platformRepository.findPlatformById(referer.split("/").last())
|
|
|
model.addAttribute("bug", bug)
|
|
|
model.addAttribute("user", getUser())
|
|
|
- model.addAttribute("platform", getPlatform())
|
|
|
+ model.addAttribute("platform", plat)
|
|
|
model.addAttribute("qcResultType", qcResultType)
|
|
|
return "add_bug"
|
|
|
}
|
|
@@ -179,8 +180,10 @@ class BugController(
|
|
|
@Valid @ModelAttribute("bug") bug: ListBug,
|
|
|
bindingResult: BindingResult,
|
|
|
redirectAttributes: RedirectAttributes,
|
|
|
- model: Model
|
|
|
+ model: Model,
|
|
|
+ @RequestParam page: String,
|
|
|
): String {
|
|
|
+ val plat = this.platformRepository.findPlatformById(global.split("/").last())
|
|
|
if (bug.qcId == null) {
|
|
|
val myUserDetails = SecurityContextHolder.getContext().authentication.name
|
|
|
val userLogin = userRepository.findByUsername(myUserDetails)
|
|
@@ -190,7 +193,7 @@ class BugController(
|
|
|
}
|
|
|
return if (bindingResult.hasErrors()) {
|
|
|
model.addAttribute("user", getUser())
|
|
|
- model.addAttribute("platform", getPlatform())
|
|
|
+ model.addAttribute("platform", plat)
|
|
|
model.addAttribute("qcResultType", qcResultType)
|
|
|
"add_bug"
|
|
|
} else {
|
|
@@ -210,10 +213,11 @@ class BugController(
|
|
|
@RequestParam page: String,
|
|
|
model: Model,
|
|
|
): String {
|
|
|
+ val plat = this.platformRepository.findPlatformById(global.split("/").last())
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
model.addAttribute("listQc", getUser())
|
|
|
model.addAttribute("listPro", getUser())
|
|
|
- model.addAttribute("platform", getPlatform())
|
|
|
+ model.addAttribute("platform", plat)
|
|
|
model.addAttribute("bug", bug)
|
|
|
model.addAttribute("worList", worList)
|
|
|
model.addAttribute("wStList", wStList)
|
|
@@ -228,9 +232,7 @@ class BugController(
|
|
|
|
|
|
@PostMapping(value = ["/saveUser"])
|
|
|
fun saveUserEdit(
|
|
|
- @Valid @ModelAttribute("userRole") userRole: UserRole,
|
|
|
- bindingResult: BindingResult,
|
|
|
- model: Model
|
|
|
+ @Valid @ModelAttribute("userRole") userRole: UserRole, bindingResult: BindingResult, model: Model
|
|
|
): String {
|
|
|
val existUser = userService[userRole.id]
|
|
|
val editUser = User()
|
|
@@ -284,7 +286,7 @@ class BugController(
|
|
|
model: Model,
|
|
|
redirectAttributes: RedirectAttributes
|
|
|
): String {
|
|
|
- if (bindingResult.hasErrors()){
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
return "edit_proj"
|
|
|
}
|
|
|
redirectAttributes.addFlashAttribute("successMessage", "Success save project")
|
|
@@ -298,11 +300,13 @@ class BugController(
|
|
|
@RequestParam page: String,
|
|
|
): ModelAndView {
|
|
|
global = page
|
|
|
+ val proj = this.projectRepository.findProjectById(id.toString())
|
|
|
+ val plat = this.platformRepository.findPlatformById(proj)
|
|
|
val mav = ModelAndView("edit_bug")
|
|
|
val bug: ListBug = bugService[id]
|
|
|
mav.addObject("listQc", getUser())
|
|
|
mav.addObject("listPro", getUser())
|
|
|
- mav.addObject("platform", getPlatform())
|
|
|
+ mav.addObject("platform", plat)
|
|
|
mav.addObject("bug", bug)
|
|
|
mav.addObject("worList", worList)
|
|
|
mav.addObject("wStList", wStList)
|