Skip to content

Updates in details of DF #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package br.ufrn.dct.apf.controller;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.validation.Valid;

import br.ufrn.dct.apf.dto.DataFunctionDTO;
import br.ufrn.dct.apf.model.DataFunction;
import br.ufrn.dct.apf.model.Project;
import br.ufrn.dct.apf.model.User;
import br.ufrn.dct.apf.model.UserStory;
import br.ufrn.dct.apf.service.DataFunctionService;
import br.ufrn.dct.apf.service.ProjectService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -16,12 +16,11 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.servlet.ModelAndView;
import br.ufrn.dct.apf.dto.DataFunctionDTO;
import br.ufrn.dct.apf.model.Project;
import br.ufrn.dct.apf.model.User;
import br.ufrn.dct.apf.model.UserStory;
import br.ufrn.dct.apf.service.DataFunctionService;
import br.ufrn.dct.apf.service.ProjectService;

import javax.validation.Valid;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Controller
public class DataFunctionController extends AbstractController {
Expand Down Expand Up @@ -78,15 +77,21 @@ public ModelAndView add(DataFunctionDTO df) {
return mv;
}

// @GetMapping("/df/list")
// public ModelAndView list() {
// @GetMapping("/df/list/{projectId}")
// public ModelAndView list(@PathVariable("projectId") Long projectId) throws BusinessRuleException {
// ModelAndView mv = new ModelAndView("df/list");
//
// User current = getCurrentUser();
// User currentUser = getCurrentUser();
// Project project = projectService.findOne(projectId);
//
// if (!project.isMemberOfProject(currentUser)) {
// throw MEMBER_NOT_EXISTS;
// }
//
// List<Project> projects = projectService.findByUserId(current.getId());
// List<DataFunction> dfs = dataFunctionService.findByProject(projectId);
//
// mv.addObject("projects", projects);
// mv.addObject("project", project);
// mv.addObject("dfs", dfs);
Comment on lines -81 to +94
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joaoeudes7 muito código comentado. Ainda está em construção?

Copy link
Member Author

@joaoeudes7 joaoeudes7 Nov 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Para saber se posso remover, como os DFs vão ser puxadas a partir da view do projeto, não vejo mais necessidade dessa view de list, até por isso descartei o que eu havia feito, veja os detalhes da tarefas e #31

//
// return mv;
// }
Expand Down Expand Up @@ -126,17 +131,4 @@ public ModelAndView details(@PathVariable("dataFunctionId") Long id) {

return mv;
}

// Consultar se precisa ser por projeto ou time a busca
@GetMapping("/df/list")
public ModelAndView list() {
ModelAndView mv = new ModelAndView("df/list");

List<DataFunction> dfs = dataFunctionService.findAll();

mv.addObject("dfs", dfs);

return mv;
}

Comment on lines -129 to -141
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joaoeudes7 não tem mais o listar de DataFunction?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veja a resposta no outro comentário

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package br.ufrn.dct.apf.repository;

import br.ufrn.dct.apf.model.DataFunction;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import br.ufrn.dct.apf.model.DataFunction;
import java.util.List;

@Repository("dataFunctionRepository")
public interface DataFunctionRepository extends JpaRepository<DataFunction, Long> {

List<DataFunction> findByProject(Long projectId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ private DataFunctionDTO createDTO(DataFunction df) {
public void delete(Long id) {
dataFunctionRepository.deleteById(id);
}

public List<DataFunction> findByProject(Long projectId) {
return dataFunctionRepository.findByProject(projectId);
}
}
98 changes: 0 additions & 98 deletions src/main/resources/templates/df/list.html

This file was deleted.

9 changes: 7 additions & 2 deletions src/main/resources/templates/project/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
</td>
<td>
<div class="btn-group pull-right">
<a class="btn btn-sm btn-primary" th:href="@{/df/details/{id}(id=${dataFunction.id})}">Detalhes</a>
<a class="btn btn-sm btn-primary" th:href="@{/df/edit/{id}(id=${dataFunction.id})}">Editar</a>
<a class="delete btn btn-sm btn-danger" th:href="@{/df/delete/{id}(id=${dataFunction.id})}">Excluir</a>
</div>
Expand Down Expand Up @@ -121,8 +122,7 @@
<td>
<div class="btn-group pull-right">
<a class="btn btn-sm btn-primary" th:href="@{/us/edit/{id}(id=${userstory.id})}">Editar</a>
<a class="delete btn btn-sm btn-danger"
th:href="@{/us/delete/{id}(id=${userstory.id})}">Excluir</a>
<a class="delete btn btn-sm btn-danger" th:href="@{/us/delete/{id}(id=${userstory.id})}">Excluir</a>
</div>
</td>
</tr>
Expand Down Expand Up @@ -179,5 +179,10 @@
<div th:include="fragments/footer :: footer-authenticated" align="center"></div>
</div>
</div>
<script type="text/javascript">
function viewDetailsDf(id) {
window.location = `details/${id}`;
}
</script>
Comment on lines +182 to +186
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O que acha de invés de adicionar um botão na linha da tabela, fazer a mudança de rota por meio do clique na linha? Utilizando JS

</body>
</html>