Commit ee6c417d877f65159eac2d03aa187d79f25c846b

Authored by David RENÉ
1 parent 25fea527

add log and speed up the construction of the drop down into the jqgrid

view/jqgrid.anubis
@@ -10,15 +10,21 @@ read xlib/web/making_a_web_site.anubis @@ -10,15 +10,21 @@ read xlib/web/making_a_web_site.anubis
10 read hayamiki_lib/types/hayamiki.anubis 10 read hayamiki_lib/types/hayamiki.anubis
11 read hayamiki_lib/view/types/hk_form.anubis 11 read hayamiki_lib/view/types/hk_form.anubis
12 read hayamiki_lib/view/types/hk_view.anubis 12 read hayamiki_lib/view/types/hk_view.anubis
  13 +read tools/time.anubis
  14 +read app/app_loggers.anubis
13 15
14 define String 16 define String
15 to_jqGrid_selector 17 to_jqGrid_selector
16 ( 18 (
17 List((List(CoreAttrs), WebArgValue, String)) from_hk_selector 19 List((List(CoreAttrs), WebArgValue, String)) from_hk_selector
18 )= 20 )=
19 - "\""+ 21 + logDebug("to_jqGrid_selector: entry");
  22 + with start_time = unow,
  23 + with result = "\""+
20 join(";",map(((List(CoreAttrs), WebArgValue, String) select) |-> since select is (_, wav, show), wav.value+":"+show, from_hk_selector))+ 24 join(";",map(((List(CoreAttrs), WebArgValue, String) select) |-> since select is (_, wav, show), wav.value+":"+show, from_hk_selector))+
21 - "\"" 25 + "\"",
  26 + logDebug(show_duration_string("to_jqGrid_selector: duration ", start_time));
  27 + result
22 . 28 .
23 29
24 define String 30 define String
@@ -102,30 +108,36 @@ define String @@ -102,30 +108,36 @@ define String
102 VT_view_model_entry model, 108 VT_view_model_entry model,
103 (String) -> String _T 109 (String) -> String _T
104 )= 110 )=
  111 + logDebug("to_jqGrid_ColModel 1: entry");
  112 + with start_time = unow,
