Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
subugoe
emo
TIDO
Commits
41e9596e
Commit
41e9596e
authored
Jul 19, 2021
by
dindigala
Browse files
feat: implementation of loading in annotation panel
parent
4edf4b8b
Pipeline
#213757
passed with stages
in 3 minutes and 32 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/App.vue
View file @
41e9596e
...
...
@@ -21,7 +21,7 @@
<q-page-container
class=
"root"
>
<router-view
:annotations=
"annotations"
:annotation-load
ing
=
"annotationLoad
ing
"
:annotation-load
ed
=
"annotationLoad
ed
"
:collection=
"collection"
:config=
"config"
:contenttypes=
"contentTypes"
...
...
@@ -54,7 +54,7 @@ export default {
data
()
{
return
{
annotations
:
[],
annotationLoad
ing
:
false
,
annotationLoad
ed
:
false
,
collection
:
{},
collectiontitle
:
''
,
config
:
{},
...
...
@@ -143,7 +143,7 @@ export default {
*/
async
getAnnotations
(
url
)
{
this
.
annotations
=
[];
this
.
annotationLoad
ing
=
false
;
this
.
annotationLoad
ed
=
false
;
try
{
const
annotations
=
await
this
.
request
(
url
);
...
...
@@ -163,7 +163,7 @@ export default {
}
catch
(
err
)
{
this
.
annotations
=
[];
}
finally
{
this
.
annotationLoad
ing
=
true
;
this
.
annotationLoad
ed
=
true
;
}
},
/**
...
...
src/components/annotations/annotations.vue
View file @
41e9596e
<
template
>
<div
class=
"item"
>
<div
class=
"item
relative-position
"
>
<q-tabs
v-model=
"currentTab"
active-color=
"$q.dark.isActive ? 'white' : 'accent'"
...
...
@@ -19,8 +19,13 @@
<AnnotationToggles
/>
<LoadingProgress
v-if=
"!annotationLoaded || isProcessing"
:loadingprogress=
"!annotationLoaded || isProcessing"
/>
<AnnotationList
v-if=
"currentAnnotations.length"
v-
else-
if=
"currentAnnotations.length
&& annotationLoaded && !isProcessing
"
class=
"custom-font"
:configured-annotations=
"currentAnnotations"
:get-icon=
"getIcon"
...
...
@@ -29,7 +34,7 @@
/>
<div
v-else
v-else
-if=
"annotationLoaded && !currentAnnotations.length && !isProcessing"
class=
"q-pa-sm"
>
<Notification
...
...
@@ -57,6 +62,7 @@ import AnnotationToggles from '@/components/annotations/toggles.vue';
import
AnnotationList
from
'
@/components/annotations/list.vue
'
;
import
AnnotationOptions
from
'
@/components/annotations/options.vue
'
;
import
LoadingProgress
from
'
@/components/loading.vue
'
;
import
Notification
from
'
@/components/notification.vue
'
;
export
default
{
...
...
@@ -65,6 +71,7 @@ export default {
AnnotationToggles
,
AnnotationList
,
AnnotationOptions
,
LoadingProgress
,
Notification
,
},
mixins
:
[
Annotation
],
...
...
@@ -73,7 +80,7 @@ export default {
type
:
Array
,
default
:
()
=>
[],
},
annotationLoad
ing
:
{
annotationLoad
ed
:
{
type
:
Boolean
,
default
:
false
,
},
...
...
@@ -85,13 +92,14 @@ export default {
data
()
{
return
{
configuredAnnotations
:
[],
currentTab
:
''
,
ids
:
[],
isProcessing
:
false
,
messages
:
{
none
:
'
noAnnotationMessage
'
,
},
selectedAll
:
false
,
selectedNone
:
true
,
currentTab
:
''
,
};
},
computed
:
{
...
...
@@ -139,14 +147,17 @@ export default {
},
},
mounted
()
{
this
.
$root
.
$on
(
'
update-annotations
'
,
(
content
)
=>
{
this
.
$root
.
$on
(
'
update-annotations
'
,
(
content
,
isProcessing
)
=>
{
this
.
isProcessing
=
!!
isProcessing
;
const
parser
=
new
DOMParser
();
const
doc
=
parser
.
parseFromString
(
content
,
'
text/html
'
);
this
.
ids
=
[...
doc
.
body
.
querySelectorAll
(
'
[id]
'
)].
map
((
el
)
=>
el
.
getAttribute
(
'
id
'
));
this
.
configuredAnnotations
=
[];
const
interval
=
setInterval
(()
=>
{
if
(
this
.
annotationLoad
ing
)
{
if
(
this
.
annotationLoad
ed
)
{
this
.
configuredAnnotations
=
this
.
filterAnnotationTypes
();
const
firstTab
=
this
.
annotationTabs
.
find
((
x
)
=>
x
.
type
.
length
)?.
key
||
''
;
...
...
@@ -155,7 +166,7 @@ export default {
this
.
currentTab
=
firstTab
;
clearInterval
(
interval
);
}
},
50
0
);
},
50
);
});
},
methods
:
{
...
...
src/components/content.vue
View file @
41e9596e
...
...
@@ -121,6 +121,8 @@ export default {
this
.
$refs
.
contentsize
.
style
.
fontSize
=
`
${
this
.
fontsize
}
px`
;
},
async
activeTab
(
url
)
{
this
.
$root
.
$emit
(
'
update-annotations
'
,
[],
true
);
const
data
=
await
this
.
request
(
url
,
'
text
'
);
if
(
this
.
supportType
)
{
...
...
@@ -129,7 +131,7 @@ export default {
this
.
content
=
data
;
this
.
$root
.
$emit
(
'
update-annotations
'
,
data
);
this
.
$root
.
$emit
(
'
update-annotations
'
,
data
,
false
);
},
},
async
created
()
{
...
...
src/components/loading.vue
0 → 100644
View file @
41e9596e
<
template
>
<q-inner-loading
:showing=
"loadingprogress"
>
<q-spinner
size=
"3em"
color=
"primary"
/>
</q-inner-loading>
</
template
>
<
script
>
export
default
{
name
:
'
LoadingProgress
'
,
props
:
{
loadingprogress
:
{
type
:
Boolean
,
},
textcontentprogress
:
{
type
:
Boolean
,
},
},
data
:
()
=>
({
}),
};
</
script
>
src/index.template.html
View file @
41e9596e
...
...
@@ -31,7 +31,7 @@
-->
<script
id=
"tido-config"
type=
"application/json"
>
{
"
entrypoint
"
:
""
,
"
entrypoint
"
:
"
https://ahikar-dev.sub.uni-goettingen.de/api/textapi/ahikar/arabic-karshuni/collection.json
"
,
"
annotations
"
:
{
"
show
"
:
true
,
"
types
"
:
[
...
...
src/views/mainview.vue
View file @
41e9596e
...
...
@@ -85,7 +85,7 @@ export default {
type
:
Array
,
default
:
()
=>
[],
},
annotationLoad
ing
:
{
annotationLoad
ed
:
{
type
:
Boolean
,
default
:
false
,
},
...
...
@@ -121,6 +121,9 @@ export default {
type
:
Object
,
default
:
()
=>
{},
},
loadingprogress
:
{
type
:
Boolean
,
},
manifests
:
{
type
:
Array
,
default
:
()
=>
[],
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment