diff --git a/package-lock.json b/package-lock.json index eb21b1c9b..a9d9aa8d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@hapi/joi-date": "^2.0.1", "@hookform/resolvers": "^2.8.8", "@monaco-editor/react": "^4.4.5", - "@scality/core-ui": "0.122.0", + "@scality/core-ui": "0.124.0", "@scality/module-federation": "github:scality/module-federation#1.1.0", "@types/react-table": "^7.7.10", "@types/react-virtualized": "^9.21.20", @@ -3322,9 +3322,9 @@ "dev": true }, "node_modules/@scality/core-ui": { - "version": "0.122.0", - "resolved": "https://registry.npmjs.org/@scality/core-ui/-/core-ui-0.122.0.tgz", - "integrity": "sha512-61rXypM9Z845lN7+5jqeuof3ZLZe8tIfcdaVj2FoFLP97nXUuNaKRyBEoWUc0ESSFl9U87ReU1jMOKIOJlWnsg==", + "version": "0.124.0", + "resolved": "https://registry.npmjs.org/@scality/core-ui/-/core-ui-0.124.0.tgz", + "integrity": "sha512-64fyZUkrm4CV/ZM6Vt+Qe2wVqrDHAkMzpNWWD/HMZwdfjlvS5bkg6/6pyM4H/s2zySKhg5g0wvsA2RAyJaoDvg==", "dependencies": { "@floating-ui/dom": "^1.6.3", "@fortawesome/fontawesome-free": "^5.10.2", @@ -22285,9 +22285,9 @@ "dev": true }, "@scality/core-ui": { - "version": "0.122.0", - "resolved": "https://registry.npmjs.org/@scality/core-ui/-/core-ui-0.122.0.tgz", - "integrity": "sha512-61rXypM9Z845lN7+5jqeuof3ZLZe8tIfcdaVj2FoFLP97nXUuNaKRyBEoWUc0ESSFl9U87ReU1jMOKIOJlWnsg==", + "version": "0.124.0", + "resolved": "https://registry.npmjs.org/@scality/core-ui/-/core-ui-0.124.0.tgz", + "integrity": "sha512-64fyZUkrm4CV/ZM6Vt+Qe2wVqrDHAkMzpNWWD/HMZwdfjlvS5bkg6/6pyM4H/s2zySKhg5g0wvsA2RAyJaoDvg==", "requires": { "@floating-ui/dom": "^1.6.3", "@fortawesome/fontawesome-free": "^5.10.2", diff --git a/package.json b/package.json index d01a5e126..97234b10e 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@hapi/joi-date": "^2.0.1", "@hookform/resolvers": "^2.8.8", "@monaco-editor/react": "^4.4.5", - "@scality/core-ui": "0.122.0", + "@scality/core-ui": "0.124.0", "@scality/module-federation": "github:scality/module-federation#1.1.0", "@types/react-table": "^7.7.10", "@types/react-virtualized": "^9.21.20", diff --git a/src/react/Routes.tsx b/src/react/Routes.tsx index 2d58bfacd..14e5a1174 100644 --- a/src/react/Routes.tsx +++ b/src/react/Routes.tsx @@ -1,4 +1,11 @@ -import { AppContainer, ErrorPage401, Icon, Sidebar } from '@scality/core-ui'; +import { + AppContainer, + EmptyState, + ErrorPage401, + Icon, + Loader, + Sidebar, +} from '@scality/core-ui'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { @@ -32,11 +39,9 @@ import EndpointCreate from './endpoint/EndpointCreate'; import Endpoints from './endpoint/Endpoints'; import LocationEditor from './locations/LocationEditor'; import { Locations } from './locations/Locations'; -import { EmptyStateContainer } from './ui-elements/Container'; -import Loader from './ui-elements/Loader'; import ReauthDialog from './ui-elements/ReauthDialog'; import VeeamSteppers from './ui-elements/Veeam/VeeamSteps'; -import { Warning } from './ui-elements/Warning'; + import { useAuthGroups } from './utils/hooks'; export const RemoveTrailingSlash = ({ ...rest }) => { @@ -58,7 +63,7 @@ export const RemoveTrailingSlash = ({ ...rest }) => { const RedirectToAccount = () => { // To be replace later by react-query or context - const history = useHistory(); + const { account: selectedAccount } = useCurrentAccount(); const { pathname, search } = useLocation(); @@ -68,17 +73,17 @@ const RedirectToAccount = () => { ); } else if (isStorageManager) { - const description = pathname === '/workflows' ? 'workflows' : 'data'; + const description = + pathname === '/workflows' + ? { singular: 'Workflow', plural: 'Workflows' } + : { singular: 'Bucket', plural: 'Buckets' }; return ( - - } - title={`Before browsing your ${description}, create your first account.`} - btnTitle="Create Account" - btnAction={() => history.push('/create-account')} - /> - + ); } else { return ; @@ -139,7 +144,7 @@ function PrivateRoutes() { if (!isClientsLoaded) { return ( - +
Loading clients
); diff --git a/src/react/account/AccountList.tsx b/src/react/account/AccountList.tsx index 1e3be093f..1454bdd17 100644 --- a/src/react/account/AccountList.tsx +++ b/src/react/account/AccountList.tsx @@ -1,34 +1,27 @@ -import React, { useMemo } from 'react'; -import { useHistory } from 'react-router-dom'; -import styled from 'styled-components'; -import { spacing } from '@scality/core-ui/dist/style/theme'; -import { Button } from '@scality/core-ui/dist/components/buttonv2/Buttonv2.component'; -import { Table } from '@scality/core-ui/dist/components/tablev2/Tablev2.component'; import { ConstrainedText, - FormattedDateTime, Icon, Link, Stack, + FormattedDateTime, } from '@scality/core-ui'; -import { Account } from '../next-architecture/domain/entities/account'; +import { Button, Table } from '@scality/core-ui/dist/next'; +import React, { useMemo } from 'react'; +import { useHistory } from 'react-router-dom'; import { CellProps, CoreUIColumn } from 'react-table'; +import { Account } from '../next-architecture/domain/entities/account'; + +import { VEEAM_FEATURE } from '../../js/config'; import { useCurrentAccount, useSetAssumedRole, } from '../DataServiceRoleProvider'; -import { useAuthGroups } from '../utils/hooks'; -import { getDataUsedColumn } from '../next-architecture/ui/metrics/DataUsedColumn'; -import { useMetricsAdapter } from '../next-architecture/ui/MetricsAdapterProvider'; import { useAccountLatestUsedCapacity } from '../next-architecture/domain/business/accounts'; import { useConfig } from '../next-architecture/ui/ConfigProvider'; -import { VEEAM_FEATURE } from '../../js/config'; - -const TableAction = styled.div` - display: flex; - justify-content: space-between; - margin-bottom: ${spacing.sp16}; -`; +import { useMetricsAdapter } from '../next-architecture/ui/MetricsAdapterProvider'; +import { getDataUsedColumn } from '../next-architecture/ui/metrics/DataUsedColumn'; +import { TableHeaderWrapper } from '../ui-elements/Table'; +import { useAuthGroups } from '../utils/hooks'; function useAutoAssumeRoleUponAccountDeletion({ accounts, @@ -118,7 +111,6 @@ function AccountList({ accounts }: { accounts: Account[] }) { return (
- - - {isStorageManager ? ( - - {features.includes(VEEAM_FEATURE) && ( + } + actions={ + isStorageManager && ( + + {features.includes(VEEAM_FEATURE) && ( + - - ) : ( - '' - )} - + icon={} + label="Create Account" + variant="primary" + onClick={() => history.push('/create-account')} + type="submit" + > + + ) + } + />
diff --git a/src/react/account/AccountLocations.tsx b/src/react/account/AccountLocations.tsx index fdb055390..9b40d0438 100644 --- a/src/react/account/AccountLocations.tsx +++ b/src/react/account/AccountLocations.tsx @@ -1,4 +1,4 @@ -import { Icon, Loader, Stack } from '@scality/core-ui'; +import { Loader, Stack } from '@scality/core-ui'; import { Table } from '@scality/core-ui/dist/next'; import { useMemo } from 'react'; import { CellProps, CoreUIColumn } from 'react-table'; @@ -9,10 +9,9 @@ import { useMetricsAdapter } from '../next-architecture/ui/MetricsAdapterProvide import { getDataUsedColumn } from '../next-architecture/ui/metrics/DataUsedColumn'; import { ColdStorageIcon } from '../ui-elements/ColdStorageIcon'; import { HelpLocationTargetBucket } from '../ui-elements/Help'; -import { Search } from '../ui-elements/Table'; -import { Warning } from '../ui-elements/Warning'; + import { getLocationType } from '../utils/storageOptions'; -import { CenterredSecondaryText } from './iamAttachment/AttachmentTable'; +import { TableHeaderWrapper } from '../ui-elements/Table'; export function AccountLocations() { const metricsAdapter = useMetricsAdapter(); @@ -34,7 +33,7 @@ export function AccountLocations() { (location: Location) => { return location; }, - { flex: '0.2' }, + { flex: '0.5' }, ); const columns: CoreUIColumn[] = [ { @@ -42,7 +41,9 @@ export function AccountLocations() { accessor: 'name', cellStyle: { textAlign: 'left', - minWidth: '20rem', + minWidth: '10rem', + flex: '1', + width: 'unset', }, }, { @@ -50,7 +51,10 @@ export function AccountLocations() { accessor: 'type', cellStyle: { textAlign: 'left', - minWidth: '24rem', + minWidth: '10rem', + flex: '1', + + width: 'unset', }, Cell(value: CellProps) { const rowValues = value.row.original; @@ -75,7 +79,7 @@ export function AccountLocations() { accessor: 'details.bucketName', cellStyle: { textAlign: 'left', - flex: '0.3', + flex: '0.5', }, }, dataUsedColumn, @@ -84,7 +88,7 @@ export function AccountLocations() { return columns; }, [locations]); - if (locations.status === 'loading' || locations.status === 'unknown') { + if (locations.status === 'unknown') { return ( @@ -92,46 +96,32 @@ export function AccountLocations() { ); } - if (locations.status === 'error') { - return ( - } - title="Unable to load locations." - /> - ); - } return ( - - - - +
+ + } + /> + ) => data[index].name } //@ts-expect-error fix this when you are working on it key={(index: number, data: Array) => data[index].name} - > - {(Rows) => - data.length === 0 ? ( - No Locations - ) : ( - <>{Rows} - ) - } - + >
); } diff --git a/src/react/account/AccountPoliciesList.tsx b/src/react/account/AccountPoliciesList.tsx index c57daf04b..19566be9a 100644 --- a/src/react/account/AccountPoliciesList.tsx +++ b/src/react/account/AccountPoliciesList.tsx @@ -1,13 +1,14 @@ import { useState } from 'react'; import { useHistory } from 'react-router-dom'; import { Box, Button, CopyButton } from '@scality/core-ui/dist/next'; -import { spacing } from '@scality/core-ui/dist/style/theme'; import { useIAMClient } from '../IAMProvider'; + import { ConstrainedText, - FormattedDateTime, Icon, Tooltip, + spacing, + FormattedDateTime, } from '@scality/core-ui'; import { notFalsyTypeGuard } from '../../types/typeGuards'; import { useMutation, useQuery, useQueryClient } from 'react-query'; @@ -154,7 +155,7 @@ const ActionButtons = ({ rowValues; return (