Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand Down
2 changes: 1 addition & 1 deletion src/ImageRunModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
};
});
Expand Down
6 changes: 4 additions & 2 deletions src/Volume.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -38,9 +40,9 @@ export const Volume = ({ id, item, onChange, idx, removeitem, additem, options,
>
<FileAutoComplete id={id + "-host-path"}
value={item.hostPath || ''}
onChange={value => {
onChange={(value, error) => {
utils.validationClear(validationFailed, "hostPath", onValidationChange);
utils.validationDebounce(() => onValidationChange({ ...validationFailed, hostPath: validateVolume(value, "hostPath") }));
utils.validationDebounce(() => onValidationChange({ ...validationFailed, hostPath: validateVolume(error, "hostPath") }));
Comment thread
martinpitt marked this conversation as resolved.
onChange(idx, 'hostPath', value);
}} />
<FormHelper helperTextInvalid={validationFailed?.hostPath} />
Expand Down
2 changes: 2 additions & 0 deletions test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down