Add Bucket tooltip improvements (#2326)
This commit is contained in:
@@ -427,3 +427,13 @@ export const IAM_PAGES_PERMISSIONS = {
|
|||||||
|
|
||||||
export const S3_ALL_RESOURCES = "arn:aws:s3:::*";
|
export const S3_ALL_RESOURCES = "arn:aws:s3:::*";
|
||||||
export const CONSOLE_UI_RESOURCE = "console-ui";
|
export const CONSOLE_UI_RESOURCE = "console-ui";
|
||||||
|
|
||||||
|
export const permissionTooltipHelper = (scopes: string[], name: string) => {
|
||||||
|
return (
|
||||||
|
"You require additional permissions in order to enable " +
|
||||||
|
name +
|
||||||
|
". Please ask your MinIO administrator to grant you " +
|
||||||
|
scopes +
|
||||||
|
" permission in order to enable Versioning."
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@@ -59,7 +59,10 @@ import {
|
|||||||
} from "./addBucketsSlice";
|
} from "./addBucketsSlice";
|
||||||
import { addBucketAsync } from "./addBucketThunks";
|
import { addBucketAsync } from "./addBucketThunks";
|
||||||
import AddBucketName from "./AddBucketName";
|
import AddBucketName from "./AddBucketName";
|
||||||
import { IAM_SCOPES } from "../../../../../common/SecureComponent/permissions";
|
import {
|
||||||
|
IAM_SCOPES,
|
||||||
|
permissionTooltipHelper,
|
||||||
|
} from "../../../../../common/SecureComponent/permissions";
|
||||||
import { hasPermission } from "../../../../../common/SecureComponent";
|
import { hasPermission } from "../../../../../common/SecureComponent";
|
||||||
import BucketNamingRules from "./BucketNamingRules";
|
import BucketNamingRules from "./BucketNamingRules";
|
||||||
|
|
||||||
@@ -323,10 +326,13 @@ const AddBucket = ({ classes }: IsetProps) => {
|
|||||||
<TooltipWrapper
|
<TooltipWrapper
|
||||||
tooltip={
|
tooltip={
|
||||||
versioningAllowed
|
versioningAllowed
|
||||||
? ""
|
? lockingEnabled && versioningEnabled
|
||||||
: "You require additional permissions in order to enable Versioning. Please ask your MinIO administrator to grant you " +
|
? "You must disable Locking before Versioning can be disabled"
|
||||||
IAM_SCOPES.S3_PUT_BUCKET_VERSIONING +
|
: ""
|
||||||
" permission in order to enable Versioning."
|
: permissionTooltipHelper(
|
||||||
|
[IAM_SCOPES.S3_PUT_BUCKET_VERSIONING],
|
||||||
|
"Versioning"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<FormSwitchWrapper
|
<FormSwitchWrapper
|
||||||
@@ -352,12 +358,13 @@ const AddBucket = ({ classes }: IsetProps) => {
|
|||||||
tooltip={
|
tooltip={
|
||||||
lockingAllowed
|
lockingAllowed
|
||||||
? ""
|
? ""
|
||||||
: "You require additional permissions in order to enable Locking. Please ask your MinIO administrator to grant you " +
|
: permissionTooltipHelper(
|
||||||
(versioningAllowed
|
[
|
||||||
? ""
|
IAM_SCOPES.S3_PUT_BUCKET_VERSIONING,
|
||||||
: IAM_SCOPES.S3_PUT_BUCKET_VERSIONING + " and ") +
|
IAM_SCOPES.S3_PUT_BUCKET_OBJECT_LOCK_CONFIGURATION,
|
||||||
IAM_SCOPES.S3_PUT_BUCKET_OBJECT_LOCK_CONFIGURATION +
|
],
|
||||||
" permissions in order to enable Locking."
|
"Locking"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<FormSwitchWrapper
|
<FormSwitchWrapper
|
||||||
@@ -501,19 +508,27 @@ const AddBucket = ({ classes }: IsetProps) => {
|
|||||||
onClick={resForm}
|
onClick={resForm}
|
||||||
label={"Clear"}
|
label={"Clear"}
|
||||||
/>
|
/>
|
||||||
<Button
|
<TooltipWrapper
|
||||||
id={"create-bucket"}
|
tooltip={
|
||||||
type="submit"
|
invalidFields.length > 0 || !isDirty || hasErrors
|
||||||
variant="callAction"
|
? "You must apply a valid name to the bucket"
|
||||||
color="primary"
|
: ""
|
||||||
disabled={
|
|
||||||
addLoading ||
|
|
||||||
invalidFields.length > 0 ||
|
|
||||||
!isDirty ||
|
|
||||||
hasErrors
|
|
||||||
}
|
}
|
||||||
label={"Create Bucket"}
|
>
|
||||||
/>
|
<Button
|
||||||
|
id={"create-bucket"}
|
||||||
|
type="submit"
|
||||||
|
variant="callAction"
|
||||||
|
color="primary"
|
||||||
|
disabled={
|
||||||
|
addLoading ||
|
||||||
|
invalidFields.length > 0 ||
|
||||||
|
!isDirty ||
|
||||||
|
hasErrors
|
||||||
|
}
|
||||||
|
label={"Create Bucket"}
|
||||||
|
/>
|
||||||
|
</TooltipWrapper>
|
||||||
</Grid>
|
</Grid>
|
||||||
{addLoading && (
|
{addLoading && (
|
||||||
<Grid item xs={12}>
|
<Grid item xs={12}>
|
||||||
|
|||||||
Reference in New Issue
Block a user