Skip to content
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

fix(storage-browser): set up location detail view table using data table #5726

Open
wants to merge 14 commits into
base: feat-storage-browser/main
Choose a base branch
from

Conversation

timngyn
Copy link
Member

@timngyn timngyn commented Sep 3, 2024

Description of changes

  • Add implementation of Location Detail View table using Data Table
    • This should fix:
      • Sorting by file types not actually sorting the rows
      • Table header buttons styling

Issue #, if available

Description of how you validated changes

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • yarn test passes and tests are updated/added
  • PR title and commit messages follow conventional commit syntax
  • If this change should result in a version bump, changeset added (This can be done after creating the PR.) This does not apply to changes made to docs, 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.

@timngyn timngyn requested a review from a team as a code owner September 3, 2024 07:32
Copy link

changeset-bot bot commented Sep 3, 2024

⚠️ No Changeset found

Latest commit: ab0bd9f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@hbuchel hbuchel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a note about some table cell formatting.

className: `${TABLE_DATA_CLASS_NAME} ${TABLE_DATA_CLASS_NAME}--download`,
key: `td-download-${index}`,
children: (
<SpanElement className={TABLE_DATA_TEXT_CLASS_NAME}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SpanElement wrapping the DownloadControl can be removed (the button styles on Download already supply the padding/string truncation that plain text cells would otherwise need).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, thanks Heather. Just pushed up the change to remove the span

hbuchel
hbuchel previously approved these changes Sep 3, 2024
Copy link
Member

@calebpollman calebpollman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't get too deep in to reviewing the logic or the unit tests. Let me know if you need to sync on the questions/feedback

packages/react-storage/jest.config.ts Outdated Show resolved Hide resolved
Comment on lines 89 to 90
<LocationDetailViewTable />
<DataTableControl />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we delete LocationDetailViewTable with this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes we can, was waiting for Heather's changes for pagination to get in first

};

// Generate the data for each row in the table
const getLocationsItemData = ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit concerned abt the size of this utility, feels like there should be a separation of concerns

Comment on lines +91 to +101
<ButtonElement variant="sort" className={TABLE_HEADER_BUTTON_CLASS_NAME}>
{header}
<IconElement
variant={
selection === key && direction !== 'none'
? `sort-${direction}`
: 'sort-indeterminate'
}
/>
</ButtonElement>
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this logic be handled by renderColumnHeaderItem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still working on this

Comment on lines +32 to +49
export type SortState = {
selection: string;
direction: SortDirection;
};

type Column<T> = {
key: keyof T;
header: string;
compareFn?: (a: T, b: T) => number;
};

type DataTableLocationItems = {
key: string;
fileExt: string;
lastModified: Date | undefined;
size: number | undefined;
type: string;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few things:

  • these should be declared as interfaces, not types
  • why are we reintroducing a Column interface? This isn't needed for the LocationsView right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added it to help with managing the key and header properties since I wanted to add a new column, fileExt that would contain the file extensions, but display as as a type column.

I think when I tried to set it up similar to how LocationsView was set up, I was running into a lot of typescript errors related to the sorting, but I can try it out again

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants