Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Roque
jio
Commits
24b938cb
Commit
24b938cb
authored
Aug 31, 2020
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Storage: do not lose some domain values
parent
3ddb9321
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
9 deletions
+73
-9
src/jio.storage/erp5storage.js
src/jio.storage/erp5storage.js
+15
-9
test/jio.storage/erp5storage.tests.js
test/jio.storage/erp5storage.tests.js
+58
-0
No files found.
src/jio.storage/erp5storage.js
View file @
24b938cb
...
...
@@ -487,6 +487,7 @@
result_list
,
local_roles
,
local_role_found
=
false
,
selection_domain_found
=
false
,
selection_domain
,
sort_list
=
[],
group_list
=
[];
...
...
@@ -537,18 +538,23 @@
result_list
=
isSingleDomain
(
sub_query
);
if
(
result_list
)
{
parsed_query
.
query_list
.
splice
(
i
,
1
);
query
=
jIO
.
Query
.
objectToSearchText
(
parsed_query
);
if
(
selection_domain
)
{
for
(
key
in
result_list
)
{
if
(
result_list
.
hasOwnProperty
(
key
))
{
selection_domain
[
key
]
=
result_list
[
key
];
selection_domain_found
=
false
;
for
(
key
in
result_list
)
{
if
(
result_list
.
hasOwnProperty
(
key
)
&&
((
selection_domain
===
undefined
)
||
(
!
selection_domain
.
hasOwnProperty
(
key
))))
{
if
(
selection_domain
===
undefined
)
{
selection_domain
=
{};
}
selection_domain
[
key
]
=
result_list
[
key
];
selection_domain_found
=
true
;
}
}
else
{
selection_domain
=
result_list
;
}
i
-=
1
;
if
(
selection_domain_found
===
true
)
{
parsed_query
.
query_list
.
splice
(
i
,
1
);
query
=
jIO
.
Query
.
objectToSearchText
(
parsed_query
);
i
-=
1
;
}
}
}
...
...
test/jio.storage/erp5storage.tests.js
View file @
24b938cb
...
...
@@ -2086,6 +2086,64 @@
});
});
test
(
"
extract multiple values for a single domains
"
,
function
()
{
var
search_url
=
domain
+
"
?mode=search&
"
+
"
query=%28%20portal_type%3A%20%20%22Person%22%20AND%20
"
+
"
selection_domain_group%3A%20%20%22foo%2Fbar%22%20AND%20
"
+
"
title%3A%20%20%22atitle%22%20%29&
"
+
"
select_list=destination&select_list=source&limit=5&
"
+
"
local_roles=Assignee&
"
+
"
selection_domain=%7B%22group%22%3A%22bar%2Ffoo%22%7D
"
,
search_hateoas
=
JSON
.
stringify
({
"
_embedded
"
:
{
"
contents
"
:
[]
}
}),
server
=
this
.
server
;
this
.
server
.
respondWith
(
"
GET
"
,
domain
,
[
200
,
{
"
Content-Type
"
:
"
application/hal+json
"
},
root_hateoas
]);
this
.
server
.
respondWith
(
"
GET
"
,
search_url
,
[
200
,
{
"
Content-Type
"
:
"
application/hal+json
"
},
search_hateoas
]);
stop
();
expect
(
10
);
this
.
jio
.
allDocs
({
limit
:
[
5
],
select_list
:
[
"
destination
"
,
"
source
"
],
query
:
'
portal_type:"Person" AND selection_domain_group:"bar/foo" AND
'
+
'
selection_domain_group:"foo/bar" AND
'
+
'
local_roles:"Assignee" AND title:"atitle"
'
})
.
then
(
function
(
result
)
{
deepEqual
(
result
,
{
data
:
{
rows
:
[],
total_rows
:
0
}
},
"
Check document
"
);
equal
(
server
.
requests
.
length
,
2
);
equal
(
server
.
requests
[
0
].
method
,
"
GET
"
);
equal
(
server
.
requests
[
0
].
url
,
domain
);
equal
(
server
.
requests
[
0
].
requestBody
,
undefined
);
equal
(
server
.
requests
[
0
].
withCredentials
,
true
);
equal
(
server
.
requests
[
1
].
method
,
"
GET
"
);
equal
(
server
.
requests
[
1
].
url
,
search_url
);
equal
(
server
.
requests
[
1
].
requestBody
,
undefined
);
equal
(
server
.
requests
[
1
].
withCredentials
,
true
);
})
.
fail
(
function
(
error
)
{
console
.
log
(
error
);
ok
(
false
,
error
);
})
.
always
(
function
()
{
start
();
});
});
test
(
"
extract local_roles and selection_domain
"
,
function
()
{
var
search_url
=
domain
+
"
?mode=search&
"
+
"
query=&
"
+
...
...
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