105 with empty_referer = hk_referer("","","",""), 113 with empty_referer = hk_referer("","","",""),
106 - if model is 114 + with result = if model is
107 { 115 {
108 primary_key then "{ name: \"id\", hidden:true }", 116 primary_key then "{ name: \"id\", hidden:true }",
109 information(label,column_name,width,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", autoResizable: true, "+search_options(column_name)+"}", 117 information(label,column_name,width,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", autoResizable: true, "+search_options(column_name)+"}",
110 text(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, "+search_options(column_name)+" }", 118 text(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, "+search_options(column_name)+" }",
111 password(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", autoResizable: true }", 119 password(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", autoResizable: true }",
112 foreign_text(label,column_name,selector,help) then 120 foreign_text(label,column_name,selector,help) then
113 - "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db,table_referer,""))+"},"+ 121 + with jqgrid_selector = to_jqGrid_selector(selector.get(db,table_referer,"")),
  122 + "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+jqgrid_selector+"},"+
114 " formatter: \"select\","+ 123 " formatter: \"select\","+
115 - " formatoptions:{value: "+to_jqGrid_selector(selector.get(db, table_referer, ""))+"},"+ 124 + " formatoptions:{value: "+jqgrid_selector+"},"+
116 "}", 125 "}",
117 choices_text(label,column_name,selector,help) then 126 choices_text(label,column_name,selector,help) then
118 - "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db, empty_referer, ""))+"},"+ 127 + with jqgrid_selector = to_jqGrid_selector(selector.get(db, empty_referer, "")),
  128 + "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+jqgrid_selector+"},"+
119 " formatter: \"select\","+ 129 " formatter: \"select\","+
120 - " formatoptions:{value: "+to_jqGrid_selector(selector.get(db, empty_referer, ""))+"},"+ 130 + " formatoptions:{value: "+jqgrid_selector+"},"+
121 "}", 131 "}",
122 text_area(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\" }", 132 text_area(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\" }",
123 boolean(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"booleanCheckboxFa\" }", 133 boolean(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"booleanCheckboxFa\" }",
124 integer(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"integer\" }", 134 integer(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"integer\" }",
125 float(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"number\" }", 135 float(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, template: \"number\" }",
126 - choices_int(label,column_name,selector,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+to_jqGrid_selector(selector.get(db, empty_referer, ""))+"},"+ 136 + choices_int(label,column_name,selector,help) then
  137 + with jqgrid_selector = to_jqGrid_selector(selector.get(db, empty_referer, "")),
  138 + "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype:\"select\", editoptions:{value: "+jqgrid_selector+"},"+
127 " formatter: \"select\","+ 139 " formatter: \"select\","+
128 - " formatoptions:{value: "+to_jqGrid_selector(selector.get(db, empty_referer, ""))+"},"+ 140 + " formatoptions:{value: "+jqgrid_selector+"},"+
129 "}", 141 "}",
130 date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}", 142 date(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, formatter: \"date\", formatoptions: { newformat: \"Y-M-d\" }}",
131 time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }", 143 time(label,column_name,help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true }",
@@ -134,7 +146,9 @@ define String @@ -134,7 +146,9 @@ define String
134 phone(label,column_name, ph_type, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype: 'custom', formatter:formatPhone, unformat:unformatPhone, "+custom_edit_phone+"}", 146 phone(label,column_name, ph_type, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype: 'custom', formatter:formatPhone, unformat:unformatPhone, "+custom_edit_phone+"}",
135 email(label,column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype: 'custom', formatter:formatEmail, unformat:unformatEmail, "+custom_edit_email+"}", 147 email(label,column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, edittype: 'custom', formatter:formatEmail, unformat:unformatEmail, "+custom_edit_email+"}",
136 url(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, "+search_options(column_name)+" }", 148 url(label, column_name, help) then "{ name: \""+column_name+"\", label: \""+_T(label)+"\", editable:true, autoResizable: true, "+search_options(column_name)+" }",
137 - } 149 + },
  150 + logDebug(show_duration_string("to_jqGrid_ColModel 1: result", start_time));
  151 + result
138 . 152 .
139 153
140 public define String 154 public define String
@@ -145,11 +159,14 @@ public define String @@ -145,11 +159,14 @@ public define String
145 (String) -> String _T, 159 (String) -> String _T,
146 List(VT_view_model_entry) models 160 List(VT_view_model_entry) models
147 )= 161 )=
148 - "colModel: [\n"+ 162 + logDebug("to_jqGrid_ColModel: entry");
  163 + with result = "colModel: [\n"+
149 join(",\n ", 164 join(",\n ",
150 [ "{name: 'myac', label: '', width:65, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}}" . 165 [ "{name: 'myac', label: '', width:65, fixed:true, sortable:false, resize:false, formatter:'actions', formatoptions:{keys:true}}" .
151 map((VT_view_model_entry col_model) |-> to_jqGrid_ColModel(db, table_referer, col_model, _T), models) 166 map((VT_view_model_entry col_model) |-> to_jqGrid_ColModel(db, table_referer, col_model, _T), models)
152 ] 167 ]
153 )+ 168 )+
154 - "]" 169 + "]",
  170 + logDebug("to_jqGrid_ColModel: result");
  171 + result
155 . 172 .
view/view_table_manager.anubis
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 */ 6 */
7 7
8 read tools/basis.anubis 8 read tools/basis.anubis
  9 +read app/app_loggers.anubis
9 transmit hayamiki_lib/view/types/hk_form.anubis 10 transmit hayamiki_lib/view/types/hk_form.anubis
10 transmit hayamiki_lib/view/view_table_manager_types.anubis 11 transmit hayamiki_lib/view/view_table_manager_types.anubis
11 12
@@ -17,7 +18,7 @@ public define Maybe(VTM_view) @@ -17,7 +18,7 @@ public define Maybe(VTM_view)
17 ) = 18 ) =
18 if list is 19 if list is
19 { 20 {
20 - [] then println("_vtm_get_view "+_table_name+" not found"); failure, 21 + [] then logError("_vtm_get_view "+_table_name+" not found"); failure,
21 [ h . t ] then 22 [ h . t ] then
22 if h.table_name = _table_name then 23 if h.table_name = _table_name then
23 success(h) 24 success(h)
view/view_table_renderer.anubis
@@ -20,6 +20,7 @@ read tools/basis.anubis @@ -20,6 +20,7 @@ read tools/basis.anubis
20 read tools/base64.anubis 20 read tools/base64.anubis
21 read tools/list.anubis 21 read tools/list.anubis
22 read tools/printable_tree.anubis 22 read tools/printable_tree.anubis
  23 +read tools/time.anubis
23 read data_base/sqlite.anubis 24 read data_base/sqlite.anubis
24 read system_colors/rgb.anubis 25 read system_colors/rgb.anubis
25 read system/convert.anubis 26 read system/convert.anubis
@@ -42,6 +43,7 @@ read xlib/web/widgets/css_helper.anubis @@ -42,6 +43,7 @@ read xlib/web/widgets/css_helper.anubis
42 read xlib/web/widgets/button.anubis 43 read xlib/web/widgets/button.anubis
43 read xlib/web/widgets/specialized_elements.anubis 44 read xlib/web/widgets/specialized_elements.anubis
44 read xlib/web/urllib.anubis 45 read xlib/web/urllib.anubis
  46 +read app/app_loggers.anubis
45 47
46 public define List(CXM_Form_Field) 48 public define List(CXM_Form_Field)
47 get_hidden 49 get_hidden
@@ -375,7 +377,8 @@ define String @@ -375,7 +377,8 @@ define String
375 VT_view rows, 377 VT_view rows,
376 (String) -> String _T 378 (String) -> String _T
377 )= 379 )=
378 - " 380 + logDebug("jqGrid_options: entry");
  381 + with result = "
379 editurl: '?aws_controller=hk_c&aws_action=grid_action&table_name="+rows.table_name+"', 382 editurl: '?aws_controller=hk_c&aws_action=grid_action&table_name="+rows.table_name+"',
380 iconSet: \"fontAwesome\", 383 iconSet: \"fontAwesome\",
381 cmTemplate: { autoResizable: true}, 384 cmTemplate: { autoResizable: true},
@@ -437,7 +440,9 @@ define String @@ -437,7 +440,9 @@ define String
437 } 440 }
438 ] 441 ]
439 } 442 }
440 - " 443 + ",
  444 + logDebug("jqGrid_options: return result");
  445 + result
