forked from linode/manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upcoming: [M3-8378] - Add Bucket Management
Properties
Tab for Obje…
…ct Storage Gen2 (linode#10797) * Add and init Properties tab setup for obj gen 2 * Fix hostname text alignments for smaller screens * Clean up.. * Add Styled Action Panel and some cleanup.. * Add notice for success and error events * Update todo comments * Update todo comment * Clean up.. * Add set default rate limit logic * Passing endpointType prop to BucketProperties * Add label for bucket rate limit * Added changeset: Enhance bucket management Properties Tab for object storage gen2 * Update changeset file * Add logic to disable save button * Add loading for the hostname in properites tab * Use location and history hooks for BucketBreadcrumb * formating... * Refactor code to integrate React Hook Form * Clean up... * Fix padding rule for StyledActionsPanel * Replace component with for support links * Add feature flag to Properties tab * Add title to SupportLink * Resolve Merge conficts and formatting... * Refactor: Remove useWatch and access rateLimit value directly from field.value * Refactoring... * Fix flag check to use 'objectStorageGen2?.enabled' instead of 'objectStorageGen2' * Remove some filtering by passing down bucket * Update packages/manager/.changeset/pr-10795-upcoming-features-1724084768188.md Co-authored-by: Hana Xu <115299789+hana-linode@users.noreply.github.com> --------- Co-authored-by: Jaalah Ramos <jaalah.ramos@gmail.com> Co-authored-by: Jaalah Ramos <125309814+jaalah-akamai@users.noreply.github.com> Co-authored-by: Hana Xu <115299789+hana-linode@users.noreply.github.com>
- Loading branch information
1 parent
fb5cb06
commit 812843a
Showing
5 changed files
with
220 additions
and
49 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-10795-upcoming-features-1724084768188.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": Upcoming Features | ||
--- | ||
|
||
Add bucket management Properties Tab for Object Storage Gen2 ([#10795](https://github.com/linode/manager/pull/10795)) |
41 changes: 41 additions & 0 deletions
41
packages/manager/src/features/ObjectStorage/BucketDetail/BucketProperties.styles.ts
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,41 @@ | ||
import { styled } from '@mui/material/styles'; | ||
|
||
import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel'; | ||
import { Paper } from 'src/components/Paper'; | ||
import { Typography } from 'src/components/Typography'; | ||
|
||
export const StyledText = styled(Typography, { | ||
label: 'StyledText', | ||
})(({ theme }) => ({ | ||
lineHeight: 0.5, | ||
paddingLeft: 8, | ||
[theme.breakpoints.down('lg')]: { | ||
marginLeft: 8, | ||
}, | ||
[theme.breakpoints.down('sm')]: { | ||
lineHeight: 1, | ||
}, | ||
})); | ||
|
||
export const StyledRootContainer = styled(Paper, { | ||
label: 'StyledRootContainer', | ||
})(({ theme }) => ({ | ||
marginTop: 25, | ||
padding: theme.spacing(3), | ||
})); | ||
|
||
export const StyledHelperText = styled(Typography, { | ||
label: 'StyledHelperText', | ||
})(({ theme }) => ({ | ||
lineHeight: 1.5, | ||
paddingBottom: theme.spacing(), | ||
paddingTop: theme.spacing(), | ||
})); | ||
|
||
export const StyledActionsPanel = styled(ActionsPanel, { | ||
label: 'StyledActionsPanel', | ||
})(() => ({ | ||
display: 'flex', | ||
justifyContent: 'right', | ||
padding: 0, | ||
})); |
91 changes: 91 additions & 0 deletions
91
packages/manager/src/features/ObjectStorage/BucketDetail/BucketProperties.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,91 @@ | ||
import * as React from 'react'; | ||
import { FormProvider, useForm } from 'react-hook-form'; | ||
import { useHistory, useLocation } from 'react-router-dom'; | ||
|
||
import { Link } from 'src/components/Link'; | ||
import { Notice } from 'src/components/Notice/Notice'; | ||
import { SupportLink } from 'src/components/SupportLink'; | ||
import { Typography } from 'src/components/Typography'; | ||
import { getQueryParamFromQueryString } from 'src/utilities/queryParams'; | ||
|
||
import { BucketRateLimitTable } from '../BucketLanding/BucketRateLimitTable'; | ||
import { BucketBreadcrumb } from './BucketBreadcrumb'; | ||
import { | ||
StyledActionsPanel, | ||
StyledHelperText, | ||
StyledRootContainer, | ||
StyledText, | ||
} from './BucketProperties.styles'; | ||
|
||
import type { ObjectStorageBucket } from '@linode/api-v4'; | ||
|
||
interface Props { | ||
bucket: ObjectStorageBucket; | ||
} | ||
|
||
export interface UpdateBucketRateLimitPayload { | ||
rateLimit: string; | ||
} | ||
|
||
export const BucketProperties = React.memo((props: Props) => { | ||
const { bucket } = props; | ||
const { endpoint_type, hostname, label } = bucket; | ||
|
||
const form = useForm<UpdateBucketRateLimitPayload>({ | ||
defaultValues: { | ||
rateLimit: '1', | ||
}, | ||
}); | ||
|
||
const { | ||
formState: { errors, isDirty, isSubmitting }, | ||
handleSubmit, | ||
} = form; | ||
|
||
const location = useLocation(); | ||
const history = useHistory(); | ||
const prefix = getQueryParamFromQueryString(location.search, 'prefix'); | ||
|
||
const onSubmit = () => { | ||
// TODO: OBJGen2 - Handle Bucket Rate Limit update logic once the endpoint for updating is available. | ||
// The 'data' argument is expected -> data: UpdateBucketRateLimitPayload | ||
}; | ||
|
||
return ( | ||
<FormProvider {...form}> | ||
<BucketBreadcrumb bucketName={label} history={history} prefix={prefix} /> | ||
<StyledText>{hostname || 'Loading...'}</StyledText> | ||
|
||
<StyledRootContainer> | ||
<Typography variant="h2">Bucket Rate Limits</Typography> | ||
|
||
{errors.root?.message ? ( | ||
<Notice text={errors.root?.message} variant="error" /> | ||
) : null} | ||
|
||
{/* TODO: OBJGen2 - We need to handle link in upcoming PR */} | ||
<StyledHelperText> | ||
Specifies the maximum Requests Per Second (RPS) for an Endpoint. To | ||
increase it to High,{' '} | ||
<SupportLink | ||
text="open a support ticket" | ||
title="Request to Increase Bucket Rate Limits" | ||
/> | ||
. Understand <Link to="#">bucket rate limits</Link>. | ||
</StyledHelperText> | ||
|
||
<form onSubmit={handleSubmit(onSubmit)}> | ||
<BucketRateLimitTable endpointType={endpoint_type} /> | ||
<StyledActionsPanel | ||
primaryButtonProps={{ | ||
disabled: !isDirty, | ||
label: 'Save', | ||
loading: isSubmitting, | ||
type: 'submit', | ||
}} | ||
/> | ||
</form> | ||
</StyledRootContainer> | ||
</FormProvider> | ||
); | ||
}); |
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