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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
87b8fe07
Commit
87b8fe07
authored
Sep 20, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Reduce number of created Queue
parent
ee9ff19e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
68 deletions
+52
-68
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
...thTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
+13
-13
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
...hTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
...mplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
+35
-51
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
...plateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
View file @
87b8fe07
...
...
@@ -21,7 +21,8 @@
function
addField
(
field
,
rendered_document
,
form_definition
,
form_gadget
,
group_name
,
modification_dict
)
{
var
field_name
=
field
[
0
],
field_element
,
suboptions
;
suboptions
,
queue
;
if
(
!
rendered_document
.
hasOwnProperty
(
field_name
))
{
return
;
...
...
@@ -45,18 +46,17 @@
}
field_element
=
document
.
createElement
(
"
div
"
);
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
var
rendered_field_name
=
rendered_document
[
field_name
].
key
;
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
return
form_gadget
.
declareGadget
(
'
gadget_erp5_label_field.html
'
,
{
scope
:
rendered_field_name
,
// ugly! Should be just `field_name` but too many tests depend on it
element
:
field_element
,
sandbox
:
"
public
"
});
}
return
form_gadget
.
getDeclaredGadget
(
rendered_field_name
);
})
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
queue
=
form_gadget
.
declareGadget
(
'
gadget_erp5_label_field.html
'
,
{
scope
:
rendered_document
[
field_name
].
key
,
// ugly! Should be just `field_name` but too many tests depend on it
element
:
field_element
,
sandbox
:
"
public
"
});
}
else
{
queue
=
form_gadget
.
getDeclaredGadget
(
rendered_document
[
field_name
].
key
);
}
return
queue
.
push
(
function
(
label_gadget
)
{
if
(
modification_dict
.
hasOwnProperty
(
'
hash
'
))
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
View file @
87b8fe07
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
64.58561.19908.14080
</string>
</value>
<value>
<string>
9
70.11330.19298.59511
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
15
16274548.8
8
</float>
<float>
15
37454067.9
8
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
View file @
87b8fe07
...
...
@@ -8,21 +8,19 @@
var
MAIN_SCOPE
=
"
m
"
;
function
renderMainGadget
(
gadget
,
url
,
options
)
{
var
page_gadget
;
return
gadget
.
declareGadget
(
url
,
{
scope
:
MAIN_SCOPE
})
.
push
(
function
(
page_gadget
)
{
.
push
(
function
(
result
)
{
page_gadget
=
result
;
gadget
.
props
.
m_options_string
=
JSON
.
stringify
(
options
);
if
(
page_gadget
.
render
=
==
undefined
)
{
return
[
page_gadget
]
;
if
(
page_gadget
.
render
!
==
undefined
)
{
return
page_gadget
.
render
(
options
)
;
}
return
RSVP
.
all
([
page_gadget
,
page_gadget
.
render
(
options
)
]);
})
.
push
(
function
(
all_result
)
{
return
all_result
[
0
]
;
.
push
(
function
()
{
return
page_gadget
;
});
}
...
...
@@ -67,42 +65,34 @@
}
function
increaseLoadingCounter
(
gadget
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
gadget
.
props
.
loading_counter
+=
1
;
if
(
gadget
.
props
.
loading_counter
===
1
)
{
return
gadget
.
getDeclaredGadget
(
"
header
"
)
.
push
(
function
(
header_gadget
)
{
return
header_gadget
.
notifyLoading
();
});
}
});
gadget
.
props
.
loading_counter
+=
1
;
if
(
gadget
.
props
.
loading_counter
===
1
)
{
return
gadget
.
getDeclaredGadget
(
"
header
"
)
.
push
(
function
(
header_gadget
)
{
return
header_gadget
.
notifyLoading
();
});
}
return
new
RSVP
.
Queue
();
}
function
decreaseLoadingCounter
(
gadget
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
gadget
.
props
.
loading_counter
-=
1
;
if
(
gadget
.
props
.
loading_counter
<
0
)
{
gadget
.
props
.
loading_counter
=
0
;
// throw new Error("Unexpected negative loading counter");
}
if
(
gadget
.
props
.
loading_counter
===
0
)
{
return
gadget
.
getDeclaredGadget
(
"
header
"
)
.
push
(
function
(
header_gadget
)
{
return
header_gadget
.
notifyLoaded
();
});
}
});
gadget
.
props
.
loading_counter
-=
1
;
if
(
gadget
.
props
.
loading_counter
<
0
)
{
gadget
.
props
.
loading_counter
=
0
;
// throw new Error("Unexpected negative loading counter");
}
if
(
gadget
.
props
.
loading_counter
===
0
)
{
return
gadget
.
getDeclaredGadget
(
"
header
"
)
.
push
(
function
(
header_gadget
)
{
return
header_gadget
.
notifyLoaded
();
});
}
return
new
RSVP
.
Queue
();
}
function
callJioGadget
(
gadget
,
method
,
param_list
)
{
var
called
=
false
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
called
=
true
;
return
increaseLoadingCounter
(
gadget
);
})
var
called
=
true
;
return
increaseLoadingCounter
(
gadget
)
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
"
jio_gadget
"
);
})
...
...
@@ -577,14 +567,11 @@
}
if
(
modification_dict
.
hasOwnProperty
(
'
url
'
))
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
renderMainGadget
(
gadget
,
route_result
.
url
,
route_result
.
options
);
})
return
renderMainGadget
(
gadget
,
route_result
.
url
,
route_result
.
options
)
.
push
(
function
(
main_gadget
)
{
// Append loaded gadget in the page
if
(
main_gadget
!==
undefined
)
{
...
...
@@ -637,10 +624,7 @@
// (ERP5 title by default + sidebar)
initHeaderOptions
(
gadget
);
initPanelOptions
(
gadget
);
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
increaseLoadingCounter
(
gadget
);
})
return
increaseLoadingCounter
(
gadget
)
.
push
(
function
()
{
var
promise_list
=
[
route
(
gadget
,
'
panel
'
,
'
close
'
),
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
View file @
87b8fe07
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
68.42891.50280.153
</string>
</value>
<value>
<string>
9
70.25626.47614.53111
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
153
0622831.54
</float>
<float>
153
7451374.56
</float>
<string>
UTC
</string>
</tuple>
</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