diff --git a/Makefile b/Makefile index 8efea1c24..931d760de 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ COCKPIT_REPO_FILES = \ $(NULL) COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git -COCKPIT_REPO_COMMIT = 5ec1a3ad4c1b544c9935b680333b07d54f42661e # 304 + 29 commits +COCKPIT_REPO_COMMIT = 0e6ff0dd3d0d48466219b3d683dacb9d5272d4ac # 304 + FileAutoComplete error callback feature $(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP) COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}' diff --git a/src/ImageRunModal.jsx b/src/ImageRunModal.jsx index 37634c537..1d3d5c047 100644 --- a/src/ImageRunModal.jsx +++ b/src/ImageRunModal.jsx @@ -624,8 +624,8 @@ export class ImageRunModal extends React.Component { validationFailed.publish = publishValidation; const volumesValidation = volumes.map(a => { + // We can't validate hostPath as that happens via an error callback. return { - hostPath: validateVolume(a.hostPath, "hostPath"), containerPath: validateVolume(a.containerPath, "containerPath"), }; }); diff --git a/src/Volume.jsx b/src/Volume.jsx index 988ea422a..8427d7815 100644 --- a/src/Volume.jsx +++ b/src/Volume.jsx @@ -17,6 +17,8 @@ const _ = cockpit.gettext; export function validateVolume(value, key) { switch (key) { case "hostPath": + if (value) + return value; break; case "containerPath": if (!value) @@ -38,9 +40,9 @@ export const Volume = ({ id, item, onChange, idx, removeitem, additem, options, > { + onChange={(value, error) => { utils.validationClear(validationFailed, "hostPath", onValidationChange); - utils.validationDebounce(() => onValidationChange({ ...validationFailed, hostPath: validateVolume(value, "hostPath") })); + utils.validationDebounce(() => onValidationChange({ ...validationFailed, hostPath: validateVolume(error, "hostPath") })); onChange(idx, 'hostPath', value); }} /> diff --git a/test/check-application b/test/check-application index e863ddc07..f4420e7dd 100755 --- a/test/check-application +++ b/test/check-application @@ -2321,6 +2321,8 @@ class TestApplication(testlib.MachineCase): b.click('.volume-form .btn-add') b.set_input_text("#run-image-dialog-volume-0-container-path-group input", "/somepath") validateField("#run-image-dialog-volume-0-container-path-group", "", "not be empty", resetValue="/somepath") + validateField("#run-image-dialog-volume-0-host-path-group", "/non-existant/", "No such file or directory", + resetValue="") # Test validation of environment variables b.click('.env-form .btn-add')