pywebexec 2.2.6__tar.gz → 2.2.8__tar.gz

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.
Files changed (83) hide show
  1. {pywebexec-2.2.6/pywebexec.egg-info → pywebexec-2.2.8}/PKG-INFO +1 -1
  2. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/css/form.css +11 -0
  3. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/executables.js +7 -5
  4. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/schemaform.js +26 -11
  5. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/templates/swagger_ui.html +1 -0
  6. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/version.py +2 -2
  7. {pywebexec-2.2.6 → pywebexec-2.2.8/pywebexec.egg-info}/PKG-INFO +1 -1
  8. {pywebexec-2.2.6 → pywebexec-2.2.8}/.github/workflows/python-publish.yml +0 -0
  9. {pywebexec-2.2.6 → pywebexec-2.2.8}/.gitignore +0 -0
  10. {pywebexec-2.2.6 → pywebexec-2.2.8}/LICENSE +0 -0
  11. {pywebexec-2.2.6 → pywebexec-2.2.8}/README.md +0 -0
  12. {pywebexec-2.2.6 → pywebexec-2.2.8}/pyproject.toml +0 -0
  13. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/__init__.py +0 -0
  14. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/host_ip.py +0 -0
  15. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/pywebexec.py +0 -0
  16. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/css/markdown.css +0 -0
  17. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/css/style.css +0 -0
  18. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/css/swagger-ui.css +0 -0
  19. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/css/swagger-ui.css.map +0 -0
  20. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/css/xterm.css +0 -0
  21. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/fonts/CommitMonoNerdFontMono-Regular.ttf +0 -0
  22. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/fonts/LICENSE +0 -0
  23. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/fonts/glyphicons-halflings-regular.eot +0 -0
  24. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/fonts/glyphicons-halflings-regular.svg +0 -0
  25. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/fonts/glyphicons-halflings-regular.ttf +0 -0
  26. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/fonts/glyphicons-halflings-regular.woff +0 -0
  27. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/fonts/glyphicons-halflings-regular.woff2 +0 -0
  28. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/aborted.svg +0 -0
  29. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/copy.svg +0 -0
  30. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/copy_ok.svg +0 -0
  31. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/down-arrow.svg +0 -0
  32. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/failed.svg +0 -0
  33. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/favicon.svg +0 -0
  34. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/fit-tty.svg +0 -0
  35. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/fit-win.svg +0 -0
  36. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/font-decrease.svg +0 -0
  37. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/font-increase.svg +0 -0
  38. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/norun.svg +0 -0
  39. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/pause.svg +0 -0
  40. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/popup.svg +0 -0
  41. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/resume.svg +0 -0
  42. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/running.svg +0 -0
  43. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/success.svg +0 -0
  44. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/images/swagger-ui.svg +0 -0
  45. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/js-yaml/LICENSE +0 -0
  46. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/js-yaml/js-yaml.min.js +0 -0
  47. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/marked/LICENSE.md +0 -0
  48. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/marked/marked.min.js +0 -0
  49. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/popup.js +0 -0
  50. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/script.js +0 -0
  51. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/swagger-form.js +0 -0
  52. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/swagger-ui/LICENSE +0 -0
  53. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/swagger-ui/swagger-ui-bundle.js +0 -0
  54. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/swagger-ui/swagger-ui-standalone-preset.js +0 -0
  55. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/LICENSE +0 -0
  56. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/addon-canvas.js +0 -0
  57. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/addon-canvas.js.map +0 -0
  58. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/addon-fit.js +0 -0
  59. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/addon-fit.js.map +0 -0
  60. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/addon-unicode-graphemes.js +0 -0
  61. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/addon-unicode-graphemes.js.map +0 -0
  62. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/addon-unicode11.js +0 -0
  63. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/addon-unicode11.js.map +0 -0
  64. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/xterm.js +0 -0
  65. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/js/xterm/xterm.js.map +0 -0
  66. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/jsonform/LICENSE +0 -0
  67. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/jsonform/deps/README.md +0 -0
  68. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/jsonform/deps/img/glyphicons-halflings.png +0 -0
  69. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/jsonform/deps/jquery.min.js +0 -0
  70. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/jsonform/deps/jsv.js +0 -0
  71. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/jsonform/deps/underscore.js +0 -0
  72. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/static/jsonform/lib/jsonform.js +0 -0
  73. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/swagger.yaml +0 -0
  74. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/templates/__init__.py +0 -0
  75. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/templates/index.html +0 -0
  76. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec/templates/popup.html +0 -0
  77. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec.egg-info/SOURCES.txt +0 -0
  78. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec.egg-info/dependency_links.txt +0 -0
  79. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec.egg-info/entry_points.txt +0 -0
  80. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec.egg-info/requires.txt +0 -0
  81. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexec.egg-info/top_level.txt +0 -0
  82. {pywebexec-2.2.6 → pywebexec-2.2.8}/pywebexecdev +0 -0
  83. {pywebexec-2.2.6 → pywebexec-2.2.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pywebexec
3
- Version: 2.2.6
3
+ Version: 2.2.8
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -226,6 +226,17 @@
226
226
  margin-right: 4px;
227
227
  }
