1414// You should have received a copy of the GNU Affero General Public License
1515// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17- import React , { useEffect , useState , Fragment } from "react" ;
17+ import React , { Fragment , useEffect , useState } from "react" ;
1818import { connect } from "react-redux" ;
1919import { createStyles , Theme , withStyles } from "@material-ui/core/styles" ;
20- import { Button , IconButton , TextField } from "@material-ui/core" ;
20+ import { Button , TextField } from "@material-ui/core" ;
2121import * as reactMoment from "react-moment" ;
2222import get from "lodash/get" ;
2323import Paper from "@material-ui/core/Paper" ;
2424import Grid from "@material-ui/core/Grid" ;
2525import Tabs from "@material-ui/core/Tabs" ;
2626import Tab from "@material-ui/core/Tab" ;
2727import CircularProgress from "@material-ui/core/CircularProgress" ;
28- import Checkbox from "@material-ui/core/Checkbox" ;
2928import Typography from "@material-ui/core/Typography" ;
3029import api from "../../../../common/api" ;
3130import {
@@ -65,7 +64,6 @@ import TableWrapper from "../../Common/TableWrapper/TableWrapper";
6564import AddReplicationModal from "./AddReplicationModal" ;
6665import PageHeader from "../../Common/PageHeader/PageHeader" ;
6766import EnableBucketEncryption from "./EnableBucketEncryption" ;
68- import PencilIcon from "../../Common/TableWrapper/TableActionIcons/PencilIcon" ;
6967import EnableVersioningModal from "./EnableVersioningModal" ;
7068import UsageIcon from "../../../../icons/UsageIcon" ;
7169import AddPolicy from "../../Policies/AddPolicy" ;
@@ -265,6 +263,8 @@ const ViewBucket = ({
265263 const [ isVersioned , setIsVersioned ] = useState < boolean > ( false ) ;
266264 const [ hasObjectLocking , setHasObjectLocking ] = useState < boolean > ( false ) ;
267265 const [ encryptionEnabled , setEncryptionEnabled ] = useState < boolean > ( false ) ;
266+ const [ encryptionCfg , setEncryptionCfg ] =
267+ useState < BucketEncryptionInfo | null > ( null ) ;
268268 const [ retentionConfigOpen , setRetentionConfigOpen ] =
269269 useState < boolean > ( false ) ;
270270 const [ policyEdit , setPolicyEdit ] = useState < any > ( null ) ;
@@ -477,6 +477,7 @@ const ViewBucket = ({
477477 . then ( ( res : BucketEncryptionInfo ) => {
478478 if ( res . algorithm ) {
479479 setEncryptionEnabled ( true ) ;
480+ setEncryptionCfg ( res ) ;
480481 }
481482 setLoadingEncryption ( false ) ;
482483 } )
@@ -485,6 +486,7 @@ const ViewBucket = ({
485486 err === "The server side encryption configuration was not found"
486487 ) {
487488 setEncryptionEnabled ( false ) ;
489+ setEncryptionCfg ( null ) ;
488490 }
489491 setLoadingEncryption ( false ) ;
490492 } ) ;
@@ -718,6 +720,7 @@ const ViewBucket = ({
718720 open = { enableEncryptionScreenOpen }
719721 selectedBucket = { bucketName }
720722 encryptionEnabled = { encryptionEnabled }
723+ encryptionCfg = { encryptionCfg }
721724 closeModalAndRefresh = { closeEnableBucketEncryption }
722725 />
723726 ) }
@@ -846,15 +849,23 @@ const ViewBucket = ({
846849 </ td >
847850 < td > Encryption:</ td >
848851 < td >
849- < Checkbox
850- color = "primary"
851- className = { classes . encCheckbox }
852- inputProps = { {
853- "aria-label" : "secondary checkbox" ,
854- } }
855- onChange = { ( event ) => handleEncryptionCheckbox ( event ) }
856- checked = { encryptionEnabled }
857- />
852+ { loadingEncryption ? (
853+ < CircularProgress
854+ color = "primary"
855+ size = { 16 }
856+ variant = "indeterminate"
857+ />
858+ ) : (
859+ < Button
860+ color = "primary"
861+ className = { classes . anchorButton }
862+ onClick = { ( ) => {
863+ setEnableEncryptionScreenOpen ( true ) ;
864+ } }
865+ >
866+ { encryptionEnabled ? "Enabled" : "Disabled" }
867+ </ Button >
868+ ) }
858869 </ td >
859870 </ tr >
860871 < tr >
@@ -880,10 +891,10 @@ const ViewBucket = ({
880891 </ Grid >
881892 < Grid xs = { 3 } className = { classes . reportedUsage } >
882893 < Grid container direction = "row" alignItems = "center" >
883- < Grid item className = { classes . icon } >
894+ < Grid item className = { classes . icon } xs = { 2 } >
884895 < UsageIcon />
885896 </ Grid >
886- < Grid item >
897+ < Grid item xs = { 10 } >
887898 < Typography className = { classes . elementTitle } >
888899 Reported Usage
889900 </ Typography >
@@ -914,17 +925,13 @@ const ViewBucket = ({
914925 />
915926 ) : (
916927 < Fragment >
917- { isVersioned && ! loadingVersioning ? "Yes" : "No" }
918-
919- < IconButton
928+ < Button
920929 color = "primary"
921- aria-label = "retention"
922- size = "small"
923- className = { classes . propertiesIcon }
930+ className = { classes . anchorButton }
924931 onClick = { setBucketVersioning }
925932 >
926- < PencilIcon active = { true } />
927- </ IconButton >
933+ { isVersioned ? "Enabled" : "Disabled" }
934+ </ Button >
928935 </ Fragment >
929936 ) }
930937 </ td >
@@ -954,18 +961,15 @@ const ViewBucket = ({
954961 />
955962 ) : (
956963 < Fragment >
957-
958- < IconButton
964+ < Button
959965 color = "primary"
960- aria-label = "retention"
961- size = "small"
962- className = { classes . propertiesIcon }
966+ className = { classes . anchorButton }
963967 onClick = { ( ) => {
964968 setRetentionConfigOpen ( true ) ;
965969 } }
966970 >
967- < PencilIcon active = { true } />
968- </ IconButton >
971+ Configure
972+ </ Button >
969973 </ Fragment >
970974 ) }
971975 </ td >
0 commit comments