diff --git a/src/main/java/ru/ulstu/extractor/controller/BaseIndexingController.java b/src/main/java/ru/ulstu/extractor/controller/BaseIndexingController.java new file mode 100644 index 0000000..c6d1b7a --- /dev/null +++ b/src/main/java/ru/ulstu/extractor/controller/BaseIndexingController.java @@ -0,0 +1,36 @@ +package ru.ulstu.extractor.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import ru.ulstu.extractor.model.mvc.IndexRepoForm; +import ru.ulstu.extractor.model.mvc.RepoForm; +import ru.ulstu.extractor.service.GitRepositoryService; + +@Controller +public class BaseIndexingController { + private final GitRepositoryService gitRepositoryService; + + public BaseIndexingController(GitRepositoryService gitRepositoryService) { + this.gitRepositoryService = gitRepositoryService; + } + + @GetMapping("/indexRepo") + public String indexNewRepo(Model model) { + model.addAttribute(new RepoForm()); + return "indexRepo"; + } + + @RequestMapping(value = "/indexRepo", method = RequestMethod.POST, params = "send") + public String getBranch(@ModelAttribute IndexRepoForm indexRepoForm, Model model) { + try { + return "indexRepo"; + } catch (Exception ex) { + model.addAttribute("error", ex.getMessage()); + return "indexRepo"; + } + } +} diff --git a/src/main/java/ru/ulstu/extractor/model/mvc/IndexRepoForm.java b/src/main/java/ru/ulstu/extractor/model/mvc/IndexRepoForm.java new file mode 100644 index 0000000..27f55b7 --- /dev/null +++ b/src/main/java/ru/ulstu/extractor/model/mvc/IndexRepoForm.java @@ -0,0 +1,20 @@ +package ru.ulstu.extractor.model.mvc; + +public class IndexRepoForm { + private String repo; + + public String getRepo() { + return repo; + } + + public void setRepo(String repo) { + this.repo = repo; + } + + @Override + public String toString() { + return "IndexRepoForm{" + + "repo='" + repo + '\'' + + '}'; + } +} diff --git a/src/main/resources/templates/default.html b/src/main/resources/templates/default.html index 8497859..04f7459 100644 --- a/src/main/resources/templates/default.html +++ b/src/main/resources/templates/default.html @@ -25,7 +25,7 @@ Link diff --git a/src/main/resources/templates/indexRepo.html b/src/main/resources/templates/indexRepo.html new file mode 100644 index 0000000..5266427 --- /dev/null +++ b/src/main/resources/templates/indexRepo.html @@ -0,0 +1,25 @@ + + + + Индексировать новый репозиторий + + +
+
+ + + + + + + + + + + +
Url
+
+
+