Compare commits

...

17 Commits

Author SHA1 Message Date
26edf1d4b2 Improve SPA cacheing
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-11-06 18:35:05 +01:00
e7ff487aeb Merge pull request '"Problem melden"-Link korrigiert' (!78) from brain-patch-1 into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #78
2023-10-27 15:12:55 +02:00
c5bda80f11 Merge pull request 'Klarnamen in der Suche berücksichtigen' (!80) from zeitschlag/ki-frontend:feature/48-search-address-name into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #80
2023-10-27 15:12:06 +02:00
379ddaf5b9 Change placeholder (kompetenzinventar/ki-doku#48)
All checks were successful
continuous-integration/drone/pr Build is passing
2023-04-20 18:14:07 +02:00
13fb15e033 Fix link for new issues 2022-07-20 18:26:39 +02:00
aaa0883692 Merge pull request 'add tag trigger' (!77) from feature/tag-trigger into main
All checks were successful
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is passing
Reviewed-on: #77
2022-02-28 19:32:33 +01:00
e404bef2a9 add tag trigger
All checks were successful
continuous-integration/drone/push Build is passing
2022-02-28 19:32:04 +01:00
cbbcfd0f37 Merge pull request 'add address.name to frontend' (!76) from feature/realname into main
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
Reviewed-on: #76
2022-01-26 22:03:08 +01:00
5c5f157a77 add address.name to frontend
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-25 21:04:17 +01:00
3017c001b2 Merge pull request 'Paginierung' (!74) from feature/pagination into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #74
2022-01-24 19:46:59 +01:00
fefe9a034d Merge pull request 'Aktualisierung NPM Pakete' (!75) from fix/npm-update into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #75
2022-01-24 19:11:50 +01:00
bac8731e17 add pagination
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2022-01-23 20:14:52 +01:00
dc883ac302 update npm packages
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-23 19:56:14 +01:00
16feb41f8a kompetenzinventar/ki-doku#18 line-break new text (!72)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: scammo <samuel.brinkmann@googlemail.com>
Reviewed-on: #72
Reviewed-by: weeman <weeman@noreply.git.wtf-eg.de>
Co-authored-by: scammo <scammo@noreply.git.wtf-eg.de>
Co-committed-by: scammo <scammo@noreply.git.wtf-eg.de>
2022-01-17 14:44:13 +01:00
04cb8a7217 Merge pull request '#64 "Ich Suche" besser definiert' (#71) from profile-page into main
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #71
2022-01-14 13:10:10 +01:00
e3115f9944 Merge branch 'main' into profile-page
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2022-01-14 13:09:46 +01:00
122b13b6a2 #64 ich besser definiert
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-14 12:53:23 +01:00
11 changed files with 8101 additions and 6594 deletions

View File

@ -9,6 +9,7 @@ name: default
steps: steps:
- name: reuse - name: reuse
image: fsfe/reuse:latest image: fsfe/reuse:latest
- name: docker-publish - name: docker-publish
image: plugins/docker image: plugins/docker
settings: settings:
@ -21,5 +22,22 @@ steps:
password: password:
from_secret: "docker_password" from_secret: "docker_password"
when: when:
event:
- push
branch: branch:
- main - main
- name: docker-publish-tag
image: plugins/docker
settings:
registry: registry.wtf-eg.net
repo: registry.wtf-eg.net/ki-frontend
target: ki-frontend
auto_tag: true
username:
from_secret: "docker_username"
password:
from_secret: "docker_password"
when:
event:
- tag

View File

@ -9,10 +9,24 @@ server {
#access_log /var/log/nginx/host.access.log main; #access_log /var/log/nginx/host.access.log main;
root /usr/share/nginx/html;
# routes without dots serve the index.html without caching
location / { location / {
root /usr/share/nginx/html; add_header Cache-Control "no-cache";
index index.html index.htm; try_files $uri $uri/index.html /index.html;
try_files $uri $uri/ /index.html; }
# static js and css files that get replaced instead of updated
location ~ \.(js|css) {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}
# cache other static files for 30 days
location ~ \.(?!html) {
add_header Cache-Control "public, max-age=2592000";
try_files $uri =404;
} }
#error_page 404 /404.html; #error_page 404 /404.html;

14478
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,10 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-babel": "^4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-plugin-eslint": "^4.5.0",
"@vue/cli-plugin-router": "~4.5.0", "@vue/cli-plugin-router": "^4.5.0",
"@vue/cli-service": "~4.5.0", "@vue/cli-service": "^4.5.0",
"@vue/compiler-sfc": "^3.0.0", "@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"bootstrap": "^5.0.1", "bootstrap": "^5.0.1",

View File

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<div class="fw-bold text-white mb-2">Kompetenzinventar</div> <div class="fw-bold text-white mb-2">Kompetenzinventar</div>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li><a href="https://git.wtf-eg.de/kompetenzinventar">Quellcode</a></li> <li><a href="https://git.wtf-eg.de/kompetenzinventar">Quellcode</a></li>
<li><a href="https://git.wtf-eg.de/kompetenzinventar/ki-frontend/issues/new">Problem melden</a></li> <li><a href="https://git.wtf-eg.de/kompetenzinventar/ki-doku/issues/new/choose">Problem melden</a></li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -0,0 +1,49 @@
<!--
SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<ul class="pagination">
<li
class="page-item"
:class="{ active: page === current }"
v-for="page in pages"
:key="page"
>
<span
class="page-link pointer"
@click="onPageClicked(page)"
>
{{ page }}
</span>
</li>
</ul>
</template>
<script>
export default {
name: 'Paginator',
props: {
page: Number,
current: Number,
pages: Number
},
methods: {
onPageClicked(page) {
if (page == this.current) {
return
}
this.$emit('page', page)
}
}
}
</script>
<style>
.pointer {
cursor: pointer;
}
</style>

View File

@ -16,6 +16,14 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</span> </span>
</div> </div>
</div> </div>
<div v-if="profile?.address?.name">
<div class="d-flex align-items-center">
<i class="fs-4 bi bi-person-fill text-dark mx-2"></i>
<div class="text-white">
a.k.a. {{ profile.address.name }}
</div>
</div>
</div>
<div v-if="location"> <div v-if="location">
<div class="d-flex align-items-center"> <div class="d-flex align-items-center">
<i class="fs-4 bi bi-geo-alt-fill text-dark mx-2"></i> <i class="fs-4 bi bi-geo-alt-fill text-dark mx-2"></i>

View File

@ -12,8 +12,10 @@ export default {
profiles: [], profiles: [],
error: false, error: false,
errorMessage: '', errorMessage: '',
pages: 1,
query: { query: {
search: '' search: '',
page: 1
} }
} }
}, },
@ -40,11 +42,17 @@ export default {
state.errorMessage = errorMessage state.errorMessage = errorMessage
}, },
setQuerySearch(state, search) { setQuerySearch(state, search) {
state.query.search = search state.query = {...state.query, search}
},
setPages(state, pages) {
state.pages = pages
},
setQueryPage(state, page) {
state.query = {...state.query, page}
} }
}, },
actions: { actions: {
async search({state, commit, rootState}) { async search({state, commit, rootState, dispatch}) {
if (state.searching) { if (state.searching) {
return return
} }
@ -60,11 +68,13 @@ export default {
commit('setErrorMessage', '') commit('setErrorMessage', '')
const url = new URL(`${window.ki.apiUrl}/users/profiles`) const url = new URL(`${window.ki.apiUrl}/users/profiles`)
if (state.query.search) { if (state.query.search) {
url.searchParams.append('search', state.query.search) url.searchParams.append('search', state.query.search)
} }
url.searchParams.append('page', state.query.page)
const headers = { const headers = {
Authorization: `Bearer ${rootState.token}`, Authorization: `Bearer ${rootState.token}`,
} }
@ -81,8 +91,19 @@ export default {
return return
} }
console.log(response.ok)
console.log(response.status)
console.log(state.query.page)
clearTimeout(timeoutId) clearTimeout(timeoutId)
if (!response.ok && response.status === 404 && state.query.page != 1) {
commit('setQueryPage', 1)
commit('setSearching', false)
await dispatch('search')
return
}
if (!response.ok) { if (!response.ok) {
commit('setError', true) commit('setError', true)
commit('clearProfiles') commit('clearProfiles')
@ -93,6 +114,7 @@ export default {
const responseData = await response.json() const responseData = await response.json()
commit('setProfiles', responseData.profiles) commit('setProfiles', responseData.profiles)
commit('setPages', responseData.pages)
commit('setSearching', false) commit('setSearching', false)
commit('hideSpinner') commit('hideSpinner')
} }

View File

@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
class="form-control" class="form-control"
id="searchText" id="searchText"
v-model="searchText" v-model="searchText"
placeholder="Nick, Fähigkeit, Sprache" placeholder="Nick, Name, Fähigkeit, Sprache"
ref="searchTextInput" ref="searchTextInput"
/> />
</div> </div>
@ -53,12 +53,26 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<p v-if="searchText !== ''">Probiere eine andere Suche.</p> <p v-if="searchText !== ''">Probiere eine andere Suche.</p>
</div> </div>
<div v-else-if="showResults"> <div v-else-if="showResults">
<div class="d-flex justify-content-around">
<Paginator
:pages="pages"
:current="currentPage"
@page="handlePageSelected"
/>
</div>
<SearchResult <SearchResult
v-for="profile in profiles" v-for="profile in profiles"
:key="profile.user_id" :key="profile.user_id"
class="mb-3" class="mb-3"
:profile="profile" :profile="profile"
/> />
<div class="d-flex justify-content-around">
<Paginator
:pages="pages"
:current="currentPage"
@page="handlePageSelected"
/>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -67,21 +81,29 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Paginator from '@/components/Paginator'
import SearchResult from '@/components/SearchResult' import SearchResult from '@/components/SearchResult'
import Spinner from '@/components/Spinner' import Spinner from '@/components/Spinner'
export default { export default {
name: 'Search', name: 'Search',
components: { components: {
Paginator,
SearchResult, SearchResult,
Spinner, Spinner,
}, },
data() {
return {
textChanged: false
}
},
computed: { computed: {
...mapState({ ...mapState({
searching: state => state.search.searching, searching: state => state.search.searching,
profiles: state => state.search.profiles, profiles: state => state.search.profiles,
error: state => state.search.error, error: state => state.search.error,
showSpinner: state => state.search.showSpinner, showSpinner: state => state.search.showSpinner,
pages: state => state.search.pages,
}), }),
searchText: { searchText: {
get() { get() {
@ -89,6 +111,15 @@ export default {
}, },
set(text) { set(text) {
this.$store.commit('search/setQuerySearch', text) this.$store.commit('search/setQuerySearch', text)
this.textChanged = true
}
},
currentPage: {
get() {
return this.$store.state.search.query.page
},
set(page) {
this.$store.commit('search/setQueryPage', page)
} }
}, },
showNoResults() { showNoResults() {
@ -109,21 +140,37 @@ export default {
}, },
methods: { methods: {
handleSubmit() { handleSubmit() {
this.$router.push({ query: { query: this.searchText }}) if (this.textChanged === true) {
this.$store.commit('search/setQueryPage', 1)
}
this.pushState()
this.$store.dispatch('search/search') this.$store.dispatch('search/search')
}, },
focusSearchText() { focusSearchText() {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.searchTextInput.focus() this.$refs.searchTextInput.focus()
}) })
},
handlePageSelected(page) {
this.currentPage = page
this.pushState()
this.$store.dispatch('search/search')
},
pushState() {
this.$router.push({ query: { query: this.searchText, page: this.currentPage }})
} }
}, },
created() { created() {
if (this.$route.query.query !== undefined) { if (this.$route.query.query) {
this.searchText = this.$route.query.query this.searchText = this.$route.query.query
this.$store.commit('search/clearProfiles') this.$store.commit('search/clearProfiles')
} }
if (this.$route.query.page) {
this.currentPage = parseInt(this.$route.query.page, 10)
this.$store.commit('search/clearProfiles')
}
this.$store.dispatch('search/search') this.$store.dispatch('search/search')
} }
}; };

View File

@ -32,7 +32,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</div> </div>
<div class="row mb-4"> <div class="row mb-4">
<div class="col-6 mb-3"> <div class="col-12 col-md-4 mb-3 mb-md-0">
<label class="form-label">Nickname</label> <label class="form-label">Nickname</label>
<input <input
type="text" type="text"
@ -43,7 +43,17 @@ SPDX-License-Identifier: AGPL-3.0-or-later
required required
/> />
</div> </div>
<div class="col-6 mb-3"> <div class="col-12 col-md-4 mb-3 mb-md-0">
<label class="form-label">Klarname (optional)</label>
<input
type="text"
class="form-control"
id="realname"
maxlength="25"
v-model="profile.address.name"
/>
</div>
<div class="col-12 col-md-4">
<label class="form-label"> <label class="form-label">
Pronomen Pronomen
<i class="bi bi-info-circle" v-tooltip="pronounsTooltip"></i> <i class="bi bi-info-circle" v-tooltip="pronounsTooltip"></i>
@ -115,11 +125,11 @@ SPDX-License-Identifier: AGPL-3.0-or-later
</template> </template>
</Section> </Section>
<Section title="Ich suche"> <Section title="Ich suche für mich Projekte/Aufträge in folgenden Bereichen">
<template v-slot:card-body> <template v-slot:card-body>
<auto-complete <auto-complete
type="skill" type="skill"
label="Ich suche" label="Ich suche für mich Projekte/Aufträge in folgenden Bereichen"
:values="profile.searchtopics" :values="profile.searchtopics"
:showSecondary="false" :showSecondary="false"
placeholder="z.B. Python, JavaScript, Linux" placeholder="z.B. Python, JavaScript, Linux"

View File

@ -31,7 +31,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<Section <Section
v-if="profile.searchtopics && profile.searchtopics.length > 0" v-if="profile.searchtopics && profile.searchtopics.length > 0"
title="Das suche ich"> title="Ich suche für mich Projekte/Aufträge in folgenden Bereichen">
<div style="margin-bottom: -.5rem;"> <div style="margin-bottom: -.5rem;">
<Skill <Skill
class="me-2 mb-2" class="me-2 mb-2"
@ -75,7 +75,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
<label class="form-label fw-bold"> <label class="form-label fw-bold">
Anmerkungen Anmerkungen
</label> </label>
<div>{{ profile.availability_text }}</div> <div class="line-break-text">{{ profile.availability_text }}</div>
</div> </div>
</Section> </Section>
@ -98,11 +98,11 @@ SPDX-License-Identifier: AGPL-3.0-or-later
title="Sonstiges"> title="Sonstiges">
<div v-if="profile.freetext" :class="{ 'lh-base': true, 'mb-4': profile.volunteerwork }"> <div v-if="profile.freetext" :class="{ 'lh-base': true, 'mb-4': profile.volunteerwork }">
<h5>Über mich</h5> <h5>Über mich</h5>
{{ profile.freetext }} <div class="line-break-text">{{ profile.freetext }}</div>
</div> </div>
<div v-if="profile.volunteerwork" class="lh-base"> <div v-if="profile.volunteerwork" class="lh-base">
<h5>Ehrenamtliche Arbeit</h5> <h5>Ehrenamtliche Arbeit</h5>
{{ profile.volunteerwork }} <div class="line-break-text">{{ profile.volunteerwork }}</div>
</div> </div>
</Section> </Section>
</template> </template>
@ -154,4 +154,7 @@ export default {
</script> </script>
<style> <style>
.line-break-text{
white-space: pre-line;
}
</style> </style>