Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Hardik Juneja
jio-main
Commits
60e0a8dd
Commit
60e0a8dd
authored
Mar 31, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add optional additional mapping parameter
parent
544ba866
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
src/jio.storage/erp5storage.taskmanagerview.js
src/jio.storage/erp5storage.taskmanagerview.js
+22
-9
No files found.
src/jio.storage/erp5storage.taskmanagerview.js
View file @
60e0a8dd
...
@@ -146,16 +146,18 @@
...
@@ -146,16 +146,18 @@
// addMetadataMapping("category", "category_list");
// addMetadataMapping("category", "category_list");
// XXX docstring
// XXX docstring
function
toERP5Metadata
(
jio_type
)
{
function
toERP5Metadata
(
jio_type
,
additional
)
{
/*jslint forin: true */
/*jslint forin: true */
if
(
typeof
jio_type
===
"
string
"
)
{
if
(
typeof
jio_type
===
"
string
"
)
{
return
constant
.
mapping_jio_to_erp5
[
jio_type
]
||
jio_type
;
additional
=
additional
||
{};
return
additional
[
jio_type
]
||
constant
.
mapping_jio_to_erp5
[
jio_type
]
||
jio_type
;
}
}
var
result
=
{},
key
;
var
result
=
{},
key
;
if
(
typeof
jio_type
===
"
object
"
&&
jio_type
)
{
if
(
typeof
jio_type
===
"
object
"
&&
jio_type
)
{
for
(
key
in
jio_type
)
{
for
(
key
in
jio_type
)
{
if
(
hasOwnProperty
(
jio_type
,
key
))
{
if
(
hasOwnProperty
(
jio_type
,
key
))
{
result
[
toERP5Metadata
(
key
)]
=
jio_type
[
key
];
result
[
toERP5Metadata
(
key
,
additional
)]
=
jio_type
[
key
];
}
}
}
}
}
}
...
@@ -163,16 +165,18 @@
...
@@ -163,16 +165,18 @@
}
}
// XXX docstring
// XXX docstring
function
toJIOMetadata
(
erp5_type
)
{
function
toJIOMetadata
(
erp5_type
,
additional
)
{
/*jslint forin: true */
/*jslint forin: true */
if
(
typeof
erp5_type
===
"
string
"
)
{
if
(
typeof
erp5_type
===
"
string
"
)
{
return
constant
.
mapping_erp5_to_jio
[
erp5_type
]
||
erp5_type
;
additional
=
additional
||
{};
return
additional
[
erp5_type
]
||
constant
.
mapping_erp5_to_jio
[
erp5_type
]
||
erp5_type
;
}
}
var
result
=
{},
key
;
var
result
=
{},
key
;
if
(
typeof
erp5_type
===
"
object
"
&&
erp5_type
)
{
if
(
typeof
erp5_type
===
"
object
"
&&
erp5_type
)
{
for
(
key
in
erp5_type
)
{
for
(
key
in
erp5_type
)
{
if
(
hasOwnProperty
(
erp5_type
,
key
))
{
if
(
hasOwnProperty
(
erp5_type
,
key
))
{
result
[
toJIOMetadata
(
key
)]
=
erp5_type
[
key
];
result
[
toJIOMetadata
(
key
,
additional
)]
=
erp5_type
[
key
];
}
}
}
}
}
}
...
@@ -206,12 +210,16 @@
...
@@ -206,12 +210,16 @@
/*jslint unparam: true */
/*jslint unparam: true */
function
changeQueryKeysToERP5Metadata
()
{
function
changeQueryKeysToERP5Metadata
()
{
if
(
Array
.
isArray
(
options
.
select_list
))
{
if
(
Array
.
isArray
(
options
.
select_list
))
{
options
.
select_list
=
options
.
select_list
.
map
(
toERP5Metadata
);
options
.
select_list
=
options
.
select_list
.
map
(
toERP5Metadata
,
{
"
translated_state
"
:
"
translated_simulation_state_title_text
"
});
}
}
try
{
try
{
options
.
query
=
jIO
.
QueryFactory
.
create
(
options
.
query
);
options
.
query
=
jIO
.
QueryFactory
.
create
(
options
.
query
);
options
.
query
.
onParseSimpleQuery
=
function
(
object
)
{
options
.
query
.
onParseSimpleQuery
=
function
(
object
)
{
object
.
parsed
.
key
=
toERP5Metadata
(
object
.
parsed
.
key
);
object
.
parsed
.
key
=
toERP5Metadata
(
object
.
parsed
.
key
,
{
"
translated_state
"
:
"
translated_simulation_state_title_text
"
});
};
};
return
options
.
query
.
parse
().
then
(
function
(
query
)
{
return
options
.
query
.
parse
().
then
(
function
(
query
)
{
options
.
query
=
jIO
.
QueryFactory
.
create
(
query
).
toString
();
options
.
query
=
jIO
.
QueryFactory
.
create
(
query
).
toString
();
...
@@ -261,7 +269,12 @@
...
@@ -261,7 +269,12 @@
item
=
data
[
i
];
item
=
data
[
i
];
uri
=
new
URI
(
item
.
_links
.
self
.
href
);
uri
=
new
URI
(
item
.
_links
.
self
.
href
);
delete
item
.
_links
;
delete
item
.
_links
;
item
=
toJIOMetadata
(
item
);
item
=
toJIOMetadata
(
item
,
{
"
translated_simulation_state_title_text
"
:
"
translated_state
"
});
if
(
item
.
translated_state
)
{
item
.
state
=
item
.
translated_state
;
}
result
.
push
({
result
.
push
({
id
:
uri
.
segment
(
2
),
id
:
uri
.
segment
(
2
),
doc
:
item
,
doc
:
item
,
...
...
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