[ARVADOS-WORKBENCH2] updated: 2.1.0-64-g4745e251
Git user
git at public.arvados.org
Thu Nov 12 19:15:52 UTC 2020
Summary of changes:
cypress/integration/collection-panel.spec.js | 26 ++++------------------
src/validators/valid-name.tsx | 2 +-
.../dialog-forms/update-collection-dialog.ts | 1 +
.../rename-file-dialog/rename-file-dialog.tsx | 1 +
4 files changed, 7 insertions(+), 23 deletions(-)
via 4745e25131346a4521884773be1ce11a349c3263 (commit)
via b7b20fb214acc7e756360a081bb801afe16af775 (commit)
from 1b9616cd4d120cdc473e457637287502fff531b8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 4745e25131346a4521884773be1ce11a349c3263
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Thu Nov 12 16:14:07 2020 -0300
15685: Adds validations to file names to avoid '.' and '..'
Although the backend already does validations, this will provide a better UX
because of the immediate feedback and better error message.
Also, adjusted tests.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/cypress/integration/collection-panel.spec.js b/cypress/integration/collection-panel.spec.js
index c20c8ca8..63a25a25 100644
--- a/cypress/integration/collection-panel.spec.js
+++ b/cypress/integration/collection-panel.spec.js
@@ -142,7 +142,8 @@ describe('Collection panel tests', function() {
['bar', '&'],
['&', 'foo'],
['foo', '&'],
- ['&', 'I ❤️ ⛵️']
+ ['&', 'I ❤️ ⛵️'],
+ ['I ❤️ ⛵️', '...']
];
nameTransitions.forEach(([from, to]) => {
cy.get('[data-cy=collection-files-panel]')
@@ -220,27 +221,9 @@ describe('Collection panel tests', function() {
.as('testCollection').then(function() {
cy.loginAs(activeUser);
cy.visit(`/collections/${this.testCollection.uuid}`);
- const illegalNamesFromBackend = ['.', '..'];
- illegalNamesFromBackend.forEach((name) => {
- cy.get('[data-cy=collection-files-panel]')
- .contains('bar').rightclick();
- cy.get('[data-cy=context-menu]')
- .contains('Rename')
- .click();
- cy.get('[data-cy=form-dialog]')
- .should('contain', 'Rename')
- .within(() => {
- cy.get('input').type(`{selectall}{backspace}${name}`);
- });
- cy.get('[data-cy=form-submit-btn]').click();
- cy.get('[data-cy=form-dialog]')
- .should('contain', 'Rename')
- .within(() => {
- cy.contains('Could not rename');
- });
- cy.get('[data-cy=form-cancel-btn]').click();
- });
const illegalNamesFromUI = [
+ ['.', "Name cannot be '.' or '..'"],
+ ['..', "Name cannot be '.' or '..'"],
['', 'This field is required'],
[' ', 'Leading/trailing whitespaces not allowed'],
[' foo', 'Leading/trailing whitespaces not allowed'],
@@ -258,7 +241,6 @@ describe('Collection panel tests', function() {
.within(() => {
cy.get('input').type(`{selectall}{backspace}${name}`);
});
- cy.get('[data-cy=form-cancel-btn]').focus();
cy.get('[data-cy=form-dialog]')
.should('contain', 'Rename')
.within(() => {
diff --git a/src/validators/valid-name.tsx b/src/validators/valid-name.tsx
index c3650542..89bb3f96 100644
--- a/src/validators/valid-name.tsx
+++ b/src/validators/valid-name.tsx
@@ -31,7 +31,7 @@ export const validFileName = (value: string) => {
export const validFilePath = (filePath: string) => {
const errors = filePath.split('/').map(pathPart => {
if (pathPart === "") { return "Empty dir name not allowed"; }
- return validFileName(pathPart);
+ return validNameAllowSlash(pathPart) || validFileName(pathPart);
});
return errors.filter(e => e !== undefined)[0];
};
\ No newline at end of file
commit b7b20fb214acc7e756360a081bb801afe16af775
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Thu Nov 12 16:11:54 2020 -0300
15685: Sets dialog forms to get immediate validation feedback.
Surprinsingly, this setting is off by default:
https://redux-form.com/7.4.2/docs/api/reduxform.md/#-code-touchonchange-boolean-code-optional-
...so validations only happened after the first field blur event.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/views-components/dialog-forms/update-collection-dialog.ts b/src/views-components/dialog-forms/update-collection-dialog.ts
index cfa52639..021a335b 100644
--- a/src/views-components/dialog-forms/update-collection-dialog.ts
+++ b/src/views-components/dialog-forms/update-collection-dialog.ts
@@ -12,6 +12,7 @@ import { updateCollection } from "~/store/workbench/workbench-actions";
export const UpdateCollectionDialog = compose(
withDialog(COLLECTION_UPDATE_FORM_NAME),
reduxForm<CollectionUpdateFormDialogData>({
+ touchOnChange: true,
form: COLLECTION_UPDATE_FORM_NAME,
onSubmit: (data, dispatch) => {
dispatch(updateCollection(data));
diff --git a/src/views-components/rename-file-dialog/rename-file-dialog.tsx b/src/views-components/rename-file-dialog/rename-file-dialog.tsx
index 9fbf6c9c..98147acc 100644
--- a/src/views-components/rename-file-dialog/rename-file-dialog.tsx
+++ b/src/views-components/rename-file-dialog/rename-file-dialog.tsx
@@ -17,6 +17,7 @@ export const RenameFileDialog = compose(
withDialog(RENAME_FILE_DIALOG),
reduxForm({
form: RENAME_FILE_DIALOG,
+ touchOnChange: true,
onSubmit: (data: { path: string }, dispatch) => {
dispatch<any>(renameFile(data.path));
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list