Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions models/bucket_replication_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions models/multi_bucket_replication.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 94 additions & 0 deletions models/multi_bucket_replication_edit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const AddReplicationModal = ({
const [useTLS, setUseTLS] = useState<boolean>(true);
const [repDeleteMarker, setRepDeleteMarker] = useState<boolean>(true);
const [repDelete, setRepDelete] = useState<boolean>(true);
const [metadataSync, setMetadataSync] = useState<boolean>(true);
const [tags, setTags] = useState<string>("");
const [replicationMode, setReplicationMode] = useState<string>("async");
const [bandwidthScalar, setBandwidthScalar] = useState<string>("100");
Expand Down Expand Up @@ -148,6 +149,8 @@ const AddReplicationModal = ({
replicateDeleteMarkers: repDeleteMarker,
replicateDeletes: repDelete,
priority: parseInt(priority),
storageClass: targetStorageClass,
replicateMetadata: metadataSync,
};

api
Expand Down Expand Up @@ -343,6 +346,22 @@ const AddReplicationModal = ({
value={healthCheck}
/>
</Grid>
<Grid
item
xs={12}
className={`${classes.spacerTop} ${classes.formFieldRow}`}
>
<InputBoxWrapper
id="storageClass"
name="storageClass"
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setTargetStorageClass(e.target.value);
}}
placeholder="STANDARD_IA,REDUCED_REDUNDANCY etc"
label="Storage Class"
value={targetStorageClass}
/>
</Grid>
<Grid item xs={12}>
<fieldset className={classes.fieldGroup}>
<legend className={classes.descriptionText}>
Expand Down Expand Up @@ -375,29 +394,23 @@ const AddReplicationModal = ({
</Grid>
</fieldset>
</Grid>

<Grid
item
xs={12}
className={`${classes.spacerTop} ${classes.formFieldRow}`}
>
<InputBoxWrapper
id="storageClass"
name="storageClass"
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
setTargetStorageClass(e.target.value);
}}
placeholder="STANDARD_IA,REDUCED_REDUNDANCY etc"
label="Storage Class"
value={targetStorageClass}
/>
</Grid>
<Grid item xs={12}>
<fieldset className={classes.fieldGroup}>
<legend className={classes.descriptionText}>
Replication Options
</legend>
<Grid item xs={12} className={classes.formFieldRow}>
<FormSwitchWrapper
checked={metadataSync}
id="metadatataSync"
name="metadatataSync"
label="Metadata Sync"
onChange={(e) => {
setMetadataSync(e.target.checked);
}}
value={metadataSync}
description={"Metadata Sync"}
/>
<FormSwitchWrapper
checked={repDeleteMarker}
id="deleteMarker"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { IAM_SCOPES } from "../../../../common/SecureComponent/permissions";

import withSuspense from "../../Common/Components/withSuspense";
import RBIconButton from "./SummaryItems/RBIconButton";
import EditReplicationModal from "./EditReplicationModal";

const AddReplicationModal = withSuspense(
React.lazy(() => import("./AddReplicationModal"))
Expand Down Expand Up @@ -86,6 +87,8 @@ const BucketReplicationPanel = ({
const [deleteReplicationModal, setDeleteReplicationModal] =
useState<boolean>(false);
const [openSetReplication, setOpenSetReplication] = useState<boolean>(false);
const [editReplicationModal, setEditReplicationModal] =
useState<boolean>(false);
const [selectedRRule, setSelectedRRule] = useState<string>("");

const bucketName = match.params["bucketName"];
Expand All @@ -107,6 +110,9 @@ const BucketReplicationPanel = ({
.invoke("GET", `/api/v1/buckets/${bucketName}/replication`)
.then((res: BucketReplication) => {
const r = res.rules ? res.rules : [];

r.sort((a, b) => a.priority - b.priority);

setReplicationRules(r);
setLoadingReplication(false);
})
Expand Down Expand Up @@ -142,11 +148,24 @@ const BucketReplicationPanel = ({
}
};

const closeEditReplication = (refresh: boolean) => {
setEditReplicationModal(false);

if (refresh) {
setLoadingReplication(true);
}
};

const confirmDeleteReplication = (replication: BucketReplicationRule) => {
setSelectedRRule(replication.id);
setDeleteReplicationModal(true);
};

const editReplicationRule = (replication: BucketReplicationRule) => {
setSelectedRRule(replication.id);
setEditReplicationModal(true);
};

const ruleDestDisplay = (events: BucketReplicationDestination) => {
return <Fragment>{events.bucket.replace("arn:aws:s3:::", "")}</Fragment>;
};
Expand All @@ -161,6 +180,11 @@ const BucketReplicationPanel = ({
onClick: confirmDeleteReplication,
disableButtonFunction: () => replicationRules.length === 1,
},
{
type: "view",
onClick: editReplicationRule,
disableButtonFunction: !hasPermission(bucketName, [IAM_SCOPES.S3_PUT_REPLICATION_CONFIGURATION], true),
},
];

return (
Expand All @@ -182,6 +206,15 @@ const BucketReplicationPanel = ({
ruleToDelete={selectedRRule}
/>
)}

{editReplicationModal && (
<EditReplicationModal
closeModalAndRefresh={closeEditReplication}
open={editReplicationModal}
bucketName={bucketName}
ruleID={selectedRRule}
/>
)}
<Grid container>
<Grid item xs={12} className={classes.actionsTray}>
<PanelTitle>Replication</PanelTitle>
Expand Down Expand Up @@ -215,6 +248,8 @@ const BucketReplicationPanel = ({
{
label: "Priority",
elementKey: "priority",
width: 55,
contentTextAlign: "center",
},
{
label: "Destination",
Expand All @@ -224,19 +259,22 @@ const BucketReplicationPanel = ({
{
label: "Prefix",
elementKey: "prefix",
width: 200,
},
{
label: "Tags",
elementKey: "tags",
renderFunction: tagDisplay,
width: 60,
},
{ label: "Status", elementKey: "status" },
{ label: "Status", elementKey: "status", width: 100 },
]}
isLoading={loadingReplication}
records={replicationRules}
entityName="Replication Rules"
idField="id"
customPaperHeight={classes.twHeight}
textSelectable
/>
</SecureComponent>
</Grid>
Expand Down
Loading