-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/linode/manager into develop
- Loading branch information
Showing
11 changed files
with
303 additions
and
190 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-10124-tech-stories-1706629455055.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Tech Stories | ||
--- | ||
|
||
Refactor AccessKeyTable - Eliminate react anti patterns. ([#10124](https://github.com/linode/manager/pull/10124)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Fixed | ||
--- | ||
|
||
Breadcrumb label in NodeBalancers details & create pages ([#10127](https://github.com/linode/manager/pull/10127)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
183 changes: 0 additions & 183 deletions
183
packages/manager/src/features/ObjectStorage/AccessKeyLanding/AccessKeyTable.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
105 changes: 105 additions & 0 deletions
105
...ges/manager/src/features/ObjectStorage/AccessKeyLanding/AccessKeyTable/AccessKeyTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import { | ||
ObjectStorageKey, | ||
RegionS3EndpointAndID, | ||
} from '@linode/api-v4/lib/object-storage'; | ||
import { APIError } from '@linode/api-v4/lib/types'; | ||
import { styled } from '@mui/material/styles'; | ||
import React, { useState } from 'react'; | ||
|
||
import { Table } from 'src/components/Table'; | ||
|
||
import { TableCell } from 'src/components/TableCell'; | ||
import { TableHead } from 'src/components/TableHead'; | ||
import { TableRow } from 'src/components/TableRow'; | ||
import { TableBody } from 'src/components/TableBody'; | ||
|
||
import { useAccountManagement } from 'src/hooks/useAccountManagement'; | ||
import { useFlags } from 'src/hooks/useFlags'; | ||
import { isFeatureEnabled } from 'src/utilities/accountCapabilities'; | ||
|
||
import { HostNamesDrawer } from '../HostNamesDrawer'; | ||
import { OpenAccessDrawer } from '../types'; | ||
|
||
import { AccessKeyTableBody } from './AccessKeyTableBody'; | ||
|
||
export interface AccessKeyTableProps { | ||
data: ObjectStorageKey[] | undefined; | ||
error: APIError[] | null | undefined; | ||
isLoading: boolean; | ||
isRestrictedUser: boolean; | ||
openDrawer: OpenAccessDrawer; | ||
openRevokeDialog: (objectStorageKey: ObjectStorageKey) => void; | ||
} | ||
|
||
export const AccessKeyTable = (props: AccessKeyTableProps) => { | ||
const { | ||
data, | ||
error, | ||
isLoading, | ||
isRestrictedUser, | ||
openDrawer, | ||
openRevokeDialog, | ||
} = props; | ||
|
||
const [showHostNamesDrawer, setShowHostNamesDrawers] = useState<boolean>( | ||
false | ||
); | ||
const [hostNames, setHostNames] = useState<RegionS3EndpointAndID[]>([]); | ||
|
||
const flags = useFlags(); | ||
const { account } = useAccountManagement(); | ||
|
||
const isObjMultiClusterEnabled = isFeatureEnabled( | ||
'Object Storage Access Key Regions', | ||
Boolean(flags.objMultiCluster), | ||
account?.capabilities ?? [] | ||
); | ||
|
||
return ( | ||
<> | ||
<Table | ||
aria-label="List of Object Storage Access Keys" | ||
colCount={2} | ||
data-testid="data-qa-access-key-table" | ||
rowCount={data?.length} | ||
> | ||
<TableHead> | ||
<TableRow data-qa-table-head> | ||
<StyledLabelCell data-qa-header-label>Label</StyledLabelCell> | ||
<StyledLabelCell data-qa-header-key>Access Key</StyledLabelCell> | ||
{isObjMultiClusterEnabled && ( | ||
<StyledLabelCell data-qa-header-key> | ||
Regions/S3 Hostnames | ||
</StyledLabelCell> | ||
)} | ||
{/* empty cell for kebab menu */} | ||
<TableCell /> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
<AccessKeyTableBody | ||
data={data} | ||
error={error} | ||
isLoading={isLoading} | ||
isRestrictedUser={isRestrictedUser} | ||
openDrawer={openDrawer} | ||
openRevokeDialog={openRevokeDialog} | ||
setHostNames={setHostNames} | ||
setShowHostNamesDrawers={setShowHostNamesDrawers} | ||
/> | ||
</TableBody> | ||
</Table> | ||
{isObjMultiClusterEnabled && ( | ||
<HostNamesDrawer | ||
onClose={() => setShowHostNamesDrawers(false)} | ||
open={showHostNamesDrawer} | ||
regions={hostNames} | ||
/> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
const StyledLabelCell = styled(TableCell)(() => ({ | ||
width: '35%', | ||
})); |
Oops, something went wrong.