pywebexec 2.2.1__py3-none-any.whl → 2.2.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.
@@ -211,6 +211,19 @@
211
211
  box-shadow: unset;
212
212
  outline: 0;
213
213
  }
214
+ .controls > .checkbox input {
215
+ top: 5px;
216
+ }
217
+ .checkbox {
218
+ label {
219
+ font-weight: normal;
220
+ }
221
+ input {
222
+ top: 1px;
223
+ display: unset;
224
+ margin-right: 4px;
225
+ }
226
+ }
214
227
  }
215
228
 
216
229
  .swagger-ui textarea {
@@ -259,9 +259,6 @@ async function fetchExecutables() {
259
259
  paramsInput.addEventListener('focus', () => {
260
260
  const currentCmd = commandInput.value;
261
261
  paramsInput.name = currentCmd;
262
- if (paramsContainer.style.display == 'none') {
263
- $('#schemaForm').html('');
264
- }
265
262
  if (gExecutables[currentCmd] && gExecutables[currentCmd].schema && gExecutables[currentCmd].schema.properties && paramsContainer.style.display == 'none') {
266
263
  createSchemaForm($('#schemaForm'), gExecutables[currentCmd].schema, async function (errors, values) {
267
264
  const commandName = commandInput.value;
@@ -10,24 +10,20 @@ function adjustInputWidth(input) {
10
10
 
11
11
  function formInputHandle() {
12
12
  schemaForm.querySelectorAll('input[type="text"], input[type="number"]').forEach(input => {
13
- if (! inputHandlers.includes(input)) {
14
- val = input.placeholder;
15
- if (val) {
16
- size = Math.max(val.length, 2)
17
- if (input.type== 'number') {
18
- size += 2;
19
- }
20
- } else {
21
- size = 12;
22
- }
23
- if (input.value) {
24
- size = 2;
13
+ val = input.placeholder;
14
+ if (val) {
15
+ size = Math.max(val.length, 2)
16
+ if (input.type== 'number') {
17
+ size += 2;
25
18
  }
26
- input.setAttribute('size', size);
27
- setTimeout(() => adjustInputWidth(input), 1);
28
- input.addEventListener('input', () => adjustInputWidth(input));
29
- inputHandlers.push(input);
19
+ } else {
20
+ size = 12;
30
21
  }
22
+ if (input.value) {
23
+ size = 2;
24
+ }
25
+ input.setAttribute('size', size);
26
+ setTimeout(() => adjustInputWidth(input), 1);
31
27
  });
32
28
  }
33
29
 
@@ -84,6 +80,8 @@ function convertTextareaToArray(values, formDesc, schema) {
84
80
  const val = obj[lastKey];
85
81
  if (val) {
86
82
  obj[lastKey] = val.trim().split(/[\s\r,]+/).filter(x => x);
83
+ } else {
84
+ delete obj[lastKey];
87
85
  }
88
86
  }
89
87
  }
@@ -93,7 +91,7 @@ function convertTextareaToArray(values, formDesc, schema) {
93
91
 
94
92
  // ...existing code...
95
93
 
96
- function createSchemaForm(form, schema, onSubmit, schemaName) {
94
+ function createSchemaForm($form, schema, onSubmit, schemaName) {
97
95
  if (schema && schema.schema_options) {
98
96
  schema_options = schema.schema_options;
99
97
  } else {
@@ -140,8 +138,14 @@ function createSchemaForm(form, schema, onSubmit, schemaName) {
140
138
  } else {
141
139
  value = {};
142
140
  }
143
-
144
- schemaForm = form[0];
141
+ // recreate form to remove event listeners
142
+ $form.off();
143
+ $form.empty();
144
+ $form.html('');
145
+ $newform = $form.clone();
146
+ $form.replaceWith($newform);
147
+ $form = $newform;
148
+ schemaForm = $form[0];
145
149
  if (onSubmit != null) {
146
150
  if (schema_options && schema_options.batch_param) {
147
151
  schema.properties[schema_options.batch_param].required = true;
@@ -207,8 +211,8 @@ function createSchemaForm(form, schema, onSubmit, schemaName) {
207
211
  }
208
212
  }
209
213
  }
210
- form[0].classList.add('form-inline');
211
- jsform = form.jsonForm({
214
+ schemaForm.classList.add('form-inline');
215
+ jsform = $form.jsonForm({
212
216
  schema: schema,
213
217
  onSubmit: function (errors, values) {
214
218
  convertTextareaToArray(values, formDesc, schema);
@@ -228,23 +232,22 @@ function createSchemaForm(form, schema, onSubmit, schemaName) {
228
232
  // fieldHtmlClass: "input-small",
229
233
  // }
230
234
  });
231
- form[0].firstChild.classList.add('form-inline');
232
- form[0].querySelectorAll('._jsonform-array-addmore').forEach(btn => {
233
- btn.addEventListener('click', formInputHandle);
234
- });
235
- formInputHandle();
236
-
237
- form[0].querySelectorAll('textarea').forEach(txt => {
235
+ schemaForm.firstChild.classList.add('form-inline');
236
+ schemaForm.querySelectorAll('textarea').forEach(txt => {
238
237
  txt.style.height = "0";
239
238
  setTimeout(() => adjustTxtHeight(txt), 1);
240
239
  txt.setAttribute("spellcheck", "false");
241
240
  txt.addEventListener("input", () => adjustTxtHeight(txt));
242
241
  });
243
- form[0].addEventListener('input', () => {
242
+ schemaForm.addEventListener('input', (e) => {
243
+ console.log(schemaName);
244
244
  schemaValues[schemaName] = convertTextareaToArray(jsform.root.getFormValues(), formDesc, schema);
245
245
  localStorage.setItem('schemaValues', JSON.stringify(schemaValues));
246
+ if (e.target.tagName === 'INPUT' && e.target.type === 'text') {
247
+ adjustInputWidth(e.target);
248
+ }
246
249
  });
247
-
250
+ formInputHandle();
248
251
  return jsform;
249
252
  }
250
253
  function adjustTxtHeight(txt) {
@@ -286,7 +289,7 @@ async function getPostParametersSchema() {
286
289
  }
287
290
 
288
291
  let schemaForm;
289
- let inputHandlers = [];
292
+ // let inputHandlers = [];
290
293
  let schemaValues = JSON.parse(localStorage.getItem('schemaValues')) || {};
291
294
 
292
295
 
@@ -107,12 +107,12 @@ window.onload = function() {
107
107
  const form = document.createElement("form");
108
108
  form.id = routePathId;
109
109
  form.classList.add("schema-form");
110
+ paramtext.parentNode.insertBefore(form, paramtext.nextSibling);
110
111
  jsform = createSchemaForm($(form), swaggerSchemas[routePath], null, routePath);
111
- // form.addEventListener("input", formInput(node, jsform));
112
+ newForm = jsform.root.ownerTree.domRoot;
112
113
  setTimeout(() => addFormInputListener(paramtext, jsform)(), 100);
113
- form.addEventListener("input", addFormInputListener(paramtext, jsform));
114
- paramtext.parentNode.insertBefore(form, paramtext.nextSibling);
115
- item1 = form.querySelector("input, select, textarea");
114
+ newForm.addEventListener("input", addFormInputListener(paramtext, jsform));
115
+ item1 = newForm.querySelector("input, select, textarea");
116
116
  if (item1) {
117
117
  item1.focus();
118
118
  }
pywebexec/version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '2.2.1'
21
- __version_tuple__ = version_tuple = (2, 2, 1)
20
+ __version__ = version = '2.2.3'
21
+ __version_tuple__ = version_tuple = (2, 2, 3)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: pywebexec
3
- Version: 2.2.1
3
+ Version: 2.2.3
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -62,6 +62,7 @@ Requires-Dist: ldap3>=2.9.1
62
62
  Requires-Dist: pyte>=0.8.1
63
63
  Requires-Dist: PyYAML>=6.0.1
64
64
  Requires-Dist: run-para>=1.0.2
65
+ Dynamic: license-file
65
66
 
66
67
  [![Pypi version](https://img.shields.io/pypi/v/pywebexec.svg)](https://pypi.org/project/pywebexec/)
67
68
  ![Publish Package](https://github.com/joknarf/pywebexec/actions/workflows/python-publish.yml/badge.svg)
@@ -2,8 +2,8 @@ pywebexec/__init__.py,sha256=197fHJy0UDBwTTpGCGortZRr-w2kTaD7MxqdbVmTEi0,61
2
2
  pywebexec/host_ip.py,sha256=Ud_HTflWVQ8789aoQ2RZdT1wGI-ccvrwSWGz_c7T3TI,1241
3
3
  pywebexec/pywebexec.py,sha256=R-jp9BiUMJZW7m9N9kQC6dpIueUgFVDo4n9_GFb1rOs,45734
4
4
  pywebexec/swagger.yaml,sha256=I_oLpp7Hqel8SDEEykvpmCT-Gv3ytGlziq9bvQOrtZY,7598
5
- pywebexec/version.py,sha256=wUUonx5HNvzUsCYrR_oek7De76IsD1eqg46c4ZbWiDg,511
6
- pywebexec/static/css/form.css,sha256=eApJskeJ3MCzC7_p4gXgoIbvbG5s8m4bP1O4KHHqeiA,5293
5
+ pywebexec/version.py,sha256=GFdu4pEXfeZqco923fxtZpMv4y3dAXDtUa8pCmbC1zQ,511
6
+ pywebexec/static/css/form.css,sha256=HnQ4A7QSQu1lC6P8h4hGpUMtOXujNg8SR1_qteu7oDk,5487
7
7
  pywebexec/static/css/markdown.css,sha256=br4-iK9wigTs54N2KHtjgZ4KLH0THVSvJo-XZAdMHiE,1970
8
8
  pywebexec/static/css/style.css,sha256=R1VOPNV2ztROKy9Fgf3tvUrtuKagY027tFJ8C866yWU,9991
9
9
  pywebexec/static/css/swagger-ui.css,sha256=xhXN8fnUaIACGHuPIEIr9-qmyYr6Zx0k2wv4Qy7Bg1Y,154985
@@ -33,11 +33,11 @@ pywebexec/static/images/resume.svg,sha256=99LP1Ya2JXakRCO9kW8JMuT_4a_CannF65Eiuw
33
33
  pywebexec/static/images/running.svg,sha256=fBCYwYb2O9K4N3waC2nURP25NRwZlqR4PbDZy6JQMww,610
34
34
  pywebexec/static/images/success.svg,sha256=NVwezvVMplt46ElW798vqGfrL21Mw_DWHUp_qiD_FU8,489
35
35
  pywebexec/static/images/swagger-ui.svg,sha256=FR0yeOVwe4zCYKZAjCGcT_m0Mf25NexIVaSXifIkoU0,2117
36
- pywebexec/static/js/executables.js,sha256=lF9Icb4VzbxSCTmcz-TUjvFKQ_ygmSgPq0Q_uaTRR-g,11866
36
+ pywebexec/static/js/executables.js,sha256=_Deyx1O8QyiFt6RcmaXnC9Vx9yagTQP4Vhz9GAXFR84,11774
37
37
  pywebexec/static/js/popup.js,sha256=O3DEWnyb5yGW9tjODYycc-ujWndyAfnJMxulaQeogtc,9700
38
- pywebexec/static/js/schemaform.js,sha256=uYlu8P6Y1adEGefzsRhLT-gwS27TZsLwzDGs2UBgDGk,8808
38
+ pywebexec/static/js/schemaform.js,sha256=tCe7P8yK2bXEFWO0nfislmFW1C_ju2XJDUNcrKK1n3Q,8871
39
39
  pywebexec/static/js/script.js,sha256=X5TN2q1m6ZGPK72e1MWgyQWk1agOrcOWuGdwVWB9HJk,18204
40
- pywebexec/static/js/swagger-form.js,sha256=EYXqHIE105DkXPCPi5-eYzux9nPLmJuisf-5EwFypsQ,4578
40
+ pywebexec/static/js/swagger-form.js,sha256=CLcSHMhk5P4-_2MIRBoJLgEnIj_9keDDSzUugXHZjio,4565
41
41
  pywebexec/static/js/js-yaml/LICENSE,sha256=oHvCRGi5ZUznalR9R6LbKC0HcztxXbTHOpi9Y5YflVA,1084
42
42
  pywebexec/static/js/js-yaml/js-yaml.min.js,sha256=Rdw90D3AegZwWiwpibjH9wkBPwS9U4bjJ51ORH8H69c,39430
43
43
  pywebexec/static/js/marked/LICENSE.md,sha256=jjo_gvWaYJWPVsoI9EVkfDKkcz3HymwsRvbriYRxq5w,2942
@@ -67,9 +67,9 @@ pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
67
67
  pywebexec/templates/index.html,sha256=w18O2plH_yS8bqlPsu5hwFFmCj9H2hWLSV8B6ADcSwU,3900
68
68
  pywebexec/templates/popup.html,sha256=3kpMccKD_OLLhJ4Y9KRw6Ny8wQWjVaRrUfV9y5-bDiQ,1580
69
69
  pywebexec/templates/swagger_ui.html,sha256=9ngyldkyEdLonBjl97mbIZUlVk-jxwcHrvFzMSrveyU,1067
70
- pywebexec-2.2.1.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
71
- pywebexec-2.2.1.dist-info/METADATA,sha256=UWTzS7NVz171aeuAw2z8nEdeg5ggBeKEEISktYdU8ms,12810
72
- pywebexec-2.2.1.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
73
- pywebexec-2.2.1.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
74
- pywebexec-2.2.1.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
75
- pywebexec-2.2.1.dist-info/RECORD,,
70
+ pywebexec-2.2.3.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
71
+ pywebexec-2.2.3.dist-info/METADATA,sha256=qtdsZrSYDbczwUkF7CZVEoBUUHzuG6_WOpeFC78VNYA,12832
72
+ pywebexec-2.2.3.dist-info/WHEEL,sha256=tTnHoFhvKQHCh4jz3yCn0WPTYIy7wXx3CJtJ7SJGV7c,91
73
+ pywebexec-2.2.3.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
74
+ pywebexec-2.2.3.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
75
+ pywebexec-2.2.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.1.0)
2
+ Generator: setuptools (77.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5