228
228
  }
229
+ .alert {
230
+ padding: 5px 10px;
231
+ margin-bottom: 2px;
232
+ border: 1px solid transparent;
233
+ border-radius: 15px;
234
+ font-size: 14px;
235
+ font-family: Arial, Helvetica, sans-serif;
236
+ color: #a94442;
237
+ background-color: #f2dede;
238
+ border-color: #ebccd1;
239
+ }
229
240
  }
230
241
 
231
242
  .swagger-ui textarea {
@@ -260,7 +260,7 @@ paramsInput.addEventListener('focus', () => {
260
260
  const currentCmd = commandInput.value;
261
261
  paramsInput.name = currentCmd;
262
262
  if (gExecutables[currentCmd] && gExecutables[currentCmd].schema && gExecutables[currentCmd].schema.properties && paramsContainer.style.display == 'none') {
263
- createSchemaForm($('#schemaForm'), gExecutables[currentCmd].schema, async function (errors, values) {
263
+ jsForm = createSchemaForm($('#schemaForm'), gExecutables[currentCmd].schema, async function (errors, values) {
264
264
  const commandName = commandInput.value;
265
265
  fitAddon.fit();
266
266
  terminal.clear();
@@ -293,12 +293,18 @@ paramsInput.addEventListener('focus', () => {
293
293
  console.log('Error running command:', error);
294
294
  }
295
295
  }, currentCmd);
296
+ schemaFormPW = jsForm.root.ownerTree.domRoot;
296
297
  setHelpDivPosition();
297
298
  paramsContainer.style.display = 'block';
298
299
  const input1 = schemaFormPW.querySelector('input, select, textarea');
299
300
  if (input1) {
300
301
  input1.focus();
301
302
  }
303
+ schemaFormPW.addEventListener('submit', (event) => {
304
+ console.log('Form submitted');
305
+ paramsContainer.style.display = 'none';
306
+ event.preventDefault();
307
+ });
302
308
  } else {
303
309
  paramsContainer.style.display = 'none';
304
310
  }
@@ -318,7 +324,3 @@ paramsInput.addEventListener('blur', () => {
318
324
  window.addEventListener('resize', setHelpDivPosition);
319
325
  window.addEventListener('scroll', setHelpDivPosition);
320
326
 
321
- schemaFormPW.addEventListener('submit', (event) => {
322
- paramsContainer.style.display = 'none';
323
- event.preventDefault();
324
- });
@@ -92,8 +92,21 @@ function convertTextareaToArray(values, formDesc, schema) {
92
92
  return values;
93
93
  }
94
94
 
95
- // ...existing code...
96
-
95
+ function validateSchemaForm(form, formDesc, schema, values, schemaName) {
96
+ schemaValues[schemaName] = convertTextareaToArray(values, formDesc, schema);
97
+ localStorage.setItem('schemaValues', JSON.stringify(schemaValues));
98
+ env = JSV.createEnvironment();
99
+ report = env.validate(values, schema);
100
+ errors = report.errors;
101
+ err = form.querySelector('.alert');
102
+ if (errors.length > 0) {
103
+ err.innerText = errors[0].uri.split('#')[1].slice(1).replaceAll('/', '.') + ': ' + errors[0].message + ': ' + errors[0].details;
104
+ err.style.display = 'block';
105
+ return false;
106
+ }
107
+ err.style.display = 'none';
108
+ return true;
109
+ }
97
110
  function createSchemaForm($form, schema, onSubmit, schemaName) {
98
111
  if (schema && schema.schema_options) {
99
112
  schema_options = schema.schema_options;
@@ -214,16 +227,14 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
214
227
  }
215
228
  }
216
229
  }
217
- schemaForm.classList.add('form-inline');
230
+ // schemaForm.classList.add('form-inline');
218
231
  jsform = $form.jsonForm({
219
232
  schema: schema,
220
233
  onSubmit: function (errors, values) {
221
- convertTextareaToArray(values, formDesc, schema);
222
- env = JSV.createEnvironment();
223
- report = env.validate(values, schema);
224
- errors = report.errors;
225
- if (errors.length > 0) {
226
- alert(errors[0].message);
234
+ if (! validateSchemaForm(event.target, formDesc, schema, values, schemaName)) {
235
+ event.preventDefault();
236
+ event.stopPropagation();
237
+ event.stopImmediatePropagation();
227
238
  return false;
228
239
  }
229
240
  onSubmit(errors, values);
@@ -236,6 +247,11 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
236
247
  // }
237
248
  });
238
249
  schemaForm.firstChild.classList.add('form-inline');
250
+ err = document.createElement('div');
251
+ err.classList.add('alert');
252
+ err.style.display = 'none';
253
+ schemaForm.appendChild(err);
254
+ validateSchemaForm(schemaForm, formDesc, schema, value, schemaName);
239
255
  schemaForm.querySelectorAll('textarea').forEach(txt => {
240
256
  txt.style.height = "0";
241
257
  setTimeout(() => adjustTxtHeight(txt), 1);
@@ -243,8 +259,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
243
259
  txt.addEventListener("input", () => adjustTxtHeight(txt));
244
260
  });
245
261
  schemaForm.addEventListener('input', (e) => {
246
- schemaValues[schemaName] = convertTextareaToArray(jsform.root.getFormValues(), formDesc, schema);
247
- localStorage.setItem('schemaValues', JSON.stringify(schemaValues));
262
+ validateSchemaForm(schemaForm, formDesc, schema, jsform.root.getFormValues(), schemaName);
248
263
  if (e.target.tagName === 'INPUT' && e.target.type === 'text') {
249
264
  adjustInputWidth(e.target);
250
265
  }
@@ -14,6 +14,7 @@
14
14
  <script src="/static/js/swagger-ui/swagger-ui-standalone-preset.js"></script>
15
15
  <script type="text/javascript" src="/static/jsonform/deps/jquery.min.js"></script>
16
16
  <script type="text/javascript" src="/static/jsonform/deps/underscore.js"></script>
17
+ <script type="text/javascript" src="/static/jsonform/deps/jsv.js"></script>
17
18
  <script type="text/javascript" src="/static/jsonform/lib/jsonform.js"></script>
18
19
  <script type="text/javascript" src="/static/js/js-yaml/js-yaml.min.js"></script>
19
20
  <script src="/static/js/schemaform.js"></script>
@@ -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.6'
21
- __version_tuple__ = version_tuple = (2, 2, 6)
20
+ __version__ = version = '2.2.8'
21
+ __version_tuple__ = version_tuple = (2, 2, 8)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pywebexec
3
- Version: 2.2.6
3
+ Version: 2.2.8
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes