pywebexec 2.1.17__py3-none-any.whl → 2.1.19__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.
@@ -256,8 +256,6 @@ async function fetchExecutables() {
256
256
 
257
257
  }
258
258
 
259
- let schemaValues = {};
260
-
261
259
  paramsInput.addEventListener('focus', () => {
262
260
  const currentCmd = commandInput.value;
263
261
  paramsInput.name = currentCmd;
@@ -267,8 +265,6 @@ paramsInput.addEventListener('focus', () => {
267
265
  if (gExecutables[currentCmd] && gExecutables[currentCmd].schema && gExecutables[currentCmd].schema.properties && paramsContainer.style.display == 'none') {
268
266
  createSchemaForm($('#schemaForm'), gExecutables[currentCmd].schema, async function (errors, values) {
269
267
  if (errors) {
270
- schemaValues[currentCmd] = values;
271
-
272
268
  console.log(errors);
273
269
  alert(errors[0].message);
274
270
  return false;
@@ -276,7 +272,6 @@ paramsInput.addEventListener('focus', () => {
276
272
  const commandName = commandInput.value;
277
273
  fitAddon.fit();
278
274
  terminal.clear();
279
- schemaValues[currentCmd] = values;
280
275
  payload = { params: values, rows: terminal.rows, cols: terminal.cols }
281
276
  if ('parallel' in values) {
282
277
  payload['parallel'] = values['parallel'];
@@ -306,7 +301,7 @@ paramsInput.addEventListener('focus', () => {
306
301
  console.log('Error running command:', error);
307
302
  }
308
303
  }
309
- }, schemaValues[currentCmd]);
304
+ }, currentCmd.toString());
310
305
  setHelpDivPosition();
311
306
  paramsContainer.style.display = 'block';
312
307
  const input1 = schemaFormPW.querySelector('input, select, textarea');
@@ -35,16 +35,17 @@ function extractKeysAndPlaceholders(obj, formoptions, prefix = '') {
35
35
  let result = [];
36
36
 
37
37
  for (let key in obj.properties) {
38
+ k = prefix ? `${prefix}.${key}` : key;
38
39
  if (obj.properties[key].type === 'object' && obj.properties[key].properties) {
39
- result = result.concat(extractKeysAndPlaceholders(obj.properties[key], formoptions, prefix ? `${prefix}.${key}` : key));
40
+ result = result.concat(extractKeysAndPlaceholders(obj.properties[key], formoptions, k));
40
41
  } else {
41
- if (formoptions[`${prefix}.${key}`]) {
42
- foptions = formoptions[`${prefix}.${key}`];
42
+ if (formoptions[k]) {
43
+ foptions = formoptions[k];
43
44
  } else {
44
45
  foptions = {};
45
46
  }
46
47
  result.push({
47
- key: prefix ? `${prefix}.${key}` : key,
48
+ key: k,
48
49
  placeholder: obj.properties[key].example || null,
49
50
  ... foptions
50
51
  });
@@ -53,7 +54,12 @@ function extractKeysAndPlaceholders(obj, formoptions, prefix = '') {
53
54
  return result;
54
55
  }
55
56
 
56
- function createSchemaForm(form, schema, onSubmit, value={}) {
57
+ function createSchemaForm(form, schema, onSubmit, schemaName) {
58
+ if (schemaValues[schemaName]) {
59
+ value = schemaValues[schemaName];
60
+ } else {
61
+ value = {};
62
+ }
57
63
  if (schema && schema.schema_options) {
58
64
  schema_options = schema.schema_options;
59
65
  } else {
@@ -162,7 +168,11 @@ function createSchemaForm(form, schema, onSubmit, value={}) {
162
168
  txt.setAttribute("spellcheck", "false");
163
169
  txt.addEventListener("input", () => adjustTxtHeight(txt));
164
170
  });
165
-
171
+ form[0].addEventListener('input', () => {
172
+ schemaValues[schemaName] = jsform.root.getFormValues();
173
+ localStorage.setItem('schemaValues', JSON.stringify(schemaValues));
174
+ });
175
+
166
176
  return jsform;
167
177
  }
168
178
  function adjustTxtHeight(txt) {
@@ -200,5 +210,6 @@ async function getPostParametersSchema() {
200
210
 
201
211
  let schemaForm;
202
212
  let inputHandlers = [];
213
+ let schemaValues = JSON.parse(localStorage.getItem('schemaValues')) || {};
203
214
 
204
215
 
@@ -88,7 +88,7 @@ window.onload = function() {
88
88
  const form = document.createElement("form");
89
89
  form.id = routePathId;
90
90
  form.classList.add("schema-form");
91
- jsform = createSchemaForm($(form), swaggerSchemas[routePath], null);
91
+ jsform = createSchemaForm($(form), swaggerSchemas[routePath], null, routePath);
92
92
  // form.addEventListener("input", formInput(node, jsform));
93
93
  form.addEventListener("input", addFormInputListener(node, jsform));
94
94
  node.parentNode.insertBefore(form, node.nextSibling);
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.1.17'
21
- __version_tuple__ = version_tuple = (2, 1, 17)
20
+ __version__ = version = '2.1.19'
21
+ __version_tuple__ = version_tuple = (2, 1, 19)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pywebexec
3
- Version: 2.1.17
3
+ Version: 2.1.19
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=kufip6m7MWjCIjtheUYuFUZgnNS5_W3kC5gVFVSUVX8,45662
4
4
  pywebexec/swagger.yaml,sha256=zP_Nz69vZx0iwbKTwiQgSs8rJRUTiGKRyIkWzMPANOE,6688
5
- pywebexec/version.py,sha256=6B1QsV14vku3b3mzQ60TgvM-e03ET7xDx-6ZZcUvbqI,513
5
+ pywebexec/version.py,sha256=H0zgjQHhg7kQrNE7IoxjBFCFnEnqqBnOnQe-ScWOyb4,513
6
6
  pywebexec/static/css/form.css,sha256=eApJskeJ3MCzC7_p4gXgoIbvbG5s8m4bP1O4KHHqeiA,5293
7
7
  pywebexec/static/css/markdown.css,sha256=3RzUnpVBdF6cQuB_NXV7hMTc0quYU8sfyuZcpsREj6A,1939
8
8
  pywebexec/static/css/style.css,sha256=ynccbEDzK07rurLm-UirUs5j_hVfXlIgaHeUIq9WvA0,9969
@@ -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=DgkpsiXYRLzS57W8s8zTa-bqk4aErQaQnC7Y_icJITs,12301
36
+ pywebexec/static/js/executables.js,sha256=V9SUmRQP9M69jYbahNrsV4_oI0ASZv_F6Ax9wj0S0Ww,12171
37
37
  pywebexec/static/js/popup.js,sha256=0fr3pp4j9D2fXEVnHyQrx2bPWFHfgbb336dbewgH1d8,9023
38
- pywebexec/static/js/schemaform.js,sha256=AcJky1SuxlcPFmVsHSXTTHBUtb3ZJ8SlDk1Yq2Zb_Es,6096
38
+ pywebexec/static/js/schemaform.js,sha256=mpOYvAiCcuG6-3dJiOLaGKK14mBic0UWN5WrrKxCA_g,6403
39
39
  pywebexec/static/js/script.js,sha256=KrtLF77vKvKomKAIy0rix-T1hx4VTgjkQunHvgs-jaA,17631
40
- pywebexec/static/js/swagger-form.js,sha256=BU64XxyfrWx4DnpAuaWtG-9YpcHF3OzzAYzjiSH0NGo,3826
40
+ pywebexec/static/js/swagger-form.js,sha256=o2ovbTpqwy6H2yubV1NIi7VBQfAqW7seZWQ6O78ACb8,3837
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.1.17.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
71
- pywebexec-2.1.17.dist-info/METADATA,sha256=KCKxVgXAdHSNNrg9xrxNUjL5PrTJDkYQXv1ZlkMhAl0,12811
72
- pywebexec-2.1.17.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
73
- pywebexec-2.1.17.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
74
- pywebexec-2.1.17.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
75
- pywebexec-2.1.17.dist-info/RECORD,,
70
+ pywebexec-2.1.19.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
71
+ pywebexec-2.1.19.dist-info/METADATA,sha256=NDtHARH0QFd_0FthJ2ui5LPVdw2O-1TtP4stJSenWWY,12811
72
+ pywebexec-2.1.19.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
73
+ pywebexec-2.1.19.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
74
+ pywebexec-2.1.19.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
75
+ pywebexec-2.1.19.dist-info/RECORD,,