cmdbox 0.5.1.2__py3-none-any.whl → 0.5.3__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.
- cmdbox/app/app.py +4 -2
- cmdbox/app/auth/signin.py +634 -631
- cmdbox/app/client.py +10 -10
- cmdbox/app/common.py +50 -6
- cmdbox/app/commons/convert.py +9 -0
- cmdbox/app/commons/module.py +113 -113
- cmdbox/app/commons/redis_client.py +40 -29
- cmdbox/app/edge.py +4 -4
- cmdbox/app/features/cli/audit_base.py +138 -0
- cmdbox/app/features/cli/cmdbox_audit_createdb.py +224 -0
- cmdbox/app/features/cli/cmdbox_audit_delete.py +308 -0
- cmdbox/app/features/cli/cmdbox_audit_search.py +416 -0
- cmdbox/app/features/cli/cmdbox_audit_write.py +247 -0
- cmdbox/app/features/cli/cmdbox_client_file_copy.py +207 -207
- cmdbox/app/features/cli/cmdbox_client_file_download.py +207 -207
- cmdbox/app/features/cli/cmdbox_client_file_list.py +193 -193
- cmdbox/app/features/cli/cmdbox_client_file_mkdir.py +191 -191
- cmdbox/app/features/cli/cmdbox_client_file_move.py +199 -199
- cmdbox/app/features/cli/cmdbox_client_file_remove.py +190 -190
- cmdbox/app/features/cli/cmdbox_client_file_rmdir.py +190 -190
- cmdbox/app/features/cli/cmdbox_client_file_upload.py +212 -212
- cmdbox/app/features/cli/cmdbox_client_server_info.py +166 -166
- cmdbox/app/features/cli/cmdbox_server_list.py +88 -88
- cmdbox/app/features/cli/cmdbox_server_stop.py +138 -138
- cmdbox/app/features/web/cmdbox_web_audit.py +81 -0
- cmdbox/app/features/web/cmdbox_web_audit_metrics.py +72 -0
- cmdbox/app/features/web/cmdbox_web_del_cmd.py +2 -0
- cmdbox/app/features/web/cmdbox_web_del_pipe.py +1 -0
- cmdbox/app/features/web/cmdbox_web_do_signin.py +12 -2
- cmdbox/app/features/web/cmdbox_web_do_signout.py +1 -0
- cmdbox/app/features/web/cmdbox_web_exec_cmd.py +31 -2
- cmdbox/app/features/web/cmdbox_web_exec_pipe.py +1 -0
- cmdbox/app/features/web/cmdbox_web_filer download.py +43 -42
- cmdbox/app/features/web/cmdbox_web_filer.py +1 -0
- cmdbox/app/features/web/cmdbox_web_filer_upload.py +65 -64
- cmdbox/app/features/web/cmdbox_web_gui.py +166 -165
- cmdbox/app/features/web/cmdbox_web_load_pin.py +43 -43
- cmdbox/app/features/web/cmdbox_web_raw_pipe.py +87 -87
- cmdbox/app/features/web/cmdbox_web_save_cmd.py +1 -0
- cmdbox/app/features/web/cmdbox_web_save_pin.py +42 -42
- cmdbox/app/features/web/cmdbox_web_save_pipe.py +1 -0
- cmdbox/app/features/web/cmdbox_web_user_data.py +58 -0
- cmdbox/app/features/web/cmdbox_web_users.py +12 -0
- cmdbox/app/options.py +788 -601
- cmdbox/app/web.py +7 -1
- cmdbox/extensions/features.yml +23 -0
- cmdbox/extensions/sample_project/sample/app/features/cli/sample_client_time.py +82 -82
- cmdbox/extensions/sample_project/sample/app/features/cli/sample_server_time.py +145 -145
- cmdbox/extensions/user_list.yml +5 -0
- cmdbox/licenses/{LICENSE.Sphinx.8.1.3(BSD License).txt → LICENSE.Sphinx.8.2.3(UNKNOWN).txt} +1 -1
- cmdbox/licenses/LICENSE.argcomplete.3.6.2(Apache Software License).txt +177 -0
- cmdbox/licenses/{LICENSE.babel.2.16.0(BSD License).txt → LICENSE.babel.2.17.0(BSD License).txt } +1 -1
- cmdbox/licenses/{LICENSE.pkginfo.1.10.0(MIT License).txt → LICENSE.charset-normalizer.3.4.1(MIT License).txt } +1 -1
- cmdbox/licenses/LICENSE.gevent.25.4.1(MIT).txt +25 -0
- cmdbox/licenses/LICENSE.greenlet.3.2.0(MIT AND Python-2.0).txt +30 -0
- cmdbox/licenses/LICENSE.gunicorn.23.0.0(MIT License).txt +23 -0
- cmdbox/licenses/LICENSE.importlib_metadata.8.6.1(Apache Software License).txt +202 -0
- cmdbox/licenses/LICENSE.nh3.0.2.21(MIT).txt +21 -0
- cmdbox/licenses/{LICENSE.pillow.11.0.0(CMU License (MIT-CMU)).txt → LICENSE.pillow.11.1.0(CMU License (MIT-CMU)).txt } +27 -40
- cmdbox/licenses/LICENSE.pillow.11.2.1(UNKNOWN).txt +1200 -0
- cmdbox/licenses/LICENSE.plyer.2.1.0(MIT License).txt +19 -0
- cmdbox/licenses/LICENSE.prompt_toolkit.3.0.50(BSD License).txt +27 -0
- cmdbox/licenses/LICENSE.prompt_toolkit.3.0.51(BSD License).txt +27 -0
- cmdbox/licenses/LICENSE.psycopg-binary.3.2.6(GNU Lesser General Public License v3 (LGPLv3)).txt +165 -0
- cmdbox/licenses/LICENSE.psycopg-pool.3.2.6(GNU Lesser General Public License v3 (LGPLv3)).txt +165 -0
- cmdbox/licenses/LICENSE.psycopg.3.2.6(GNU Lesser General Public License v3 (LGPLv3)).txt +165 -0
- cmdbox/licenses/LICENSE.pycryptodome.3.22.0(BSD License; Public Domain).txt +61 -0
- cmdbox/licenses/LICENSE.pydantic.2.11.3(MIT License).txt +21 -0
- cmdbox/licenses/LICENSE.pydantic_core.2.33.1(MIT License).txt +21 -0
- cmdbox/licenses/LICENSE.pystray.0.19.5(GNU Lesser General Public License v3 (LGPLv3)).txt +674 -0
- cmdbox/licenses/LICENSE.questionary.2.1.0(MIT License).txt +19 -0
- cmdbox/licenses/LICENSE.roman-numerals-py.3.1.0(CC0 1.0 Universal (CC0 1.0) Public Domain Dedication; Zero-Clause BSD (0BSD)).txt +146 -0
- cmdbox/licenses/{LICENSE.six.1.16.0(MIT License).txt → LICENSE.six.1.17.0(MIT License).txt } +1 -1
- cmdbox/licenses/LICENSE.starlette.0.46.2(BSD License).txt +27 -0
- cmdbox/licenses/{LICENSE.charset-normalizer.3.4.0(MIT License).txt → LICENSE.typing-inspection.0.4.0(MIT License).txt } +2 -2
- cmdbox/licenses/LICENSE.typing_extensions.4.13.2(UNKNOWN).txt +279 -0
- cmdbox/licenses/LICENSE.tzdata.2025.2(Apache Software License).txt +15 -0
- cmdbox/licenses/LICENSE.urllib3.2.4.0(UNKNOWN).txt +21 -0
- cmdbox/licenses/LICENSE.uvicorn.0.34.1(BSD License).txt +27 -0
- cmdbox/licenses/LICENSE.watchfiles.1.0.5(MIT License).txt +21 -0
- cmdbox/licenses/files.txt +49 -38
- cmdbox/logconf_audit.yml +30 -0
- cmdbox/logconf_cmdbox.yml +30 -0
- cmdbox/version.py +2 -2
- cmdbox/web/assets/apexcharts/apexcharts.css +679 -0
- cmdbox/web/assets/apexcharts/apexcharts.min.js +38 -0
- cmdbox/web/assets/cmdbox/audit.js +340 -0
- cmdbox/web/assets/cmdbox/color_mode.css +520 -0
- cmdbox/web/assets/cmdbox/common.js +416 -24
- cmdbox/web/assets/cmdbox/filer_modal.js +1 -1
- cmdbox/web/assets/cmdbox/list_cmd.js +10 -275
- cmdbox/web/assets/cmdbox/list_pipe.js +3 -3
- cmdbox/web/assets/cmdbox/main.js +2 -2
- cmdbox/web/assets/cmdbox/result.js +2 -2
- cmdbox/web/assets/cmdbox/signin.js +2 -2
- cmdbox/web/assets/cmdbox/users.js +19 -20
- cmdbox/web/assets/cmdbox/view_raw.js +1 -1
- cmdbox/web/assets/cmdbox/view_result.js +11 -13
- cmdbox/web/assets/filer/filer.js +2 -2
- cmdbox/web/assets/filer/main.js +2 -2
- cmdbox/web/assets_license_list.txt +4 -1
- cmdbox/web/audit.html +268 -0
- cmdbox/web/filer.html +37 -12
- cmdbox/web/gui.html +36 -53
- cmdbox/web/result.html +24 -3
- cmdbox/web/signin.html +35 -14
- cmdbox/web/users.html +21 -3
- {cmdbox-0.5.1.2.dist-info → cmdbox-0.5.3.dist-info}/METADATA +28 -5
- {cmdbox-0.5.1.2.dist-info → cmdbox-0.5.3.dist-info}/RECORD +142 -103
- {cmdbox-0.5.1.2.dist-info → cmdbox-0.5.3.dist-info}/entry_points.txt +0 -1
- cmdbox/licenses/LICENSE.nh3.0.2.18(MIT).txt +0 -1
- /cmdbox/licenses/{LICENSE.Jinja2.3.1.4(BSD License).txt → LICENSE.Jinja2.3.1.6(BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.Pygments.2.18.0(BSD License).txt → LICENSE.Pygments.2.19.1(BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.anyio.4.6.2.post1(MIT License).txt → LICENSE.anyio.4.9.0(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.argcomplete.3.5.1(Apache Software License).txt → LICENSE.argcomplete.3.6.1(Apache Software License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.certifi.2024.8.30(Mozilla Public License 2.0 (MPL 2.0)).txt → LICENSE.certifi.2025.1.31(Mozilla Public License 2.0 (MPL 2.0)).txt} +0 -0
- /cmdbox/licenses/{LICENSE.click.8.1.7(BSD License).txt → LICENSE.click.8.1.8(BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.cryptography.43.0.3(Apache Software License; BSD License).txt → LICENSE.cryptography.44.0.2(Apache Software License; BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.fastapi.0.115.5(MIT License).txt → LICENSE.fastapi.0.115.12(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.importlib_metadata.8.5.0(Apache Software License).txt → LICENSE.id.1.5.0(Apache Software License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.keyring.25.5.0(MIT License).txt → LICENSE.keyring.25.6.0(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.more-itertools.10.5.0(MIT License).txt → LICENSE.more-itertools.10.6.0(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.numpy.2.1.3(BSD License).txt → LICENSE.numpy.2.2.4(BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.prettytable.3.12.0(BSD License).txt → LICENSE.prettytable.3.16.0(UNKNOWN).txt} +0 -0
- /cmdbox/licenses/{LICENSE.pydantic.2.10.2(MIT License).txt → LICENSE.pydantic.2.11.1(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.pydantic_core.2.27.1(MIT License).txt → LICENSE.pydantic_core.2.33.0(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.python-dotenv.1.0.1(BSD License).txt → LICENSE.python-dotenv.1.1.0(BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.python-multipart.0.0.17(Apache Software License).txt → LICENSE.python-multipart.0.0.20(Apache Software License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.redis.5.2.0(MIT License).txt → LICENSE.redis.5.2.1(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.rich.13.9.4(MIT License).txt → LICENSE.rich.14.0.0(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.sphinx-intl.2.3.0(BSD License).txt → LICENSE.sphinx-intl.2.3.1(BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.starlette.0.41.3(BSD License).txt → LICENSE.starlette.0.46.1(BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.tomli.2.1.0(MIT License).txt → LICENSE.tomli.2.2.1(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.twine.5.1.1(Apache Software License).txt → LICENSE.twine.6.1.0(Apache Software License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.typing_extensions.4.12.2(Python Software Foundation License).txt → LICENSE.typing_extensions.4.13.0(UNKNOWN).txt} +0 -0
- /cmdbox/licenses/{LICENSE.urllib3.2.2.3(MIT License).txt → LICENSE.urllib3.2.3.0(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.uvicorn.0.32.1(BSD License).txt → LICENSE.uvicorn.0.34.0(BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.watchfiles.1.0.0(MIT License).txt → LICENSE.watchfiles.1.0.4(MIT License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.websockets.14.1(BSD License).txt → LICENSE.websockets.15.0.1(BSD License).txt} +0 -0
- /cmdbox/licenses/{LICENSE.zope.interface.7.1.1(Zope Public License).txt → LICENSE.zope.interface.7.2(Zope Public License).txt} +0 -0
- {cmdbox-0.5.1.2.dist-info → cmdbox-0.5.3.dist-info}/LICENSE +0 -0
- {cmdbox-0.5.1.2.dist-info → cmdbox-0.5.3.dist-info}/WHEEL +0 -0
- {cmdbox-0.5.1.2.dist-info → cmdbox-0.5.3.dist-info}/top_level.txt +0 -0
|
@@ -93,13 +93,14 @@ const list_cmd_func = async () => {
|
|
|
93
93
|
};
|
|
94
94
|
// タグボタンを追加
|
|
95
95
|
py_list_cmd.forEach(row => {
|
|
96
|
+
// タグボタンを追加
|
|
96
97
|
if (!row.tag || !Array.isArray(row.tag)) return;
|
|
97
98
|
row.tag.forEach(tag => {
|
|
98
99
|
if (tag=='') return;
|
|
99
100
|
if (cmd_item_tags.find(`[data-tag="${tag}"]`).length > 0) return;
|
|
100
|
-
const elem = $(`<button type="button" class="btn btn-outline-secondary btn-sm btn-tag me-2"
|
|
101
|
+
const elem = $(`<button type="button" class="btn btn-outline-secondary btn-sm btn-tag me-2">` +
|
|
102
|
+
`<svg class="bi svg-tag" width="16" height="16" fill="currentColor"><use href="#svg_tag"></use></svg>${tag}</button>`);
|
|
101
103
|
elem.attr('data-tag', tag);
|
|
102
|
-
elem.text(tag);
|
|
103
104
|
elem.click(tag_bot_click);
|
|
104
105
|
cmd_item_tags.append(elem);
|
|
105
106
|
});
|
|
@@ -158,167 +159,16 @@ const list_cmd_func_then = () => {
|
|
|
158
159
|
const cmd = cmd_modal.find('[name="cmd"]').val();
|
|
159
160
|
const selected_cmd = cmd_modal.find('[name="cmd"] option:selected');
|
|
160
161
|
cmd_modal.find('.cmd_label').attr('title', selected_cmd.attr('discription'));
|
|
161
|
-
const py_get_cmd_choices = await get_cmd_choices(mode, cmd);
|
|
162
|
+
const py_get_cmd_choices = await cmdbox.get_cmd_choices(mode, cmd);
|
|
162
163
|
row_content.html('');
|
|
163
|
-
// オプション一覧をフォームに追加
|
|
164
|
-
const add_form_func = (i, row, next_elem) => {
|
|
165
|
-
const target_name = row.opt;
|
|
166
|
-
let input_elem, elem;
|
|
167
|
-
if(!row.choice) {
|
|
168
|
-
// 選択肢がない場合
|
|
169
|
-
if(row.type=='text') {
|
|
170
|
-
elem = $(cmd_modal.find('.row_content_template_text').html());
|
|
171
|
-
} else if(row.type=='dict') {
|
|
172
|
-
elem = $(cmd_modal.find('.row_content_template_dict').html());
|
|
173
|
-
} else {
|
|
174
|
-
elem = $(cmd_modal.find('.row_content_template_str').html());
|
|
175
|
-
}
|
|
176
|
-
if (next_elem) next_elem.after(elem);
|
|
177
|
-
else row_content.append(elem);
|
|
178
|
-
input_elem = elem.find('.row_content_template_input');
|
|
179
|
-
input_elem.removeClass('row_content_template_input');
|
|
180
|
-
input_elem.val(row.default);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
// 選択肢がある場合
|
|
184
|
-
if(row.type=='dict') {
|
|
185
|
-
elem = $(cmd_modal.find('.row_content_template_dict_choice').html());
|
|
186
|
-
} else {
|
|
187
|
-
elem = $(cmd_modal.find('.row_content_template_choice').html());
|
|
188
|
-
}
|
|
189
|
-
if (next_elem) next_elem.after(elem);
|
|
190
|
-
else row_content.append(elem);
|
|
191
|
-
input_elem = elem.find('.row_content_template_select,.row_content_template_input');
|
|
192
|
-
input_elem.removeClass('row_content_template_select').removeClass('row_content_template_input');
|
|
193
|
-
if (row.choice_show) {
|
|
194
|
-
input_elem.addClass('choice_show');
|
|
195
|
-
input_elem.change(() => {
|
|
196
|
-
let names = []
|
|
197
|
-
for (const ns of Object.values(row.choice_show)) {
|
|
198
|
-
if (Array.isArray(ns)) {
|
|
199
|
-
ns.forEach(n => names.push(n));
|
|
200
|
-
} else {
|
|
201
|
-
names.push(ns);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
names = [...new Set(names)];
|
|
205
|
-
names.forEach(name => row_content.find(`[name="${name}"]`).parent().parent().hide());
|
|
206
|
-
const v = input_elem.val();
|
|
207
|
-
if (!row.choice_show[v]) return;
|
|
208
|
-
row.choice_show[v].forEach(n => row_content.find(`[name="${n}"]`).parent().parent().show());
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
input_elem.html(mkopt(row.choice));
|
|
212
|
-
input_elem.val(`${row.default!=null?row.default:''}`);
|
|
213
|
-
}
|
|
214
|
-
let index = 0;
|
|
215
|
-
if (cmd_modal.find(`[name="${target_name}"]`).length > 0) {
|
|
216
|
-
index = 0;
|
|
217
|
-
cmd_modal.find(`[name="${target_name}"][param_data_index]`).each((i, val) => {
|
|
218
|
-
v = Number($(val).attr('param_data_index'));
|
|
219
|
-
if (index <= v) index = v + 1;
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
input_elem.attr('name', target_name);
|
|
223
|
-
if(row.type=='dict') {
|
|
224
|
-
input_elem.each((i, e) => {
|
|
225
|
-
$(e).attr('id', target_name + (index + i));
|
|
226
|
-
$(e).attr('param_data_index', (index + i));
|
|
227
|
-
});
|
|
228
|
-
} else {
|
|
229
|
-
input_elem.attr('id', target_name + index);
|
|
230
|
-
input_elem.attr('param_data_index', index);
|
|
231
|
-
}
|
|
232
|
-
input_elem.attr('required', row.required);
|
|
233
|
-
input_elem.attr('param_data_type', row.type);
|
|
234
|
-
input_elem.attr('param_data_multi', row.multi);
|
|
235
|
-
input_elem.attr('param_data_web', row.web);
|
|
236
|
-
if (row.web=='mask' || row.web=='readonly') {
|
|
237
|
-
input_elem.attr('disabled', 'disabled');
|
|
238
|
-
}
|
|
239
|
-
// ファイルタイプの場合はファイラーモーダルを開くボタンを追加
|
|
240
|
-
if(row.type=='file'){
|
|
241
|
-
const btn = $('<button class="btn btn-secondary" type="button">file</button>');
|
|
242
|
-
input_elem.parent().append(btn);
|
|
243
|
-
const mk_func = (tid, tn) => {
|
|
244
|
-
// tid, tnの値を残すためにクロージャーにする
|
|
245
|
-
return () => {
|
|
246
|
-
const current_path = $(`[id="${tid}"]`).val();
|
|
247
|
-
fmodal.filer_modal_func(tid, tn, current_path, false, true);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
btn.click(mk_func(input_elem.attr('id'), input_elem.attr('name')));
|
|
251
|
-
}
|
|
252
|
-
// ディレクトリタイプの場合はファイラーモーダルを開くボタンを追加
|
|
253
|
-
if(row.type=='dir'){
|
|
254
|
-
const btn = $('<button class="btn btn-secondary" type="button">dir</button>');
|
|
255
|
-
input_elem.parent().append(btn);
|
|
256
|
-
const mk_func = (tid, tn) => {
|
|
257
|
-
// tid, tnの値を残すためにクロージャーにする
|
|
258
|
-
return () => {
|
|
259
|
-
const current_path = $(`[id="${tid}"]`).val();
|
|
260
|
-
fmodal.filer_modal_func(tid, tn, current_path, true, true);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
btn.click(mk_func(input_elem.attr('id'), input_elem.attr('name')));
|
|
264
|
-
}
|
|
265
|
-
// マルチの場合は追加ボタンを追加
|
|
266
|
-
if(row.multi){
|
|
267
|
-
const btn_a = $('<button class="btn btn-secondary add_buton" type="button"></button>');
|
|
268
|
-
btn_a.append('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus" viewBox="0 0 16 16">'
|
|
269
|
-
+'<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"/>'
|
|
270
|
-
+'</svg>');
|
|
271
|
-
input_elem.parent().append(btn_a);
|
|
272
|
-
let mk_func = (row, next_elem) => {
|
|
273
|
-
// row, next_elemの値を残すためにクロージャーにする
|
|
274
|
-
return () => {
|
|
275
|
-
const r = {...row};
|
|
276
|
-
//r.hide = next_elem.is(':hidden');
|
|
277
|
-
add_form_func(0, r, next_elem);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
btn_a.click(mk_func(row, input_elem.parent().parent()));
|
|
281
|
-
// 2個目以降は削除ボタンを追加
|
|
282
|
-
const len = cmd_modal.find(`[name="${target_name}"]`).length;
|
|
283
|
-
if (row.type!='dict' && len > 1 || row.type=='dict' && len > 2) {
|
|
284
|
-
mk_func = (del_elem, row) => {
|
|
285
|
-
// del_elemの値を残すためにクロージャーにする
|
|
286
|
-
return () => del_elem.remove();
|
|
287
|
-
}
|
|
288
|
-
const btn_t = $('<button class="btn btn-secondary" type="button"></button>');
|
|
289
|
-
btn_t.append('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">'
|
|
290
|
-
+'<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/>'
|
|
291
|
-
+'<path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/>'
|
|
292
|
-
+'</svg>');
|
|
293
|
-
input_elem.parent().append(btn_t);
|
|
294
|
-
btn_t.click(mk_func(input_elem.parent().parent(), row));
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
const title = elem.find('.row_content_template_title');
|
|
298
|
-
title.html('');
|
|
299
|
-
title.attr('title', window.navigator.language=='ja'?row.discription_ja:row.discription_en)
|
|
300
|
-
if (row.required) {
|
|
301
|
-
title.append('<span class="text-danger" title="required">*</span>');
|
|
302
|
-
}
|
|
303
|
-
if (row.choice_show) {
|
|
304
|
-
title.append('<span class="text-primary" title="choice_show">*</span>');
|
|
305
|
-
}
|
|
306
|
-
title.append(`<span>${row.opt}</span>`);
|
|
307
|
-
if (row.hide) {
|
|
308
|
-
if (row_content.find('.row_content_hide').is(':hidden')) elem.hide();
|
|
309
|
-
elem.addClass('row_content_hide');
|
|
310
|
-
} else {
|
|
311
|
-
title.addClass('text-decoration-underline');
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
164
|
// 表示オプションを追加
|
|
315
|
-
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));
|
|
316
166
|
// 高度なオプションを表示するリンクを追加
|
|
317
167
|
const show_link = $('<div class="text-center card-hover mb-3"><a href="#">[ advanced options ]</a></div>');
|
|
318
168
|
show_link.click(() => row_content.find('.row_content_hide').toggle());
|
|
319
169
|
row_content.append(show_link);
|
|
320
170
|
// 非表示オプションを追加
|
|
321
|
-
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));
|
|
322
172
|
cmd_modal.find('.choice_show').change();
|
|
323
173
|
}
|
|
324
174
|
//row_content.find('is-invalid, is-valid').removeClass('is-invalid').removeClass('is-valid');
|
|
@@ -410,7 +260,7 @@ const list_cmd_func_then = () => {
|
|
|
410
260
|
cmdbox.load_cmd_pin(title).then((result) => {
|
|
411
261
|
if (!result['success']) {
|
|
412
262
|
cmd_modal.find('.btn_pin_fill').hide();
|
|
413
|
-
cmd_modal.find('.btn_pin_angle').
|
|
263
|
+
cmd_modal.find('.btn_pin_angle').show();
|
|
414
264
|
} else if (result['success']=='on') {
|
|
415
265
|
cmd_modal.find('.btn_pin_fill').show();
|
|
416
266
|
cmd_modal.find('.btn_pin_angle').hide();
|
|
@@ -450,7 +300,7 @@ const list_cmd_func_then = () => {
|
|
|
450
300
|
// コマンドファイルの保存
|
|
451
301
|
$('#cmd_save').off('click').on('click', async () => {
|
|
452
302
|
const cmd_modal = $('#cmd_modal');
|
|
453
|
-
const [title, opt] = get_param(cmd_modal);
|
|
303
|
+
const [title, opt] = cmdbox.get_param(cmd_modal);
|
|
454
304
|
if (cmd_modal.find('.row_content, .row_content_common').find('.is-invalid').length > 0) {
|
|
455
305
|
return;
|
|
456
306
|
}
|
|
@@ -481,7 +331,7 @@ const list_cmd_func_then = () => {
|
|
|
481
331
|
// コマンドファイルの実行
|
|
482
332
|
$('#cmd_exec').off('click').on('click', async () => {
|
|
483
333
|
const cmd_modal = $('#cmd_modal');
|
|
484
|
-
const [title, opt] = get_param(cmd_modal);
|
|
334
|
+
const [title, opt] = cmdbox.get_param(cmd_modal);
|
|
485
335
|
if (cmd_modal.find('.row_content, .row_content_common').find('.is-invalid').length > 0) {
|
|
486
336
|
return;
|
|
487
337
|
}
|
|
@@ -496,7 +346,7 @@ const list_cmd_func_then = () => {
|
|
|
496
346
|
// RAW表示の実行
|
|
497
347
|
$('#cmd_raw').off('click').on('click', async () => {
|
|
498
348
|
const cmd_modal = $('#cmd_modal');
|
|
499
|
-
const [title, opt] = get_param(cmd_modal);
|
|
349
|
+
const [title, opt] = cmdbox.get_param(cmd_modal);
|
|
500
350
|
if (cmd_modal.find('.row_content, .row_content_common').find('.is-invalid').length > 0) {
|
|
501
351
|
return;
|
|
502
352
|
}
|
|
@@ -509,113 +359,6 @@ const list_cmd_func_then = () => {
|
|
|
509
359
|
});
|
|
510
360
|
};
|
|
511
361
|
|
|
512
|
-
// コマンドフォームからパラメータを取得
|
|
513
|
-
const get_param = (modal_elem) => {
|
|
514
|
-
modal_elem.find('.is-invalid, .is-valid').removeClass('is-invalid').removeClass('is-valid');
|
|
515
|
-
const opt = {};
|
|
516
|
-
const title = modal_elem.find('[name="title"]').val();
|
|
517
|
-
opt["modal_mode"] = modal_elem.find('[name="modal_mode"]').val();
|
|
518
|
-
opt["mode"] = modal_elem.find('[name="mode"]').val();
|
|
519
|
-
opt["cmd"] = modal_elem.find('[name="cmd"]').val();
|
|
520
|
-
if(!opt["mode"]) delete opt["mode"];
|
|
521
|
-
if(!opt["cmd"]) delete opt["cmd"];
|
|
522
|
-
opt["title"] = title;
|
|
523
|
-
const isFloat = (i) => {
|
|
524
|
-
try {
|
|
525
|
-
n = Number(i);
|
|
526
|
-
return n % 1 !== 0;
|
|
527
|
-
} catch(e) {
|
|
528
|
-
return false;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
const isInt = (i) => {
|
|
532
|
-
try {
|
|
533
|
-
n = Number(i);
|
|
534
|
-
return n % 1 === 0;
|
|
535
|
-
} catch(e) {
|
|
536
|
-
return false;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
// フォームの入力値をチェック(不正な値があればフォームに'is-invalid'クラスを付加する)
|
|
540
|
-
const dict_buf = {};
|
|
541
|
-
modal_elem.find('.row_content, .row_content_common').find('input, select, textarea').each((i, elem) => {
|
|
542
|
-
const data_name = $(elem).attr('name');
|
|
543
|
-
let data_val = $(elem).val();
|
|
544
|
-
const data_type = $(elem).attr('param_data_type');
|
|
545
|
-
const data_web = $(elem).attr('param_data_web');
|
|
546
|
-
const data_index = parseInt($(elem).attr('param_data_index'));
|
|
547
|
-
const data_multi = $(elem).attr('param_data_multi');
|
|
548
|
-
if ($(elem).attr('required') && (!data_val || data_val=='')) {
|
|
549
|
-
$(elem).addClass('is-invalid');
|
|
550
|
-
} else if (data_type=='int' && !data_web) {
|
|
551
|
-
if(data_val && data_val!='') {
|
|
552
|
-
if(!isInt(data_val)) $(elem).addClass('is-invalid');
|
|
553
|
-
else {
|
|
554
|
-
$(elem).removeClass('is-invalid');
|
|
555
|
-
$(elem).addClass('is-valid');
|
|
556
|
-
data_val = parseInt(data_val);
|
|
557
|
-
}
|
|
558
|
-
} else {
|
|
559
|
-
$(elem).removeClass('is-invalid');
|
|
560
|
-
$(elem).addClass('is-valid');
|
|
561
|
-
}
|
|
562
|
-
} else if (data_type=='float') {
|
|
563
|
-
if(data_val && data_val!='') {
|
|
564
|
-
if(!isFloat(data_val) && !isInt(data_val)) $(elem).addClass('is-invalid');
|
|
565
|
-
else {
|
|
566
|
-
$(elem).removeClass('is-invalid');
|
|
567
|
-
$(elem).addClass('is-valid');
|
|
568
|
-
data_val = parseFloat(data_val);
|
|
569
|
-
}
|
|
570
|
-
} else {
|
|
571
|
-
$(elem).removeClass('is-invalid');
|
|
572
|
-
$(elem).addClass('is-valid');
|
|
573
|
-
}
|
|
574
|
-
} else if (data_type=='bool') {
|
|
575
|
-
if(data_val!='true' && data_val!='false') $(elem).addClass('is-invalid');
|
|
576
|
-
else {
|
|
577
|
-
data_val = data_val=='true';
|
|
578
|
-
$(elem).removeClass('is-invalid');
|
|
579
|
-
$(elem).addClass('is-valid');
|
|
580
|
-
}
|
|
581
|
-
} else if (data_type=='dict') {
|
|
582
|
-
data_val = data_val ? data_val : '';
|
|
583
|
-
if(data_val.indexOf(' ')>=0) $(elem).addClass('is-invalid');
|
|
584
|
-
else {
|
|
585
|
-
$(elem).removeClass('is-invalid');
|
|
586
|
-
$(elem).addClass('is-valid');
|
|
587
|
-
}
|
|
588
|
-
} else if (data_type=='text') {
|
|
589
|
-
$(elem).removeClass('is-invalid');
|
|
590
|
-
$(elem).addClass('is-valid');
|
|
591
|
-
} else {
|
|
592
|
-
$(elem).removeClass('is-invalid');
|
|
593
|
-
$(elem).addClass('is-valid');
|
|
594
|
-
}
|
|
595
|
-
if(data_multi=='true' || data_type=='dict') {
|
|
596
|
-
if (data_type=='dict') {
|
|
597
|
-
if(!opt[data_name]) {
|
|
598
|
-
opt[data_name] = {};
|
|
599
|
-
dict_buf[data_name] = {};
|
|
600
|
-
}
|
|
601
|
-
if(data_index%2==0) dict_buf[data_name]['key'] = data_val;
|
|
602
|
-
else if (dict_buf[data_name]['key']) {
|
|
603
|
-
opt[data_name][dict_buf[data_name]['key']] = data_val;
|
|
604
|
-
delete dict_buf[data_name]['key'];
|
|
605
|
-
}
|
|
606
|
-
} else {
|
|
607
|
-
if(!opt[data_name]) opt[data_name] = [];
|
|
608
|
-
if(data_val && data_val!='') opt[data_name].push(data_val);
|
|
609
|
-
else if(data_val==false) opt[data_name].push(data_val);
|
|
610
|
-
}
|
|
611
|
-
} else {
|
|
612
|
-
if(data_val && data_val!='') opt[data_name] = data_val;
|
|
613
|
-
else if(data_val==false) opt[data_name] = data_val;
|
|
614
|
-
}
|
|
615
|
-
});
|
|
616
|
-
return [title, opt];
|
|
617
|
-
}
|
|
618
|
-
|
|
619
362
|
const list_cmd = async (kwd) => {
|
|
620
363
|
const formData = new FormData();
|
|
621
364
|
formData.append('kwd', kwd?`*${kwd}*`:'*');
|
|
@@ -635,14 +378,6 @@ const get_cmds = async (mode) => {
|
|
|
635
378
|
if (res.status != 200) cmdbox.message({'error':`${res.status}: ${res.statusText}`});
|
|
636
379
|
return await res.json();
|
|
637
380
|
}
|
|
638
|
-
const get_cmd_choices = async (mode, cmd) => {
|
|
639
|
-
const formData = new FormData();
|
|
640
|
-
formData.append('mode', mode);
|
|
641
|
-
formData.append('cmd', cmd);
|
|
642
|
-
const res = await fetch('gui/get_cmd_choices', {method: 'POST', body: formData});
|
|
643
|
-
if (res.status != 200) cmdbox.message({'error':`${res.status}: ${res.statusText}`});
|
|
644
|
-
return await res.json();
|
|
645
|
-
}
|
|
646
381
|
const load_cmd = async (title) => {
|
|
647
382
|
const formData = new FormData();
|
|
648
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
|
}
|
cmdbox/web/assets/cmdbox/main.js
CHANGED
|
@@ -198,21 +198,21 @@ users.users_list = async () => {
|
|
|
198
198
|
modal.modal('show');
|
|
199
199
|
};
|
|
200
200
|
// ユーザー一覧を表示
|
|
201
|
-
const user_table = $('<table
|
|
201
|
+
const user_table = $('<table/>').addClass('table table-bordered table-hover').appendTo(users_elem);
|
|
202
202
|
// ヘッダ行を作成
|
|
203
|
-
const user_thead = $('<thead
|
|
203
|
+
const user_thead = $('<thead/>').appendTo(user_table);
|
|
204
204
|
const cols = new Set();
|
|
205
205
|
if (users_data.length == 0) {
|
|
206
|
-
$('<tr
|
|
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
|
|
213
|
+
$('<th class="th"/>').text('-').attr('scope', 'col').attr('width', '40').appendTo(user_thead_tr);
|
|
214
214
|
for (const col of cols) {
|
|
215
|
-
$('<th
|
|
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
|
|
346
|
+
const group_table = $('<table/>').addClass('table table-bordered table-hover').appendTo(groups_elem);
|
|
347
347
|
// ヘッダ行を作成
|
|
348
|
-
const group_thead = $('<thead
|
|
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
|
|
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
|
|
358
|
+
$('<th class="th"/>').text('-').attr('scope', 'col').attr('width', '40').appendTo(group_thead_tr);
|
|
359
359
|
for (const col of cols) {
|
|
360
|
-
$('<th
|
|
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
|
|
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
|
|
428
|
+
$('<th class="th"/>').text('#').attr('scope', 'col').attr('width', '40').appendTo(cmdrule_thead_tr);
|
|
429
429
|
for (const col of cols) {
|
|
430
|
-
$('<th
|
|
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
|
|
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
|
|
489
|
+
$('<th class="th"/>').text('#').attr('scope', 'col').attr('width', '40').appendTo(pathrule_thead_tr);
|
|
490
490
|
for (const col of cols) {
|
|
491
|
-
$('<th
|
|
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) {
|
|
@@ -552,9 +552,8 @@ users.passsetting_list = async () => {
|
|
|
552
552
|
mk_card(passsetting_elem, 'Account Lockout', passsetting_root_data['lockout']);
|
|
553
553
|
};
|
|
554
554
|
$(() => {
|
|
555
|
-
//
|
|
556
|
-
cmdbox.
|
|
557
|
-
|
|
555
|
+
// カラーモード対応
|
|
556
|
+
cmdbox.change_color_mode();
|
|
558
557
|
// アイコンを表示
|
|
559
558
|
cmdbox.set_logoicon('.navbar-brand');
|
|
560
559
|
// copyright表示
|
|
@@ -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
|
-
|
|
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
|
-
|
|
28
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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'])){
|
cmdbox/web/assets/filer/filer.js
CHANGED
|
@@ -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'] &&
|
|
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('');
|
cmdbox/web/assets/filer/main.js
CHANGED