From c7bb3d470433e1722212d3819cf3676fe4c0c155 Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Wed, 13 Aug 2025 07:48:26 +0000
Subject: [PATCH] update settings
---
vue/src/pages/Users.vue | 72 +++++++++++++++++++++++++++++++----
1 files changed, 63 insertions(+), 9 deletions(-)
diff --git a/vue/src/pages/Users.vue b/vue/src/pages/Users.vue
index 80b010e..6d7ff13 100644
--- a/vue/src/pages/Users.vue
+++ b/vue/src/pages/Users.vue
@@ -3,9 +3,11 @@
import {onMounted, reactive, ref} from "vue"
import {useRoute} from "vue-router"
import Pagination from "../components/Pagination.vue"
-import {getUsers, routerBase} from "@/lib/api"
+import {getUsers, routerBase, searchUsers} from "@/lib/api"
import {useRouteQuery} from '@vueuse/router'
-import {onKeyStroke} from "@vueuse/core"
+import {onKeyStroke, useDebounceFn} from "@vueuse/core"
+
+document.title = `Users | globus-ilias-rest`
const route = useRoute()
const userId = route.params.userId
@@ -16,15 +18,34 @@
data: [],
})
const offset = useRouteQuery("offset", 0, {transform: Number})
-const limit = 24
+const limit = 22
const error = ref(null)
-onMounted(() => init(offset.value))
+onMounted(() => init(offset.value, search.value))
+
+/////// SEARCH ////////////////////////////////////////////////////////////////
+
+const search = useRouteQuery("search", "",)// {transform: s => s.trim()})
+async function _doSearch (asearch) {
+ console.log("doSEarch", asearch)
+ // return init(0, asearch)
+ // TODO offset muss zurückgesetzt werden wenn die Suche neu ist
+ // search.value = asearch
+ return init(0, asearch)
+ // return init(offset.value, asearch)
+}
+const doSearch = useDebounceFn(_doSearch, 333)
+
+function resetSearch () {
+ search.value = ''
+ init(0, "")
+}
/////////////////////////////////////////////////////////////////////////
-async function init (noffset = 0) {
- const data = await getUsers(noffset, limit)
+async function init (noffset = 0, search) {
+ console.log(">>> INIT", noffset, search)
+ const data = await getUsers(noffset, limit, search)
console.log(data)
Object.assign(users, data)
offset.value = noffset
@@ -32,8 +53,9 @@
function go (offset) {
console.log("go to offset", offset)
- return init(offset)
+ return init(offset, search.value)
}
+
</script>
@@ -51,7 +73,16 @@
<div class="users">
- <Pagination :offset="users.offset" :limit="users.limit" :total="users.total" @go="go" />
+ <div class="users-header">
+ <div class="search">
+ Search
+ <input @keyup="doSearch(search)" v-model="search" type="text" size="30">
+ <button type="button" @click="resetSearch">
+ <div style="transform:scale(1.4); font-weight: bold;">×</div>
+ </button>
+ </div>
+ <Pagination :offset="users.offset" :limit="users.limit" :total="users.total" :current="users.data.length" @go="go" />
+ </div>
<table class="w100p">
<thead>
@@ -90,6 +121,29 @@
</template>
-<style scoped>
+<style scoped lang="stylus">
+
+.users-header
+ display flex;
+ align-items center
+ justify-content space-around
+ margin-bottom 1em;
+ margin-top -.5em;
+ border 1px dotted #ccc
+ background-color #eee;
+
+.search
+ display flex;
+ gap .33em
+ align-items center;
+ button
+ display flex;
+ //background-color blue
+ align-items stretch
+ display grid
+ grid-template-columns 1fr
+ padding 0
+ min-width 1.33em
+ cursor pointer;
</style>
--
Gitblit v1.8.0