Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wiki
Manage
Activity
Members
Labels
Plan
Issues
53
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
MDM Lab
Wiki
Commits
fbe72252
Commit
fbe72252
authored
1 year ago
by
Remi PLANEL
Browse files
Options
Downloads
Patches
Plain Diff
fix issue with articles
parent
5e3e0541
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#127655
waiting for manual action with stages
in 6 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
components/content/ArticleDoi.vue
+7
-7
7 additions, 7 deletions
components/content/ArticleDoi.vue
composables/useFetchArticle.ts
+8
-3
8 additions, 3 deletions
composables/useFetchArticle.ts
pages/[...slug].vue
+0
-1
0 additions, 1 deletion
pages/[...slug].vue
with
15 additions
and
11 deletions
components/content/ArticleDoi.vue
+
7
−
7
View file @
fbe72252
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
useDisplay
}
from
"
vuetify
"
;
import
{
useDisplay
}
from
"
vuetify
"
;
import
type
{
WikiArticle
}
from
'
@/types/articles
'
;
import
type
{
WikiArticle
}
from
'
@/types/articles
'
;
import
{
useFetchArticle
}
from
"
../../composables/useFetchArticle
"
;
export
interface
Props
{
export
interface
Props
{
index
?:
number
;
index
?:
number
;
...
@@ -19,16 +20,15 @@ const props = withDefaults(defineProps<Props>(), {
...
@@ -19,16 +20,15 @@ const props = withDefaults(defineProps<Props>(), {
isRelevant
:
false
,
isRelevant
:
false
,
});
});
const
article
=
ref
<
WikiArticle
|
undefined
>
(
undefined
)
//
const article = ref
<
WikiArticle
|
undefined
>
(
undefined
)
const
{
mobile
}
=
useDisplay
();
const
{
mobile
}
=
useDisplay
();
const
show
=
ref
(
false
);
const
show
=
ref
(
false
);
onMounted
(()
=>
{
const
{
article
:
articleOnMounted
}
=
useFetchArticle
(
props
.
doi
);
const
{
article
}
=
useFetchArticle
(
props
.
doi
);
article
.
value
=
articleOnMounted
.
value
})
const
articleTitle
=
computed
(()
=>
{
const
articleTitle
=
computed
(()
=>
{
return
props
?.
title
??
article
?.
value
?.
title
??
props
.
doi
;
return
props
?.
title
??
article
?.
value
?.
title
??
props
.
doi
;
...
@@ -38,8 +38,8 @@ const articleAbstract = computed(() => {
...
@@ -38,8 +38,8 @@ const articleAbstract = computed(() => {
});
});
</
script
>
</
script
>
<
template
>
<
template
>
<v-list-item
:href=
"article?.href"
:id=
"`ref-$
{props.doi}`" :target="article?.target"
density="compact"
<v-list-item
v-if=
"article?.DOI"
:href=
"article?.href"
:id=
"`ref-$
{props.doi}`" :target="article?.target"
color="transparent" class="px-1">
density="compact"
color="transparent" class="px-1">
<template
v-if=
"!mobile"
#prepend
>
<template
v-if=
"!mobile"
#prepend
>
<v-icon
icon=
"md:star"
:color=
"props.isRelevant ? 'info' : 'transparent'"
></v-icon>
<v-icon
icon=
"md:star"
:color=
"props.isRelevant ? 'info' : 'transparent'"
></v-icon>
</
template
>
</
template
>
...
...
This diff is collapsed.
Click to expand it.
composables/useFetchArticle.ts
+
8
−
3
View file @
fbe72252
...
@@ -6,6 +6,7 @@ import type { SearchParams } from 'meilisearch'
...
@@ -6,6 +6,7 @@ import type { SearchParams } from 'meilisearch'
export
function
useFetchArticle
(
doi
:
string
=
""
)
{
export
function
useFetchArticle
(
doi
:
string
=
""
)
{
const
doiBaseUrl
=
ref
(
new
URL
(
"
https://doi.org/
"
));
const
doiBaseUrl
=
ref
(
new
URL
(
"
https://doi.org/
"
));
const
article
=
useSessionStorage
<
WikiArticle
|
undefined
>
(
doi
,
null
,
{
serializer
:
StorageSerializers
.
object
})
const
article
=
useSessionStorage
<
WikiArticle
|
undefined
>
(
doi
,
null
,
{
serializer
:
StorageSerializers
.
object
})
// const article = ref<WikiArticle | undefined>(null)
const
client
=
useMeiliSearchRef
()
const
client
=
useMeiliSearchRef
()
const
index
=
ref
(
"
article
"
)
const
index
=
ref
(
"
article
"
)
const
params
=
ref
<
SearchParams
>
({
const
params
=
ref
<
SearchParams
>
({
...
@@ -24,6 +25,7 @@ export function useFetchArticle(doi: string = "") {
...
@@ -24,6 +25,7 @@ export function useFetchArticle(doi: string = "") {
.
join
(
"
,
"
);
.
join
(
"
,
"
);
}
}
function
zoteroArticleToArticle
(
zoteroArticle
:
CslJson
):
WikiArticle
|
undefined
{
function
zoteroArticleToArticle
(
zoteroArticle
:
CslJson
):
WikiArticle
|
undefined
{
console
.
log
(
zoteroArticle
)
if
(
zoteroArticle
!=
undefined
)
{
if
(
zoteroArticle
!=
undefined
)
{
const
{
const
{
DOI
,
DOI
,
...
@@ -50,10 +52,13 @@ export function useFetchArticle(doi: string = "") {
...
@@ -50,10 +52,13 @@ export function useFetchArticle(doi: string = "") {
}
}
if
(
!
article
.
value
)
{
if
(
!
article
.
value
)
{
client
.
index
(
toValue
(
index
)).
search
<
CslJson
>
(
""
,
toValue
(
params
)).
then
((
response
)
=>
{
client
.
index
(
toValue
(
index
)).
search
<
CslJson
>
(
""
,
toValue
(
params
)).
then
((
data
)
=>
{
const
sanitizedData
=
zoteroArticleToArticle
(
response
.
hits
[
0
])
if
(
data
!==
undefined
&&
data
?.
hits
.
length
>=
1
)
{
article
.
value
=
sanitizedData
const
sanitizedData
=
zoteroArticleToArticle
(
data
.
hits
[
0
])
article
.
value
=
sanitizedData
}
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
error
)
article
.
value
=
{
DOI
:
doi
}
article
.
value
=
{
DOI
:
doi
}
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
pages/[...slug].vue
+
0
−
1
View file @
fbe72252
...
@@ -6,7 +6,6 @@ function resetError(error) {
...
@@ -6,7 +6,6 @@ function resetError(error) {
<
template
>
<
template
>
<v-card-text>
<v-card-text>
<NuxtErrorBoundary>
<NuxtErrorBoundary>
<!-- ... -->
<template
#error
="
{ error }">
<template
#error
="
{ error }">
<ErrorAlert
:error=
"error"
@
clear-error=
"resetError(error)"
></ErrorAlert>
<ErrorAlert
:error=
"error"
@
clear-error=
"resetError(error)"
></ErrorAlert>
</
template
>
</
template
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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