441 // ondblClickRow: function( rowid) {"+ 446 // ondblClickRow: function( rowid) {"+
442 // jq_dialog_open(dialog_id(uid+"edit_table_dlg_ajax"), "'id='+rowid")+ 447 // jq_dialog_open(dialog_id(uid+"edit_table_dlg_ajax"), "'id='+rowid")+
443 . 448 .
@@ -454,6 +459,7 @@ public define HTML_Partial_Content @@ -454,6 +459,7 @@ public define HTML_Partial_Content
454 String clause, 459 String clause,
455 HK_Referer table_referer 460 HK_Referer table_referer
456 )= 461 )=
  462 + logDebug("jqGrid_table: entry");
457 with filter_clause = if clause = "" then "" else "&clause="+url_quote(clause), 463 with filter_clause = if clause = "" then "" else "&clause="+url_quote(clause),
458 with referer_arg = "&"+to_Web_arg(table_referer, ""), 464 with referer_arg = "&"+to_Web_arg(table_referer, ""),
459 with js = js_inline(jquery_ready( 465 with js = js_inline(jquery_ready(
@@ -511,7 +517,7 @@ url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&vi @@ -511,7 +517,7 @@ url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&vi
511 var ret = jqo.text(); 517 var ret = jqo.text();
512 return ret; 518 return ret;
513 }")), 519 }")),
514 - 520 + logDebug("jqGrid_table: partial_content");
515 partial_content(jqgrid_init(lang) + [js, css(css_file("hayamiki/css/hayamiki.css"))], 521 partial_content(jqgrid_init(lang) + [js, css(css_file("hayamiki/css/hayamiki.css"))],
516 div([], 522 div([],
517 sequence([ 523 sequence([
@@ -537,15 +543,19 @@ public define HTML_Partial_Content @@ -537,15 +543,19 @@ public define HTML_Partial_Content
537 HK_Referer table_referer, 543 HK_Referer table_referer,
538 String fk_clause //filter for foreign key of the table (one to many) 544 String fk_clause //filter for foreign key of the table (one to many)
539 ) = 545 ) =
  546 + logDebug("view_table_page: entry");
540 with current_view = vtm_v.get_view(view_name), 547 with current_view = vtm_v.get_view(view_name),
541 //with _filter = get_filter_from_name(vtm_v, view_name, filter_name), 548 //with _filter = get_filter_from_name(vtm_v, view_name, filter_name),
542 //with f_clause = if _filter.filter_string = "" then "" else if _f_clause = "" then _filter.filter_string else "("+_filter.filter_string+") AND "+_f_clause, 549 //with f_clause = if _filter.filter_string = "" then "" else if _f_clause = "" then _filter.filter_string else "("+_filter.filter_string+") AND "+_f_clause,
543 with filter_clause = if f_clause = "" then "" else "&clause="+url_quote(f_clause), 550 with filter_clause = if f_clause = "" then "" else "&clause="+url_quote(f_clause),
544 //with foreign_clause = if fk_clause = "" then "" else "&fk_clause="+url_quote(fk_clause), 551 //with foreign_clause = if fk_clause = "" then "" else "&fk_clause="+url_quote(fk_clause),
545 with referer_arg = "&"+to_Web_arg(table_referer, ""), 552 with referer_arg = "&"+to_Web_arg(table_referer, ""),
546 -  
547 -  
548 with uid = "_"+generate_random_string(15)+"_", 553 with uid = "_"+generate_random_string(15)+"_",
  554 + logDebug("view_table_page: start_time unow");
  555 + with start_time = unow,
  556 + with jqgrid_table = jqGrid_table(db, uid, current_view, filter_name, _T, lang, f_clause, table_referer),
  557 + logDebug(show_duration_string("jqGrid_table : current_view '"+view_name+"' filter_name '"+filter_name+"'", start_time));
  558 + with result =
549 partial_content([ js(js_file("hayamiki/js/jscolor.min.js")) 559 partial_content([ js(js_file("hayamiki/js/jscolor.min.js"))
550 ]+jq_dialog_init + jq_datetimepicker_init(lang), 560 ]+jq_dialog_init + jq_datetimepicker_init(lang),
551 [html_wave_box_wide(_T(to_upper(current_view.table_name)), 561 [html_wave_box_wide(_T(to_upper(current_view.table_name)),
@@ -559,9 +569,11 @@ public define HTML_Partial_Content @@ -559,9 +569,11 @@ public define HTML_Partial_Content
559 table_view_filter_selector(_T, vtm_v, view_name, filter_name), 569 table_view_filter_selector(_T, vtm_v, view_name, filter_name),
560 ])), 570 ])),
561 //grid with data 571 //grid with data
562 - partial(jqGrid_table(db, uid, current_view, filter_name, _T, lang, f_clause, table_referer)) 572 + partial(jqgrid_table)
563 //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(500), true, true, true, lang, no_extra, web_site_directory)) 573 //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(500), true, true, true, lang, no_extra, web_site_directory))
564 - ]))]). 574 + ]))]),
  575 + logDebug(show_duration_string("view_table_page: current_view '"+view_name+"' filter_name '"+filter_name+"'", start_time));
  576 + result.
