From: Lucas Di Pentima Date: Fri, 2 Jul 2021 14:48:12 +0000 (-0300) Subject: 17782: Additional imports and typing fixes. X-Git-Tag: 2.2.2~29^2~17 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/c56b5c0f2df66fbb23b278c2a3338c09d9435735 17782: Additional imports and typing fixes. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/package.json b/package.json index 2d64e21e..37392cf8 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "elliptic": "6.5.4", "file-saver": "2.0.1", "fstream": "1.0.12", - "is-image": "2.0.0", + "is-image": "3.0.0", "js-yaml": "3.13.1", "jssha": "2.3.1", "jszip": "3.1.5", @@ -89,6 +89,7 @@ "@types/classnames": "2.2.6", "@types/enzyme": "3.1.14", "@types/enzyme-adapter-react-16": "1.0.3", + "@types/is-image": "3.0.0", "@types/jest": "26.0.23", "@types/node": "15.12.4", "@types/react-dom": "17.0.8", @@ -119,11 +120,7 @@ "**/meow/trim-newlines": "^3.0.1", "react-rte/**/ua-parser-js": "0.7.24", "**/@typescript-eslint/eslint-plugin": "^4.1.1", - "**/@typescript-eslint/parser": "^4.1.1", - "webpack-dev-server/http-proxy-middleware/http-proxy": "^1.18.1", - "webpack-dev-server/selfsigned/node-forge": "0.10.0", - "webpack/node-libs-browser/crypto-browserify/*/elliptic": "6.5.4", - "webpack/terser-webpack-plugin/serialize-javascript": "^3.1.0" + "**/@typescript-eslint/parser": "^4.1.1" }, "browserslist": { "production": [ diff --git a/src/store/store.ts b/src/store/store.ts index 0cacc88f..d0f1af87 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -73,10 +73,15 @@ import { Config } from 'common/config'; import { pluginConfig } from 'plugins'; import { MiddlewareListReducer } from 'common/plugintypes'; +declare global { + interface Window { + __REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose; + } +} + const composeEnhancers = (process.env.NODE_ENV === 'development' && - window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ && - window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ trace: true, traceLimit: 25 })) || + window && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose; export type RootState = ReturnType>; diff --git a/src/views-components/auto-logout/auto-logout.tsx b/src/views-components/auto-logout/auto-logout.tsx index c6c1feee..9a8299b2 100644 --- a/src/views-components/auto-logout/auto-logout.tsx +++ b/src/views-components/auto-logout/auto-logout.tsx @@ -40,7 +40,7 @@ const mapDispatchToProps = (dispatch: Dispatch): AutoLogoutActionProps => ({ export type AutoLogoutProps = AutoLogoutDataProps & AutoLogoutActionProps; const debounce = (delay: number | undefined, fn: Function) => { - let timerId: number | null; + let timerId: NodeJS.Timer | null; return (...args: any[]) => { if (timerId) { clearTimeout(timerId); } timerId = setTimeout(() => { diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index a8f375ae..dccd2786 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -477,9 +477,9 @@ export const ResponsiblePerson = compose( connect( (state: RootState, props: { uuid: string, parentRef: HTMLElement | null }) => { - let responsiblePersonName = null; - let responsiblePersonUUID = null; - let responsiblePersonProperty = null; + let responsiblePersonName: string = ''; + let responsiblePersonUUID: string = ''; + let responsiblePersonProperty: string = ''; if (state.auth.config.clusterConfig.Collections.ManagedProperties) { let index = 0; diff --git a/src/views-components/project-properties-dialog/project-properties-form.tsx b/src/views-components/project-properties-dialog/project-properties-form.tsx index 09c847c3..f36bacf4 100644 --- a/src/views-components/project-properties-dialog/project-properties-form.tsx +++ b/src/views-components/project-properties-dialog/project-properties-form.tsx @@ -6,12 +6,13 @@ import { reduxForm, reset } from 'redux-form'; import { PROJECT_PROPERTIES_FORM_NAME, createProjectProperty } from 'store/details-panel/details-panel-action'; import { ResourcePropertiesForm, ResourcePropertiesFormData } from 'views-components/resource-properties-form/resource-properties-form'; import { withStyles } from '@material-ui/core'; +import { Dispatch } from 'redux'; const Form = withStyles(({ spacing }) => ({ container: { marginBottom: spacing.unit * 2 } }))(ResourcePropertiesForm); export const ProjectPropertiesForm = reduxForm({ form: PROJECT_PROPERTIES_FORM_NAME, - onSubmit: (data, dispatch) => { + onSubmit: (data, dispatch: Dispatch) => { dispatch(createProjectProperty(data)); dispatch(reset(PROJECT_PROPERTIES_FORM_NAME)); } diff --git a/src/views-components/resource-properties-form/property-chip.tsx b/src/views-components/resource-properties-form/property-chip.tsx index 01164882..24b5c0a9 100644 --- a/src/views-components/resource-properties-form/property-chip.tsx +++ b/src/views-components/resource-properties-form/property-chip.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { Chip } from '@material-ui/core'; import { connect } from 'react-redux'; import { RootState } from 'store/store'; -import * as CopyToClipboard from 'react-copy-to-clipboard'; +import CopyToClipboard from 'react-copy-to-clipboard'; import { getVocabulary } from 'store/vocabulary/vocabulary-selectors'; import { Dispatch } from 'redux'; import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions'; diff --git a/src/views-components/sharing-dialog/participant-select.tsx b/src/views-components/sharing-dialog/participant-select.tsx index d34a8125..402faa7f 100644 --- a/src/views-components/sharing-dialog/participant-select.tsx +++ b/src/views-components/sharing-dialog/participant-select.tsx @@ -12,7 +12,7 @@ import { ListItemText, Typography } from '@material-ui/core'; import { noop } from 'lodash/fp'; import { GroupClass, GroupResource } from 'models/group'; import { getUserDisplayName, UserResource } from 'models/user'; -import { ResourceKind } from 'models/resource'; +import { Resource, ResourceKind } from 'models/resource'; import { ListResults } from 'services/common-service/common-service'; export interface Participant { @@ -20,7 +20,7 @@ export interface Participant { uuid: string; } -type ParticipantResource = GroupResource & UserResource; +type ParticipantResource = GroupResource | UserResource; interface ParticipantSelectProps { items: Participant[]; @@ -40,14 +40,14 @@ interface ParticipantSelectState { suggestions: ParticipantResource[]; } -const getDisplayName = (item: GroupResource & UserResource) => { +const getDisplayName = (item: GroupResource | UserResource) => { switch (item.kind) { case ResourceKind.USER: return getUserDisplayName(item, true); case ResourceKind.GROUP: return item.name; default: - return item.uuid; + return (item as Resource).uuid; } }; diff --git a/src/views/collection-panel/collection-tag-form.tsx b/src/views/collection-panel/collection-tag-form.tsx index d1956d33..6d9cbd59 100644 --- a/src/views/collection-panel/collection-tag-form.tsx +++ b/src/views/collection-panel/collection-tag-form.tsx @@ -6,12 +6,13 @@ import { reduxForm, reset } from 'redux-form'; import { createCollectionTag, COLLECTION_TAG_FORM_NAME } from 'store/collection-panel/collection-panel-action'; import { ResourcePropertiesForm, ResourcePropertiesFormData } from 'views-components/resource-properties-form/resource-properties-form'; import { withStyles } from '@material-ui/core'; +import { Dispatch } from 'redux'; const Form = withStyles(({ spacing }) => ({ container: { marginBottom: spacing.unit * 2 } }))(ResourcePropertiesForm); export const CollectionTagForm = reduxForm({ form: COLLECTION_TAG_FORM_NAME, - onSubmit: (data, dispatch) => { + onSubmit: (data, dispatch: Dispatch) => { dispatch(createCollectionTag(data)); dispatch(reset(COLLECTION_TAG_FORM_NAME)); } diff --git a/src/views/link-account-panel/link-account-panel-root.tsx b/src/views/link-account-panel/link-account-panel-root.tsx index 87809d36..eb52ba18 100644 --- a/src/views/link-account-panel/link-account-panel-root.tsx +++ b/src/views/link-account-panel/link-account-panel-root.tsx @@ -52,7 +52,7 @@ export interface LinkAccountPanelRootActionProps { } function displayUser(user: UserResource, showCreatedAt: boolean = false, showCluster: boolean = false) { - const disp = []; + const disp: JSX.Element[] = []; disp.push({user.email} ({user.username}, {user.uuid})); if (showCluster) { const homeCluster = user.uuid.substr(0, 5); diff --git a/src/views/login-panel/login-panel.tsx b/src/views/login-panel/login-panel.tsx index e09e486e..110097be 100644 --- a/src/views/login-panel/login-panel.tsx +++ b/src/views/login-panel/login-panel.tsx @@ -51,7 +51,7 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ }); const doPasswordLogin = (url: string) => (username: string, password: string) => { - const formData = []; + const formData: string[] = []; formData.push('username='+encodeURIComponent(username)); formData.push('password='+encodeURIComponent(password)); return Axios.post(`${url}/arvados/v1/users/authenticate`, formData.join('&'), { diff --git a/src/views/virtual-machine-panel/virtual-machine-admin-panel.tsx b/src/views/virtual-machine-panel/virtual-machine-admin-panel.tsx index 68526501..a6ad24a7 100644 --- a/src/views/virtual-machine-panel/virtual-machine-admin-panel.tsx +++ b/src/views/virtual-machine-panel/virtual-machine-admin-panel.tsx @@ -31,7 +31,6 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ const mapStateToProps = (state: RootState) => { return { - logins: state.virtualMachines.logins, userUuid: state.auth.user!.uuid, ...state.virtualMachines }; diff --git a/yarn.lock b/yarn.lock index 1740bbb8..140e34ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1824,6 +1824,13 @@ resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.8.tgz#49348387983075705fe8f4e02fb67f7daaec4934" integrity sha512-S78QIYirQcUoo6UJZx9CSP0O2ix9IaeAXwQi26Rhr/+mg7qqPy8TzaxHSUut7eGjL8WmLccT7/MXf304WjqHcA== +"@types/is-image@3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/is-image/-/is-image-3.0.0.tgz#79baa13a9d3395b916a566df4ae7dd6115bfd779" + integrity sha512-+CD4viNsVIn9hPNGAZPEfV2DKoJd/by1OcbCFbsBirmDLNj3v8aZ+5QUPFZFeP4YXgQHVA4A37/ueb5qwnd1fg== + dependencies: + is-image "*" + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" @@ -6718,7 +6725,7 @@ http-proxy-middleware@0.19.1: lodash "^4.17.11" micromatch "^3.1.10" -http-proxy@^1.17.0, http-proxy@^1.18.1: +http-proxy@^1.17.0: version "1.18.1" resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549" integrity sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ== @@ -6804,7 +6811,7 @@ ignore@^5.1.4: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== -image-extensions@^1.0.1: +image-extensions@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/image-extensions/-/image-extensions-1.1.0.tgz#b8e6bf6039df0056e333502a00b6637a3105d894" integrity sha1-uOa/YDnfAFbjM1AqALZjejEF2JQ= @@ -7234,12 +7241,12 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" -is-image@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-image/-/is-image-2.0.0.tgz#454c9569578de31869371fbfaea4958f461b3e0c" - integrity sha1-RUyVaVeN4xhpNx+/rqSVj0YbPgw= +is-image@*, is-image@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-image/-/is-image-3.0.0.tgz#f183431372f6f8caf7cda316a0a6dea4d41926dd" + integrity sha512-NNPLvwKZ/hqx1Wv+ayKvVeDOylIapVKSxK/guzmB9doAk0FEdK0KqFKbnwNbuMLEPqEY4NaBhxzB4e98fVOq2Q== dependencies: - image-extensions "^1.0.1" + image-extensions "^1.1.0" is-in-browser@^1.0.2, is-in-browser@^1.1.3: version "1.1.3" @@ -9080,7 +9087,7 @@ node-fetch@^1.0.1: encoding "^0.1.11" is-stream "^1.0.1" -node-forge@0.10.0, node-forge@^0.10.0: +node-forge@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3" integrity sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA== @@ -12021,13 +12028,6 @@ send@0.17.1: range-parser "~1.2.1" statuses "~1.5.0" -serialize-javascript@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-3.1.0.tgz#8bf3a9170712664ef2561b44b691eafe399214ea" - integrity sha512-JIJT1DGiWmIKhzRsG91aS6Ze4sFUrYbltlkg2onR5OrnNM02Kl/hnY/T4FN2omvyeBbQmMJv+K4cPOpGzOTFBg== - dependencies: - randombytes "^2.1.0" - serialize-javascript@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa"