pywebexec 2.2.6__py3-none-any.whl → 2.2.8__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/css/form.css +11 -0
- pywebexec/static/js/executables.js +7 -5
- pywebexec/static/js/schemaform.js +26 -11
- pywebexec/templates/swagger_ui.html +1 -0
- pywebexec/version.py +2 -2
- {pywebexec-2.2.6.dist-info → pywebexec-2.2.8.dist-info}/METADATA +1 -1
- {pywebexec-2.2.6.dist-info → pywebexec-2.2.8.dist-info}/RECORD +11 -11
- {pywebexec-2.2.6.dist-info → pywebexec-2.2.8.dist-info}/WHEEL +0 -0
- {pywebexec-2.2.6.dist-info → pywebexec-2.2.8.dist-info}/entry_points.txt +0 -0
- {pywebexec-2.2.6.dist-info → pywebexec-2.2.8.dist-info}/licenses/LICENSE +0 -0
- {pywebexec-2.2.6.dist-info → pywebexec-2.2.8.dist-info}/top_level.txt +0 -0
pywebexec/static/css/form.css
CHANGED
@@ -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
|
-
|
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
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
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
|
-
|
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>
|
pywebexec/version.py
CHANGED
@@ -2,8 +2,8 @@ pywebexec/__init__.py,sha256=197fHJy0UDBwTTpGCGortZRr-w2kTaD7MxqdbVmTEi0,61
|
|
2
2
|
pywebexec/host_ip.py,sha256=Ud_HTflWVQ8789aoQ2RZdT1wGI-ccvrwSWGz_c7T3TI,1241
|
3
3
|
pywebexec/pywebexec.py,sha256=R-jp9BiUMJZW7m9N9kQC6dpIueUgFVDo4n9_GFb1rOs,45734
|
4
4
|
pywebexec/swagger.yaml,sha256=I_oLpp7Hqel8SDEEykvpmCT-Gv3ytGlziq9bvQOrtZY,7598
|
5
|
-
pywebexec/version.py,sha256=
|
6
|
-
pywebexec/static/css/form.css,sha256=
|
5
|
+
pywebexec/version.py,sha256=IzlbUXKZ3t6SO6-P3X0oVBlXDGkJ-oDKEhIOPY9IVKQ,511
|
6
|
+
pywebexec/static/css/form.css,sha256=XC_0ES5yMHYz0S2OHR0RAboQN7fBUmg5ZIq8Qm5rHP0,5806
|
7
7
|
pywebexec/static/css/markdown.css,sha256=br4-iK9wigTs54N2KHtjgZ4KLH0THVSvJo-XZAdMHiE,1970
|
8
8
|
pywebexec/static/css/style.css,sha256=R1VOPNV2ztROKy9Fgf3tvUrtuKagY027tFJ8C866yWU,9991
|
9
9
|
pywebexec/static/css/swagger-ui.css,sha256=xhXN8fnUaIACGHuPIEIr9-qmyYr6Zx0k2wv4Qy7Bg1Y,154985
|
@@ -33,9 +33,9 @@ pywebexec/static/images/resume.svg,sha256=99LP1Ya2JXakRCO9kW8JMuT_4a_CannF65Eiuw
|
|
33
33
|
pywebexec/static/images/running.svg,sha256=fBCYwYb2O9K4N3waC2nURP25NRwZlqR4PbDZy6JQMww,610
|
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
|
-
pywebexec/static/js/executables.js,sha256=
|
36
|
+
pywebexec/static/js/executables.js,sha256=jB4QqWi4Qeq1uJflTSqqjsZy-ec9iy5ZmFvfNWMzXq4,11913
|
37
37
|
pywebexec/static/js/popup.js,sha256=O3DEWnyb5yGW9tjODYycc-ujWndyAfnJMxulaQeogtc,9700
|
38
|
-
pywebexec/static/js/schemaform.js,sha256=
|
38
|
+
pywebexec/static/js/schemaform.js,sha256=VEI6itnu9SKltIpfnCDDQKYglsAa8z1xvUP0FpSGe3E,9602
|
39
39
|
pywebexec/static/js/script.js,sha256=yQP2dWwTObWbg6ROeKFxwYi1NfDd2gxEn2e3oL-FWL8,18379
|
40
40
|
pywebexec/static/js/swagger-form.js,sha256=CLcSHMhk5P4-_2MIRBoJLgEnIj_9keDDSzUugXHZjio,4565
|
41
41
|
pywebexec/static/js/js-yaml/LICENSE,sha256=oHvCRGi5ZUznalR9R6LbKC0HcztxXbTHOpi9Y5YflVA,1084
|
@@ -66,10 +66,10 @@ pywebexec/static/jsonform/lib/jsonform.js,sha256=U-BvOgq5gCvSUo36qSAK7Y91RPKOq7v
|
|
66
66
|
pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
67
67
|
pywebexec/templates/index.html,sha256=w18O2plH_yS8bqlPsu5hwFFmCj9H2hWLSV8B6ADcSwU,3900
|
68
68
|
pywebexec/templates/popup.html,sha256=3kpMccKD_OLLhJ4Y9KRw6Ny8wQWjVaRrUfV9y5-bDiQ,1580
|
69
|
-
pywebexec/templates/swagger_ui.html,sha256=
|
70
|
-
pywebexec-2.2.
|
71
|
-
pywebexec-2.2.
|
72
|
-
pywebexec-2.2.
|
73
|
-
pywebexec-2.2.
|
74
|
-
pywebexec-2.2.
|
75
|
-
pywebexec-2.2.
|
69
|
+
pywebexec/templates/swagger_ui.html,sha256=MAPr-z96VERAecDvX37V8q2Nxph-O0fNDBul1x2w9SI,1147
|
70
|
+
pywebexec-2.2.8.dist-info/licenses/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
|
71
|
+
pywebexec-2.2.8.dist-info/METADATA,sha256=Dr-b4gxKWPpV0us8pkVqOdFsitPKbGHMFQcZYgzkSYA,12832
|
72
|
+
pywebexec-2.2.8.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
73
|
+
pywebexec-2.2.8.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
|
74
|
+
pywebexec-2.2.8.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
|
75
|
+
pywebexec-2.2.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|