Added new user button handler in admin

This commit is contained in:
Rohan Sircar 2020-07-31 12:45:48 +05:30
parent 42f8978d06
commit 8ceadfa28a
3 changed files with 95 additions and 2 deletions

View File

@ -64,7 +64,7 @@ export async function viewUsers(authToken: string) {
{ {
text: "New User", text: "New User",
action: () => { action: () => {
log.error("Not implemented yet"); window.location.assign("/admin/users?mode=new");
}, },
}, },
], ],

View File

@ -11,6 +11,7 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.server.ResponseStatusException; import org.springframework.web.server.ResponseStatusException;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -37,7 +38,13 @@ public class AdminController {
} }
@GetMapping("/users") @GetMapping("/users")
public String usersPage() { public String usersPage(@RequestParam Optional<String> mode) {
if (mode.isPresent()) {
switch (mode.get()) {
case "new":
return "admin/new-user";
}
}
return "admin/users"; return "admin/users";
} }

View File

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<div th:replace="fragments/head :: headFragment">
<title id="pageTitle" th:text="${userName}">New User</title>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js" th:if="false"></script>
<script src="http://blackpeppersoftware.github.io/thymeleaf-fragment.js/thymeleaf-fragment.js"
data-template-prefix="../" defer="defer" th:if="false"></script>
<th:block th:include="fragments/admin :: headFragment"></th:block>
</head>
<!-- TODO
Make user admin / remove user from admin
Change E2E passphrase
Delete Messages
-->
<!-- <div th:include="fragments/admin :: admin-sidebar"></div> -->
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<div th:include="fragments/admin :: sidebar-fragment"></div>
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column" style="background-color: #333;">
<!-- Main Content -->
<div id="content">
<div th:include="fragments/admin :: topbar-fragment"></div>
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-light">Dashboard</h1>
</div>
<!-- Content Row -->
<div class="row">
<div class="col-lg-4 mb-4 offset-lg-4">
<!-- Approach -->
<div class="card bg-dark border border-dark text-white shadow mb-4">
<div class="card-header bg-secondary border border-secondary py-3">
<h6 class="m-0 font-weight-bold text-white">New User</h6>
</div>
<div class="card-body">
page under construction
</div>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<div th:include="fragments/admin :: footer"></div>
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<th:block th:include="fragments/admin :: modal"></th:block>
<div th:if="false">
<th:block th:include="admin :: modal"></th:block>
</div>
</body>
</html>