Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nomad-FAIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nomad-lab
nomad-FAIR
Commits
43fc9674
Commit
43fc9674
authored
2 years ago
by
David Sikter
Browse files
Options
Downloads
Patches
Plain Diff
Added test case and improved var names
parent
ccefa053
No related branches found
No related tags found
No related merge requests found
Pipeline
#141081
failed
2 years ago
Stage: build
Stage: test
Stage: deploy
Stage: release
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gui/src/components/DataStore.js
+31
-31
31 additions, 31 deletions
gui/src/components/DataStore.js
gui/src/components/entry/ArchiveEntryView.spec.js
+18
-0
18 additions, 0 deletions
gui/src/components/entry/ArchiveEntryView.spec.js
with
49 additions
and
31 deletions
gui/src/components/DataStore.js
+
31
−
31
View file @
43fc9674
...
@@ -605,8 +605,8 @@ function entryRefreshSatisfiesOptions(entryStoreObj, requireMetadata, requireArc
...
@@ -605,8 +605,8 @@ function entryRefreshSatisfiesOptions(entryStoreObj, requireMetadata, requireArc
}
}
/**
/**
* Merges two archive data filters f
1, f
2, returning a filter which will fetch all data
* Merges two archive data filters
,
f
ilter1 and filter
2, returning a filter which will fetch all data
* fetched by either f1 or f2.
* fetched by either f
ilter
1 or f
ilter
2.
* Note, this method only handles certain simple types of filters, used by the gui.
* Note, this method only handles certain simple types of filters, used by the gui.
* Each filter can either have the value
* Each filter can either have the value
* 1) undefined (meaning include nothing)
* 1) undefined (meaning include nothing)
...
@@ -615,48 +615,48 @@ function entryRefreshSatisfiesOptions(entryStoreObj, requireMetadata, requireArc
...
@@ -615,48 +615,48 @@ function entryRefreshSatisfiesOptions(entryStoreObj, requireMetadata, requireArc
* 4) an object with subkeys (will be treated recursively)
* 4) an object with subkeys (will be treated recursively)
* The `resolve-inplace` option should not be specified (it will be implicitly set to false).
* The `resolve-inplace` option should not be specified (it will be implicitly set to false).
*/
*/
function
mergeArchiveFilter
(
f
1
,
f
2
,
level
=
0
)
{
function
mergeArchiveFilter
(
f
ilter1
,
filter
2
,
level
=
0
)
{
if
(
f1
===
f2
)
return
f1
if
(
f
ilter
1
===
f
ilter
2
)
return
f
ilter
1
if
(
f1
===
undefined
)
return
f2
if
(
f
ilter
1
===
undefined
)
return
f
ilter
2
if
(
f2
===
undefined
)
return
f1
if
(
f
ilter
2
===
undefined
)
return
f
ilter
1
if
(
f1
===
'
include-resolved
'
||
f2
===
'
include-resolved
'
)
return
'
include-resolved
'
if
(
f
ilter
1
===
'
include-resolved
'
||
f
ilter
2
===
'
include-resolved
'
)
return
'
include-resolved
'
const
obj1
=
typeof
f1
===
'
object
'
const
obj1
=
typeof
f
ilter
1
===
'
object
'
const
obj2
=
typeof
f2
===
'
object
'
const
obj2
=
typeof
f
ilter
2
===
'
object
'
if
(
f1
===
'
*
'
&&
obj2
)
return
level
!==
0
&&
hasIncludeResolved
(
f2
)
?
'
include-resolved
'
:
'
*
'
if
(
f
ilter
1
===
'
*
'
&&
obj2
)
return
level
!==
0
&&
hasIncludeResolved
(
f
ilter
2
)
?
'
include-resolved
'
:
'
*
'
if
(
f2
===
'
*
'
&&
obj1
)
return
level
!==
0
&&
hasIncludeResolved
(
f1
)
?
'
include-resolved
'
:
'
*
'
if
(
f
ilter
2
===
'
*
'
&&
obj1
)
return
level
!==
0
&&
hasIncludeResolved
(
f
ilter
1
)
?
'
include-resolved
'
:
'
*
'
if
(
!
obj1
||
!
obj2
)
throw
new
Error
(
'
Cannot merge filters: bad values
'
)
if
(
!
obj1
||
!
obj2
)
throw
new
Error
(
'
Cannot merge filters: bad values
'
)
// Two objects. Inspect recursively.
// Two objects. Inspect recursively.
const
rv
=
{}
const
rv
=
{}
for
(
const
key
in
{...
f1
,
...
f2
})
{
for
(
const
key
in
{...
f
ilter
1
,
...
f
ilter
2
})
{
const
v1
=
f1
[
key
]
const
v
alue
1
=
f
ilter
1
[
key
]
const
v2
=
f2
[
key
]
const
v
alue
2
=
f
ilter
2
[
key
]
rv
[
key
]
=
mergeArchiveFilter
(
v
1
,
v
2
,
level
+
1
)
rv
[
key
]
=
mergeArchiveFilter
(
v
alue1
,
value
2
,
level
+
1
)
}
}
return
rv
return
rv
}
}
/**
/**
* True if the archive filter f1 *extends* the filter f2, i.e. if all data passing
* True if the archive filter f
ilter
1 *extends* the filter f
ilter
2, i.e. if all data passing
* f2 will also pass f1.
* f
ilter
2 will also pass f
ilter
1.
* Note, this method only handles certain simple types of filters, used by the gui.
* Note, this method only handles certain simple types of filters, used by the gui.
*/
*/
function
archiveFilterExtends
(
f
1
,
f
2
,
level
=
0
)
{
function
archiveFilterExtends
(
f
ilter1
,
filter
2
,
level
=
0
)
{
if
(
f1
===
f2
)
return
true
if
(
f
ilter
1
===
f
ilter
2
)
return
true
if
(
f2
===
undefined
)
return
true
if
(
f
ilter
2
===
undefined
)
return
true
if
(
f1
===
undefined
)
return
false
if
(
f
ilter
1
===
undefined
)
return
false
if
(
f1
===
'
include-resolved
'
)
return
true
if
(
f
ilter
1
===
'
include-resolved
'
)
return
true
if
(
f2
===
'
include-resolved
'
)
return
false
if
(
f
ilter
2
===
'
include-resolved
'
)
return
false
const
obj1
=
typeof
f1
===
'
object
'
const
obj1
=
typeof
f
ilter
1
===
'
object
'
const
obj2
=
typeof
f2
===
'
object
'
const
obj2
=
typeof
f
ilter
2
===
'
object
'
if
(
f1
===
'
*
'
&&
obj2
)
return
level
===
0
||
!
hasIncludeResolved
(
f2
)
if
(
f
ilter
1
===
'
*
'
&&
obj2
)
return
level
===
0
||
!
hasIncludeResolved
(
f
ilter
2
)
if
(
f2
===
'
*
'
&&
obj1
)
return
false
if
(
f
ilter
2
===
'
*
'
&&
obj1
)
return
false
if
(
!
obj1
||
!
obj2
)
throw
new
Error
(
'
Cannot compare filters: bad values
'
)
if
(
!
obj1
||
!
obj2
)
throw
new
Error
(
'
Cannot compare filters: bad values
'
)
// Two objects. Inspect recursively.
// Two objects. Inspect recursively.
for
(
const
key
in
f2
)
{
for
(
const
key
in
f
ilter
2
)
{
const
v1
=
f1
[
key
]
const
v
alue
1
=
f
ilter
1
[
key
]
const
v2
=
f2
[
key
]
const
v
alue
2
=
f
ilter
2
[
key
]
if
(
!
archiveFilterExtends
(
v
1
,
v
2
,
level
+
1
))
return
false
if
(
!
archiveFilterExtends
(
v
alue1
,
value
2
,
level
+
1
))
return
false
}
}
return
true
return
true
}
}
...
...
This diff is collapsed.
Click to expand it.
gui/src/components/entry/ArchiveEntryView.spec.js
+
18
−
0
View file @
43fc9674
...
@@ -125,3 +125,21 @@ test('inheriting sections', async () => {
...
@@ -125,3 +125,21 @@ test('inheriting sections', async () => {
await
waitForGUI
()
await
waitForGUI
()
await
waitFor
(()
=>
expect
(
selectInput
.
value
).
toEqual
(
`
${
sectionName
}
`
))
await
waitFor
(()
=>
expect
(
selectInput
.
value
).
toEqual
(
`
${
sectionName
}
`
))
})
})
test
.
each
([
[
'
vasp
'
,
'
1WGSYo1RrGFEIcM17Re4kjHC7k6p
'
,
[
'
metadata/last_processing_time
'
,
'
results/material/elements
'
,
'
run/calculation/stress/total
'
]]
])(
'
specific paths %s
'
,
async
(
name
,
entryId
,
paths
)
=>
{
// Test some paths that we expect to exist
await
startAPI
(
'
tests.states.uploads.archive_browser_test
'
,
'
tests/data/uploads/archive_browser_test_paths_
'
+
name
.
replace
(
/ /g
,
'
_
'
),
'
test
'
,
'
password
'
)
render
(
<
EntryPageContext
entryId
=
{
entryId
}
><
ArchiveEntryView
/><
/EntryPageContext>
)
expect
(
await
screen
.
findByText
(
'
Entry
'
)).
toBeVisible
()
for
(
const
path
of
paths
)
{
await
navigateTo
(
path
)
}
},
5
*
minutes
)
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