@@ -59,7 +59,10 @@ import {
5959} from "./addBucketsSlice" ;
6060import { addBucketAsync } from "./addBucketThunks" ;
6161import AddBucketName from "./AddBucketName" ;
62- import { IAM_SCOPES } from "../../../../../common/SecureComponent/permissions" ;
62+ import {
63+ IAM_SCOPES ,
64+ permissionTooltipHelper ,
65+ } from "../../../../../common/SecureComponent/permissions" ;
6366import { hasPermission } from "../../../../../common/SecureComponent" ;
6467import BucketNamingRules from "./BucketNamingRules" ;
6568
@@ -323,10 +326,13 @@ const AddBucket = ({ classes }: IsetProps) => {
323326 < TooltipWrapper
324327 tooltip = {
325328 versioningAllowed
326- ? ""
327- : "You require additional permissions in order to enable Versioning. Please ask your MinIO administrator to grant you " +
328- IAM_SCOPES . S3_PUT_BUCKET_VERSIONING +
329- " permission in order to enable Versioning."
329+ ? lockingEnabled && versioningEnabled
330+ ? "You must disable Locking before Versioning can be disabled"
331+ : ""
332+ : permissionTooltipHelper (
333+ [ IAM_SCOPES . S3_PUT_BUCKET_VERSIONING ] ,
334+ "Versioning"
335+ )
330336 }
331337 >
332338 < FormSwitchWrapper
@@ -352,12 +358,13 @@ const AddBucket = ({ classes }: IsetProps) => {
352358 tooltip = {
353359 lockingAllowed
354360 ? ""
355- : "You require additional permissions in order to enable Locking. Please ask your MinIO administrator to grant you " +
356- ( versioningAllowed
357- ? ""
358- : IAM_SCOPES . S3_PUT_BUCKET_VERSIONING + " and " ) +
359- IAM_SCOPES . S3_PUT_BUCKET_OBJECT_LOCK_CONFIGURATION +
360- " permissions in order to enable Locking."
361+ : permissionTooltipHelper (
362+ [
363+ IAM_SCOPES . S3_PUT_BUCKET_VERSIONING ,
364+ IAM_SCOPES . S3_PUT_BUCKET_OBJECT_LOCK_CONFIGURATION ,
365+ ] ,
366+ "Locking"
367+ )
361368 }
362369 >
363370 < FormSwitchWrapper
@@ -501,19 +508,27 @@ const AddBucket = ({ classes }: IsetProps) => {
501508 onClick = { resForm }
502509 label = { "Clear" }
503510 />
504- < Button
505- id = { "create-bucket" }
506- type = "submit"
507- variant = "callAction"
508- color = "primary"
509- disabled = {
510- addLoading ||
511- invalidFields . length > 0 ||
512- ! isDirty ||
513- hasErrors
511+ < TooltipWrapper
512+ tooltip = {
513+ invalidFields . length > 0 || ! isDirty || hasErrors
514+ ? "You must apply a valid name to the bucket"
515+ : ""
514516 }
515- label = { "Create Bucket" }
516- />
517+ >
518+ < Button
519+ id = { "create-bucket" }
520+ type = "submit"
521+ variant = "callAction"
522+ color = "primary"
523+ disabled = {
524+ addLoading ||
525+ invalidFields . length > 0 ||
526+ ! isDirty ||
527+ hasErrors
528+ }
529+ label = { "Create Bucket" }
530+ />
531+ </ TooltipWrapper >
517532 </ Grid >
518533 { addLoading && (
519534 < Grid item xs = { 12 } >
0 commit comments