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
alecs_myu
erp5
Commits
e26beb3a
Commit
e26beb3a
authored
Feb 20, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
Feb 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] Protect page-tabs rendering with mutexes by moving it to changeState
parent
90ebcf01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
43 deletions
+63
-43
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.js
...lateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.js
+61
-41
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.js
View file @
e26beb3a
/*global window, rJS, RSVP, Handlebars, URI, calculatePageTitle */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/** Page for displaying Views, Jump and BreadCrumb navigation for a document.
*/
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
,
URI
,
calculatePageTitle
)
{
"
use strict
"
;
...
...
@@ -12,6 +16,38 @@
.
getElementById
(
"
table-template
"
)
.
innerHTML
);
/** Go recursively up the parent-chain and insert breadcrumbs in the last argument.
*/
function
modifyBreadcrumbList
(
gadget
,
parent_link
,
breadcrumb_action_list
)
{
if
(
parent_link
===
undefined
)
{
return
;
}
var
uri
=
new
URI
(
parent_link
.
href
),
jio_key
=
uri
.
segment
(
2
);
if
((
uri
.
protocol
()
!==
'
urn
'
)
||
(
uri
.
segment
(
0
)
!==
'
jio
'
)
||
(
uri
.
segment
(
1
)
!==
"
get
"
))
{
// Parent is the ERP5 site thus recursive calling ends here
breadcrumb_action_list
.
unshift
({
title
:
"
ERP5
"
,
link
:
"
#
"
});
return
;
}
// Parent is an ERP5 document
return
gadget
.
getUrlFor
({
command
:
'
display_stored_state
'
,
options
:
{
jio_key
:
jio_key
}})
.
push
(
function
(
parent_href
)
{
breadcrumb_action_list
.
unshift
({
title
:
parent_link
.
name
,
link
:
parent_href
});
return
gadget
.
jio_getAttachment
(
jio_key
,
"
links
"
);
})
.
push
(
function
(
result
)
{
return
modifyBreadcrumbList
(
gadget
,
result
.
_links
.
parent
||
"
#
"
,
breadcrumb_action_list
);
});
}
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
...
...
@@ -24,52 +60,33 @@
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
/** Render only transforms its arguments and passes them to mutex-protected onStateChange
options:
jio_key: {string} currently viewed document (e.g. foo/1)
page: {string} selected page (always "tab" for page_tab)
view: {string} always "view"
selection, history, selection_index
*/
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
view_list
,
return
this
.
changeState
({
jio_key
:
options
.
jio_key
});
})
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
,
view_list
=
[],
tab_list
=
[],
jump_action_list
=
[],
breadcrumb_action_list
=
[],
parent_queue
,
gadget
=
this
,
erp5_document
,
tab_title
=
"
Views
"
,
tab_icon
=
"
eye
"
,
jump_list
;
function
handleParent
(
parent_link
)
{
parent_queue
.
push
(
function
()
{
var
uri
,
jio_key
;
if
(
parent_link
!==
undefined
)
{
uri
=
new
URI
(
parent_link
.
href
);
jio_key
=
uri
.
segment
(
2
);
if
((
uri
.
protocol
()
!==
'
urn
'
)
||
(
uri
.
segment
(
0
)
!==
'
jio
'
)
||
(
uri
.
segment
(
1
)
!==
"
get
"
))
{
// Parent is the ERP5 site
breadcrumb_action_list
.
unshift
({
title
:
"
ERP5
"
,
link
:
"
#
"
});
}
else
{
// Parent is an ERP5 document
return
gadget
.
getUrlFor
({
command
:
'
display_stored_state
'
,
options
:
{
jio_key
:
jio_key
}})
.
push
(
function
(
parent_href
)
{
breadcrumb_action_list
.
unshift
({
title
:
parent_link
.
name
,
link
:
parent_href
});
return
gadget
.
jio_getAttachment
(
jio_key
,
"
links
"
);
})
.
push
(
function
(
result
)
{
handleParent
(
result
.
_links
.
parent
||
"
#
"
);
});
}
}
});
}
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
"
links
"
)
return
gadget
.
jio_getAttachment
(
modification_dict
.
jio_key
,
"
links
"
)
.
push
(
function
(
result
)
{
var
i
,
promise_list
=
[];
...
...
@@ -88,7 +105,8 @@
for
(
i
=
0
;
i
<
view_list
.
length
;
i
+=
1
)
{
promise_list
.
push
(
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
view
:
view_list
[
i
].
href
,
page
:
undefined
page
:
undefined
// Views in ERP5 must be forms but because of
// OfficeJS we keep it empty for different default
}}));
}
for
(
i
=
0
;
i
<
jump_list
.
length
;
i
+=
1
)
{
...
...
@@ -97,9 +115,11 @@
page
:
'
search
'
}}));
}
parent_queue
=
new
RSVP
.
Queue
();
handleParent
(
erp5_document
.
_links
.
parent
||
"
#
"
);
promise_list
.
push
(
parent_queue
);
promise_list
.
push
(
modifyBreadcrumbList
(
gadget
,
erp5_document
.
_links
.
parent
||
"
#
"
,
breadcrumb_action_list
)
);
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
all_result
)
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_tabpage_js.xml
View file @
e26beb3a
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
58.28347.56387.25600
</string>
</value>
<value>
<string>
9
65.39422.59074.24098
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1
491225418.18
</float>
<float>
1
519114113.71
</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