Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Environments
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
subugoe
ahiqar
Website
Commits
f7b586de
Commit
f7b586de
authored
3 years ago
by
Paul Pestov
Browse files
Options
Downloads
Patches
Plain Diff
feat: add landing message to search page
parent
71f8d73f
No related branches found
No related tags found
1 merge request
!70
feat: add landing message to search page
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/.vuepress/components/SearchPage.vue
+33
-10
33 additions, 10 deletions
src/.vuepress/components/SearchPage.vue
src/.vuepress/components/SearchResultList.vue
+0
-15
0 additions, 15 deletions
src/.vuepress/components/SearchResultList.vue
with
33 additions
and
25 deletions
src/.vuepress/components/SearchPage.vue
+
33
−
10
View file @
f7b586de
...
@@ -12,10 +12,23 @@
...
@@ -12,10 +12,23 @@
<code
class=
"font-weight-black"
>
{{
distinctManuscripts
}}
</code>
{{
'
Manuscript
'
|
numerus
(
distinctManuscripts
)
}}
.
<code
class=
"font-weight-black"
>
{{
distinctManuscripts
}}
</code>
{{
'
Manuscript
'
|
numerus
(
distinctManuscripts
)
}}
.
</p>
</p>
<v-alert
v-if=
"showPlaceholder"
border=
"left"
colored-border
color=
"secondary accent-4"
elevation=
"1"
>
<!-- TODO: provide translation -->
Please use the form above to enter a and search for a term of your choice.
</v-alert>
<SearchResultEmpty
v-if=
"showNoResult"
:message=
"message"
/>
<div
<div
v-if=
"loading"
v-if=
"loading"
class=
"loading-wrapper py-10"
class=
"loading-wrapper py-10"
>
>
<v-progress-circular
<v-progress-circular
color=
"primary"
color=
"primary"
indeterminate
indeterminate
...
@@ -67,6 +80,8 @@ export default {
...
@@ -67,6 +80,8 @@ export default {
query
:
null
,
query
:
null
,
size
:
20
,
size
:
20
,
total
:
0
,
total
:
0
,
showPlaceholder
:
false
,
showNoResult
:
false
,
};
};
},
},
watch
:{
watch
:{
...
@@ -80,6 +95,8 @@ export default {
...
@@ -80,6 +95,8 @@ export default {
mounted
(){
mounted
(){
if
(
this
.
$route
.
query
?.
searchTerm
)
{
if
(
this
.
$route
.
query
?.
searchTerm
)
{
this
.
onSearchInput
(
this
.
$route
.
query
.
searchTerm
);
this
.
onSearchInput
(
this
.
$route
.
query
.
searchTerm
);
}
else
{
this
.
showPlaceholder
=
true
;
}
}
},
},
computed
:
{
computed
:
{
...
@@ -103,21 +120,21 @@ export default {
...
@@ -103,21 +120,21 @@ export default {
onSearchInput
(
query
)
{
onSearchInput
(
query
)
{
this
.
query
=
query
;
this
.
query
=
query
;
this
.
page
=
1
;
this
.
page
=
1
;
this
.
resetList
();
this
.
showPlaceholder
=
false
;
this
.
showNoResult
=
false
;
this
.
search
(
this
.
query
.
trim
(),
0
,
this
.
size
);
this
.
search
(
this
.
query
.
trim
(),
0
,
this
.
size
);
if
(
this
.
$route
.
query
.
searchTerm
!==
query
)
{
if
(
this
.
$route
.
query
.
searchTerm
!==
query
)
{
this
.
$router
.
push
({
query
:
{
...
this
.
$route
.
query
,
searchTerm
:
query
}
});
this
.
$router
.
push
({
query
:
{
...
this
.
$route
.
query
,
searchTerm
:
query
}
});
}
;
}
},
},
async
search
(
value
,
from
,
size
)
{
async
search
(
value
,
from
,
size
)
{
this
.
hitCounter
=
from
+
1
;
this
.
hitCounter
=
from
+
1
;
try
{
try
{
this
.
items
=
[];
this
.
total
=
0
;
this
.
distinctSheets
=
0
;
this
.
loading
=
true
;
this
.
loading
=
true
;
const
searchResponse
=
await
apiService
.
search
(
value
,
from
,
size
);
const
searchResponse
=
await
apiService
.
search
(
value
,
from
,
size
);
...
@@ -132,13 +149,14 @@ export default {
...
@@ -132,13 +149,14 @@ export default {
this
.
total
=
searchResponse
.
hits
?.
total
?.
matches
||
0
;
this
.
total
=
searchResponse
.
hits
?.
total
?.
matches
||
0
;
}
}
// Toggle no result message on top of result list
this
.
showNoResult
=
this
.
total
===
0
;
// TODO: make string translable
// TODO: make string translable
if
(
!
this
.
invalid
)
this
.
message
=
`No search results found for <code>
${
this
.
query
}
</code>.`
;
if
(
!
this
.
invalid
)
this
.
message
=
`No search results found for <code>
${
this
.
query
}
</code>.`
;
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
items
=
[];
this
.
resetList
();
this
.
distinctSheets
=
0
;
this
.
showNoResult
=
true
;
this
.
total
=
0
;
this
.
message
=
'
Please enter a valid search term.
'
;
this
.
message
=
'
Please enter a valid search term.
'
;
}
finally
{
}
finally
{
this
.
loading
=
false
;
this
.
loading
=
false
;
...
@@ -151,6 +169,11 @@ export default {
...
@@ -151,6 +169,11 @@ export default {
behavior
:
'
smooth
'
,
behavior
:
'
smooth
'
,
});
});
},
},
resetList
()
{
this
.
items
=
[];
this
.
distinctSheets
=
0
;
this
.
total
=
0
;
}
},
},
};
};
</
script
>
</
script
>
...
...
This diff is collapsed.
Click to expand it.
src/.vuepress/components/SearchResultList.vue
+
0
−
15
View file @
f7b586de
...
@@ -27,8 +27,6 @@
...
@@ -27,8 +27,6 @@
</v-list-item-content>
</v-list-item-content>
</v-list-item>
</v-list-item>
</v-list>
</v-list>
<SearchResultEmpty
:message=
"message"
v-else-if=
"query !== null"
/>
</div>
</div>
</
template
>
</
template
>
...
@@ -47,11 +45,6 @@ export default {
...
@@ -47,11 +45,6 @@ export default {
mixins
:
[
mixins
:
[
pathUrl
,
pathUrl
,
],
],
computed
:
{
viewerBaseUrl
()
{
return
process
.
env
.
VUE_APP_BASE_URL_VIEWER
;
},
},
props
:
{
props
:
{
hitCounter
:
{
hitCounter
:
{
type
:
Number
,
type
:
Number
,
...
@@ -61,14 +54,6 @@ export default {
...
@@ -61,14 +54,6 @@ export default {
type
:
Array
,
type
:
Array
,
default
:
()
=>
[],
default
:
()
=>
[],
},
},
message
:
{
type
:
String
,
default
:
()
=>
''
,
},
query
:
{
type
:
String
,
default
:
()
=>
null
,
},
},
},
computed
:
{
computed
:
{
viewerBaseUrl
()
{
viewerBaseUrl
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment