From 942b8101cc2c6e142c52ea5186d86a381cce6ee7 Mon Sep 17 00:00:00 2001 From: Prakash Senthil Vel <23444145+prakashsvmx@users.noreply.github.com> Date: Wed, 7 Feb 2024 23:05:25 +0530 Subject: [PATCH] Fix lifecycle rule and edit modal to be consistent to display tier (#3227) --- .../EditLifecycleConfiguration.tsx | 378 +++++++++--------- 1 file changed, 192 insertions(+), 186 deletions(-) diff --git a/web-app/src/screens/Console/Buckets/BucketDetails/EditLifecycleConfiguration.tsx b/web-app/src/screens/Console/Buckets/BucketDetails/EditLifecycleConfiguration.tsx index 7f39546f8..175765acc 100644 --- a/web-app/src/screens/Console/Buckets/BucketDetails/EditLifecycleConfiguration.tsx +++ b/web-app/src/screens/Console/Buckets/BucketDetails/EditLifecycleConfiguration.tsx @@ -23,6 +23,7 @@ import { Grid, InputBox, LifecycleConfigIcon, + Loader, ProgressBar, RadioGroup, Select, @@ -70,10 +71,10 @@ const EditLifecycleConfiguration = ({ const [expandedAdv, setExpandedAdv] = useState(false); const [expanded, setExpanded] = useState(false); - /*To be removed on component replacement*/ - const formFieldRowFilter = { - "& .MuiPaper-root": { padding: 0 }, - }; + const ILM_TYPES = [ + { value: "expiry", label: "Expiry" }, + { value: "transition", label: "Transition" }, + ]; useEffect(() => { if (loadingTiers) { @@ -317,214 +318,219 @@ const EditLifecycleConfiguration = ({ title={"Edit Lifecycle Configuration"} titleIcon={} > -
) => { - saveRecord(e); - }} - > - - { - setEnabled(e.target.checked); - }} - /> - {}} - disabled - /> - {}} - disableOptions - /> - - {}} - disabled - /> - - {ilmType === "expiry" && lifecycleRule.expiration?.days && ( - ) => { - setExpiryDays(e.target.value); + {!loadingTiers ? ( + ) => { + saveRecord(e); + }} + > + + { + setEnabled(e.target.checked); }} - label="Expiry Days" - value={expiryDays} - min="0" /> - )} + {}} + disabled + /> + {ilmType ? ( + {}} + disableOptions + /> + ) : null} - {ilmType === "expiry" && - lifecycleRule.expiration?.noncurrent_expiration_days && ( + {}} + disabled + /> + + {ilmType === "expiry" && lifecycleRule.expiration?.days && ( ) => { - setNCExpirationDays(e.target.value); + setExpiryDays(e.target.value); }} - label="Non-current Expiration Days" - value={NCExpirationDays} + label="Expiry Days" + value={expiryDays} min="0" /> )} - {ilmType === "transition" && lifecycleRule.transition?.days && ( - - ) => { - setTransitionDays(e.target.value); - }} - label="Transition Days" - value={transitionDays} - min="0" - /> - { + setStorageClass(value); }} - placeholder="Set Non-current Version Transition Storage Class" - label="Non-current Version Transition Storage Class" - value={NCTransitionSC} + options={tiersList} /> )} - - setExpanded(!expanded)} - > - ) => { - setPrefix(e.target.value); - }} - label="Prefix" - value={prefix} - /> - { - setTags(vl); - }} - keyPlaceholder="Tag Key" - valuePlaceholder="Tag Value" - withBorder - /> - - - {ilmType === "expiry" && - lifecycleRule.expiration?.noncurrent_expiration_days && ( - - setExpandedAdv(!expandedAdv)} - sx={{ marginTop: 15 }} - > - ) => { - setExpiredObjectDM(event.target.checked); + + {ilmType === "transition" && + lifecycleRule.transition?.noncurrent_transition_days && ( + + ) => { + setNCTransitionDays(e.target.value); }} - label={"Expired Object Delete Marker"} + label="Non-current Transition Days" + value={NCTransitionDays} + min="0" /> - + ) => { + setNCTransitionSC(e.target.value); + }} + placeholder="Set Non-current Version Transition Storage Class" + label="Non-current Version Transition Storage Class" + value={NCTransitionSC} + /> + + )} + + setExpanded(!expanded)} + > + ) => { + setPrefix(e.target.value); + }} + label="Prefix" + value={prefix} + /> + { + setTags(vl); + }} + keyPlaceholder="Tag Key" + valuePlaceholder="Tag Value" + withBorder + /> + + + {ilmType === "expiry" && + lifecycleRule.expiration?.noncurrent_expiration_days && ( + + setExpandedAdv(!expandedAdv)} + sx={{ marginTop: 15 }} + > + , + ) => { + setExpiredObjectDM(event.target.checked); + }} + label={"Expired Object Delete Marker"} + /> + + + )} + +