From: Lucas Di Pentima Date: Fri, 2 Jul 2021 14:37:24 +0000 (-0300) Subject: 17782: Disabling typechecking for some common Field component usage. X-Git-Tag: 2.2.2~29^2~15 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/618af1a3106c399765788be4583463ab35d97cd5 17782: Disabling typechecking for some common Field component usage. I'm guessing the previous TS machinery didn't do checking either, and I wasn't able to come up with a solution yet, so to avoid scope creeping, I'm making the required changes to be able to move on and address this issues in a later time. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/components/popover/helpers.ts b/src/components/popover/helpers.ts index f2be98cf..ac860ac0 100644 --- a/src/components/popover/helpers.ts +++ b/src/components/popover/helpers.ts @@ -6,7 +6,10 @@ import { PopoverOrigin } from "@material-ui/core/Popover"; export const createAnchorAt = (position: {x: number, y: number}) => { const el = document.createElement('div'); - const clientRect = { + const clientRect: DOMRect = { + x: position.x, + y: position.y, + toJSON: () => '', left: position.x, right: position.x, top: position.y, diff --git a/src/components/text-field/text-field.tsx b/src/components/text-field/text-field.tsx index 09fa2dd8..78e2c7fb 100644 --- a/src/components/text-field/text-field.tsx +++ b/src/components/text-field/text-field.tsx @@ -13,7 +13,6 @@ import { PropTypes } from '@material-ui/core'; import RichTextEditor from 'react-rte'; -import Margin from 'PropTypes'; type CssRules = 'textField' | 'rte'; @@ -37,7 +36,7 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ type TextFieldProps = WrappedFieldProps & WithStyles; export const TextField = withStyles(styles)((props: TextFieldProps & { - label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode, margin?: Margin, placeholder?: string, + label?: string, autoFocus?: boolean, required?: boolean, select?: boolean, disabled?: boolean, children: React.ReactNode, margin?: PropTypes.Margin, placeholder?: string, helperText?: string, type?: string, }) => ; diff --git a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts index 8b9e008d..775930bd 100644 --- a/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts +++ b/src/store/collection-panel/collection-panel-files/collection-panel-files-reducer.ts @@ -72,7 +72,7 @@ export const collectionPanelFilesReducer = (state: CollectionPanelFilesState = c return mapTreeValues((v: CollectionPanelDirectory | CollectionPanelFile) => { if (v.type === CollectionFileType.DIRECTORY) { - return ({ + return ({ ...v, collapsed: searchValue.length === 0, }); @@ -83,10 +83,10 @@ export const collectionPanelFilesReducer = (state: CollectionPanelFilesState = c }, SELECT_ALL_COLLECTION_FILES: () => - mapTreeValues(v => ({ ...v, selected: true }))({ ...state }), + mapTreeValues((v: any) => ({ ...v, selected: true }))({ ...state }), UNSELECT_ALL_COLLECTION_FILES: () => - mapTreeValues(v => ({ ...v, selected: false }))({ ...state }), + mapTreeValues((v: any) => ({ ...v, selected: false }))({ ...state }), default: () => state }) as CollectionPanelFilesState; @@ -108,7 +108,7 @@ const toggleDescendants = (id: string) => (tree: CollectionPanelFilesState) => { if (node && node.value.type === CollectionFileType.DIRECTORY) { return getNodeDescendantsIds(id)(tree) .reduce((newTree, id) => - setNodeValueWith(v => ({ ...v, selected: node.value.selected }))(id)(newTree), tree); + setNodeValueWith((v: any) => ({ ...v, selected: node.value.selected }))(id)(newTree), tree); } return tree; }; @@ -126,7 +126,7 @@ const toggleParentNode = (id: string) => (tree: CollectionPanelFilesState) => { const selected = parentNode.children .map(id => getNode(id)(tree)) .every(node => node !== undefined && node.value.selected); - return setNodeValueWith(v => ({ ...v, selected }))(parentNode.id)(tree); + return setNodeValueWith((v: any) => ({ ...v, selected }))(parentNode.id)(tree); } return setNode(node)(tree); } diff --git a/src/views-components/dialog-copy/dialog-copy.tsx b/src/views-components/dialog-copy/dialog-copy.tsx index 97fe52bb..5605e6ca 100644 --- a/src/views-components/dialog-copy/dialog-copy.tsx +++ b/src/views-components/dialog-copy/dialog-copy.tsx @@ -28,7 +28,7 @@ const CopyDialogFields = memoize((pickerId: string) => & InjectedFormProps ; const UsersFieldValidation = [minLength(1, () => 'Select at least one user')]; diff --git a/src/views-components/dialog-forms/create-group-dialog.tsx b/src/views-components/dialog-forms/create-group-dialog.tsx index 601f8004..fceea262 100644 --- a/src/views-components/dialog-forms/create-group-dialog.tsx +++ b/src/views-components/dialog-forms/create-group-dialog.tsx @@ -42,7 +42,7 @@ const CreateGroupFormFields = () => const GroupNameField = () => ; @@ -52,7 +52,7 @@ const GROUP_NAME_VALIDATION = [require, maxLength(255)]; const UsersField = () => ; + component={UsersSelect as any} />; const UsersSelect = ({ fields }: WrappedFieldArrayProps) => ; @@ -61,7 +61,7 @@ const UserVirtualMachineField = ({ data }: VirtualMachinesProps) => Virtual Machine ; @@ -69,7 +69,7 @@ const UserVirtualMachineField = ({ data }: VirtualMachinesProps) => const UserGroupsVirtualMachineField = () => ; diff --git a/src/views-components/form-fields/collection-form-fields.tsx b/src/views-components/form-fields/collection-form-fields.tsx index 6c522b67..b882d684 100644 --- a/src/views-components/form-fields/collection-form-fields.tsx +++ b/src/views-components/form-fields/collection-form-fields.tsx @@ -29,7 +29,7 @@ export const CollectionNameField = connect( })((props: CollectionNameFieldProps) => @@ -38,7 +38,7 @@ export const CollectionNameField = connect( export const CollectionDescriptionField = () => ; diff --git a/src/views-components/form-fields/process-form-fields.tsx b/src/views-components/form-fields/process-form-fields.tsx index d70413f6..60a51b1a 100644 --- a/src/views-components/form-fields/process-form-fields.tsx +++ b/src/views-components/form-fields/process-form-fields.tsx @@ -10,13 +10,13 @@ import { PROCESS_NAME_VALIDATION, PROCESS_DESCRIPTION_VALIDATION } from "validat export const ProcessNameField = () => ; export const ProcessDescriptionField = () => ; diff --git a/src/views-components/form-fields/project-form-fields.tsx b/src/views-components/form-fields/project-form-fields.tsx index be762b51..34d7cef7 100644 --- a/src/views-components/form-fields/project-form-fields.tsx +++ b/src/views-components/form-fields/project-form-fields.tsx @@ -31,7 +31,7 @@ export const ProjectNameField = connect( })((props: ProjectNameFieldProps) => @@ -40,5 +40,5 @@ export const ProjectNameField = connect( export const ProjectDescriptionField = () => ; diff --git a/src/views-components/form-fields/repository-form-fields.tsx b/src/views-components/form-fields/repository-form-fields.tsx index ff35779c..8d2359e4 100644 --- a/src/views-components/form-fields/repository-form-fields.tsx +++ b/src/views-components/form-fields/repository-form-fields.tsx @@ -16,7 +16,7 @@ export const RepositoryNameField = (props: any) => diff --git a/src/views-components/form-fields/resource-form-fields.tsx b/src/views-components/form-fields/resource-form-fields.tsx index 7945552c..f2bb97f4 100644 --- a/src/views-components/form-fields/resource-form-fields.tsx +++ b/src/views-components/form-fields/resource-form-fields.tsx @@ -40,5 +40,5 @@ export const ResourceParentField = connect( return value; } } - component={TextField} /> + component={TextField as any} /> ); diff --git a/src/views-components/form-fields/search-bar-form-fields.tsx b/src/views-components/form-fields/search-bar-form-fields.tsx index 7a926168..777fa824 100644 --- a/src/views-components/form-fields/search-bar-form-fields.tsx +++ b/src/views-components/form-fields/search-bar-form-fields.tsx @@ -21,7 +21,7 @@ import { RootState } from "store/store"; export const SearchBarTypeField = () => ); @@ -80,17 +80,17 @@ export const SearchBarPastVersionsField = () => export const SearchBarDateFromField = () => ; + component={DateTextField as any} />; export const SearchBarDateToField = () => ; + component={DateTextField as any} />; export const SearchBarPropertiesField = () => ; + component={SearchBarAdvancedPropertiesView as any} />; export const SearchBarKeyField = () => ; @@ -107,5 +107,5 @@ export const SearchBarSaveSearchField = () => export const SearchBarQuerySearchField = () => ; diff --git a/src/views-components/form-fields/ssh-key-form-fields.tsx b/src/views-components/form-fields/ssh-key-form-fields.tsx index b2274000..21217258 100644 --- a/src/views-components/form-fields/ssh-key-form-fields.tsx +++ b/src/views-components/form-fields/ssh-key-form-fields.tsx @@ -10,7 +10,7 @@ import { SSH_KEY_PUBLIC_VALIDATION, SSH_KEY_NAME_VALIDATION } from "validators/v export const SshKeyPublicField = () => ; @@ -18,7 +18,7 @@ export const SshKeyPublicField = () => export const SshKeyNameField = () => ; diff --git a/src/views-components/form-fields/user-form-fields.tsx b/src/views-components/form-fields/user-form-fields.tsx index 54929b3e..393f29d3 100644 --- a/src/views-components/form-fields/user-form-fields.tsx +++ b/src/views-components/form-fields/user-form-fields.tsx @@ -13,7 +13,7 @@ import { VirtualMachinesResource } from "models/virtual-machines"; export const UserEmailField = () => ; @@ -23,7 +23,7 @@ export const UserVirtualMachineField = ({ data }: any) => Virtual Machine ; @@ -31,7 +31,7 @@ export const UserVirtualMachineField = ({ data }: any) => export const UserGroupsVirtualMachineField = () => ; 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 6cd7e0b8..b67697b5 100644 --- a/src/views-components/rename-file-dialog/rename-file-dialog.tsx +++ b/src/views-components/rename-file-dialog/rename-file-dialog.tsx @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import React from 'react'; -import { compose } from 'redux'; +import { compose, Dispatch } from 'redux'; import { reduxForm, InjectedFormProps, Field } from 'redux-form'; import { withDialog, WithDialogProps } from 'store/dialog/with-dialog'; import { FormDialog } from 'components/form-dialog/form-dialog'; @@ -18,7 +18,7 @@ export const RenameFileDialog = compose( reduxForm({ form: RENAME_FILE_DIALOG, touchOnChange: true, - onSubmit: (data: { path: string }, dispatch) => { + onSubmit: (data: { path: string }, dispatch: Dispatch) => { dispatch(renameFile(data.path)); } }) @@ -36,7 +36,7 @@ const RenameDialogFormFields = (props: WithDialogProps) => diff --git a/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx b/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx index be875f51..6c0b8d81 100644 --- a/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx +++ b/src/views-components/sharing-dialog/sharing-invitation-form-component.tsx @@ -21,7 +21,7 @@ export default () => const InvitedPeopleField = () => ; + component={InvitedPeopleFieldComponent as any} />; const InvitedPeopleFieldComponent = ({ fields }: WrappedFieldArrayProps) => diff --git a/src/views-components/sharing-dialog/sharing-management-form-component.tsx b/src/views-components/sharing-dialog/sharing-management-form-component.tsx index 40f49a95..9c3b6403 100644 --- a/src/views-components/sharing-dialog/sharing-management-form-component.tsx +++ b/src/views-components/sharing-dialog/sharing-management-form-component.tsx @@ -18,7 +18,7 @@ import { CloseIcon } from 'components/icon/icon'; export default () => - ; + ; const SharingManagementFieldArray = ({ fields }: WrappedFieldArrayProps<{ email: string }>) =>
@@ -44,7 +44,7 @@ const PermissionManagementRow = withStyles(permissionManagementRowStyles)( diff --git a/src/views/my-account-panel/my-account-panel-root.tsx b/src/views/my-account-panel/my-account-panel-root.tsx index 188525c8..02a8ba67 100644 --- a/src/views/my-account-panel/my-account-panel-root.tsx +++ b/src/views/my-account-panel/my-account-panel-root.tsx @@ -84,7 +84,7 @@ export const MyAccountPanelRoot = withStyles(styles)( @@ -92,7 +92,7 @@ export const MyAccountPanelRoot = withStyles(styles)( @@ -100,7 +100,7 @@ export const MyAccountPanelRoot = withStyles(styles)( @@ -108,7 +108,7 @@ export const MyAccountPanelRoot = withStyles(styles)( @@ -116,7 +116,7 @@ export const MyAccountPanelRoot = withStyles(styles)( @@ -125,7 +125,7 @@ export const MyAccountPanelRoot = withStyles(styles)( @@ -135,7 +135,7 @@ export const MyAccountPanelRoot = withStyles(styles)( @@ -143,7 +143,7 @@ export const MyAccountPanelRoot = withStyles(styles)( diff --git a/src/views/not-found-panel/not-found-panel.tsx b/src/views/not-found-panel/not-found-panel.tsx index d1fb3f99..18df092c 100644 --- a/src/views/not-found-panel/not-found-panel.tsx +++ b/src/views/not-found-panel/not-found-panel.tsx @@ -15,5 +15,5 @@ const mapStateToProps = (state: RootState): NotFoundPanelRootDataProps => { const mapDispatchToProps = null; -export const NotFoundPanel = connect(mapStateToProps, mapDispatchToProps) - (NotFoundPanelRoot); +export const NotFoundPanel = connect(mapStateToProps, mapDispatchToProps) + (NotFoundPanelRoot) as any; diff --git a/src/views/run-process-panel/inputs/directory-array-input.tsx b/src/views/run-process-panel/inputs/directory-array-input.tsx index ad5aceda..1b04718d 100644 --- a/src/views/run-process-panel/inputs/directory-array-input.tsx +++ b/src/views/run-process-panel/inputs/directory-array-input.tsx @@ -37,7 +37,7 @@ export const DirectoryArrayInput = ({ input }: DirectoryArrayInputProps) => ; @@ -194,7 +194,7 @@ const DirectoryArrayInputComponent = connect(mapStateToProps)( refreshDirectories = () => { clearTimeout(this.directoryRefreshTimeout); - this.directoryRefreshTimeout = setTimeout(this.setSelectedFiles); + this.directoryRefreshTimeout = window.setTimeout(this.setSelectedFiles); } setSelectedFiles = () => { diff --git a/src/views/run-process-panel/inputs/directory-input.tsx b/src/views/run-process-panel/inputs/directory-input.tsx index 36c14e53..ab1cf9d1 100644 --- a/src/views/run-process-panel/inputs/directory-input.tsx +++ b/src/views/run-process-panel/inputs/directory-input.tsx @@ -30,7 +30,7 @@ export const DirectoryInput = ({ input, options }: DirectoryInputProps) => ; @@ -174,7 +174,7 @@ const FileArrayInputComponent = connect(mapStateToProps)( refreshFiles = () => { clearTimeout(this.fileRefreshTimeout); - this.fileRefreshTimeout = setTimeout(this.setSelectedFiles); + this.fileRefreshTimeout = window.setTimeout(this.setSelectedFiles); } setSelectedFiles = () => { diff --git a/src/views/run-process-panel/inputs/file-input.tsx b/src/views/run-process-panel/inputs/file-input.tsx index a1e0b911..c2e17c95 100644 --- a/src/views/run-process-panel/inputs/file-input.tsx +++ b/src/views/run-process-panel/inputs/file-input.tsx @@ -29,7 +29,7 @@ export const FileInput = ({ input, options }: FileInputProps) => diff --git a/src/views/run-process-panel/run-process-basic-form.tsx b/src/views/run-process-panel/run-process-basic-form.tsx index 3608c1b0..13d882ba 100644 --- a/src/views/run-process-panel/run-process-basic-form.tsx +++ b/src/views/run-process-panel/run-process-basic-form.tsx @@ -23,7 +23,7 @@ export const RunProcessBasicForm = @@ -31,7 +31,7 @@ export const RunProcessBasicForm = diff --git a/src/views/site-manager-panel/site-manager-panel-root.tsx b/src/views/site-manager-panel/site-manager-panel-root.tsx index 45f0a116..246bc875 100644 --- a/src/views/site-manager-panel/site-manager-panel-root.tsx +++ b/src/views/site-manager-panel/site-manager-panel-root.tsx @@ -187,7 +187,7 @@ export const SiteManagerPanelRoot = compose(