Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Domain Data Mgmt Services
Seismic
Seismic DMS Suite
seismic-dms-service
Commits
29a08052
Commit
29a08052
authored
Mar 22, 2021
by
Sid Stenersen
Browse files
Fix /utility/ls pagination
parent
e35b0a21
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/services/dataset/dao.ts
View file @
29a08052
// ============================================================================
// Copyright 2017-201
9
, Schlumberger
// Copyright 2017-20
2
1, Schlumberger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
...
...
@@ -126,7 +126,20 @@ export class DatasetDAO {
const
output
=
{
datasets
:
[],
nextPageCursor
:
null
};
// Retrieve the content datasets
if
(
!
pagination
.
cursor
)
{
// Retrieve directories
let
query
=
journalClient
.
createQuery
(
Config
.
SEISMIC_STORE_NS
+
'
-
'
+
dataset
.
tenant
+
'
-
'
+
dataset
.
subproject
,
Config
.
DATASETS_KIND
)
.
select
([
'
path
'
]).
groupBy
(
'
path
'
).
filter
(
'
path
'
,
'
>
'
,
dataset
.
path
).
filter
(
'
path
'
,
'
<
'
,
dataset
.
path
+
'
\
ufffd
'
);
const
[
entitieshy
]
=
await
journalClient
.
runQuery
(
query
);
output
.
datasets
=
entitieshy
.
map
((
entity
)
=>
(
entity
.
path
as
string
).
substr
(
dataset
.
path
.
length
));
output
.
datasets
=
output
.
datasets
.
map
(
(
entity
)
=>
entity
.
substr
(
0
,
entity
.
indexOf
(
'
/
'
)
+
1
)).
filter
(
(
elem
,
index
,
self
)
=>
index
===
self
.
indexOf
(
elem
)
);
}
// Retrieve datasets
let
query
=
journalClient
.
createQuery
(
Config
.
SEISMIC_STORE_NS
+
'
-
'
+
dataset
.
tenant
+
'
-
'
+
dataset
.
subproject
,
Config
.
DATASETS_KIND
)
.
filter
(
'
path
'
,
dataset
.
path
);
...
...
@@ -139,7 +152,7 @@ export class DatasetDAO {
const
[
entitiesds
,
info
]
=
await
journalClient
.
runQuery
(
query
);
if
(
entitiesds
.
length
!==
0
)
{
output
.
datasets
=
entitiesds
.
map
((
item
)
=>
item
.
name
);
output
.
datasets
=
output
.
datasets
.
concat
(
entitiesds
.
map
((
item
)
=>
item
.
name
)
)
;
if
(
pagination
)
{
output
.
nextPageCursor
=
info
.
endCursor
;
}
...
...
@@ -201,7 +214,7 @@ export class DatasetDAO {
const
[
entitieshy
]
=
await
journalClient
.
runQuery
(
query
);
results
.
directories
=
entitieshy
.
map
((
entity
)
=>
(
entity
.
path
as
string
).
substr
(
dataset
.
path
.
length
));
results
.
directories
=
results
.
directories
.
map
(
(
entity
)
=>
entity
.
substr
(
0
,
entity
.
indexOf
(
'
/
'
))).
filter
(
(
entity
)
=>
entity
.
substr
(
0
,
entity
.
indexOf
(
'
/
'
)
+
1
)).
filter
(
(
elem
,
index
,
self
)
=>
index
===
self
.
indexOf
(
elem
)
);
}
...
...
src/services/utility/handler.ts
View file @
29a08052
// ============================================================================
// Copyright 2017-202
0
, Schlumberger
// Copyright 2017-202
1
, Schlumberger
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
...
...
@@ -179,7 +179,7 @@ export class UtilityHandler {
const
results
=
await
DatasetDAO
.
listContent
(
journalClient
,
dataset
,
wmode
);
return
(
(
wmode
===
Config
.
LS_MODE
.
ALL
||
wmode
===
Config
.
LS_MODE
.
DIRS
)
?
results
.
directories
.
map
((
el
)
=>
el
.
endsWith
(
'
/
'
)
?
el
:
el
+
'
/
'
)
:
[]).
concat
(
results
.
directories
:
[]).
concat
(
(
wmode
===
Config
.
LS_MODE
.
ALL
||
wmode
===
Config
.
LS_MODE
.
DATASETS
)
?
results
.
datasets
:
[]);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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