pywebexec 2.1.14__py3-none-any.whl → 2.1.15__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.
pywebexec/pywebexec.py CHANGED
@@ -837,6 +837,7 @@ def run_dynamic_command(cmd):
837
837
  separator_params = exe.get("schema", {}).get("schema_options", {}).get("separator_params", {})
838
838
  noprefix = exe.get("schema", {}).get("schema_options", {}).get("noprefix_params", {})
839
839
  convert_params = exe.get("schema", {}).get("schema_options", {}).get("convert_params", {})
840
+ convert_values = exe.get("schema", {}).get("schema_options", {}).get("convert_values", {})
840
841
  schema_params = exe.get("schema", {}).get("properties", {})
841
842
  batch_param = exe.get("schema", {}).get("schema_options", {}).get("batch_param", None)
842
843
  batch_values = []
@@ -865,14 +866,17 @@ def run_dynamic_command(cmd):
865
866
  separator = ""
866
867
  else:
867
868
  prefix = f"--{param}"
868
- if isinstance(value, bool):
869
+ if isinstance(value, bool) and convert_params.get(param, None) is None:
869
870
  if value:
870
871
  params += f"{prefix} "
871
872
  continue
872
- if isinstance(value, dict):
873
+ if isinstance(value, dict) or convert_values.get(param, None) == "json":
873
874
  value = shlex.quote(json.dumps(value))
875
+ elif convert_values.get(param, None) == "quote":
876
+ value = shlex.quote(str(value))
877
+ else:
878
+ values = shlex.split(value) if isinstance(value, str) else value
874
879
  params += f"{prefix}{separator}"
875
- values = shlex.split(value) if isinstance(value, str) else value
876
880
  if param == batch_param and len(values)>1:
877
881
  batch_values = values
878
882
  value="@1"
@@ -196,9 +196,23 @@
196
196
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
197
197
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
198
198
  }
199
+ ._jsonform-array-deletelast {
200
+ display: none;
201
+ }
202
+ ._jsonform-array-buttons {
203
+ display: block;
204
+ width: 100%;
205
+ text-align: right;
206
+ }
207
+ i[title="Delete current"] {
208
+ top: 5px;
209
+ }
210
+ ._jsonform-array-addmore, ._jsonform-array-deletecurrent {
211
+ box-shadow: unset;
212
+ }
199
213
  }
200
214
 
201
215
  .swagger-ui textarea {
202
- min-height: 130px;
203
- overflow-y: hidden;
216
+ min-height: 130px;
217
+ overflow-y: hidden;
204
218
  }
@@ -13,7 +13,7 @@ function formInputHandle() {
13
13
  if (! inputHandlers.includes(input)) {
14
14
  val = input.value || input.placeholder;
15
15
  if (val) {
16
- size = Math.max(val.length - 2, 2)
16
+ size = Math.max(val.length, 2)
17
17
  if (input.type== 'number') {
18
18
  size += 2;
19
19
  }
@@ -27,16 +27,22 @@ function formInputHandle() {
27
27
  });
28
28
  }
29
29
 
30
- function extractKeysAndPlaceholders(obj, prefix = '') {
30
+ function extractKeysAndPlaceholders(obj, formoptions, prefix = '') {
31
31
  let result = [];
32
32
 
33
33
  for (let key in obj.properties) {
34
34
  if (obj.properties[key].type === 'object' && obj.properties[key].properties) {
35
- result = result.concat(extractKeysAndPlaceholders(obj.properties[key], prefix ? `${prefix}.${key}` : key));
35
+ result = result.concat(extractKeysAndPlaceholders(obj.properties[key], formoptions, prefix ? `${prefix}.${key}` : key));
36
36
  } else {
37
+ if (formoptions[`${prefix}.${key}`]) {
38
+ foptions = formoptions[`${prefix}.${key}`];
39
+ } else {
40
+ foptions = {};
41
+ }
37
42
  result.push({
38
43
  key: prefix ? `${prefix}.${key}` : key,
39
- placeholder: obj.properties[key].example || null
44
+ placeholder: obj.properties[key].example || null,
45
+ ... foptions
40
46
  });
41
47
  }
42
48
  }
@@ -44,11 +50,30 @@ function extractKeysAndPlaceholders(obj, prefix = '') {
44
50
  }
45
51
 
46
52
  function createSchemaForm(form, schema, onSubmit) {
47
- formDesc = extractKeysAndPlaceholders(schema);
53
+ if (schema && schema.schema_options) {
54
+ schema_options = schema.schema_options;
55
+ } else {
56
+ schema_options = {};
57
+ }
58
+ if (schema && schema.properties && schema.properties.params && schema.properties.params.schema_options) {
59
+ schema_params_options = schema.properties.params.schema_options;
60
+ } else {
61
+ schema_params_options = {};
62
+ }
63
+
64
+ formoptions = {};
65
+ if (schema_options && schema_options.form) {
66
+ formoptions = schema.schema_options.form;
67
+ } else if (schema_params_options && schema_params_options.form) {
68
+ for (let key in schema_params_options.form) {
69
+ formoptions[`params.${key}`] = schema_params_options.form[key];
70
+ }
71
+ }
72
+ formDesc = extractKeysAndPlaceholders(schema, formoptions);
48
73
  schemaForm = form[0];
49
74
  if (onSubmit != null) {
50
- if (schema && schema.schema_options && schema.schema_options.batch_param) {
51
- schema.properties[schema.schema_options.batch_param].required = true;
75
+ if (schema_options && schema_options.batch_param) {
76
+ schema.properties[schema_options.batch_param].required = true;
52
77
  if (!schema.properties.parallel) {
53
78
  schema.properties['parallel'] = {
54
79
  type: 'integer',
@@ -74,7 +99,7 @@ function createSchemaForm(form, schema, onSubmit) {
74
99
  });
75
100
  }
76
101
  for (i = 0; i < formDesc.length; i++) {
77
- if (formDesc[i].key == schema.schema_options.batch_param) {
102
+ if (formDesc[i].key == schema_options.batch_param) {
78
103
  formDesc[i].type = 'textarea';
79
104
  formDesc[i].required = true;
80
105
  }
@@ -93,10 +118,10 @@ function createSchemaForm(form, schema, onSubmit) {
93
118
  title: 'Run',
94
119
  });
95
120
  } else {
96
- if (schema && schema.properties && schema.properties.params.schema_options && schema.properties.params.schema_options.batch_param) {
97
- schema.properties.params.properties[schema.properties.params.schema_options.batch_param].required = true;
121
+ if (schema_params_options && schema_params_options.batch_param) {
122
+ schema.properties.params.properties[schema_params_options.batch_param].required = true;
98
123
  for (i = 0; i < formDesc.length; i++) {
99
- if (formDesc[i].key == 'params.' + schema.properties.params.schema_options.batch_param) {
124
+ if (formDesc[i].key == 'params.' + schema_params_options.batch_param) {
100
125
  formDesc[i].type = 'textarea';
101
126
  formDesc[i].required = true;
102
127
  }
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.14'
21
- __version_tuple__ = version_tuple = (2, 1, 14)
20
+ __version__ = version = '2.1.15'
21
+ __version_tuple__ = version_tuple = (2, 1, 15)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pywebexec
3
- Version: 2.1.14
3
+ Version: 2.1.15
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -1,9 +1,9 @@
1
1
  pywebexec/__init__.py,sha256=197fHJy0UDBwTTpGCGortZRr-w2kTaD7MxqdbVmTEi0,61
2
2
  pywebexec/host_ip.py,sha256=Ud_HTflWVQ8789aoQ2RZdT1wGI-ccvrwSWGz_c7T3TI,1241
3
- pywebexec/pywebexec.py,sha256=0k8ABFv9K5iTxBGcekH7OOEtskl2kXoiBP4Azlt35ZQ,45304
3
+ pywebexec/pywebexec.py,sha256=QIcwYwF8UPAh6juN_LpEHJnyNhZkBlqdbuGRhP1cvqw,45635
4
4
  pywebexec/swagger.yaml,sha256=zP_Nz69vZx0iwbKTwiQgSs8rJRUTiGKRyIkWzMPANOE,6688
5
- pywebexec/version.py,sha256=80wtCyj9QUrrEVvuEW7o-ILwCKz10sXaQFnSq4DOKBE,513
6
- pywebexec/static/css/form.css,sha256=FgeB8ihJE_RKVvN6s3vTnzs5O26DCYC9LX2xI-2Fx2g,4989
5
+ pywebexec/version.py,sha256=B5GTyfnCcU_OVejGvc44yPuiU01UHMzbmUciqEKsU_4,513
6
+ pywebexec/static/css/form.css,sha256=FvU2HkAn7jjJAsY4-Z0L7KaO46M46NKcuSJv8_4xIdA,5277
7
7
  pywebexec/static/css/markdown.css,sha256=3RzUnpVBdF6cQuB_NXV7hMTc0quYU8sfyuZcpsREj6A,1939
8
8
  pywebexec/static/css/style.css,sha256=ynccbEDzK07rurLm-UirUs5j_hVfXlIgaHeUIq9WvA0,9969
9
9
  pywebexec/static/css/swagger-ui.css,sha256=xhXN8fnUaIACGHuPIEIr9-qmyYr6Zx0k2wv4Qy7Bg1Y,154985
@@ -35,7 +35,7 @@ pywebexec/static/images/success.svg,sha256=NVwezvVMplt46ElW798vqGfrL21Mw_DWHUp_q
35
35
  pywebexec/static/images/swagger-ui.svg,sha256=FR0yeOVwe4zCYKZAjCGcT_m0Mf25NexIVaSXifIkoU0,2117
36
36
  pywebexec/static/js/executables.js,sha256=Hbcpv1IZfxC406qhwkwoTvJh8TZD7kEc651IXkQDYws,12077
37
37
  pywebexec/static/js/popup.js,sha256=0fr3pp4j9D2fXEVnHyQrx2bPWFHfgbb336dbewgH1d8,9023
38
- pywebexec/static/js/schemaform.js,sha256=z-gg5Zd_JMuKW_1QkS4329Wk_AFZTUvwjHm5Hh34eLo,5213
38
+ pywebexec/static/js/schemaform.js,sha256=RqFzI0rAoKke0FzArxBIupK5eR1-0GBMcEIuAkfz3Zs,5945
39
39
  pywebexec/static/js/script.js,sha256=-CfZRzjusxRCY7Kol_KNOq8BdRdHYTc5X3vXNChlsdQ,17631
40
40
  pywebexec/static/js/swagger-form.js,sha256=BU64XxyfrWx4DnpAuaWtG-9YpcHF3OzzAYzjiSH0NGo,3826
41
41
  pywebexec/static/js/js-yaml/LICENSE,sha256=oHvCRGi5ZUznalR9R6LbKC0HcztxXbTHOpi9Y5YflVA,1084
@@ -66,9 +66,9 @@ pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
66
66
  pywebexec/templates/index.html,sha256=KeNLBH9PN_ZuGhzwrjvRTj2oBtbINv_SbwGQpOahNWo,3820
67
67
  pywebexec/templates/popup.html,sha256=3kpMccKD_OLLhJ4Y9KRw6Ny8wQWjVaRrUfV9y5-bDiQ,1580
68
68
  pywebexec/templates/swagger_ui.html,sha256=9ngyldkyEdLonBjl97mbIZUlVk-jxwcHrvFzMSrveyU,1067
69
- pywebexec-2.1.14.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
70
- pywebexec-2.1.14.dist-info/METADATA,sha256=kEWuJ-81cVEq1ZFJO91pobbt8Kb921ByZ0qOLIs-ZsA,12811
71
- pywebexec-2.1.14.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
72
- pywebexec-2.1.14.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
73
- pywebexec-2.1.14.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
74
- pywebexec-2.1.14.dist-info/RECORD,,
69
+ pywebexec-2.1.15.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
70
+ pywebexec-2.1.15.dist-info/METADATA,sha256=iZVsPUPDkmF5fAn7hB_PpNtmOY_ZKCat_cROdcWqRzw,12811
71
+ pywebexec-2.1.15.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
72
+ pywebexec-2.1.15.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
73
+ pywebexec-2.1.15.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
74
+ pywebexec-2.1.15.dist-info/RECORD,,