@@ -59,7 +59,10 @@ import {
59
59
} from "./addBucketsSlice" ;
60
60
import { addBucketAsync } from "./addBucketThunks" ;
61
61
import AddBucketName from "./AddBucketName" ;
62
- import { IAM_SCOPES } from "../../../../../common/SecureComponent/permissions" ;
62
+ import {
63
+ IAM_SCOPES ,
64
+ permissionTooltipHelper ,
65
+ } from "../../../../../common/SecureComponent/permissions" ;
63
66
import { hasPermission } from "../../../../../common/SecureComponent" ;
64
67
import BucketNamingRules from "./BucketNamingRules" ;
65
68
@@ -323,10 +326,13 @@ const AddBucket = ({ classes }: IsetProps) => {
323
326
< TooltipWrapper
324
327
tooltip = {
325
328
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
+ )
330
336
}
331
337
>
332
338
< FormSwitchWrapper
@@ -352,12 +358,13 @@ const AddBucket = ({ classes }: IsetProps) => {
352
358
tooltip = {
353
359
lockingAllowed
354
360
? ""
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
+ )
361
368
}
362
369
>
363
370
< FormSwitchWrapper
@@ -501,19 +508,27 @@ const AddBucket = ({ classes }: IsetProps) => {
501
508
onClick = { resForm }
502
509
label = { "Clear" }
503
510
/>
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
+ : ""
514
516
}
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 >
517
532
</ Grid >
518
533
{ addLoading && (
519
534
< Grid item xs = { 12 } >
0 commit comments