cmdbox 0.5.2__py3-none-any.whl → 0.5.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cmdbox might be problematic. Click here for more details.

Files changed (114) hide show
  1. cmdbox/app/auth/signin.py +1 -0
  2. cmdbox/app/feature.py +2 -0
  3. cmdbox/app/features/cli/audit_base.py +5 -2
  4. cmdbox/app/features/cli/cmdbox_audit_createdb.py +1 -1
  5. cmdbox/app/features/cli/cmdbox_audit_delete.py +27 -18
  6. cmdbox/app/features/cli/cmdbox_audit_search.py +128 -62
  7. cmdbox/app/features/cli/cmdbox_audit_write.py +31 -20
  8. cmdbox/app/features/cli/cmdbox_client_file_copy.py +1 -1
  9. cmdbox/app/features/cli/cmdbox_client_file_download.py +1 -1
  10. cmdbox/app/features/cli/cmdbox_client_file_list.py +1 -1
  11. cmdbox/app/features/cli/cmdbox_client_file_mkdir.py +1 -1
  12. cmdbox/app/features/cli/cmdbox_client_file_move.py +1 -1
  13. cmdbox/app/features/cli/cmdbox_client_file_remove.py +1 -1
  14. cmdbox/app/features/cli/cmdbox_client_file_rmdir.py +1 -1
  15. cmdbox/app/features/cli/cmdbox_client_file_upload.py +1 -1
  16. cmdbox/app/features/cli/cmdbox_client_server_info.py +1 -1
  17. cmdbox/app/features/cli/cmdbox_gui_start.py +1 -1
  18. cmdbox/app/features/cli/cmdbox_server_start.py +1 -1
  19. cmdbox/app/features/cli/cmdbox_server_stop.py +1 -1
  20. cmdbox/app/features/cli/cmdbox_web_apikey_add.py +1 -1
  21. cmdbox/app/features/cli/cmdbox_web_apikey_del.py +1 -1
  22. cmdbox/app/features/cli/cmdbox_web_group_add.py +1 -1
  23. cmdbox/app/features/cli/cmdbox_web_group_del.py +1 -1
  24. cmdbox/app/features/cli/cmdbox_web_group_edit.py +1 -1
  25. cmdbox/app/features/cli/cmdbox_web_group_list.py +1 -1
  26. cmdbox/app/features/cli/cmdbox_web_start.py +1 -1
  27. cmdbox/app/features/cli/cmdbox_web_user_add.py +1 -1
  28. cmdbox/app/features/cli/cmdbox_web_user_del.py +1 -1
  29. cmdbox/app/features/cli/cmdbox_web_user_edit.py +1 -1
  30. cmdbox/app/features/cli/cmdbox_web_user_list.py +1 -1
  31. cmdbox/app/features/web/cmdbox_web_audit.py +87 -0
  32. cmdbox/app/features/web/cmdbox_web_audit_metrics.py +72 -0
  33. cmdbox/app/features/web/cmdbox_web_exec_cmd.py +10 -5
  34. cmdbox/app/features/web/cmdbox_web_user_data.py +58 -0
  35. cmdbox/app/options.py +49 -19
  36. cmdbox/app/server.py +15 -3
  37. cmdbox/app/web.py +7 -1
  38. cmdbox/extensions/features.yml +11 -8
  39. cmdbox/extensions/sample_project/sample/app/features/cli/sample_server_time.py +1 -1
  40. cmdbox/extensions/user_list.yml +5 -0
  41. cmdbox/licenses/LICENSE.Jinja2.3.1.4(BSD License).txt +28 -0
  42. cmdbox/licenses/LICENSE.Pygments.2.18.0(BSD License).txt +25 -0
  43. cmdbox/licenses/LICENSE.Sphinx.8.1.3(BSD License).txt +31 -0
  44. cmdbox/licenses/LICENSE.anyio.4.6.2.post1(MIT License).txt +20 -0
  45. cmdbox/licenses/LICENSE.argcomplete.3.5.1(Apache Software License).txt +177 -0
  46. cmdbox/licenses/LICENSE.argcomplete.3.6.2(Apache Software License).txt +177 -0
  47. cmdbox/licenses/LICENSE.babel.2.16.0(BSD License).txt +27 -0
  48. cmdbox/licenses/LICENSE.certifi.2024.8.30(Mozilla Public License 2.0 (MPL 2.0)).txt +20 -0
  49. cmdbox/licenses/LICENSE.charset-normalizer.3.4.0(MIT License).txt +21 -0
  50. cmdbox/licenses/LICENSE.click.8.1.7(BSD License).txt +28 -0
  51. cmdbox/licenses/LICENSE.cryptography.43.0.3(Apache Software License; BSD License).txt +3 -0
  52. cmdbox/licenses/LICENSE.fastapi.0.115.5(MIT License).txt +21 -0
  53. cmdbox/licenses/LICENSE.gevent.25.4.1(MIT).txt +25 -0
  54. cmdbox/licenses/LICENSE.greenlet.3.2.0(MIT AND Python-2.0).txt +30 -0
  55. cmdbox/licenses/LICENSE.importlib_metadata.8.5.0(Apache Software License).txt +202 -0
  56. cmdbox/licenses/LICENSE.keyring.25.5.0(MIT License).txt +17 -0
  57. cmdbox/licenses/LICENSE.more-itertools.10.5.0(MIT License).txt +19 -0
  58. cmdbox/licenses/LICENSE.nh3.0.2.18(MIT).txt +1 -0
  59. cmdbox/licenses/LICENSE.numpy.2.1.3(BSD License).txt +950 -0
  60. cmdbox/licenses/LICENSE.pillow.11.0.0(CMU License (MIT-CMU)).txt +1226 -0
  61. cmdbox/licenses/LICENSE.pillow.11.2.1(UNKNOWN).txt +1200 -0
  62. cmdbox/licenses/LICENSE.pkginfo.1.10.0(MIT License).txt +21 -0
  63. cmdbox/licenses/LICENSE.prettytable.3.12.0(BSD License).txt +30 -0
  64. cmdbox/licenses/LICENSE.prompt_toolkit.3.0.51(BSD License).txt +27 -0
  65. cmdbox/licenses/LICENSE.pydantic.2.10.2(MIT License).txt +21 -0
  66. cmdbox/licenses/LICENSE.pydantic.2.11.3(MIT License).txt +21 -0
  67. cmdbox/licenses/LICENSE.pydantic_core.2.27.1(MIT License).txt +21 -0
  68. cmdbox/licenses/LICENSE.pydantic_core.2.33.1(MIT License).txt +21 -0
  69. cmdbox/licenses/LICENSE.python-dotenv.1.0.1(BSD License).txt +27 -0
  70. cmdbox/licenses/LICENSE.python-multipart.0.0.17(Apache Software License).txt +14 -0
  71. cmdbox/licenses/LICENSE.redis.5.2.0(MIT License).txt +21 -0
  72. cmdbox/licenses/LICENSE.rich.13.9.4(MIT License).txt +19 -0
  73. cmdbox/licenses/LICENSE.six.1.16.0(MIT License).txt +18 -0
  74. cmdbox/licenses/LICENSE.sphinx-intl.2.3.0(BSD License).txt +25 -0
  75. cmdbox/licenses/LICENSE.starlette.0.41.3(BSD License).txt +27 -0
  76. cmdbox/licenses/LICENSE.starlette.0.46.2(BSD License).txt +27 -0
  77. cmdbox/licenses/LICENSE.tomli.2.1.0(MIT License).txt +21 -0
  78. cmdbox/licenses/LICENSE.twine.5.1.1(Apache Software License).txt +174 -0
  79. cmdbox/licenses/LICENSE.typing_extensions.4.12.2(Python Software Foundation License).txt +279 -0
  80. cmdbox/licenses/LICENSE.typing_extensions.4.13.2(UNKNOWN).txt +279 -0
  81. cmdbox/licenses/LICENSE.urllib3.2.2.3(MIT License).txt +21 -0
  82. cmdbox/licenses/LICENSE.urllib3.2.4.0(UNKNOWN).txt +21 -0
  83. cmdbox/licenses/LICENSE.uvicorn.0.32.1(BSD License).txt +27 -0
  84. cmdbox/licenses/LICENSE.uvicorn.0.34.1(BSD License).txt +27 -0
  85. cmdbox/licenses/LICENSE.watchfiles.1.0.0(MIT License).txt +21 -0
  86. cmdbox/licenses/LICENSE.watchfiles.1.0.5(MIT License).txt +21 -0
  87. cmdbox/licenses/LICENSE.websockets.14.1(BSD License).txt +24 -0
  88. cmdbox/licenses/LICENSE.zope.interface.7.1.1(Zope Public License).txt +44 -0
  89. cmdbox/licenses/files.txt +12 -13
  90. cmdbox/version.py +2 -2
  91. cmdbox/web/assets/apexcharts/apexcharts.css +679 -0
  92. cmdbox/web/assets/apexcharts/apexcharts.min.js +38 -0
  93. cmdbox/web/assets/cmdbox/audit.js +404 -0
  94. cmdbox/web/assets/cmdbox/color_mode.css +4 -0
  95. cmdbox/web/assets/cmdbox/common.js +397 -24
  96. cmdbox/web/assets/cmdbox/filer_modal.js +1 -1
  97. cmdbox/web/assets/cmdbox/list_cmd.js +7 -271
  98. cmdbox/web/assets/cmdbox/list_pipe.js +3 -3
  99. cmdbox/web/assets/cmdbox/users.js +17 -17
  100. cmdbox/web/assets/cmdbox/view_raw.js +1 -1
  101. cmdbox/web/assets/cmdbox/view_result.js +11 -13
  102. cmdbox/web/assets/filer/filer.js +2 -2
  103. cmdbox/web/assets_license_list.txt +4 -1
  104. cmdbox/web/audit.html +293 -0
  105. cmdbox/web/filer.html +21 -10
  106. cmdbox/web/gui.html +21 -52
  107. cmdbox/web/result.html +9 -2
  108. cmdbox/web/users.html +7 -3
  109. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/METADATA +13 -10
  110. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/RECORD +114 -59
  111. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/LICENSE +0 -0
  112. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/WHEEL +0 -0
  113. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/entry_points.txt +0 -0
  114. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/top_level.txt +0 -0
