Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
99ca7eed
Commit
99ca7eed
authored
Apr 04, 2018
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Jio Release 3.28.0
/reviewed-on
nexedi/erp5!625
parent
65d4019b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
45 deletions
+64
-45
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
...enderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
+62
-43
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
...nderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
View file @
99ca7eed
...
@@ -6308,33 +6308,52 @@ return new Parser;
...
@@ -6308,33 +6308,52 @@ return new Parser;
/**
/**
* A sort function to sort items by key
* A sort function to sort items by key
*
*
* @param {String} key The key to sort on
* @param {Array} sort_list List of couples [key, direction]
* @param {String} [way="ascending"] 'ascending' or 'descending'
* @return {Function} The sort function
* @return {Function} The sort function
*/
*/
function
sortFunction
(
key
,
way
,
key_schema
)
{
function
generateSortFunction
(
key_schema
,
sort_list
)
{
var
result
,
cast_to
;
return
function
sortByMultipleIndex
(
a
,
b
)
{
if
(
way
===
'
descending
'
)
{
var
result
,
result
=
1
;
cast_to
,
}
else
if
(
way
===
'
ascending
'
)
{
key
=
sort_list
[
0
][
0
],
result
=
-
1
;
way
=
sort_list
[
0
][
1
],
}
else
{
i
,
throw
new
TypeError
(
"
Query.sortFunction():
"
+
l
,
"
Argument 2 must be 'ascending' or 'descending'
"
);
a_string_array
,
}
b_string_array
,
if
(
key_schema
!==
undefined
&&
f_a
,
key_schema
.
key_set
!==
undefined
&&
f_b
,
key_schema
.
key_set
[
key
]
!==
undefined
&&
tmp
;
key_schema
.
key_set
[
key
].
cast_to
!==
undefined
)
{
if
(
typeof
key_schema
.
key_set
[
key
].
cast_to
===
"
string
"
)
{
if
(
way
===
'
descending
'
)
{
cast_to
=
key_schema
.
cast_lookup
[
key_schema
.
key_set
[
key
].
cast_to
];
result
=
1
;
}
else
if
(
way
===
'
ascending
'
)
{
result
=
-
1
;
}
else
{
}
else
{
cast_to
=
key_schema
.
key_set
[
key
].
cast_to
;
throw
new
TypeError
(
"
Query.sortFunction():
"
+
"
Argument 2 must be 'ascending' or 'descending'
"
);
}
}
return
function
(
a
,
b
)
{
var
f_a
=
cast_to
(
a
[
key
]),
f_b
=
cast_to
(
b
[
key
]);
if
(
key_schema
!==
undefined
&&
key_schema
.
key_set
!==
undefined
&&
key_schema
.
key_set
[
key
]
!==
undefined
&&
key_schema
.
key_set
[
key
].
cast_to
!==
undefined
)
{
if
(
typeof
key_schema
.
key_set
[
key
].
cast_to
===
"
string
"
)
{
cast_to
=
key_schema
.
cast_lookup
[
key_schema
.
key_set
[
key
].
cast_to
];
}
else
{
cast_to
=
key_schema
.
key_set
[
key
].
cast_to
;
}
f_a
=
cast_to
(
a
[
key
]);
f_b
=
cast_to
(
b
[
key
]);
if
(
typeof
f_b
.
cmp
===
'
function
'
)
{
if
(
typeof
f_b
.
cmp
===
'
function
'
)
{
return
result
*
f_b
.
cmp
(
f_a
);
tmp
=
result
*
f_b
.
cmp
(
f_a
);
if
(
tmp
!==
0
)
{
return
tmp
;
}
if
(
sort_list
.
length
>
1
)
{
return
generateSortFunction
(
key_schema
,
sort_list
.
slice
(
1
))(
a
,
b
);
}
return
tmp
;
}
}
if
(
f_a
>
f_b
)
{
if
(
f_a
>
f_b
)
{
return
-
result
;
return
-
result
;
...
@@ -6342,30 +6361,35 @@ return new Parser;
...
@@ -6342,30 +6361,35 @@ return new Parser;
if
(
f_a
<
f_b
)
{
if
(
f_a
<
f_b
)
{
return
result
;
return
result
;
}
}
if
(
sort_list
.
length
>
1
)
{
return
generateSortFunction
(
key_schema
,
sort_list
.
slice
(
1
))(
a
,
b
);
}
return
0
;
return
0
;
};
}
}
return
function
(
a
,
b
)
{
// this comparison is 5 times faster than json comparison
// this comparison is 5 times faster than json comparison
var
i
,
l
;
a_string_array
=
metadataValueToStringArray
(
a
[
key
])
||
[];
a
=
metadataValueToStringArray
(
a
[
key
])
||
[];
b_string_array
=
metadataValueToStringArray
(
b
[
key
])
||
[];
b
=
metadataValueToStringArray
(
b
[
key
])
||
[];
l
=
Math
.
max
(
a_string_array
.
length
,
b_string_array
.
length
);
l
=
a
.
length
>
b
.
length
?
a
.
length
:
b
.
length
;
for
(
i
=
0
;
i
<
l
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
l
;
i
+=
1
)
{
if
(
a
[
i
]
===
undefined
)
{
if
(
a
_string_array
[
i
]
===
undefined
)
{
return
result
;
return
result
;
}
}
if
(
b
[
i
]
===
undefined
)
{
if
(
b
_string_array
[
i
]
===
undefined
)
{
return
-
result
;
return
-
result
;
}
}
if
(
a
[
i
]
>
b
[
i
])
{
if
(
a
_string_array
[
i
]
>
b_string_array
[
i
])
{
return
-
result
;
return
-
result
;
}
}
if
(
a
[
i
]
<
b
[
i
])
{
if
(
a
_string_array
[
i
]
<
b_string_array
[
i
])
{
return
result
;
return
result
;
}
}
}
}
if
(
sort_list
.
length
>
1
)
{
return
generateSortFunction
(
key_schema
,
sort_list
.
slice
(
1
))(
a
,
b
);
}
return
0
;
return
0
;
};
};
}
}
...
@@ -6378,19 +6402,14 @@ return new Parser;
...
@@ -6378,19 +6402,14 @@ return new Parser;
* @return {Array} The filtered list
* @return {Array} The filtered list
*/
*/
function
sortOn
(
sort_on_option
,
list
,
key_schema
)
{
function
sortOn
(
sort_on_option
,
list
,
key_schema
)
{
var
sort_index
;
if
(
!
Array
.
isArray
(
sort_on_option
))
{
if
(
!
Array
.
isArray
(
sort_on_option
))
{
throw
new
TypeError
(
"
jioquery.sortOn():
"
+
throw
new
TypeError
(
"
jioquery.sortOn():
"
+
"
Argument 1 is not of type 'array'
"
);
"
Argument 1 is not of type 'array'
"
);
}
}
for
(
sort_index
=
sort_on_option
.
length
-
1
;
sort_index
>=
0
;
list
.
sort
(
generateSortFunction
(
sort_index
-=
1
)
{
key_schema
,
list
.
sort
(
sortFunction
(
sort_on_option
sort_on_option
[
sort_index
][
0
],
));
sort_on_option
[
sort_index
][
1
],
key_schema
));
}
return
list
;
return
list
;
}
}
...
@@ -6756,7 +6775,7 @@ return new Parser;
...
@@ -6756,7 +6775,7 @@ return new Parser;
* @param {String} spec.value The value of the metadata to compare
* @param {String} spec.value The value of the metadata to compare
*/
*/
function
ComplexQuery
(
spec
,
key_schema
)
{
function
ComplexQuery
(
spec
,
key_schema
)
{
Query
.
call
(
this
);
Query
.
call
(
this
,
key_schema
);
/**
/**
* Logical operator to use to compare object values
* Logical operator to use to compare object values
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
View file @
99ca7eed
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
3.29105.23200.50073
</string>
</value>
<value>
<string>
96
6.12481.11377.36966
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
152
0356783.07
</float>
<float>
152
2845747.33
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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