565 577
566 public define HTML_Partial_Content 578 public define HTML_Partial_Content
567 table_in_list_view 579 table_in_list_view
@@ -583,7 +595,10 @@ public define HTML_Partial_Content @@ -583,7 +595,10 @@ public define HTML_Partial_Content
583 with referer_arg = "&"+to_Web_arg(table_referer, ""), 595 with referer_arg = "&"+to_Web_arg(table_referer, ""),
584 with current_view = vtm_v.get_view(view_name), 596 with current_view = vtm_v.get_view(view_name),
585 with uid = generate_random_string(20)+"_", 597 with uid = generate_random_string(20)+"_",
586 - partial_content([ js(js_file("hayamiki/js/jscolor.min.js")) 598 + with start_time = unow,
  599 + with jqgrid_table = jqGrid_table(db, uid, current_view, filter_name, _T, lang, /*fk_clause*/ f_clause, table_referer),
  600 + logDebug(show_duration_string("jqGrid_table : current_view '"+view_name+"' filter_name '"+filter_name+"'", start_time));
  601 + with result = partial_content([ js(js_file("hayamiki/js/jscolor.min.js"))
587 ]+ 602 ]+
588 jq_dialog_init + 603 jq_dialog_init +
589 jq_datetimepicker_init(lang), 604 jq_datetimepicker_init(lang),
@@ -591,9 +606,11 @@ public define HTML_Partial_Content @@ -591,9 +606,11 @@ public define HTML_Partial_Content
591 partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+action_name+"_dlg_ajax&table_name="+current_view.table_name+filter_clause+referer_arg)))), 606 partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+action_name+"_dlg_ajax&table_name="+current_view.table_name+filter_clause+referer_arg)))),
592 partial(img_button(icn16_add, [class("icon_in_text"), event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), 607 partial(img_button(icn16_add, [class("icon_in_text"), event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])),
593 //table_view_selector(_T, vtm_v, view_name), 608 //table_view_selector(_T, vtm_v, view_name),
594 - partial(jqGrid_table(db, uid, current_view, filter_name, _T, lang, /*fk_clause*/ f_clause, table_referer)), 609 + partial(jqgrid_table),
595 //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(200), true, true, true, lang, no_extra, web_site_directory)) 610 //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(200), true, true, true, lang, no_extra, web_site_directory))
596 - ]). 611 + ]),
  612 + logDebug(show_duration_string("table_in_list_view: current_view '"+view_name+"' filter_name '"+filter_name+"'", start_time));
  613 + result.
597 614
598 public define Maybe(HTML_Partial_Content) 615 public define Maybe(HTML_Partial_Content)
599 view_table_content 616 view_table_content
@@ -611,10 +628,12 @@ public define Maybe(HTML_Partial_Content) @@ -611,10 +628,12 @@ public define Maybe(HTML_Partial_Content)
611 String fk_clause, 628 String fk_clause,
612 VTM vtm 629 VTM vtm
613 ) = 630 ) =
  631 + logDebug("view_table_content: entry");
614 if vtm_get_view(table_name, vtm.view_list) is 632 if vtm_get_view(table_name, vtm.view_list) is
615 { 633 {
616 failure then failure, 634 failure then failure,
617 - success(vtm_v) then 635 + success(vtm_v) then
  636 + logDebug("view_table_content: success");
618 success(view_table_page(db, _T, lang, /*web_site_directory, */action_name, vtm_v, view_name, filter_name, f_clause, table_referer, fk_clause)) 637 success(view_table_page(db, _T, lang, /*web_site_directory, */action_name, vtm_v, view_name, filter_name, f_clause, table_referer, fk_clause))
619 }. 638 }.
620 639