@@ -159,165 +159,16 @@ const list_cmd_func_then = () => {
159
159
  const cmd = cmd_modal.find('[name="cmd"]').val();
160
160
  const selected_cmd = cmd_modal.find('[name="cmd"] option:selected');
161
161
  cmd_modal.find('.cmd_label').attr('title', selected_cmd.attr('discription'));
162
- const py_get_cmd_choices = await get_cmd_choices(mode, cmd);
162
+ const py_get_cmd_choices = await cmdbox.get_cmd_choices(mode, cmd);
163
163
  row_content.html('');
164
- // オプション一覧をフォームに追加
165
- const add_form_func = (i, row, next_elem) => {
166
- const target_name = row.opt;
167
- let input_elem, elem;
168
- if(!row.choice) {
169
- // 選択肢がない場合
170
- if(row.type=='text') {
171
- elem = $(cmd_modal.find('.row_content_template_text').html());
172
- } else if(row.type=='dict') {
173
- elem = $(cmd_modal.find('.row_content_template_dict').html());
174
- } else {
175
- elem = $(cmd_modal.find('.row_content_template_str').html());
176
- }
177
- if (next_elem) next_elem.after(elem);
178
- else row_content.append(elem);
179
- input_elem = elem.find('.row_content_template_input');
180
- if(row.type=='date') input_elem.attr('type', 'date');
181
- else if(row.type=='datetime') input_elem.attr('type', 'datetime-local');
182
- input_elem.removeClass('row_content_template_input');
183
- input_elem.val(row.default);
184
- }
185
- else {
186
- // 選択肢がある場合
187
- if(row.type=='dict') {
188
- elem = $(cmd_modal.find('.row_content_template_dict_choice').html());
189
- } else {
190
- elem = $(cmd_modal.find('.row_content_template_choice').html());
191
- }
192
- if (next_elem) next_elem.after(elem);
193
- else row_content.append(elem);
194
- input_elem = elem.find('.row_content_template_select,.row_content_template_input');
195
- input_elem.removeClass('row_content_template_select').removeClass('row_content_template_input');
196
- if (row.choice_show) {
197
- input_elem.addClass('choice_show');
198
- input_elem.change(() => {
199
- let names = []
200
- for (const ns of Object.values(row.choice_show)) {
201
- if (Array.isArray(ns)) {
202
- ns.forEach(n => names.push(n));
203
- } else {
204
- names.push(ns);
205
- }
206
- }
207
- names = [...new Set(names)];
208
- names.forEach(name => row_content.find(`[name="${name}"]`).parent().parent().hide());
209
- const v = input_elem.val();
210
- if (!row.choice_show[v]) return;
211
- row.choice_show[v].forEach(n => row_content.find(`[name="${n}"]`).parent().parent().show());
212
- });
213
- }
214
- input_elem.html(mkopt(row.choice));
215
- input_elem.val(`${row.default!=null?row.default:''}`);
216
- }
217
- let index = 0;
218
- if (cmd_modal.find(`[name="${target_name}"]`).length > 0) {
219
- index = 0;
220
- cmd_modal.find(`[name="${target_name}"][param_data_index]`).each((i, val) => {
221
- v = Number($(val).attr('param_data_index'));
222
- if (index <= v) index = v + 1;
223
- });
224
- }
225
- input_elem.attr('name', target_name);
226
- if(row.type=='dict') {
227
- input_elem.each((i, e) => {
228
- $(e).attr('id', target_name + (index + i));
229
- $(e).attr('param_data_index', (index + i));
230
- });
231
- } else {
232
- input_elem.attr('id', target_name + index);
233
- input_elem.attr('param_data_index', index);
234
- }
235
- input_elem.attr('required', row.required);
236
- input_elem.attr('param_data_type', row.type);
237
- input_elem.attr('param_data_multi', row.multi);
238
- input_elem.attr('param_data_web', row.web);
239
- if (row.web=='mask' || row.web=='readonly') {
240
- input_elem.attr('disabled', 'disabled');
241
- }
242
- // ファイルタイプの場合はファイラーモーダルを開くボタンを追加
243
- if(row.type=='file'){
244
- const btn = $('<button class="btn btn-secondary" type="button">file</button>');
245
- input_elem.parent().append(btn);
246
- const mk_func = (tid, tn) => {
247
- // tid, tnの値を残すためにクロージャーにする
248
- return () => {
249
- const current_path = $(`[id="${tid}"]`).val();
250
- fmodal.filer_modal_func(tid, tn, current_path, false, true);
251
- }
252
- }
253
- btn.click(mk_func(input_elem.attr('id'), input_elem.attr('name')));
254
- }
255
- // ディレクトリタイプの場合はファイラーモーダルを開くボタンを追加
256
- if(row.type=='dir'){
257
- const btn = $('<button class="btn btn-secondary" type="button">dir</button>');
258
- input_elem.parent().append(btn);
259
- const mk_func = (tid, tn) => {
260
- // tid, tnの値を残すためにクロージャーにする
261
- return () => {
262
- const current_path = $(`[id="${tid}"]`).val();
263
- fmodal.filer_modal_func(tid, tn, current_path, true, true);
264
- }
265
- }
266
- btn.click(mk_func(input_elem.attr('id'), input_elem.attr('name')));
267
- }
268
- // マルチの場合は追加ボタンを追加
269
- if(row.multi){
270
- const btn_a = $('<button class="btn btn-secondary add_buton" type="button"></button>');
271
- btn_a.append('<svg class="bi bi-plus" width="16" height="16" fill="currentColor"><use href="#btn_plus"></use></svg>');
272
- input_elem.parent().append(btn_a);
273
- let mk_func = (row, next_elem) => {
274
- // row, next_elemの値を残すためにクロージャーにする
275
- return () => {
276
- const r = {...row};
277
- //r.hide = next_elem.is(':hidden');
278
- add_form_func(0, r, next_elem);
279
- }
280
- }
281
- btn_a.click(mk_func(row, input_elem.parent().parent()));
282
- // 2個目以降は削除ボタンを追加
283
- const len = cmd_modal.find(`[name="${target_name}"]`).length;
284
- if (row.type!='dict' && len > 1 || row.type=='dict' && len > 2) {
285
- mk_func = (del_elem, row) => {
286
- // del_elemの値を残すためにクロージャーにする
287
- return () => del_elem.remove();
288
- }
289
- const btn_t = $('<button class="btn btn-secondary" type="button"></button>');
290
- btn_trash
291
- btn_t.append('<svg class="bi bi-trash" width="16" height="16" fill="currentColor"><use href="#btn_trash"></use></svg>');
292
- input_elem.parent().append(btn_t);
293
- btn_t.click(mk_func(input_elem.parent().parent(), row));
294
- }
295
- }
296
- const title = elem.find('.row_content_template_title');
297
- title.html('');
298
- title.attr('title', window.navigator.language=='ja'?row.discription_ja:row.discription_en)
299
- if (row.required) {
300
- title.append('<span class="text-danger" title="required">*</span>');
301
- }
302
- if (row.choice_show) {
303
- title.append('<span class="text-primary" title="choice_show">*</span>');
304
- }
305
- title.append(`<span>${row.opt}</span>`);
306
- if (row.hide) {
307
- if (row_content.find('.row_content_hide').is(':hidden')) elem.hide();
308
- elem.addClass('row_content_hide');
309
- } else {
310
- title.addClass('text-decoration-underline');
311
- }
312
- }
313
164
  // 表示オプションを追加
314
- py_get_cmd_choices.filter(row => !row.hide).forEach((row, i) => add_form_func(i, row, null));
165
+ py_get_cmd_choices.filter(row => !row.hide).forEach((row, i) => cmdbox.add_form_func(i, cmd_modal, row_content, row, null));
315
166
  // 高度なオプションを表示するリンクを追加
316
167
  const show_link = $('<div class="text-center card-hover mb-3"><a href="#">[ advanced options ]</a></div>');
317
168
  show_link.click(() => row_content.find('.row_content_hide').toggle());
318
169
  row_content.append(show_link);
319
170
  // 非表示オプションを追加
320
- py_get_cmd_choices.filter(row => row.hide).forEach((row, i) => add_form_func(i, row, null));
171
+ py_get_cmd_choices.filter(row => row.hide).forEach((row, i) => cmdbox.add_form_func(i, cmd_modal, row_content, row, null));
321
172
  cmd_modal.find('.choice_show').change();
322
173
  }
