pywebexec 2.2.2__py3-none-any.whl → 2.2.4__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.
@@ -140,10 +140,10 @@
140
140
  li {
141
141
  display: flex;
142
142
  }
143
- input, select {
143
+ .controls input, select {
144
144
  min-width: unset;
145
145
  max-width: unset;
146
- width: auto;
146
+ width: 110px;
147
147
  margin: 0;
148
148
  }
149
149
  input[type="number"] {
@@ -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;
@@ -1,4 +1,7 @@
1
1
  function adjustInputWidth(input) {
2
+ if (!input.getAttribute('size')) {
3
+ input.setAttribute('size', 9);
4
+ }
2
5
  input.style.width = 'auto';
3
6
  if (input.type === 'number') {
4
7
  delta = 30;
@@ -10,24 +13,20 @@ function adjustInputWidth(input) {
10
13
 
11
14
  function formInputHandle() {
12
15
  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;
16
+ val = input.placeholder;
17
+ if (val) {
18
+ size = Math.max(val.length, 2)
19
+ if (input.type== 'number') {
20
+ size += 2;
22
21
  }
23
- if (input.value) {
24
- size = 2;
25
- }
26
- input.setAttribute('size', size);
27
- setTimeout(() => adjustInputWidth(input), 1);
28
- input.addEventListener('input', () => adjustInputWidth(input));
29
- inputHandlers.push(input);
22
+ } else {
23
+ size = 12;
24
+ }
25
+ if (input.value) {
26
+ size = 2;
30
27
  }
28
+ input.setAttribute('size', size);
29
+ setTimeout(() => adjustInputWidth(input), 1);
31
30
  });
32
31
  }
33
32
 
@@ -95,7 +94,7 @@ function convertTextareaToArray(values, formDesc, schema) {
95
94
 
96
95
  // ...existing code...
97
96
 
98
- function createSchemaForm(form, schema, onSubmit, schemaName) {
97
+ function createSchemaForm($form, schema, onSubmit, schemaName) {
99
98
  if (schema && schema.schema_options) {
100
99
  schema_options = schema.schema_options;
101
100
  } else {
@@ -142,8 +141,14 @@ function createSchemaForm(form, schema, onSubmit, schemaName) {
142
141
  } else {
143
142
  value = {};
144
143
  }
145
-
146
- schemaForm = form[0];
144
+ // recreate form to remove event listeners
145
+ $form.off();
146
+ $form.empty();
147
+ $form.html('');
148
+ $newform = $form.clone();
149
+ $form.replaceWith($newform);
150
+ $form = $newform;
151
+ schemaForm = $form[0];
147
152
  if (onSubmit != null) {
148
153
  if (schema_options && schema_options.batch_param) {
149
154
  schema.properties[schema_options.batch_param].required = true;
@@ -209,8 +214,8 @@ function createSchemaForm(form, schema, onSubmit, schemaName) {
209
214
  }
210
215
  }
211
216
  }
212
- form[0].classList.add('form-inline');
213
- jsform = form.jsonForm({
217
+ schemaForm.classList.add('form-inline');
218
+ jsform = $form.jsonForm({
214
219
  schema: schema,
215
220
  onSubmit: function (errors, values) {
216
221
  convertTextareaToArray(values, formDesc, schema);
@@ -230,23 +235,21 @@ function createSchemaForm(form, schema, onSubmit, schemaName) {
230
235
  // fieldHtmlClass: "input-small",
231
236
  // }
232
237
  });
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 => {
238
+ schemaForm.firstChild.classList.add('form-inline');
239
+ schemaForm.querySelectorAll('textarea').forEach(txt => {
240
240
  txt.style.height = "0";
241
241
  setTimeout(() => adjustTxtHeight(txt), 1);
242
242
  txt.setAttribute("spellcheck", "false");
243
243
  txt.addEventListener("input", () => adjustTxtHeight(txt));
244
244
  });
245
- form[0].addEventListener('input', () => {
245
+ schemaForm.addEventListener('input', (e) => {
246
246
  schemaValues[schemaName] = convertTextareaToArray(jsform.root.getFormValues(), formDesc, schema);
247
247
  localStorage.setItem('schemaValues', JSON.stringify(schemaValues));
248
+ if (e.target.tagName === 'INPUT' && e.target.type === 'text') {
249
+ adjustInputWidth(e.target);
250
+ }
248
251
  });
249
-
252
+ formInputHandle();
250
253
  return jsform;
251
254
  }
252
255
  function adjustTxtHeight(txt) {
@@ -288,7 +291,7 @@ async function getPostParametersSchema() {
288
291
  }
289
292
 
290
293
  let schemaForm;
291
- let inputHandlers = [];
294
+ // let inputHandlers = [];
292
295
  let schemaValues = JSON.parse(localStorage.getItem('schemaValues')) || {};
293
296
 
294
297
 
@@ -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.4'
21
+ __version_tuple__ = version_tuple = (2, 2, 4)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pywebexec
3
- Version: 2.2.2
3
+ Version: 2.2.4
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -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=YDBduKhVnvbZfZTbXbsjQMbxTwgIIXIZ646Mj9YV074,511
6
- pywebexec/static/css/form.css,sha256=HnQ4A7QSQu1lC6P8h4hGpUMtOXujNg8SR1_qteu7oDk,5487
5
+ pywebexec/version.py,sha256=Ath1yNFbHtPzluPba0J7EfQTfLH_byRzLfGjqAUl6cY,511
6
+ pywebexec/static/css/form.css,sha256=R61CysMe2QqRHe3uxamkK29-pnm23y4Ekl3pZIVgPKQ,5498
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=NLMAnS2GpyhGp286HUBqQXJAAQaqFMtJ03rGVrh8JaM,8856
38
+ pywebexec/static/js/schemaform.js,sha256=2kjdaquoIdh0hAuAuZdI0cqM5URPWslZtbYHAjtG1_4,8918
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.4.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
71
+ pywebexec-2.2.4.dist-info/METADATA,sha256=9jESgXsDGpYA9ZW1RIN4k7fy5vbTGdr4ZVRFnz48X8M,12832
72
+ pywebexec-2.2.4.dist-info/WHEEL,sha256=tTnHoFhvKQHCh4jz3yCn0WPTYIy7wXx3CJtJ7SJGV7c,91
73
+ pywebexec-2.2.4.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
74
+ pywebexec-2.2.4.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
75
+ pywebexec-2.2.4.dist-info/RECORD,,