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
Mukul
jio
Commits
7bbd7745
Commit
7bbd7745
authored
Mar 18, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hardcoded state management on put removed
parent
16d2ad60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
50 deletions
+7
-50
src/jio.storage/erp5storage.taskmanagerview.js
src/jio.storage/erp5storage.taskmanagerview.js
+7
-50
No files found.
src/jio.storage/erp5storage.taskmanagerview.js
View file @
7bbd7745
...
...
@@ -248,62 +248,19 @@
var
result
=
JSON
.
parse
(
event
.
target
.
responseText
),
put_action
=
result
.
_embedded
.
_view
.
_actions
.
put
,
renderer_form
=
result
.
_embedded
.
_view
,
data
=
new
FormData
(),
action
,
action_url
;
data
=
new
FormData
();
data
.
append
(
renderer_form
.
form_id
.
key
,
renderer_form
.
form_id
[
'
default
'
]);
metadata
=
toERP5Metadata
(
metadata
);
if
(
typeof
metadata
.
translated_simulation_state_title
===
"
string
"
&&
metadata
.
translated_simulation_state_title
!==
result
.
translated_simulation_state_title
)
{
action
=
constant
.
task_state_to_action
[
metadata
.
translated_simulation_state_title
];
if
(
!
action
)
{
throw
new
Error
(
"
State
\"
"
+
metadata
.
translated_simulation_state_title
+
"
\"
is not available.
"
);
}
if
(
result
.
_links
&&
Array
.
isArray
(
result
.
_links
.
action_workflow
))
{
result
.
_links
.
action_workflow
.
some
(
function
(
workflow
)
{
if
(
workflow
.
name
===
action
+
"
_action
"
)
{
action_url
=
workflow
.
href
;
return
true
;
}
return
false
;
});
}
if
(
!
action_url
)
{
throw
new
Error
(
"
Can not change state.
"
);
}
// XXX ERP5 side need to implement this feature
// -> do on action_url, then return vars;
console
.
warn
(
"
NotImplemented
"
);
console
.
log
(
"
Do on:
"
,
action_url
);
return
{
"
put_action
"
:
put_action
,
"
renderer_form
"
:
renderer_form
,
"
data
"
:
data
};
}
return
{
"
put_action
"
:
put_action
,
"
renderer_form
"
:
renderer_form
,
"
data
"
:
data
};
}).
then
(
function
(
vars
)
{
/*jslint forin: true */
var
key
;
for
(
key
in
metadata
)
{
if
(
hasOwnProperty
(
metadata
,
key
))
{
if
(
key
!==
"
_id
"
)
{
// Hardcoded my_ ERP5 behaviour
if
(
hasOwnProperty
(
vars
.
renderer_form
,
"
my_
"
+
key
))
{
vars
.
data
.
append
(
vars
.
renderer_form
[
"
my_
"
+
key
].
key
,
if
(
hasOwnProperty
(
renderer_form
,
"
my_
"
+
key
))
{
data
.
append
(
renderer_form
[
"
my_
"
+
key
].
key
,
metadata
[
key
]
);
}
// else {
...
...
@@ -313,9 +270,9 @@
}
}
return
jIO
.
util
.
ajax
({
"
type
"
:
vars
.
put_action
.
method
,
"
url
"
:
vars
.
put_action
.
href
,
"
data
"
:
vars
.
data
,
"
type
"
:
put_action
.
method
,
"
url
"
:
put_action
.
href
,
"
data
"
:
data
,
"
xhrFields
"
:
{
withCredentials
:
true
}
...
...
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