Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ECorpus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pirvi-public
ECorpus
Commits
cd47c348
Commit
cd47c348
authored
1 year ago
by
Sebastien Dumetz
Committed by
Sebastien DUMETZ
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
sort list again on update in <corpus-list> component (#46)
parent
ac8cb5e4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/ui/screens/List.ts
+12
-7
12 additions, 7 deletions
source/ui/screens/List.ts
with
12 additions
and
7 deletions
source/ui/screens/List.ts
+
12
−
7
View file @
cd47c348
...
@@ -38,6 +38,9 @@ interface Upload{
...
@@ -38,6 +38,9 @@ interface Upload{
@
property
({
type
:
Array
,
attribute
:
false
})
@
property
({
type
:
Array
,
attribute
:
false
})
selection
=
[];
selection
=
[];
@
property
({
type
:
Function
,
attribute
:
false
})
sort
:
Parameters
<
typeof
Array
.
prototype
.
sort
>
[
0
];
get
isUser
(){
get
isUser
(){
return
(
this
.
user
&&
!
this
.
user
.
isDefaultUser
);
return
(
this
.
user
&&
!
this
.
user
.
isDefaultUser
);
}
}
...
@@ -127,12 +130,14 @@ interface Upload{
...
@@ -127,12 +130,14 @@ interface Upload{
if
(
!
this
.
isUser
){
if
(
!
this
.
isUser
){
return
html
`<landing-page></landing-page>`
;
return
html
`<landing-page></landing-page>`
;
}
}
let
mode
=
(
this
.
user
?
"
write
"
:
"
read
"
)
let
mode
=
(
this
.
user
?
"
write
"
:
"
read
"
)
;
if
(
!
this
.
list
){
if
(
!
this
.
list
){
return
html
`<div style="margin-top:10vh"><sv-spinner visible/></div>`
;
return
html
`<div style="margin-top:10vh"><sv-spinner visible/></div>`
;
}
}
let
orderTypes
=
[
"
alphabet
"
,
"
ctime
"
,
"
mtime
"
]
let
orderTypes
=
[
"
alphabet
"
,
"
ctime
"
,
"
mtime
"
];
let
sortedList
=
this
.
list
.
sort
(
this
.
sort
);
return
html
`
return
html
`
<div class="toolbar">
<div class="toolbar">
...
@@ -169,11 +174,11 @@ interface Upload{
...
@@ -169,11 +174,11 @@ interface Upload{
</div>
</div>
<div class="section" style="width:100%">
<div class="section" style="width:100%">
${(
this
.
l
ist
.
length
==
0
&&
Object
.
keys
(
this
.
uploads
).
length
==
0
)?
${(
sortedL
ist
.
length
==
0
&&
Object
.
keys
(
this
.
uploads
).
length
==
0
)?
html
`<h4>No scenes available</h1>`
:
html
`<h4>No scenes available</h1>`
:
repeat
([
repeat
([
...
Object
.
keys
(
this
.
uploads
).
map
(
name
=>
({
name
})),
...
Object
.
keys
(
this
.
uploads
).
map
(
name
=>
({
name
})),
...
this
.
l
ist
,
...
sortedL
ist
,
],({
name
})
=>
name
,
(
scene
)
=>
this
.
renderScene
(
mode
,
scene
))
],({
name
})
=>
name
,
(
scene
)
=>
this
.
renderScene
(
mode
,
scene
))
}
}
${
this
.
dragover
?
html
`<div class="drag-overlay">Drop item here</div>`
:
""
}
${
this
.
dragover
?
html
`<div class="drag-overlay">Drop item here</div>`
:
""
}
...
@@ -229,9 +234,9 @@ interface Upload{
...
@@ -229,9 +234,9 @@ interface Upload{
onSelectOrder
=
(
ev
)
=>
{
onSelectOrder
=
(
ev
)
=>
{
let
value
=
ev
.
target
.
value
;
let
value
=
ev
.
target
.
value
;
if
(
value
==
"
alphabet
"
)
this
.
list
.
sort
(
(
a
,
b
)
=>
a
.
name
.
localeCompare
(
b
.
name
)
)
;
if
(
value
==
"
alphabet
"
)
this
.
sort
=
(
a
,
b
)
=>
a
.
name
.
localeCompare
(
b
.
name
);
if
(
value
==
"
ctime
"
)
this
.
list
.
sort
(
(
a
,
b
)
=>
new
Date
(
b
.
ctime
).
valueOf
()
-
new
Date
(
a
.
ctime
).
valueOf
()
)
;
if
(
value
==
"
ctime
"
)
this
.
sort
=
(
a
,
b
)
=>
new
Date
(
b
.
ctime
).
valueOf
()
-
new
Date
(
a
.
ctime
).
valueOf
();
if
(
value
==
"
mtime
"
)
this
.
list
.
sort
(
(
a
,
b
)
=>
new
Date
(
b
.
mtime
).
valueOf
()
-
new
Date
(
a
.
mtime
).
valueOf
()
)
;
if
(
value
==
"
mtime
"
)
this
.
sort
=
(
a
,
b
)
=>
new
Date
(
b
.
mtime
).
valueOf
()
-
new
Date
(
a
.
mtime
).
valueOf
();
this
.
requestUpdate
();
this
.
requestUpdate
();
}
}
...
...
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