Disabled versioning button when site replication is enabled (#1951)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
32
portal-ui/src/icons/AlertIcon.tsx
Normal file
32
portal-ui/src/icons/AlertIcon.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import * as React from "react";
|
||||
import { SVGProps } from "react";
|
||||
|
||||
const AlertIcon = (props: SVGProps<SVGSVGElement>) => (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className={`min-icon`}
|
||||
fill={"currentcolor"}
|
||||
viewBox="0 0 256 256"
|
||||
{...props}
|
||||
>
|
||||
<path d="M125.28,0C56.09,0,0,56.09,0,125.28s56.09,125.28,125.28,125.28,125.28-56.09,125.28-125.28S194.47,0,125.28,0Zm-17.54,35.55h31.6V105.62c0,7.43-.39,14.78-1.16,22.05-.78,7.27-1.86,14.82-3.25,22.66h-22.78c-1.39-7.84-2.47-15.39-3.25-22.66-.78-7.27-1.16-14.62-1.16-22.05V35.55Zm33.81,167.7c-1.06,2.37-2.49,4.43-4.29,6.19-1.8,1.76-3.9,3.12-6.31,4.1-2.41,.98-5,1.47-7.78,1.47s-5.49-.49-7.9-1.47c-2.41-.98-4.51-2.35-6.31-4.1-1.8-1.76-3.21-3.82-4.23-6.19-1.02-2.37-1.53-4.94-1.53-7.72s.51-5.25,1.53-7.66c1.02-2.41,2.43-4.49,4.23-6.25,1.8-1.76,3.9-3.14,6.31-4.17,2.41-1.02,5.04-1.53,7.9-1.53s5.37,.51,7.78,1.53c2.41,1.02,4.51,2.41,6.31,4.17,1.79,1.76,3.22,3.84,4.29,6.25,1.06,2.41,1.59,4.96,1.59,7.66s-.53,5.35-1.59,7.72Z" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export default AlertIcon;
|
||||
32
portal-ui/src/icons/InfoIcon.tsx
Normal file
32
portal-ui/src/icons/InfoIcon.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import * as React from "react";
|
||||
import { SVGProps } from "react";
|
||||
|
||||
const InfoIcon = (props: SVGProps<SVGSVGElement>) => (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className={`min-icon`}
|
||||
fill={"currentcolor"}
|
||||
viewBox="0 0 256 256"
|
||||
{...props}
|
||||
>
|
||||
<path d="M126.32,0C56.55,0,0,56.55,0,126.32s56.55,126.32,126.32,126.32,126.32-56.55,126.32-126.32S196.08,0,126.32,0Zm13.11,197.19h-26.22V99.24h26.22v97.94Zm1.81-119.6c-.89,1.9-2.08,3.58-3.56,5.04-1.49,1.46-3.23,2.6-5.23,3.42-2,.82-4.13,1.23-6.41,1.23-2.15,0-4.2-.41-6.13-1.23-1.93-.82-3.63-1.96-5.08-3.42-1.46-1.46-2.61-3.14-3.47-5.04s-1.28-3.96-1.28-6.17,.43-4.29,1.28-6.22c.85-1.93,2.01-3.62,3.47-5.08s3.15-2.6,5.08-3.42c1.93-.82,3.97-1.24,6.13-1.24,2.28,0,4.42,.41,6.41,1.24,2,.82,3.74,1.96,5.23,3.42,1.49,1.46,2.67,3.15,3.56,5.08,.89,1.93,1.33,4.01,1.33,6.22s-.44,4.27-1.33,6.17Z" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export default InfoIcon;
|
||||
@@ -190,3 +190,5 @@ export { default as RemoveAllIcon } from "./RemoveAllIcon";
|
||||
export { default as CancelledIcon } from "./CancelledIcon";
|
||||
export { default as EditTagIcon } from "./EditTagIcon";
|
||||
export { default as LinkIcon } from "./LinkIcon";
|
||||
export { default as AlertIcon } from "./AlertIcon";
|
||||
export { default as InfoIcon } from "./InfoIcon";
|
||||
|
||||
@@ -47,13 +47,14 @@ import FormSwitchWrapper from "../../Common/FormComponents/FormSwitchWrapper/For
|
||||
import { ErrorResponseHandler } from "../../../../common/types";
|
||||
import PageHeader from "../../Common/PageHeader/PageHeader";
|
||||
import BackLink from "../../../../common/BackLink";
|
||||
import { BucketsIcon } from "../../../../icons";
|
||||
import { BucketsIcon, InfoIcon } from "../../../../icons";
|
||||
import { setErrorSnackMessage } from "../../../../actions";
|
||||
import PageLayout from "../../Common/Layout/PageLayout";
|
||||
import InputUnitMenu from "../../Common/FormComponents/InputUnitMenu/InputUnitMenu";
|
||||
import FormLayout from "../../Common/FormLayout";
|
||||
import HelpBox from "../../../../common/HelpBox";
|
||||
import SectionTitle from "../../Common/SectionTitle";
|
||||
import { SRInfoStateType } from "../../../../types";
|
||||
|
||||
const styles = (theme: Theme) =>
|
||||
createStyles({
|
||||
@@ -70,6 +71,20 @@ const styles = (theme: Theme) =>
|
||||
padding: 8,
|
||||
borderRadius: 3,
|
||||
},
|
||||
alertVersioning: {
|
||||
border: "#E2E2E2 1px solid",
|
||||
backgroundColor: "#FBFAFA",
|
||||
borderRadius: 3,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
padding: "10px",
|
||||
color: "#767676",
|
||||
"& > .min-icon ": {
|
||||
width: 20,
|
||||
height: 20,
|
||||
marginRight: 10,
|
||||
},
|
||||
},
|
||||
title: {
|
||||
marginBottom: 8,
|
||||
},
|
||||
@@ -112,6 +127,7 @@ interface IAddBucketProps {
|
||||
retentionUnit: string;
|
||||
retentionValidity: number;
|
||||
distributedSetup: boolean;
|
||||
siteReplicationInfo: SRInfoStateType;
|
||||
}
|
||||
|
||||
const AddBucket = ({
|
||||
@@ -140,6 +156,7 @@ const AddBucket = ({
|
||||
retentionUnit,
|
||||
retentionValidity,
|
||||
distributedSetup,
|
||||
siteReplicationInfo,
|
||||
}: IAddBucketProps) => {
|
||||
const [addLoading, setAddLoading] = useState<boolean>(false);
|
||||
const [sendEnabled, setSendEnabled] = useState<boolean>(false);
|
||||
@@ -155,7 +172,10 @@ const AddBucket = ({
|
||||
|
||||
let request: MakeBucketRequest = {
|
||||
name: bucketName,
|
||||
versioning: distributedSetup ? versioningEnabled : false,
|
||||
versioning:
|
||||
distributedSetup && !siteReplicationInfo.enabled
|
||||
? versioningEnabled
|
||||
: false,
|
||||
locking: distributedSetup ? lockingEnabled : false,
|
||||
};
|
||||
|
||||
@@ -346,6 +366,16 @@ const AddBucket = ({
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={12}>
|
||||
{siteReplicationInfo.enabled && (
|
||||
<Fragment>
|
||||
<br />
|
||||
<div className={classes.alertVersioning}>
|
||||
<InfoIcon /> Versioning setting cannot be changed as
|
||||
cluster replication is enabled for this site.
|
||||
</div>
|
||||
<br />
|
||||
</Fragment>
|
||||
)}
|
||||
<FormSwitchWrapper
|
||||
value="versioned"
|
||||
id="versioned"
|
||||
@@ -355,7 +385,11 @@ const AddBucket = ({
|
||||
addBucketVersioned(event.target.checked);
|
||||
}}
|
||||
label={"Versioning"}
|
||||
disabled={!distributedSetup || lockingEnabled}
|
||||
disabled={
|
||||
!distributedSetup ||
|
||||
lockingEnabled ||
|
||||
siteReplicationInfo.enabled
|
||||
}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
@@ -367,7 +401,7 @@ const AddBucket = ({
|
||||
checked={lockingEnabled}
|
||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
enableObjectLocking(event.target.checked);
|
||||
if (event.target.checked) {
|
||||
if (event.target.checked && !siteReplicationInfo.enabled) {
|
||||
addBucketVersioned(true);
|
||||
}
|
||||
}}
|
||||
@@ -525,6 +559,7 @@ const mapState = (state: AppState) => ({
|
||||
retentionUnit: state.buckets.addBucketRetentionUnit,
|
||||
retentionValidity: state.buckets.addBucketRetentionValidity,
|
||||
distributedSetup: state.system.distributedSetup,
|
||||
siteReplicationInfo: state.system.siteReplicationInfo,
|
||||
});
|
||||
|
||||
const connector = connect(mapState, {
|
||||
|
||||
@@ -163,6 +163,12 @@ const IconsScreen = ({ classes }: IIconsScreenSimple) => {
|
||||
AddNewTagIcon
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={3} sm={2} md={1}>
|
||||
<cicons.AlertIcon />
|
||||
<br />
|
||||
AlertIcon
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={3} sm={2} md={1}>
|
||||
<cicons.AllBucketsIcon />
|
||||
<br />
|
||||
@@ -625,6 +631,12 @@ const IconsScreen = ({ classes }: IIconsScreenSimple) => {
|
||||
IAMPoliciesIcon
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={3} sm={2} md={1}>
|
||||
<cicons.InfoIcon />
|
||||
<br />
|
||||
InfoIcon
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={3} sm={2} md={1}>
|
||||
<cicons.JSONIcon />
|
||||
<br />
|
||||
|
||||
Reference in New Issue
Block a user