-
Notifications
You must be signed in to change notification settings - Fork 29
[Studio UI] Improve search modal layout, saved searches, and type dropdown #3882
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
Changes from all commits
ef2eaec
5fcf481
c9b00b6
8bcb688
9df5893
5d17f02
133bfca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,19 +70,18 @@ export const SearchResult = (): React.JSX.Element => { | |
| } | ||
|
|
||
| return ( | ||
| <> | ||
| <div /> | ||
|
|
||
| <SplitLayout | ||
| leftItem={ | ||
| <div style={ { display: 'flex', flexDirection: 'column', height: '100%' } }> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please discuss this with @vin0401 to be sure. Should we e.g. use our Flex component?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, would vote for our flex here. |
||
| <div style={ { flex: 1, overflow: 'hidden', minHeight: 0 } }> | ||
| <SplitLayout | ||
| leftItem={ | ||
| { | ||
| size: 750, | ||
| children: ( | ||
| <Content | ||
| overflow={ { x: 'hidden', y: 'auto' } } | ||
| padded | ||
| padding={ { left: 'none', right: 'none', y: 'none' } } | ||
| style={ { height: 400 } } | ||
| style={ { height: '100%' } } | ||
| > | ||
| <Flex | ||
| className='w-full h-full' | ||
|
|
@@ -116,7 +115,7 @@ export const SearchResult = (): React.JSX.Element => { | |
| } | ||
| } | ||
|
|
||
| rightItem={ | ||
| rightItem={ | ||
| { | ||
| size: 250, | ||
| minSize: 250, | ||
|
|
@@ -127,10 +126,14 @@ export const SearchResult = (): React.JSX.Element => { | |
| } | ||
| } | ||
|
|
||
| withDivider | ||
| /> | ||
| withDivider | ||
| /> | ||
| </div> | ||
|
|
||
| <Toolbar theme='secondary'> | ||
| <Toolbar | ||
| padding={ { left: 'none', right: 'none' } } | ||
| theme='secondary' | ||
| > | ||
| <Pagination | ||
| onChange={ onChange } | ||
| pageSizeOptions={ [10, 20, 50, 100] } | ||
|
|
@@ -139,7 +142,7 @@ export const SearchResult = (): React.JSX.Element => { | |
| total={ data?.totalItems ?? 0 } | ||
| /> | ||
| </Toolbar> | ||
| </> | ||
| </div> | ||
| ) | ||
| }, [data, selectedItem, isLoading]) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,11 +94,13 @@ export const SavedSearchesTab = (): React.JSX.Element => { | |
| .finally(() => { setDeletingId(undefined) }) | ||
| } | ||
|
|
||
| const tableItems: SavedSearchRow[] = (data?.items ?? []).map((item) => ({ | ||
| ...item, | ||
| ownership: item.owner ? t('saved-search.ownership.own') : t('saved-search.ownership.shared'), | ||
| modificationDateLabel: formatDateTime({ timestamp: item.modificationDate, dateStyle: 'short', timeStyle: 'short' }) | ||
| })) | ||
| const tableItems: SavedSearchRow[] = [ | ||
| ...(data?.items ?? []).map((item) => ({ | ||
| ...item, | ||
| ownership: item.owner ? t('saved-search.ownership.own') : t('saved-search.ownership.shared'), | ||
| modificationDateLabel: formatDateTime({ timestamp: item.modificationDate, dateStyle: 'short', timeStyle: 'short' }) | ||
| })) | ||
| ] | ||
|
|
||
| const columnHelper = createColumnHelper<SavedSearchRow>() | ||
| const columns = [ | ||
|
|
@@ -137,7 +139,7 @@ export const SavedSearchesTab = (): React.JSX.Element => { | |
| <Flex align='center'> | ||
| <IconButton | ||
| data-testid='saved-search-open-button' | ||
| icon={ { value: 'folder' } } | ||
| icon={ { value: 'open-folder' } } | ||
| loading={ openingId === row.original.id } | ||
| onClick={ () => { onOpen(row.original.id) } } | ||
| tooltip={ { title: t('saved-search.open') } } | ||
|
|
@@ -167,24 +169,27 @@ export const SavedSearchesTab = (): React.JSX.Element => { | |
| ] | ||
|
|
||
| return ( | ||
| <ContentLayout | ||
| renderToolbar={ | ||
| <Toolbar | ||
| borderStyle='primary' | ||
| margin={ { top: 'small' } } | ||
| padding={ { x: 'small', y: 'extra-small' } } | ||
| theme='secondary' | ||
| > | ||
| <Flex align='center'> | ||
| <IconButton | ||
| data-testid='saved-search-refresh-button' | ||
| disabled={ isFetching } | ||
| icon={ { value: 'refresh' } } | ||
| onClick={ () => { void refetch() } } | ||
| tooltip={ { title: t('refresh') } } | ||
| type='link' | ||
| /> | ||
| {total > 0 && ( | ||
| <div style={ { position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 } }> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please discuss this with @vin0401.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems to be the hack to get something stretch over the while content, any isides here @idaiv? |
||
| <ContentLayout | ||
| renderToolbar={ | ||
| <Toolbar | ||
| padding={ { left: 'none', right: 'none' } } | ||
| position={ total > 0 ? 'none' : 'bottom' } | ||
| theme='secondary' | ||
| > | ||
| <Flex | ||
| align='center' | ||
| gap='extra-small' | ||
| > | ||
| <IconButton | ||
| data-testid='saved-search-refresh-button' | ||
| disabled={ isFetching } | ||
| icon={ { value: 'refresh' } } | ||
| onClick={ () => { void refetch() } } | ||
| tooltip={ { title: t('refresh') } } | ||
| type='link' | ||
| /> | ||
| {total > 0 && ( | ||
| <> | ||
| <Divider | ||
| size='small' | ||
|
|
@@ -202,52 +207,53 @@ export const SavedSearchesTab = (): React.JSX.Element => { | |
| total={ total } | ||
| /> | ||
| </> | ||
| )} | ||
| </Flex> | ||
| </Toolbar> | ||
| )} | ||
| </Flex> | ||
| </Toolbar> | ||
| } | ||
| renderTopBar={ | ||
| <Box | ||
| className={ styles.topBar } | ||
| margin={ { bottom: 'small' } } | ||
| padding={ { x: 'small', y: 'extra-small' } } | ||
| > | ||
| <SearchInput | ||
| maxWidth='100%' | ||
| onSearch={ (value) => { | ||
| setCurrentPage(1) | ||
| setSearchTerm(value) | ||
| } } | ||
| placeholder={ t('component.search.pleaceholder') } | ||
| /> | ||
| </Box> | ||
| renderTopBar={ | ||
| <Box | ||
| className={ (data?.totalItems ?? 0) === 0 ? styles.topBar : undefined } | ||
| margin={ { bottom: 'small' } } | ||
| padding={ { y: 'extra-small' } } | ||
| > | ||
| <SearchInput | ||
| maxWidth='100%' | ||
| onSearch={ (value) => { | ||
| setCurrentPage(1) | ||
| setSearchTerm(value) | ||
| } } | ||
| placeholder={ t('component.search.pleaceholder') } | ||
| /> | ||
| </Box> | ||
| } | ||
| > | ||
| <Content | ||
| margin={ { x: 'extra-small', y: 'none' } } | ||
| none={ !isFetching && isEmpty(data?.items) } | ||
| > | ||
| <Box margin={ { x: 'extra-small', y: 'none' } }> | ||
| <Grid | ||
| autoWidth | ||
| columns={ columns } | ||
| data={ tableItems } | ||
| enableSorting | ||
| isLoading={ isFetching } | ||
| manualSorting | ||
| onSortingChange={ (nextSorting) => { | ||
| setSorting(nextSorting) | ||
| setCurrentPage(1) | ||
| } } | ||
| resizable | ||
| <Content | ||
| margin={ { x: 'extra-small', y: 'none' } } | ||
| none={ !isFetching && isEmpty(data?.items) } | ||
| > | ||
| <Box margin={ { x: 'extra-small', y: 'none' } }> | ||
| <Grid | ||
| autoWidth | ||
| columns={ columns } | ||
| data={ tableItems } | ||
| enableSorting | ||
| isLoading={ isFetching } | ||
| manualSorting | ||
| onSortingChange={ (nextSorting) => { | ||
| setSorting(nextSorting) | ||
| setCurrentPage(1) | ||
| } } | ||
| resizable | ||
| // During loading the Grid renders placeholder rows without an id; return undefined for | ||
| // those so it falls back to unique index ids (a constant id collides → phantom skeleton | ||
| // rows linger after the data loads). | ||
| setRowId={ (row) => isUndefined(row.id) ? (undefined as unknown as string) : String(row.id) } | ||
| sorting={ sorting } | ||
| /> | ||
| </Box> | ||
| </Content> | ||
| </ContentLayout> | ||
| setRowId={ (row) => isUndefined(row.id) ? (undefined as unknown as string) : String(row.id) } | ||
| sorting={ sorting } | ||
| /> | ||
| </Box> | ||
| </Content> | ||
| </ContentLayout> | ||
| </div> | ||
| ) | ||
| } | ||
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.
Please discuss this with @vin0401 to be sure. Should we e.g. use our Flex component?
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.
Yep, would vote for our flex here.