pywebexec 2.4.27__py3-none-any.whl → 2.4.28__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/static/js/schemaform.js +37 -15
- pywebexec/static/jsonform/lib/jsonform.js +1 -1
- pywebexec/version.py +2 -2
- {pywebexec-2.4.27.dist-info → pywebexec-2.4.28.dist-info}/METADATA +1 -1
- {pywebexec-2.4.27.dist-info → pywebexec-2.4.28.dist-info}/RECORD +9 -9
- {pywebexec-2.4.27.dist-info → pywebexec-2.4.28.dist-info}/WHEEL +0 -0
- {pywebexec-2.4.27.dist-info → pywebexec-2.4.28.dist-info}/entry_points.txt +0 -0
- {pywebexec-2.4.27.dist-info → pywebexec-2.4.28.dist-info}/licenses/LICENSE +0 -0
- {pywebexec-2.4.27.dist-info → pywebexec-2.4.28.dist-info}/top_level.txt +0 -0
@@ -60,25 +60,28 @@ function extractKeys(obj, formkeys, formoptions, prefix = '') {
|
|
60
60
|
return result;
|
61
61
|
}
|
62
62
|
|
63
|
+
// Helper function to get schema and check for properties
|
64
|
+
function getSchemaForKey(schema, keyPath) {
|
65
|
+
const keys = keyPath.split('.');
|
66
|
+
let current = schema.properties;
|
67
|
+
for (const key of keys) {
|
68
|
+
if (current.properties) {
|
69
|
+
current = current.properties;
|
70
|
+
}
|
71
|
+
if (!current || !current[key]) return null;
|
72
|
+
current = current[key];
|
73
|
+
}
|
74
|
+
return current;
|
75
|
+
}
|
63
76
|
|
64
77
|
// Convert objects to JSON strings where schema type is object without properties
|
65
78
|
function convertObjectsToJsonStrings(obj, schema, prefix = '') {
|
66
|
-
// Helper function to get schema type and check for properties
|
67
|
-
function getSchemaTypeForKey(schema, keyPath) {
|
68
|
-
const keys = keyPath.split('.');
|
69
|
-
let current = schema.properties;
|
70
|
-
for (const key of keys) {
|
71
|
-
if (!current || !current[key]) return null;
|
72
|
-
current = current[key];
|
73
|
-
}
|
74
|
-
return current;
|
75
|
-
}
|
76
79
|
|
77
80
|
for (const key in obj) {
|
78
81
|
const keyPath = prefix ? `${prefix}.${key}` : key;
|
79
|
-
const
|
82
|
+
const schemaKey = getSchemaForKey(schema, keyPath);
|
80
83
|
|
81
|
-
if (
|
84
|
+
if (schemaKey && schemaKey.type === 'object' && !schemaKey.properties) {
|
82
85
|
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
83
86
|
obj[key] = JSON.stringify(obj[key], null, 2);
|
84
87
|
}
|
@@ -148,11 +151,31 @@ function expandFieldset(fieldsetClass) {
|
|
148
151
|
schemaForm.querySelector(`fieldset.${fieldsetClass} > div`).style.display = 'inline-flex';
|
149
152
|
}
|
150
153
|
|
151
|
-
function
|
154
|
+
function setNestedValue(obj, keyPath, value) {
|
155
|
+
const keys = keyPath.split('.');
|
156
|
+
let current = obj;
|
157
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
158
|
+
if (current[keys[i]] === undefined) {
|
159
|
+
current[keys[i]] = {};
|
160
|
+
}
|
161
|
+
current = current[keys[i]];
|
162
|
+
}
|
163
|
+
current[keys[keys.length - 1]] = value;
|
164
|
+
}
|
165
|
+
|
166
|
+
function orderCheckboxes(schema) {
|
167
|
+
let use_default = false;
|
168
|
+
if (! value) {
|
169
|
+
value = {};
|
170
|
+
use_default = true;
|
171
|
+
}
|
152
172
|
schemaForm.querySelectorAll('.checkboxes > ul').forEach(checkboxes => {
|
153
173
|
const key = checkboxes.getAttribute('name');
|
154
174
|
const cboxes = checkboxes
|
155
175
|
const matchingElements = [];
|
176
|
+
if (use_default) {
|
177
|
+
setNestedValue(value, key, getSchemaForKey(schema, key).default);
|
178
|
+
}
|
156
179
|
if (! value || ! value[key] || !value[key].length) {
|
157
180
|
return;
|
158
181
|
}
|
@@ -441,8 +464,7 @@ function createSchemaForm($form, schema, onSubmit, schemaName) {
|
|
441
464
|
err.classList.add('alert');
|
442
465
|
err.style.display = 'none';
|
443
466
|
schemaForm.appendChild(err);
|
444
|
-
|
445
|
-
orderCheckboxes();
|
467
|
+
orderCheckboxes(schema);
|
446
468
|
validateSchemaForm(schemaForm, formDesc, schema, jsform.root.getFormValues(), schemaName);
|
447
469
|
schemaForm.querySelectorAll('textarea').forEach(txt => {
|
448
470
|
txt.style.height = "0";
|
@@ -2479,7 +2479,7 @@ formNode.prototype.computeInitialValues = function (values, ignoreDefaultValues)
|
|
2479
2479
|
// be a complex structure that needs to be pushed down the subtree.
|
2480
2480
|
// The easiest way is probably to generate a "values" object and
|
2481
2481
|
// compute initial values from that object
|
2482
|
-
// fjo start:
|
2482
|
+
// fjo start: add default values
|
2483
2483
|
else if (this.schemaElement['default']) {
|
2484
2484
|
values = {};
|
2485
2485
|
setNestedValue(values, this.key, this.schemaElement['default']);
|
pywebexec/version.py
CHANGED
@@ -2,7 +2,7 @@ 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=
|
5
|
+
pywebexec/version.py,sha256=bbq2FSCzcXGxzgbq3wH_4_DBJn7-tef7JTibaKvxIJg,513
|
6
6
|
pywebexec/static/css/form.css,sha256=7N8-xP58JF6EM9ekDzkYBisTDWbZqe8Fyhhk5vt0jc0,9062
|
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
|
@@ -36,7 +36,7 @@ pywebexec/static/images/swagger-ui.svg,sha256=FR0yeOVwe4zCYKZAjCGcT_m0Mf25NexIVa
|
|
36
36
|
pywebexec/static/js/exceljs.min.js,sha256=fknaaFiOJQ27i7oZDSyqirN4fMAoS9odiy-AXE33Qsk,947702
|
37
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=
|
39
|
+
pywebexec/static/js/schemaform.js,sha256=xPm7acOHS09zb_GBkiltWGpj1XPpuOiDGRRRXP00FPY,17101
|
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=
|
74
|
+
pywebexec/static/jsonform/lib/jsonform.js,sha256=JBkMyBV8slZA4pdV5rYxX0KpydVfEMN_oxVNCwn9ux0,140386
|
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=O7p8rsXUNo3PN5LttXfQudwUKUvBPSbXoVVU9ANJ9vM,1321
|
79
|
-
pywebexec-2.4.
|
80
|
-
pywebexec-2.4.
|
81
|
-
pywebexec-2.4.
|
82
|
-
pywebexec-2.4.
|
83
|
-
pywebexec-2.4.
|
84
|
-
pywebexec-2.4.
|
79
|
+
pywebexec-2.4.28.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
|
80
|
+
pywebexec-2.4.28.dist-info/METADATA,sha256=14szX7vfy4pbjv0knpIOk0eVQYq47J11ejVM_vWJL3c,13016
|
81
|
+
pywebexec-2.4.28.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
82
|
+
pywebexec-2.4.28.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
|
83
|
+
pywebexec-2.4.28.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
|
84
|
+
pywebexec-2.4.28.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|