pywebexec 2.4.16__py3-none-any.whl → 2.4.18__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.
@@ -76,7 +76,7 @@
76
76
  color: #808080;
77
77
  display: block;
78
78
  margin-top: 5px;
79
- margin-bottom: 10px;
79
+ margin-bottom: 5px;
80
80
  max-width: 300px;
81
81
  }
82
82
  .form-control {
@@ -162,11 +162,11 @@
162
162
  width: 110px;;
163
163
  }
164
164
 
165
- .controls > div:not([id]) { /* for checkboxes */
165
+ .controls > div:not([id]), .checkboxes { /* for checkboxes */
166
166
  scrollbar-width: thin;
167
167
  scrollbar-gutter: stable;
168
168
  overflow-y: auto;
169
- max-height: 100px;
169
+ max-height: 157px;
170
170
  border: solid 1px #ccc;
171
171
  border-radius: 5px;
172
172
  padding: 5px 2px;
@@ -326,6 +326,7 @@
326
326
 
327
327
  legend {
328
328
  font-weight: bold;
329
+ color: #444;
329
330
  }
330
331
  .expandable > legend::before {
331
332
  content: '\25B8';
@@ -338,9 +339,12 @@
338
339
  fieldset {
339
340
  border: 1px solid #ccc;
340
341
  border-radius: 5px;
341
- padding-top: 9px;
342
+ padding-top: 5px;
342
343
  height: fit-content;
344
+ display: flex;
345
+ gap: 5px;
343
346
  /* width: 100%; */
347
+ padding-bottom: 3px;
344
348
  label {
345
349
  padding-right: 5px;
346
350
  }
@@ -349,6 +353,10 @@
349
353
  fieldset > div {
350
354
  /* display: block ruby; */
351
355
  padding-bottom: 5px;
356
+ }
357
+ fieldset.expandable {
358
+ position: relative;
359
+ top: -1px;
352
360
  }
353
361
  fieldset.expandable > div {
354
362
  display: inline-flex;
@@ -377,6 +385,16 @@
377
385
  .tab-content > .active {
378
386
  display: block;
379
387
  }
388
+ .tab-container{
389
+ border: none;
390
+ padding: 0;
391
+ }
392
+ li.checkbox .draggable {
393
+ padding-top: 1px;
394
+ }
395
+ li.checkbox label {
396
+ margin-left: 0px;
397
+ }
380
398
  }
381
399
 
382
400
  .swagger-ui textarea {
@@ -92,15 +92,14 @@ commandInput.addEventListener('input', (event) => {
92
92
  });
93
93
 
94
94
  commandInput.addEventListener('keydown', (event) => {
95
+ paramsContainer.style.display = 'none';
95
96
  if (event.key === ' ' || event.key === 'ArrowRight' || event.key === 'Tab') {
96
97
  event.preventDefault();
97
- paramsContainer.style.display = 'none';
98
98
  paramsInput.focus();
99
99
  paramsInput.setSelectionRange(0, paramsInput.value.length);
100
100
  commandListDiv.style.display = 'none'
101
101
  } else if (event.key === 'ArrowDown') {
102
102
  if (commandListDiv.children.length > 1) {
103
- paramsContainer.style.display = 'none';
104
103
  commandListDiv.style.display = 'block';
105
104
  commandListDiv.children[firstVisibleItem].focus();
106
105
  }
@@ -35,7 +35,7 @@ function formInputHandle() {
35
35
  });
36
36
  }
37
37
 
38
- function extractKeysAndPlaceholders(obj, formkeys, formoptions, prefix = '') {
38
+ function extractKeys(obj, formkeys, formoptions, prefix = '') {
39
39
  let result = [];
40
40
 
41
41
  for (let key in obj.properties) {
@@ -44,7 +44,7 @@ function extractKeysAndPlaceholders(obj, formkeys, formoptions, prefix = '') {
44
44
  continue;
45
45
  }
46
46
  if (obj.properties[key].type === 'object' && obj.properties[key].properties) {
47
- result = result.concat(extractKeysAndPlaceholders(obj.properties[key], formkeys, formoptions, k));
47
+ result = result.concat(extractKeys(obj.properties[key], formkeys, formoptions, k));
48
48
  } else {
49
49
  if (formkeys[k]) {
50
50
  foptions = formkeys[k];
@@ -53,7 +53,6 @@ function extractKeysAndPlaceholders(obj, formkeys, formoptions, prefix = '') {
53
53
  }
54
54
  result.push({
55
55
  key: k,
56
- placeholder: obj.properties[key].example || null,
57
56
  ... foptions
58
57
  });
59
58
  }
@@ -149,7 +148,33 @@ function expandFieldset(fieldsetClass) {
149
148
  schemaForm.querySelector(`fieldset.${fieldsetClass} > div`).style.display = 'inline-flex';
150
149
  }
151
150
 
151
+ function orderCheckboxes() {
152
+ schemaForm.querySelectorAll('.checkboxes > ul').forEach(checkboxes => {
153
+ const key = checkboxes.getAttribute('name');
154
+ const cboxes = checkboxes
155
+ const matchingElements = [];
156
+ if (! value || ! value[key] || !value[key].length) {
157
+ return;
158
+ }
159
+ for (let val = 0; val < value[key].length; val++) {
160
+ for (let i = 0; i < cboxes.children.length; i++) {
161
+ if (cboxes.children[i].querySelector('label').innerText === value.scope[val]) {
162
+ matchingElements.push(cboxes.children[i]);
163
+ break;
164
+ }
165
+ }
166
+ }
167
+ // Append matching elements to the top in the order of value.scope
168
+ matchingElements.reverse().forEach(element => {
169
+ cboxes.insertBefore(element, cboxes.firstChild);
170
+ });
171
+ });
172
+ }
173
+
152
174
  function createSchemaForm($form, schema, onSubmit, schemaName) {
175
+ if (!schemaName in savedValues) {
176
+ savedValues[schemaName] = {};
177
+ }
153
178
  schema_options = undefined;
154
179
  schema_params_options = undefined;
155
180
  if (schema && schema.schema_options) {
@@ -176,7 +201,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
176
201
  if(schema.properties['savedValues']) {
177
202
  delete schema.properties['savedValues'];
178
203
  }
179
- formDesc = extractKeysAndPlaceholders(schema, formkeys, formoptions);
204
+ formDesc = extractKeys(schema, formkeys, formoptions);
180
205
  schema.properties["savedValues"] = {
181
206
  type: "string",
182
207
  title: " ",
@@ -209,7 +234,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
209
234
  }
210
235
  convertObjectsToJsonStrings(value, schema);
211
236
  } else {
212
- value = {};
237
+ value = undefined;
213
238
  }
214
239
  // recreate form to remove event listeners
215
240
  $form.off();
@@ -349,7 +374,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
349
374
  evt.preventDefault();
350
375
  evt.stopPropagation();
351
376
  evt.stopImmediatePropagation();
352
- schemaValues[schemaName] = {};
377
+ delete schemaValues[schemaName];
353
378
  createSchemaForm($form, schema, onSubmit, schemaName);
354
379
  },
355
380
  },
@@ -390,7 +415,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
390
415
  });
391
416
  }
392
417
  }
393
- console.log('formDesc', formDesc);
418
+ //console.log('formDesc', formDesc);
394
419
  // schemaForm.classList.add('form-inline');
395
420
  jsform = $form.jsonForm({
396
421
  schema: schema,
@@ -416,6 +441,8 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
416
441
  err.classList.add('alert');
417
442
  err.style.display = 'none';
418
443
  schemaForm.appendChild(err);
444
+ cboxes = schemaForm.querySelector('.checkboxes > ul');
445
+ orderCheckboxes();
419
446
  validateSchemaForm(schemaForm, formDesc, schema, jsform.root.getFormValues(), schemaName);
420
447
  schemaForm.querySelectorAll('textarea').forEach(txt => {
421
448
  txt.style.height = "0";
@@ -267,7 +267,7 @@ var inputFieldTemplate = function (type) {
267
267
  '<%= (node.schemaElement && node.schemaElement.required && (node.schemaElement.type !== "boolean") ? " required=\'required\'" : "") %>' +
268
268
  '<%= (node.schemaElement && (node.schemaElement.type === "number") && !isNaN(node.schemaElement.maximum) ? " max=" + \'"\' + node.schemaElement.maximum + \'"\' : "")%>' +
269
269
  '<%= (node.schemaElement && (node.schemaElement.type === "number") && !isNaN(node.schemaElement.minimum) ? " min=" + \'"\' + node.schemaElement.minimum + \'"\' : "")%>' +
270
- '<%= (node.placeholder? " placeholder=" + \'"\' + escape(node.placeholder) + \'"\' : "")%>' +
270
+ '<%= (node.placeholder ? " placeholder=" + \'"\' + escape(node.placeholder) + \'"\' : "")||(node.schemaElement && node.schemaElement.example ? " placeholder=" + \'"\' + escape(node.schemaElement.example) + \'"\' : "")%>' +
271
271
  ' />',
272
272
  'fieldtemplate': true,
273
273
  'inputfield': true
@@ -834,23 +834,24 @@ jsonform.elementTypes = {
834
834
  $(node.el).find('input:checked').parent().addClass(activeClass)
835
835
  }
836
836
  },
837
- 'checkboxes':{
838
- 'template': '<div><%= choiceshtml %></div>',
837
+ 'checkboxes': {
838
+ 'template': '<div id="<%= id %>" class="checkboxes" ><ul name="<%= node.key %>"class="_jsonform-array-ul sortable"><%= choiceshtml %></ul></div>',
839
839
  'fieldtemplate': true,
840
840
  'inputfield': true,
841
841
  'onBeforeRender': function (data, node) {
842
- // Build up choices from the enumeration list
843
842
  var choices = null;
844
843
  var choiceshtml = null;
845
- var template = '<div class="checkbox"><label>' +
844
+ var template = '<li class="checkbox" data-idx="<%= idx %>">' +
845
+ '<span class="draggable line"><i class="glyphicon glyphicon-list" title="Move item"></i></span>' +
846
+ '<label>' +
846
847
  '<input type="checkbox" <% if (value) { %> checked="checked" <% } %> name="<%= name %>" value="1"' +
847
848
  '<%= (node.disabled? " disabled" : "")%>' +
848
- '/><%= title %></label></div>';
849
+ '/><%= title %></label></li>';
850
+
849
851
  if (!node || !node.schemaElement) return;
850
852
 
851
853
  if (node.schemaElement.items) {
852
- choices =
853
- node.schemaElement.items["enum"] ||
854
+ choices = node.schemaElement.items["enum"] ||
854
855
  node.schemaElement.items[0]["enum"];
855
856
  } else {
856
857
  choices = node.schemaElement["enum"];
@@ -860,6 +861,7 @@ jsonform.elementTypes = {
860
861
  choiceshtml = '';
861
862
  _.each(choices, function (choice, idx) {
862
863
  choiceshtml += _.template(template, fieldTemplateSettings)({
864
+ idx: idx,
863
865
  name: node.key + '[' + idx + ']',
864
866
  value: _.include(node.value, choice),
865
867
  title: hasOwnProperty(node.formElement.titleMap, choice) ? node.formElement.titleMap[choice] : choice,
@@ -868,6 +870,15 @@ jsonform.elementTypes = {
868
870
  });
869
871
 
870
872
  data.choiceshtml = choiceshtml;
873
+ },
874
+ 'onInsert': function(evt, node) {
875
+ var $list = $(node.el).find('ul._jsonform-array-ul');
876
+
877
+ if (!isSet(node.formElement.draggable) || node.formElement.draggable) {
878
+ if ($list.sortable) {
879
+ $list.sortable();
880
+ }
881
+ }
871
882
  }
872
883
  },
873
884
  'array': {
@@ -2446,11 +2457,13 @@ formNode.prototype.computeInitialValues = function (values, ignoreDefaultValues)
2446
2457
  // be a complex structure that needs to be pushed down the subtree.
2447
2458
  // The easiest way is probably to generate a "values" object and
2448
2459
  // compute initial values from that object
2449
- /*
2460
+ // fjo start: TODO convert this.key to be used in values
2450
2461
  else if (this.schemaElement['default']) {
2462
+ values = {};
2463
+ values[this.key] = this.schemaElement['default'];
2451
2464
  nbChildren = this.schemaElement['default'].length;
2452
2465
  }
2453
- */
2466
+ // fjo end
2454
2467
  else if (nbChildren === 0) {
2455
2468
  // If form has already been submitted with no children, the array
2456
2469
  // needs to be rendered without children. If there are no previously
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.4.16'
21
- __version_tuple__ = version_tuple = (2, 4, 16)
20
+ __version__ = version = '2.4.18'
21
+ __version_tuple__ = version_tuple = (2, 4, 18)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pywebexec
3
- Version: 2.4.16
3
+ Version: 2.4.18
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=oiCMlo2o3AkkgXDarUSx8T3FWXKI0vk1-EPnx5FGBd8,1332
3
3
  pywebexec/pywebexec.py,sha256=avBfvbhLbjvrJ168bBmQVrm-DjbjGJoAapHHIEAD6V4,48515
4
4
  pywebexec/swagger.yaml,sha256=I_oLpp7Hqel8SDEEykvpmCT-Gv3ytGlziq9bvQOrtZY,7598
5
- pywebexec/version.py,sha256=_A38yq5XuhaqaNvvHUshJ5D7Tj6xkHHvY9tmNuQKWsI,513
6
- pywebexec/static/css/form.css,sha256=DhglYtCU-2UHrh-MSV3CAYLnskWQpkEQtAHjHF1vM_o,8346
5
+ pywebexec/version.py,sha256=tklCNhruYVYrAzUgM2IxG6oUw5E6t_A3tDtn6RUMsSk,513
6
+ pywebexec/static/css/form.css,sha256=pLM_llJw-arBEgxcKSte_SYVRwDSsLWCOMUYabXWQZU,8658
7
7
  pywebexec/static/css/markdown.css,sha256=br4-iK9wigTs54N2KHtjgZ4KLH0THVSvJo-XZAdMHiE,1970
8
8
  pywebexec/static/css/style.css,sha256=TX60M-mzIPTGVDmaypRCOcyxc8A7dOjx-p1_bpJ6t9M,11772
9
9
  pywebexec/static/css/swagger-ui.css,sha256=xhXN8fnUaIACGHuPIEIr9-qmyYr6Zx0k2wv4Qy7Bg1Y,154985
@@ -34,9 +34,9 @@ pywebexec/static/images/running.svg,sha256=fBCYwYb2O9K4N3waC2nURP25NRwZlqR4PbDZy
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
36
  pywebexec/static/js/exceljs.min.js,sha256=fknaaFiOJQ27i7oZDSyqirN4fMAoS9odiy-AXE33Qsk,947702
37
- pywebexec/static/js/executables.js,sha256=pWnEFZcQ-hKHFzwNKs5KFgyT9A_1wx3m2thlOGJwU3g,12052
37
+ pywebexec/static/js/executables.js,sha256=xD4rauofJUymUWyu3oUzUAm9djy4gp6G-Gh9tFBtlBI,11996
38
38
  pywebexec/static/js/popup.js,sha256=X-Q__R0jeZFO_I8EWucP1KkUJa9-Atz8bdnyWp6ibzY,11376
39
- pywebexec/static/js/schemaform.js,sha256=qDmY3L9jhP2QQIOfkYRsRtlP4upx1S2LNEb5hINmgPw,15683
39
+ pywebexec/static/js/schemaform.js,sha256=ZtBn_He94NKSpSb-H0m7Shz7chrvgNvcdStxWWV7tyI,16515
40
40
  pywebexec/static/js/script.js,sha256=2Jys1IpB94ygkjnpFkUvcZdchM-gZrfPOFuS74SxgZI,21508
41
41
  pywebexec/static/js/swagger-form.js,sha256=CLcSHMhk5P4-_2MIRBoJLgEnIj_9keDDSzUugXHZjio,4565
42
42
  pywebexec/static/js/tablefilter.js,sha256=YuFc4Q7OOld6tX3v4HhG5lSToEJczQM9RlU2-pITSms,11099
@@ -71,14 +71,14 @@ pywebexec/static/jsonform/deps/ace/theme-github_light_default.js,sha256=4-_JXMA3
71
71
  pywebexec/static/jsonform/deps/ace/theme-twilight.js,sha256=3FCPUePtyW8RjnVAC51dgwKyNVpB7liV9AjEy4uEP8c,3474
72
72
  pywebexec/static/jsonform/deps/ace/worker-json.js,sha256=FalZfSbOglLQIOUYUprFqETrljooqsGwM5Tey7vhbxs,24390
73
73
  pywebexec/static/jsonform/deps/img/glyphicons-halflings.png,sha256=hpJM0AbbMLnU8UGOBs172D7vK-dooQ8n0s_ybml3zO0,13826
74
- pywebexec/static/jsonform/lib/jsonform.js,sha256=U-BvOgq5gCvSUo36qSAK7Y91RPKOq7vZShkIYpzwlkk,138525
74
+ pywebexec/static/jsonform/lib/jsonform.js,sha256=X1pR8KATWk2JOFcYABbHCDQpfgPlELKSq5sdGDgkd0Q,139254
75
75
  pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
76
  pywebexec/templates/index.html,sha256=sTytur1jHuEAMTvuNqMEB3i3NNFoJRbYQgfmvDrAuJQ,4286
77
77
  pywebexec/templates/popup.html,sha256=3kpMccKD_OLLhJ4Y9KRw6Ny8wQWjVaRrUfV9y5-bDiQ,1580
78
78
  pywebexec/templates/swagger_ui.html,sha256=MAPr-z96VERAecDvX37V8q2Nxph-O0fNDBul1x2w9SI,1147
79
- pywebexec-2.4.16.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
80
- pywebexec-2.4.16.dist-info/METADATA,sha256=9oLCGxXcASh0es8NV--NELsoNuVZewcHDzX5oKpSxwk,13016
81
- pywebexec-2.4.16.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
82
- pywebexec-2.4.16.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
83
- pywebexec-2.4.16.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
84
- pywebexec-2.4.16.dist-info/RECORD,,
79
+ pywebexec-2.4.18.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
80
+ pywebexec-2.4.18.dist-info/METADATA,sha256=XWDHCOENOpiWFxN2oXSKfjjnWNXFpMEPqGFYuP-k0F8,13016
81
+ pywebexec-2.4.18.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
82
+ pywebexec-2.4.18.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
83
+ pywebexec-2.4.18.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
84
+ pywebexec-2.4.18.dist-info/RECORD,,