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
Levin Zimmermann
erp5
Commits
41b64275
Commit
41b64275
authored
Jan 25, 2022
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: refactoring code to display graphic
parent
7567a1b0
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
167 additions
and
95 deletions
+167
-95
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
+9
-0
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_label_field_js.js
...ateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
+8
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
...teItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js
...emplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js
+8
-8
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
...mplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.js
...teItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.js
+49
-9
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
...eItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_js.js
...ateItem/web_page_module/rjs_gadget_erp5_searchfield_js.js
+22
-6
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_js.xml
...teItem/web_page_module/rjs_gadget_erp5_searchfield_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_graphic_js.js
...PathTemplateItem/web_page_module/rjs_gadget_graphic_js.js
+59
-60
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_graphic_js.xml
...athTemplateItem/web_page_module/rjs_gadget_graphic_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.js
View file @
41b64275
...
...
@@ -300,6 +300,15 @@
begin_from
:
0
};
},
{
mutex
:
'
changestate
'
})
.
declareMethod
(
"
getGraphicType
"
,
function
()
{
var
gadget
=
this
;
if
(
gadget
.
props
.
listbox_gadget
)
{
return
gadget
.
props
.
listbox_gadget
.
getGraphicType
();
}
return
;
},
{
mutex
:
'
changestate
'
})
.
declareMethod
(
"
getContent
"
,
function
(
options
)
{
var
form_gadget
=
this
,
k
,
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_form_js.xml
View file @
41b64275
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
997.
31802.64350.38400
</string>
</value>
<value>
<string>
997.
49201.45822.48315
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
164
2089373.2
</float>
<float>
164
3133280.23
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
View file @
41b64275
...
...
@@ -337,6 +337,14 @@
});
},
{
mutex
:
'
changestate
'
})
.
declareMethod
(
'
getGraphicType
'
,
function
getGraphicType
()
{
var
argument_list
=
arguments
;
return
this
.
getDeclaredGadget
(
SCOPE
)
.
push
(
function
(
gadget
)
{
return
gadget
.
getGraphicType
.
apply
(
gadget
,
argument_list
);
});
},
{
mutex
:
'
changestate
'
})
.
allowPublicAcquisition
(
"
notifyFocus
"
,
function
notifyFocus
()
{
return
this
.
changeState
({
display_error_text
:
true
});
})
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
View file @
41b64275
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
99
1.31753.10689.19694
</string>
</value>
<value>
<string>
99
7.7172.17438.7031
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
16
18839010.44
</float>
<float>
16
43134111.55
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js
View file @
41b64275
...
...
@@ -1202,10 +1202,8 @@
loading_element
.
textContent
=
'
(
'
+
pagination_message
+
'
)
'
;
}
if
(
gadget
.
state
.
option_list
.
length
>
0
&&
gadget
.
state
.
enable_graphic
&&
!
gadget
.
state
.
extended_search
)
{
if
(
!
gadget
.
state
.
extended_search
&&
gadget
.
state
.
enable_graphic
)
{
if
(
gadget
.
state
.
enable_graphic
)
{
domsugar
(
gadget
.
element
.
querySelector
(
"
.graphic_section
"
),
[
domsugar
(
"
div
"
,
{
"
class
"
:
"
graphic_area
"
})
]);
...
...
@@ -1213,8 +1211,7 @@
}
});
});
if
(
!
gadget
.
state
.
extended_search
&&
gadget
.
state
.
enable_graphic
&&
if
(
gadget
.
state
.
enable_graphic
&&
gadget
.
state
.
graphic_type
&&
gadget
.
state
.
option_list
.
length
>
0
&&
gadget
.
state
.
graphic_type
!==
""
)
{
...
...
@@ -1305,6 +1302,9 @@
}
return
result_queue
;
})
.
declareMethod
(
'
getGraphicType
'
,
function
getGraphicType
()
{
return
this
.
state
.
graphic_type
;
})
.
declareMethod
(
'
getListboxInfo
'
,
function
getListboxInfo
()
{
var
domain_list
=
JSON
.
parse
(
this
.
state
.
domain_list_json
),
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
View file @
41b64275
...
...
@@ -240,7 +240,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
997.4
8220.58774.24832
</string>
</value>
<value>
<string>
997.4
9449.8762.59733
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>
1643
074611.1
</float>
<float>
1643
148086.35
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.js
View file @
41b64275
...
...
@@ -9,6 +9,23 @@
declareGadgetClassCanHandleListboxClipboardAction
,
RSVP
)
{
"
use strict
"
;
function
getDefaultGraphicType
(
option_list
)
{
var
i
,
default_option_list
=
[
"
translated_simulation_state_title
"
,
"
translated_validation_state_title
"
];
if
(
!
option_list
.
length
)
{
return
;
}
for
(
i
=
0
;
i
<
option_list
.
length
;
i
+=
1
)
{
if
(
default_option_list
.
indexOf
(
option_list
[
i
][
0
])
!==
-
1
)
{
return
option_list
[
i
][
0
];
}
}
return
option_list
[
0
][
0
];
}
function
updateSearchQueryFromSelection
(
extended_search
,
checked_uid_list
,
key
,
to_include
)
{
var
i
,
...
...
@@ -114,12 +131,19 @@
})
.
onStateChange
(
function
onStateChange
()
{
var
form_gadget
=
this
;
var
erp5_form
,
graphic_type
,
form_gadget
=
this
;
// render the erp5 form
return
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
)
.
push
(
function
(
erp5_form
)
{
return
new
RSVP
.
Queue
(
RSVP
.
all
([
form_gadget
.
getDeclaredGadget
(
"
erp5_form
"
),
form_gadget
.
getUrlParameter
(
"
graphic_type
"
)
]))
.
push
(
function
(
result_list
)
{
var
form_options
=
form_gadget
.
state
.
erp5_form
;
graphic_type
=
result_list
[
1
];
erp5_form
=
result_list
[
0
];
form_options
.
erp5_document
=
form_gadget
.
state
.
erp5_document
;
form_options
.
form_definition
=
form_gadget
.
state
.
form_definition
;
...
...
@@ -135,21 +159,37 @@
if
(
form_gadget
.
state
.
extended_search
)
{
form_options
.
form_definition
.
extended_search
=
form_gadget
.
state
.
extended_search
;
}
form_options
.
enable_graphic
=
false
;
if
(
graphic_type
||
(
!
form_gadget
.
state
.
extended_search
&&
!
graphic_type
))
{
form_options
.
enable_graphic
=
true
;
}
return
erp5_form
.
render
(
form_options
);
})
// render the search field
.
push
(
function
()
{
return
form_gadget
.
getDeclaredGadget
(
"
erp5_searchfield
"
);
.
push
(
function
(
result
)
{
return
RSVP
.
all
([
form_gadget
.
getDeclaredGadget
(
"
erp5_searchfield
"
),
erp5_form
.
getGraphicType
()
])
})
.
push
(
function
(
search_gadget
)
{
var
search_options
=
{};
.
push
(
function
(
result_list
)
{
var
search_gadget
=
result_list
[
0
],
search_options
=
{};
// XXX not generic, fix later
if
(
form_gadget
.
state
.
extended_search
)
{
search_options
.
extended_search
=
form_gadget
.
state
.
extended_search
;
}
search_options
.
enable_graphic
=
false
;
if
(
graphic_type
||
(
!
form_gadget
.
state
.
extended_search
&&
!
graphic_type
))
{
search_options
.
enable_graphic
=
true
;
}
search_options
.
graphic_type
=
result_list
[
1
];
return
search_gadget
.
render
(
search_options
);
})
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_list_js.xml
View file @
41b64275
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
997.4
8212.37929.983
0
</string>
</value>
<value>
<string>
997.4
9226.31411.5888
0
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
1643
074253.32
</float>
<float>
1643
150091.84
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_js.js
View file @
41b64275
...
...
@@ -32,7 +32,8 @@
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
state_dict
=
{
extended_search
:
options
.
extended_search
||
""
,
enable_graphic
:
options
.
enable_graphic
||
false
enable_graphic
:
options
.
enable_graphic
||
false
,
graphic_type
:
options
.
graphic_type
};
return
this
.
changeState
(
state_dict
);
})
...
...
@@ -58,10 +59,15 @@
continue_full_text_query_search
=
true
;
if
(
gadget
.
state
.
extended_search
)
{
console
.
log
(
modification_dict
);
if
(
modification_dict
.
enable_graphic
&&
button_graphic
&&
button_graphic
.
classList
.
contains
(
graphic_css_class
))
{
modification_dict
.
graphic_type
&&
button_graphic
)
{
button_graphic
.
classList
.
add
(
graphic_css_class
);
select_button_graphic
.
classList
.
remove
(
graphic_css_class
);
}
else
{
button_graphic
.
classList
.
remove
(
graphic_css_class
);
select_button_graphic
.
classList
.
add
(
graphic_css_class
);
}
// Parse the raw query
...
...
@@ -124,9 +130,13 @@
button_graphic
&&
!
button_graphic
.
classList
.
contains
(
graphic_css_class
))
{
button_graphic
.
classList
.
add
(
graphic_css_class
);
}
else
if
(
modification_dict
.
enable_graphic
&&
select_button_graphic
)
{
select_button_graphic
.
classList
.
remove
(
graphic_css_class
);
}
else
if
(
select_button_graphic
&&
modification_dict
.
enable_graphic
&&
!
modification_dict
.
extended_search
){
select_button_graphic
.
classList
.
remove
(
graphic_css_class
);
}
console
.
log
(
modification_dict
);
button_container
.
innerHTML
=
''
;
len
=
query_text_list
.
length
;
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
...
...
@@ -250,8 +260,14 @@
// Open the filter panel if one 'search' button is clicked
evt
.
preventDefault
();
return
this
.
triggerSubmit
({
focus_on
:
parseInt
(
evt
.
target
.
value
,
10
)});
}
else
if
(
evt
.
target
.
classList
.
contains
(
"
graphic-button
"
)
||
evt
.
target
.
classList
.
contains
(
"
change-graphic-button
"
))
{
}
else
if
(
evt
.
target
.
classList
.
contains
(
"
graphic-button
"
))
{
return
gadget
.
redirect
({
command
:
"
store_and_change
"
,
options
:
{
graphic_type
:
gadget
.
state
.
graphic_type
}
});
}
else
if
(
evt
.
target
.
classList
.
contains
(
"
change-graphic-button
"
))
{
return
gadget
.
triggerListboxGraphicSelection
();
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_searchfield_js.xml
View file @
41b64275
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
997.4
8219.25108.64102
</string>
</value>
<value>
<string>
997.4
9459.47071.9267
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
1643
074808.7
</float>
<float>
1643
150086.6
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_graphic_js.js
View file @
41b64275
...
...
@@ -151,6 +151,11 @@
})
);
return
gadget
.
getUrlParameter
(
'
extended_search
'
)
.
push
(
function
(
extended_search
)
{
if
(
extended_search
)
{
jio_query_list
.
push
(
Query
.
parseStringToObject
(
extended_search
));
}
if
(
domain_id
)
{
domain_list
=
options
.
layout
.
x
.
domain_list
||
[];
for
(
i
=
0
;
i
<
domain_list
.
length
;
i
+=
1
)
{
...
...
@@ -181,41 +186,35 @@
data
.
query_list
=
query_list
;
}
else
if
(
group_by
instanceof
Array
&&
group_by
.
length
>
1
)
{
data
.
query
=
{
"
query
"
:
Query
.
objectToSearchText
(
new
ComplexQuery
({
query
:
Query
.
objectToSearchText
(
new
ComplexQuery
({
operator
:
"
AND
"
,
query_list
:
jio_query_list
,
type
:
"
complex
"
type
:
"
complex
"
})),
"
list_method_template
"
:
options
.
list_method_template
,
"
list_method
"
:
options
.
list_method
,
"
relative_url
"
:
options
.
relative_url
,
"
group_by
"
:
group_by
,
"
select_list
"
:
select_list
.
concat
(
group_by
)
list_method_template
:
options
.
list_method_template
,
list_method
:
options
.
list_method
,
relative_url
:
options
.
relative_url
,
group_by
:
group_by
,
select_list
:
select_list
.
concat
(
group_by
)
};
}
else
{
data
.
extended_search_mapping
[
options
.
title
]
=
{
"
key
"
:
group_by
,
"
value
"
:
options
.
group_by
key
:
group_by
,
value
:
options
.
group_by
};
data
.
query
=
{
"
query
"
:
Query
.
objectToSearchText
(
new
ComplexQuery
({
query
:
Query
.
objectToSearchText
(
new
ComplexQuery
({
operator
:
"
AND
"
,
query_list
:
jio_query_list
,
type
:
"
complex
"
})),
"
list_method_template
"
:
options
.
list_method_template
,
"
list_method
"
:
options
.
list_method
,
"
relative_url
"
:
options
.
relative_url
,
"
group_by
"
:
group_by
,
"
select_list
"
:
select_list
list_method_template
:
options
.
list_method_template
,
list_method
:
options
.
list_method
,
relative_url
:
options
.
relative_url
,
group_by
:
group_by
,
select_list
:
select_list
};
}
return
gadget
.
getUrlParameter
(
'
extended_search
'
)
.
push
(
function
(
extended_search
)
{
if
(
extended_search
)
{
jio_query_list
.
push
(
Query
.
parseStringToObject
(
extended_search
));
}
return
gadget
.
changeState
(
data
);
});
})
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_graphic_js.xml
View file @
41b64275
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
997.
31802.54309.25309
</string>
</value>
<value>
<string>
997.
48057.37984.27733
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>
164
2089304.69
</float>
<float>
164
3148004.23
</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