pywebexec 2.4.15__py3-none-any.whl → 2.4.17__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,30 @@ 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
+ for (let val = 0; val < value[key].length; val++) {
157
+ for (let i = 0; i < cboxes.children.length; i++) {
158
+ if (cboxes.children[i].querySelector('label').innerText === value.scope[val]) {
159
+ matchingElements.push(cboxes.children[i]);
160
+ break;
161
+ }
162
+ }
163
+ }
164
+ // Append matching elements to the top in the order of value.scope
165
+ matchingElements.reverse().forEach(element => {
166
+ cboxes.insertBefore(element, cboxes.firstChild);
167
+ });
168
+ });
169
+ }
170
+
152
171
  function createSchemaForm($form, schema, onSubmit, schemaName) {
172
+ if (!schemaName in savedValues) {
173
+ savedValues[schemaName] = {};
174
+ }
153
175
  schema_options = undefined;
154
176
  schema_params_options = undefined;
155
177
  if (schema && schema.schema_options) {
@@ -176,7 +198,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
176
198
  if(schema.properties['savedValues']) {
177
199
  delete schema.properties['savedValues'];
178
200
  }
179
- formDesc = extractKeysAndPlaceholders(schema, formkeys, formoptions);
201
+ formDesc = extractKeys(schema, formkeys, formoptions);
180
202
  schema.properties["savedValues"] = {
181
203
  type: "string",
182
204
  title: " ",
@@ -221,7 +243,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
221
243
  schemaForm = $form[0];
222
244
  if (onSubmit != null) {
223
245
  if (schema_options && schema_options.formext) {
224
- formDesc = schema.schema_options.formext;
246
+ formDesc = [...schema.schema_options.formext];
225
247
  }
226
248
  if (schema_options && schema_options.batch_param) {
227
249
  schema.properties[schema_options.batch_param].required = true;
@@ -390,6 +412,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
390
412
  });
391
413
  }
392
414
  }
415
+ //console.log('formDesc', formDesc);
393
416
  // schemaForm.classList.add('form-inline');
394
417
  jsform = $form.jsonForm({
395
418
  schema: schema,
@@ -415,6 +438,8 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
415
438
  err.classList.add('alert');
416
439
  err.style.display = 'none';
417
440
  schemaForm.appendChild(err);
441
+ cboxes = schemaForm.querySelector('.checkboxes > ul');
442
+ orderCheckboxes();
418
443
  validateSchemaForm(schemaForm, formDesc, schema, jsform.root.getFormValues(), schemaName);
419
444
  schemaForm.querySelectorAll('textarea').forEach(txt => {
420
445
  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': {
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.15'
21
- __version_tuple__ = version_tuple = (2, 4, 15)
20
+ __version__ = version = '2.4.17'
21
+ __version_tuple__ = version_tuple = (2, 4, 17)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pywebexec
3
- Version: 2.4.15
3
+ Version: 2.4.17
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=bNRwzWjTQeWYwJhJDnKwLi3zx6axfgURc0QG62sU-5U,513
6
- pywebexec/static/css/form.css,sha256=DhglYtCU-2UHrh-MSV3CAYLnskWQpkEQtAHjHF1vM_o,8346
5
+ pywebexec/version.py,sha256=NuuJoBUDNLbQ3TqjX2FP0dsQj2d3zB5fCySaVzBl2pg,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=VXM9QZj1oEC9ORlLDZ8E4zYNXO3Wlyb876Yr1As4mzw,15641
39
+ pywebexec/static/js/schemaform.js,sha256=Jgprc3TtYfBtGZyIiRJ3JUfP0ZNPeX82dSZgXos_YPc,16429
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=nd6l7zaqTArj167CPaemTV9xOufOYuuIEq6Ex0bq5J8,139118
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.15.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
80
- pywebexec-2.4.15.dist-info/METADATA,sha256=MCmOsulBBqec2NmCAnL1swSNWh6qK9LbI79Ovd0h8fI,13016
81
- pywebexec-2.4.15.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
82
- pywebexec-2.4.15.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
83
- pywebexec-2.4.15.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
84
- pywebexec-2.4.15.dist-info/RECORD,,
79
+ pywebexec-2.4.17.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
80
+ pywebexec-2.4.17.dist-info/METADATA,sha256=AsTMI0GIp0rf30hiNB40qTMWtgv1tnCJFyqa6AfmqYY,13016
81
+ pywebexec-2.4.17.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
82
+ pywebexec-2.4.17.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
83
+ pywebexec-2.4.17.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
84
+ pywebexec-2.4.17.dist-info/RECORD,,