Skip to content

Commit

Permalink
Update storage tab layout (#463)
Browse files Browse the repository at this point in the history
* Update storage tab layout

* Update result strings to support one or many items
  • Loading branch information
annavik authored Jul 30, 2024
1 parent cf7d8b8 commit 9cdc0b4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
6 changes: 0 additions & 6 deletions ui/src/pages/overview/storage/storage.module.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
@import 'src/design-system/variables/colors.scss';
@import 'src/design-system/variables/typography.scss';

.fetchInfoWrapper {
position: absolute;
top: 0;
right: 0;
}

.connectionStatus {
.wizardRoot {
border-width: 1px !important;
Expand Down
31 changes: 20 additions & 11 deletions ui/src/pages/overview/storage/storage.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import { FetchInfo } from 'components/fetch-info/fetch-info'
import { API_ROUTES } from 'data-services/constants'
import { useStorageSources } from 'data-services/hooks/storage-sources/useStorageSources'
import { PageHeader } from 'design-system/components/page-header/page-header'
import { PaginationBar } from 'design-system/components/pagination-bar/pagination-bar'
import { Table } from 'design-system/components/table/table/table'
import { TableSortSettings } from 'design-system/components/table/types'
import { Error } from 'pages/error/error'
import { NewEntityDialog } from 'pages/overview/entities/new-entity-dialog'
import { useState } from 'react'
import { useParams } from 'react-router-dom'
import { STRING, translate } from 'utils/language'
import { usePagination } from 'utils/usePagination'
import { UserPermission } from 'utils/user/types'
import { columns } from './storage-columns'
import styles from './storage.module.scss'

export const StorageSources = () => {
const { projectId } = useParams()
const [sort, setSort] = useState<TableSortSettings>()
const [sort, setSort] = useState<TableSortSettings | undefined>({
field: 'created_at',
order: 'desc',
})
const { pagination, setPage } = usePagination()
const { items, userPermissions, total, isLoading, isFetching, error } =
useStorageSources({
Expand All @@ -31,11 +34,20 @@ export const StorageSources = () => {

return (
<>
{isFetching && (
<div className={styles.fetchInfoWrapper}>
<FetchInfo isLoading={isLoading} />
</div>
)}
<PageHeader
title={translate(STRING.TAB_ITEM_STORAGE)}
subTitle={translate(STRING.RESULTS, {
total,
})}
isLoading={isLoading}
isFetching={isFetching}
tooltip={translate(STRING.TOOLTIP_STORAGE)}
>
{canCreate && (
<NewEntityDialog collection={API_ROUTES.STORAGE} type="storage" />
)}
</PageHeader>

<Table
items={items}
isLoading={isLoading}
Expand All @@ -51,9 +63,6 @@ export const StorageSources = () => {
setPage={setPage}
/>
) : null}
{canCreate && (
<NewEntityDialog collection={API_ROUTES.STORAGE} type="storage" />
)}
</>
)
}
4 changes: 2 additions & 2 deletions ui/src/utils/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ const ENGLISH_STRINGS: { [key in STRING]: string } = {
[STRING.MESSAGE_PROCESS_NOW_TOOLTIP]:
'Process this single image with presets',
[STRING.MESSAGE_RESULT_RANGE]:
'Showing {{start}}-{{end}} of {{total}} results',
'Showing {{start}}-{{end}} of {{total}} result(s)',
[STRING.MESSAGE_SIGNED_UP]: 'Signed up successfully!',
[STRING.MESSAGE_VALUE_INVALID]: 'Please provide a valid value',
[STRING.MESSAGE_VALUE_MISSING]: 'Please provide a value',
Expand Down Expand Up @@ -428,7 +428,7 @@ const ENGLISH_STRINGS: { [key in STRING]: string } = {
[STRING.REJECT_ID]: 'Reject ID',
[STRING.REJECT_ID_SHORT]: 'Reject',
[STRING.SELECT_COLUMNS]: 'Select columns',
[STRING.RESULTS]: '{{total}} results',
[STRING.RESULTS]: '{{total}} result(s)',
[STRING.STAGES]: 'Stages',
[STRING.SUMMARY]: 'Summary',
[STRING.UNKNOWN]: 'Unknown',
Expand Down

0 comments on commit 9cdc0b4

Please sign in to comment.