323
174
  //row_content.find('is-invalid, is-valid').removeClass('is-invalid').removeClass('is-valid');
@@ -409,7 +260,7 @@ const list_cmd_func_then = () => {
409
260
  cmdbox.load_cmd_pin(title).then((result) => {
410
261
  if (!result['success']) {
411
262
  cmd_modal.find('.btn_pin_fill').hide();
412
- cmd_modal.find('.btn_pin_angle').hide();
263
+ cmd_modal.find('.btn_pin_angle').show();
413
264
  } else if (result['success']=='on') {
414
265
  cmd_modal.find('.btn_pin_fill').show();
415
266
  cmd_modal.find('.btn_pin_angle').hide();
@@ -449,7 +300,7 @@ const list_cmd_func_then = () => {
449
300
  // コマンドファイルの保存
450
301
  $('#cmd_save').off('click').on('click', async () => {
451
302
  const cmd_modal = $('#cmd_modal');
452
- const [title, opt] = get_param(cmd_modal);
303
+ const [title, opt] = cmdbox.get_param(cmd_modal);
453
304
  if (cmd_modal.find('.row_content, .row_content_common').find('.is-invalid').length > 0) {
454
305
  return;
455
306
  }
@@ -480,7 +331,7 @@ const list_cmd_func_then = () => {
480
331
  // コマンドファイルの実行
481
332
  $('#cmd_exec').off('click').on('click', async () => {
482
333
  const cmd_modal = $('#cmd_modal');
483
- const [title, opt] = get_param(cmd_modal);
334
+ const [title, opt] = cmdbox.get_param(cmd_modal);
484
335
  if (cmd_modal.find('.row_content, .row_content_common').find('.is-invalid').length > 0) {
485
336
  return;
486
337
  }
@@ -495,7 +346,7 @@ const list_cmd_func_then = () => {
495
346
  // RAW表示の実行
496
347
  $('#cmd_raw').off('click').on('click', async () => {
497
348
  const cmd_modal = $('#cmd_modal');
498
- const [title, opt] = get_param(cmd_modal);
349
+ const [title, opt] = cmdbox.get_param(cmd_modal);
499
350
  if (cmd_modal.find('.row_content, .row_content_common').find('.is-invalid').length > 0) {
500
351
  return;
501
352
  }
@@ -508,113 +359,6 @@ const list_cmd_func_then = () => {
508
359
  });
509
360
  };
510
361
 
511
- // コマンドフォームからパラメータを取得
512
- const get_param = (modal_elem) => {
513
- modal_elem.find('.is-invalid, .is-valid').removeClass('is-invalid').removeClass('is-valid');
514
- const opt = {};
515
- const title = modal_elem.find('[name="title"]').val();
516
- opt["modal_mode"] = modal_elem.find('[name="modal_mode"]').val();
517
- opt["mode"] = modal_elem.find('[name="mode"]').val();
518
- opt["cmd"] = modal_elem.find('[name="cmd"]').val();
519
- if(!opt["mode"]) delete opt["mode"];
520
- if(!opt["cmd"]) delete opt["cmd"];
521
- opt["title"] = title;
522
- const isFloat = (i) => {
523
- try {
524
- n = Number(i);
525
- return n % 1 !== 0;
526
- } catch(e) {
527
- return false;
528
- }
529
- }
530
- const isInt = (i) => {
531
- try {
532
- n = Number(i);
533
- return n % 1 === 0;
534
- } catch(e) {
535
- return false;
536
- }
537
- }
538
- // フォームの入力値をチェック(不正な値があればフォームに'is-invalid'クラスを付加する)
539
- const dict_buf = {};
540
- modal_elem.find('.row_content, .row_content_common').find('input, select, textarea').each((i, elem) => {
541
- const data_name = $(elem).attr('name');
542
- let data_val = $(elem).val();
543
- const data_type = $(elem).attr('param_data_type');
544
- const data_web = $(elem).attr('param_data_web');
545
- const data_index = parseInt($(elem).attr('param_data_index'));
546
- const data_multi = $(elem).attr('param_data_multi');
547
- if ($(elem).attr('required') && (!data_val || data_val=='')) {
548
- $(elem).addClass('is-invalid');
549
- } else if (data_type=='int' && !data_web) {
550
- if(data_val && data_val!='') {
551
- if(!isInt(data_val)) $(elem).addClass('is-invalid');
552
- else {
553
- $(elem).removeClass('is-invalid');
554
- $(elem).addClass('is-valid');
555
- data_val = parseInt(data_val);
556
- }
557
- } else {
558
- $(elem).removeClass('is-invalid');
559
- $(elem).addClass('is-valid');
560
- }
561
- } else if (data_type=='float') {
562
- if(data_val && data_val!='') {
563
- if(!isFloat(data_val) && !isInt(data_val)) $(elem).addClass('is-invalid');
564
- else {
565
- $(elem).removeClass('is-invalid');
566
- $(elem).addClass('is-valid');
567
- data_val = parseFloat(data_val);
568
- }
569
- } else {
570
- $(elem).removeClass('is-invalid');
571
- $(elem).addClass('is-valid');
572
- }
573
- } else if (data_type=='bool') {
574
- if(data_val!='true' && data_val!='false' && !$(elem).prop('disabled')) $(elem).addClass('is-invalid');
575
- else {
576
- data_val = data_val=='true';
577
- $(elem).removeClass('is-invalid');
578
- $(elem).addClass('is-valid');
579
- }
580
- } else if (data_type=='dict') {
581
- data_val = data_val ? data_val : '';
582
- if(data_val.indexOf(' ')>=0) $(elem).addClass('is-invalid');
583
- else {
584
- $(elem).removeClass('is-invalid');
585
- $(elem).addClass('is-valid');
586
- }
587
- } else if (data_type=='text') {
588
- $(elem).removeClass('is-invalid');
589
- $(elem).addClass('is-valid');
590
- } else {
591
- $(elem).removeClass('is-invalid');
592
- $(elem).addClass('is-valid');
593
- }
594
- if(data_multi=='true' || data_type=='dict') {
595
- if (data_type=='dict') {
596
- if(!opt[data_name]) {
597
- opt[data_name] = {};
598
- dict_buf[data_name] = {};
599
- }
600
- if(data_index%2==0) dict_buf[data_name]['key'] = data_val;
601
- else if (dict_buf[data_name]['key']) {
602
- opt[data_name][dict_buf[data_name]['key']] = data_val;
603
- delete dict_buf[data_name]['key'];
604
- }
605
- } else {
606
- if(!opt[data_name]) opt[data_name] = [];
607
- if(data_val && data_val!='') opt[data_name].push(data_val);
608
- else if(data_val==false) opt[data_name].push(data_val);
609
- }
610
- } else {
611
- if(data_val && data_val!='') opt[data_name] = data_val;
612
- else if(data_val==false) opt[data_name] = data_val;
613
- }
614
- });
615
- return [title, opt];
616
- }
617
-
618
362
  const list_cmd = async (kwd) => {
619
363
  const formData = new FormData();
620
364
  formData.append('kwd', kwd?`*${kwd}*`:'*');
@@ -634,14 +378,6 @@ const get_cmds = async (mode) => {
634
378
  if (res.status != 200) cmdbox.message({'error':`${res.status}: ${res.statusText}`});
635
379
  return await res.json();
636
380
  }
637
- const get_cmd_choices = async (mode, cmd) => {
638
- const formData = new FormData();
639
- formData.append('mode', mode);
640
- formData.append('cmd', cmd);
641
- const res = await fetch('gui/get_cmd_choices', {method: 'POST', body: formData});
642
- if (res.status != 200) cmdbox.message({'error':`${res.status}: ${res.statusText}`});
643
- return await res.json();
644
- }
645
381
  const load_cmd = async (title) => {
646
382
  const formData = new FormData();
647
383
  formData.append('title', title);
@@ -131,7 +131,7 @@ list_pipe_func_then = () => {
131
131
  // パイプラインファイルの保存
132
132
  $('#pipe_save').off('click').on('click', async () => {
133
133
  const pipe_modal = $('#pipe_modal');
134
- const [title, opt] = get_param(pipe_modal);
134
+ const [title, opt] = cmdbox.get_param(pipe_modal);
135
135
  if (pipe_modal.find('.row_content, .row_content_common').find('.is-invalid').length > 0) {
136
136
  return;
137
137
  }
@@ -159,7 +159,7 @@ list_pipe_func_then = () => {
159
159
  // パイプラインファイルの実行
160
160
  $('#pipe_exec').off('click').on('click', async () => {
161
161
  const pipe_modal = $('#pipe_modal');
162
- const [title, opt] = get_param(pipe_modal);
162
+ const [title, opt] = cmdbox.get_param(pipe_modal);
163
163
  if (pipe_modal.find('.row_content').find('.is-invalid').length > 0) {
164
164
  return;
165
165
  }
@@ -173,7 +173,7 @@ list_pipe_func_then = () => {
173
173
  // RAW表示の実行
174
174
  $('#pipe_raw').off('click').on('click', async () => {
175
175
  const pipe_modal = $('#pipe_modal');
176
- const [title, opt] = get_param(pipe_modal);
176
+ const [title, opt] = cmdbox.get_param(pipe_modal);
177
177
  if (pipe_modal.find('.row_content').find('.is-invalid').length > 0) {
178
178
  return;
179
179
  }
@@ -198,21 +198,21 @@ users.users_list = async () => {
198
198
  modal.modal('show');
199
199
  };
200
200
  // ユーザー一覧を表示
201
- const user_table = $('<table>').addClass('table table-bordered table-hover').appendTo(users_elem);
201
+ const user_table = $('<table/>').addClass('table table-bordered table-hover').appendTo(users_elem);
202
202
  // ヘッダ行を作成
203
- const user_thead = $('<thead>').appendTo(user_table);
203
+ const user_thead = $('<thead/>').appendTo(user_table);
204
204
  const cols = new Set();
205
205
  if (users_data.length == 0) {
206
- $('<tr>').append($('<th>').text('No users')).appendTo(user_thead);
206
+ $('<tr/>').append($('<th class="th"/>').text('No users')).appendTo(user_thead);
207
207
  return
208
208
  } else {
209
209
  const user_thead_tr = $('<tr>').appendTo(user_thead);
210
210
  for (const row of users_data) {
211
211
  for (const key in row) cols.add(key);
212
212
  }
213
- $('<th>').text('-').attr('scope', 'col').attr('width', '40').appendTo(user_thead_tr);
213
+ $('<th class="th"/>').text('-').attr('scope', 'col').attr('width', '40').appendTo(user_thead_tr);
214
214
  for (const col of cols) {
215
- $('<th>').text(col).attr('scope', 'col').appendTo(user_thead_tr);
215
+ $('<th class="th"/>').text(col).attr('scope', 'col').appendTo(user_thead_tr);
216
216
  }
217
217
  }
218
218
  // 明細行を作成
@@ -343,21 +343,21 @@ users.groups_list = async () => {
343
343
  modal.modal('show');
344
344
  };
345
345
  // グループ一覧を表示
346
- const group_table = $('<table>').addClass('table table-bordered table-hover').appendTo(groups_elem);
346
+ const group_table = $('<table/>').addClass('table table-bordered table-hover').appendTo(groups_elem);
347
347
  // ヘッダ行を作成
348
- const group_thead = $('<thead>').appendTo(group_table);
348
+ const group_thead = $('<thead/>').appendTo(group_table);
349
349
  const cols = new Set();
350
350
  if (groups_data.length == 0) {
351
- $('<tr>').append($('<th>').text('No groups')).appendTo(group_thead);
351
+ $('<tr>').append($('<th class="th"/>').text('No groups')).appendTo(group_thead);
352
352
  return
353
353
  } else {
354
354
  const group_thead_tr = $('<tr>').appendTo(group_thead);
355
355
  for (const row of groups_data) {
356
356
  for (const key in row) cols.add(key);
357
357
  }
358
- $('<th>').text('-').attr('scope', 'col').attr('width', '40').appendTo(group_thead_tr);
358
+ $('<th class="th"/>').text('-').attr('scope', 'col').attr('width', '40').appendTo(group_thead_tr);
359
359
  for (const col of cols) {
360
- $('<th>').text(col).attr('scope', 'col').appendTo(group_thead_tr);
360
+ $('<th class="th"/>').text(col).attr('scope', 'col').appendTo(group_thead_tr);
361
361
  }
362
362
  }
363
363
  // 明細行を作成
@@ -418,16 +418,16 @@ users.cmdrules_list = async () => {
418
418
  const cmdrule_thead = $('<thead>').appendTo(cmdrule_table);
419
419
  const cols = new Set();
420
420
  if (cmdrules_data.length == 0) {
421
- $('<tr>').append($('<th>').text('No cmdrules')).appendTo(cmdrule_thead);
421
+ $('<tr>').append($('<th class="th"/>').text('No cmdrules')).appendTo(cmdrule_thead);
422
422
  return
423
423
  } else {
424
424
  const cmdrule_thead_tr = $('<tr>').appendTo(cmdrule_thead);
425
425
  for (const row of cmdrules_data) {
426
426
  for (const key in row) cols.add(key);
427
427
  }
428
- $('<th>').text('#').attr('scope', 'col').attr('width', '40').appendTo(cmdrule_thead_tr);
428
+ $('<th class="th"/>').text('#').attr('scope', 'col').attr('width', '40').appendTo(cmdrule_thead_tr);
429
429
  for (const col of cols) {
430
- $('<th>').text(col).attr('scope', 'col').appendTo(cmdrule_thead_tr);
430
+ $('<th class="th"/>').text(col).attr('scope', 'col').appendTo(cmdrule_thead_tr);
431
431
  }
432
432
  }
433
433
  // 明細行を作成
@@ -479,16 +479,16 @@ users.pathrules_list = async () => {
479
479
  const pathrule_thead = $('<thead>').appendTo(pathrule_table);
480
480
  const cols = new Set();
481
481
  if (pathrules_data.length == 0) {
482
- $('<tr>').append($('<th>').text('No cmdrules')).appendTo(pathrule_thead);
482
+ $('<tr>').append($('<th class="th"/>').text('No cmdrules')).appendTo(pathrule_thead);
483
483
  return
484
484
  } else {
485
485
  const pathrule_thead_tr = $('<tr>').appendTo(pathrule_thead);
486
486
  for (const row of pathrules_data) {
487
487
  for (const key in row) cols.add(key);
488
488
  }
489
- $('<th>').text('#').attr('scope', 'col').attr('width', '40').appendTo(pathrule_thead_tr);
489
+ $('<th class="th"/>').text('#').attr('scope', 'col').attr('width', '40').appendTo(pathrule_thead_tr);
490
490
  for (const col of cols) {
491
- $('<th>').text(col).attr('scope', 'col').appendTo(pathrule_thead_tr);
491
+ $('<th class="th"/>').text(col).attr('scope', 'col').appendTo(pathrule_thead_tr);
492
492
  }
493
493
  }
494
494
  // 明細行を作成
@@ -536,7 +536,7 @@ users.passsetting_list = async () => {
536
536
  const cardbody_elem = $('<div class="card-body"/>').appendTo(card_elem);
537
537
  cardbody_elem.append(`<h5 class="card-title">${title}</h5>`);
538
538
  const table_elem = $('<table class="table table-bordered table-hover"/>').appendTo(cardbody_elem);
539
- const thead_elem = $('<thead><tr><th>#</th><th>setting</th><th>value</th></tr></thead>').appendTo(table_elem);
539
+ const thead_elem = $('<thead><tr><th class="th">#</th><th class="th">setting</th><th class="th">value</th></tr></thead>').appendTo(table_elem);
540
540
  const tbody_elem = $('<tbody/>').appendTo(table_elem);
541
541
  let i_row=0;
542
542
  for (const key in data) {
@@ -20,7 +20,7 @@ const view_raw_func = (title, result) => {
20
20
  let found = false;
21
21
  for (const [key, val] of Object.entries(row)) {
22
22
  if(i==0) {
23
- table_head.append($(`<th scope="col">${key}</th>`));
23
+ table_head.append($(`<th class="th" scope="col">${key}</th>`));
24
24
  }
25
25
  try {
26
26
  if (found) {
@@ -1,5 +1,6 @@
1
1
  const cell_chop = (val, res_size) => {
2
- res_size = res_size==-1 && res_size ? res_size : 150;
2
+ val = `${val || ''}`;
3
+ res_size = res_size ? res_size : 150;
3
4
  if(val && res_size>0 && val.length > res_size){
4
5
  return `${val.substring(0, res_size)}...`;
5
6
  }
@@ -24,18 +25,15 @@ const render_result_func = (target_elem, result, res_size) => {
24
25
  if (!result || Array.isArray(result) && result.length<=0) return;
25
26
  const mk_table_func = () => {
26
27
  const table = $('<table class="table table-bordered table-hover table-sm"></table>');
27
- const table_head = $('<thead></thead>');
28
- const table_body = $('<tbody></tbody>');
29
- table.append(table_head);
30
- table.append(table_body);
28
+ $('<thead><tr></tr></thead>').appendTo(table);
29
+ $('<tbody></tbody>').appendTo(table);
31
30
  return table;
32
31
  }
33
32
  const table = mk_table_func();
34
33
  target_elem.append(table);
35
34
  // list型の結果をテーブルに変換
36
35
  const list2table = (data, table_head, table_body) => {
37
- Object.keys(data).forEach(i => {
38
- const row = data[i];
36
+ data.forEach((row, i) => {
39
37
  if(row['success'] && typeof row['success'] == "object" && !Array.isArray(row['success'])){
40
38
  dict2table(row['success'], i==0?table_head:null, table_body, row['output_image']);
41
39
  return;
@@ -43,7 +41,7 @@ const render_result_func = (target_elem, result, res_size) => {
43
41
  if(typeof row == 'string' || row instanceof String){
44
42
  const tr = $('<tr></tr>');
45
43
  table_body.append(tr);
46
- tr.append($(`<td>${row}</td>`));
44
+ tr.append($(`<td>${cell_chop(row, res_size)}</td>`));
47
45
  return;
48
46
  }
49
47
  if(Array.isArray(row) && row.length > 0 && typeof row[0] != "object"){
@@ -58,7 +56,7 @@ const render_result_func = (target_elem, result, res_size) => {
58
56
  Object.keys(row).forEach(key => {
59
57
  const val = row[key];
60
58
  if(i==0) {
61
- table_head.append($(`<th scope="col" style="word-break:normal">${key}</th>`));
59
+ table_head.append($(`<th class="th" scope="col">${key}</th>`));
62
60
  }
63
61
  if(val && val['success'] && Array.isArray(val['success'])){
64
62
  const tbl = mk_table_func()
@@ -89,7 +87,7 @@ const render_result_func = (target_elem, result, res_size) => {
89
87
  list2table(val, tbl.find('thead'), tbl.find('tbody'));
90
88
  }
91
89
  else{
92
- tr.append($(`<td>${val}</td>`));
90
+ tr.append($(`<td>${cell_chop(val, res_size)}</td>`));
93
91
  }
94
92
  });
95
93
  });
@@ -98,7 +96,7 @@ const render_result_func = (target_elem, result, res_size) => {
98
96
  const dict2table = (data, table_head, table_body, output_image) => {
99
97
  const tr = $('<tr></tr>');
100
98
  if(output_image){
101
- if(table_head)table_head.append($('<th scope="col" style="word-break:normal">output_image</th>'));
99
+ if(table_head)table_head.append($('<th class="th" scope="col">output_image</th>'));
102
100
  const img = $('<img class="img-thumbnail">').attr('src', `data:image/png;base64,${output_image}`);
103
101
  img.css('width','100px').css('height','auto');
104
102
  const anchor = $(`<a href="data:image/jpeg;base64,${output_image}" data-lightbox="output_image"></a>`).append(img);
@@ -107,7 +105,7 @@ const render_result_func = (target_elem, result, res_size) => {
107
105
  table_body.append(tr);
108
106
  Object.keys(data).forEach(key => {
109
107
  let val = data[key];
110
- if(table_head)table_head.append($(`<th scope="col" style="word-break:normal">${key}</th>`));
108
+ if(table_head)table_head.append($(`<th class="th" scope="col">${key}</th>`));
111
109
  if (key != 'warn' && val) {
112
110
  if(Array.isArray(val)){
113
111
  if(val.length > 0 && typeof val[0] == "object"){
@@ -134,7 +132,7 @@ const render_result_func = (target_elem, result, res_size) => {
134
132
  tr.append($(`<td style="overflow-wrap:break-word;word-break:break-all;">${val}</td>`));
135
133
  });
136
134
  }
137
- const table_head = table.find('thead')
135
+ const table_head = table.find('thead tr')
138
136
  const table_body = table.find('tbody')
139
137
  // 結果をテーブルに変換
140
138
  if(result['success'] && Array.isArray(result['success'])){
@@ -125,7 +125,7 @@ fsapi.filer = (svpath, is_local) => {
125
125
  };
126
126
  const path = file_list.pop()
127
127
  const list_downloads = [];
128
- if (path[1] && path[1]['is_dir'] && !path[1]['children']) {
128
+ if (path[1] && path[1]['is_dir'] && path[1]['children']!=null && path[1]['children']!=undefined) {
129
129
  list_downloads.push(...get_list(path[1]));
130
130
  } else if (path[1] && !path[1]['is_dir']) {
131
131
  let rpath = path[1]['path'].replace(fsapi.right.find('.filer_address').val(), '');
@@ -315,7 +315,7 @@ fsapi.tree = (target, svpath, current_ul_elem, is_local) => {
315
315
  if(!node['path']) return;
316
316
  target.find('.filer_address').val(node['path']);
317
317
  const table = $('<table class="table table-bordered table-hover table-sm">'
318
- + '<thead><tr><th scope="col">-</th><th scope="col">name</th><th scope="col">mime</th><th scope="col">size</th><th scope="col">last</th></tr></thead>'
318
+ + '<thead><tr><th class="th" scope="col">-</th><th class="th" scope="col">name</th><th class="th" scope="col">mime</th><th class="th" scope="col">size</th><th class="th" scope="col">last</th></tr></thead>'
319
319
  + '</table>');
320
320
  const table_body = $('<tbody></tbody>');
321
321
  target.find('.file-list').html('');
@@ -1,5 +1,5 @@
1
1
  Author License Name URL Version File
2
- The Bootstrap Authors MIT Bootstrap https://getbootstrap.com/ v5.0.2 -
2
+ The Bootstrap Authors MIT Bootstrap https://getbootstrap.com/ v5.3.0 -
3
3
  Josh Goebel <hello@joshgoebel.com> and other contributors BSD-3-Clause highlight.js https://highlightjs.org/ v11.10.0 -
4
4
  JS Foundation and other contributors jquery.org/license jquery https://jquery.com/ v3.2.0 -
5
5
  jQuery Foundation and other contributors MIT jqueryui http://jqueryui.com v1.13.2 -
@@ -8,3 +8,6 @@ Simon Hagström MIT split-pane https://github.com/shagstrom/split-pane v0.9.4 -
8
8
  杜甫々 - tree-menu https://www.tohoho-web.com/tech/tree-menu.htm Ver1.1 -
9
9
  polygonplanet MIT encoding-japanese https://github.com/polygonplanet/encoding.js v2.2.0 -
10
10
  Alan Williamson MIT jquery-linedtextarea https://github.com/cotenoni/jquery-linedtextarea - -
11
+ ApexCharts MIT ApexCharts https://apexcharts.com/ v4.3.0 -
12
+ svgdotjs MIT svg.resize.js https://github.com/svgdotjs/svg.resize.js 2.0.4 -
13
+ svgdotjs MIT svg.select.js https://github.com/svgdotjs/svg.select.js 4.0.1 -