pywebexec 2.2.2__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.
@@ -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
 
@@ -95,7 +91,7 @@ function convertTextareaToArray(values, formDesc, schema) {
95
91
 
96
92
  // ...existing code...
97
93
 
98
- function createSchemaForm(form, schema, onSubmit, schemaName) {
94
+ function createSchemaForm($form, schema, onSubmit, schemaName) {
99
95
  if (schema && schema.schema_options) {
100
96
  schema_options = schema.schema_options;
101
97
  } else {
@@ -142,8 +138,14 @@ function createSchemaForm(form, schema, onSubmit, schemaName) {
142
138
  } else {
143
139
  value = {};
144
140
  }
145
-
146
- 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];
147
149
  if (onSubmit != null) {
148
150
  if (schema_options && schema_options.batch_param) {
149
151
  schema.properties[schema_options.batch_param].required = true;
@@ -209,8 +211,8 @@ function createSchemaForm(form, schema, onSubmit, schemaName) {
209
211
  }
210
212
  }
211
213
  }
212
- form[0].classList.add('form-inline');
213
- jsform = form.jsonForm({
214
+ schemaForm.classList.add('form-inline');
215
+ jsform = $form.jsonForm({
214
216
  schema: schema,
215
217
  onSubmit: function (errors, values) {
216
218
  convertTextareaToArray(values, formDesc, schema);
@@ -230,23 +232,22 @@ function createSchemaForm(form, schema, onSubmit, schemaName) {
230
232
  // fieldHtmlClass: "input-small",
231
233
  // }
232
234
  });
233
- form[0].firstChild.classList.add('form-inline');
234
- form[0].querySelectorAll('._jsonform-array-addmore').forEach(btn => {
235
- btn.addEventListener('click', formInputHandle);
236
- });
237
- formInputHandle();
238
-
239
- form[0].querySelectorAll('textarea').forEach(txt => {
235
+ schemaForm.firstChild.classList.add('form-inline');
236
+ schemaForm.querySelectorAll('textarea').forEach(txt => {
240
237
  txt.style.height = "0";
241
238
  setTimeout(() => adjustTxtHeight(txt), 1);
242
239
  txt.setAttribute("spellcheck", "false");
243
240
  txt.addEventListener("input", () => adjustTxtHeight(txt));
244
241
  });
245
- form[0].addEventListener('input', () => {
242
+ schemaForm.addEventListener('input', (e) => {
243
+ console.log(schemaName);
246
244
  schemaValues[schemaName] = convertTextareaToArray(jsform.root.getFormValues(), formDesc, schema);
247
245
  localStorage.setItem('schemaValues', JSON.stringify(schemaValues));
246
+ if (e.target.tagName === 'INPUT' && e.target.type === 'text') {
247
+ adjustInputWidth(e.target);
248
+ }
248
249
  });
249
-
250
+ formInputHandle();
250
251
  return jsform;
251
252
  }
252
253
  function adjustTxtHeight(txt) {
@@ -288,7 +289,7 @@ async function getPostParametersSchema() {
288
289
  }
289
290
 
290
291
  let schemaForm;
291
- let inputHandlers = [];
292
+ // let inputHandlers = [];
292
293
  let schemaValues = JSON.parse(localStorage.getItem('schemaValues')) || {};
293
294
 
294
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.2'
21
- __version_tuple__ = version_tuple = (2, 2, 2)
20
+ __version__ = version = '2.2.3'
21
+ __version_tuple__ = version_tuple = (2, 2, 3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pywebexec
3
- Version: 2.2.2
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
@@ -2,7 +2,7 @@ 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=YDBduKhVnvbZfZTbXbsjQMbxTwgIIXIZ646Mj9YV074,511
5
+ pywebexec/version.py,sha256=GFdu4pEXfeZqco923fxtZpMv4y3dAXDtUa8pCmbC1zQ,511
6
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
@@ -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=NLMAnS2GpyhGp286HUBqQXJAAQaqFMtJ03rGVrh8JaM,8856
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.2.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
71
- pywebexec-2.2.2.dist-info/METADATA,sha256=6wl5EJ2M1Oww4Pn6Pu5wRAIqf0cHv6DixTl4jv5ICf4,12832
72
- pywebexec-2.2.2.dist-info/WHEEL,sha256=tTnHoFhvKQHCh4jz3yCn0WPTYIy7wXx3CJtJ7SJGV7c,91
73
- pywebexec-2.2.2.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
74
- pywebexec-2.2.2.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
75
- pywebexec-2.2.2.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,,