-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(react-storage): refactor useView action related hooks #5998
Conversation
...react-storage/src/components/StorageBrowser/views/LocationActionView/DeleteFilesControls.tsx
Outdated
Show resolved
Hide resolved
|
...mponents/StorageBrowser/views/LocationActionView/DeleteView/__tests__/useDeleteView.spec.tsx
Outdated
Show resolved
Hide resolved
…bleData, update Table cell types to include key in base definition
c94cec9
to
49dfe0c
Compare
...c/components/StorageBrowser/views/LocationActionView/CopyView/__tests__/useCopyView.spec.tsx
Outdated
Show resolved
Hide resolved
const destinationPath = `${path}${getFilenameWithoutPrefix(sourcePath)}`; | ||
const destinationPath = `${path}${fileKey}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the approach here to allow to improve consumer ergonomics by providing just the parsed fileKey
as well as the full key
@@ -1,17 +1,15 @@ | |||
import { copy } from '../../storage-internal'; | |||
import { getFilenameWithoutPrefix } from '../../views/LocationActionView/utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed to fix a circular dependency
export interface FolderData { | ||
key: string; | ||
id: string; | ||
type: 'FOLDER'; | ||
} | ||
|
||
export interface FileData { | ||
key: string; | ||
lastModified: Date; | ||
id: string; | ||
size: number; | ||
type: 'FILE'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to sibling types.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interfaces in this file were migrated from ../types.ts to avoid potential circular references
@@ -8,6 +8,8 @@ export type TaskStatus = | |||
| 'QUEUED' | |||
| 'PENDING'; | |||
|
|||
export type StatusCounts = Record<TaskStatus | 'TOTAL', number>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaces TasksCount
...omponents/StorageBrowser/views/LocationActionView/UploadView/__tests__/useUploadView.spec.ts
Outdated
Show resolved
Hide resolved
type: 'RESET_LOCATION_ITEMS', | ||
type: 'SET_LOCATION_ITEMS', | ||
items: [fileDataOne, fileDataTwo], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was asserting the opposite behavior of the test description, same issue with the test case immediately below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still reviewing but publishing a few comments
...s/react-storage/src/components/StorageBrowser/views/LocationActionView/CopyFilesControls.tsx
Outdated
Show resolved
Hide resolved
|
||
export interface TaskHandlerInput< | ||
T extends TaskData = TaskData, | ||
K extends TaskHandlerOptions = TaskHandlerOptions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Isn't K
usually short for "Key"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally we have treated usage of K
as a second positional generic name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should maybe rethink this later. K is definitely a convention but we seem to be misusing it a bit
Description of changes
useUploadView
useView
action interfacesstatusCounts
,isProcessing
andisProcessingComplete
values touseProcessTasks
returnIssue #, if available
Description of how you validated changes
Unit tests
Checklist
yarn test
passes and tests are updated/addeddocs
,e2e
,examples
, or other private packages.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.