added user page
This commit is contained in:
parent
26b3c76145
commit
87c21ffc90
@ -1,7 +1,6 @@
|
||||
<script>
|
||||
import CatalogMixins from '../mixins/CatalogMixins.js';
|
||||
import Monitor from '../models/Monitor';
|
||||
import DataService from '../services/DataService';
|
||||
import User from '../models/User.js';
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
@ -9,30 +8,12 @@ export default {
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
getAllUrl: 'user/',
|
||||
getAllUrl: 'user',
|
||||
dataUrl: 'user',
|
||||
transformer: (data) => new User(data),
|
||||
headers: [
|
||||
{ name: 'userName', label: 'user' }
|
||||
],
|
||||
dataFilterUrl: 'monitor/filter?'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
filter() {
|
||||
let urlParams = ""
|
||||
if (document.getElementById('modelNameFilterInput').value !== "") {
|
||||
urlParams += "modelName=" + this.modelName;
|
||||
}
|
||||
DataService.readAll(this.dataFilterUrl + urlParams, (data) => new Monitor(data))
|
||||
.then(data => {
|
||||
this.items = data;
|
||||
});
|
||||
},
|
||||
clearFilters() {
|
||||
this.loadItems();
|
||||
this.id = null;
|
||||
this.modelName = null;
|
||||
{ name: 'login', label: 'Логин' }
|
||||
]
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
@ -44,13 +25,6 @@ export default {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" id="modelNameFilterInput" placeholder="Модель" required v-model="modelName">
|
||||
<button class="btn btn-primary" type="button" id="report-button"
|
||||
@click.prevent="filter">Сформировать</button>
|
||||
<button class="btn btn-outline-secondary" type="button" id="report-button"
|
||||
@click.prevent="clearFilters">Очистить</button>
|
||||
</div>
|
||||
<ToolBar
|
||||
@add="showAddModal"
|
||||
@edit="showEditModal"
|
||||
@ -67,9 +41,5 @@ export default {
|
||||
:confirm="this.modal.confirm"
|
||||
v-model:visible="this.modalShow"
|
||||
@done="saveItem">
|
||||
<div class="mb-3">
|
||||
<label for="model" class="form-label">Модель</label>
|
||||
<input type="text" class="form-control" id="model" required v-model="data.modelName">
|
||||
</div>
|
||||
</Modal>
|
||||
</template>
|
@ -7,12 +7,14 @@ import Computers from './components/Computers.vue'
|
||||
import Monitors from './components/Monitors.vue'
|
||||
import Login from "./components/Login.vue";
|
||||
import Signup from "@/components/Signup.vue";
|
||||
import Users from "@/components/Users.vue";
|
||||
|
||||
const routes = [
|
||||
{ path: '/', redirect: '/cabinets' },
|
||||
{ path: '/cabinets', component: Cabinets, meta: { label: 'Кабинеты' } },
|
||||
{ path: '/computers', component: Computers, meta: { label: 'Компьютеры' } },
|
||||
{ path: '/monitors', component: Monitors, meta: { label: 'Мониторы' } },
|
||||
{ path: '/users', component: Users, meta: { label: 'Пользователи' } },
|
||||
{ path: '/login', component: Login},
|
||||
{ path: '/signup', component: Signup}
|
||||
]
|
||||
|
21
frontend/src/models/User.js
Normal file
21
frontend/src/models/User.js
Normal file
@ -0,0 +1,21 @@
|
||||
export default class Monitor {
|
||||
constructor(data) {
|
||||
this._id = data?.id;
|
||||
this._login = data?.login;
|
||||
}
|
||||
|
||||
get id() {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
get login() {
|
||||
return this._login;
|
||||
}
|
||||
|
||||
set login(value) {
|
||||
if (typeof value !== 'string' || value === null || value.length == 0) {
|
||||
throw 'New model name value ' + value + ' is not a string or empty';
|
||||
}
|
||||
this._login = value;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.kalyshev.yan.user.controller;
|
||||
|
||||
import com.kalyshev.yan.configuration.OpenAPI30Configuration;
|
||||
import com.kalyshev.yan.user.model.User;
|
||||
import com.kalyshev.yan.user.service.UserService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -17,7 +18,7 @@ public class UserController {
|
||||
public UserController(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
@GetMapping(URL_LOGIN)
|
||||
@GetMapping(OpenAPI30Configuration.API_PREFIX + "/user")
|
||||
public List<UserDto> getUsers() {
|
||||
return userService.findAllUsers().stream()
|
||||
.map(UserDto::new)
|
||||
|
Loading…
Reference in New Issue
Block a user