Skip to content

Commit

Permalink
GUI S3 Objects lifecycle (#2759): transitions modified check - fix, m… (
Browse files Browse the repository at this point in the history
#2849)

* GUI S3 Objects lifecycle (#2759): transitions modified check - fix, minor style adjustments

* small fix
  • Loading branch information
AleksandrGorodetskii authored Oct 4, 2022
1 parent f2300fc commit 315beba
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,17 @@ class NotificationForm extends React.Component {
type="flex"
align="middle"
>
<Col offset={3}>
<Col
{...fullWidthLayout.labelCol}
style={{
padding: '0px 10px 3px 0px',
textAlign: 'right'
}}
>
Subject:
</Col>
<Col>
<Col {...fullWidthLayout.wrapperCol}>
<EmailPreview
style={{marginLeft: 5}}
iFrameStyle={{
height: 34,
width: '100%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,21 @@ class LifeCycleEditModal extends React.Component {
comparerFn = ((a, b) => a === b)
) => {
const fieldValue = form.getFieldValue(formPath);
return !compareArrays(initialValue, fieldValue, comparerFn);
return !compareArrays(fieldValue, initialValue, comparerFn);
};
const transitionsModified = () => {
const transitions = (form.getFieldValue('transitions') || [])
.filter(Boolean);
const initialTransitions = initialRule.transitions || [];
if (transitions.length !== initialTransitions.length) {
return true;
}
return transitions.some((current, index) => {
const initial = initialTransitions[index] || {};
return current.storageClass !== initial.storageClass ||
`${current.transitionAfterDays}` !== `${initial.transitionAfterDays}` ||
moment(current.transitionDate).diff(initial.transitionDate, 'days') !== 0;
});
};
return stringFieldModified('notification.body', notification.body) ||
stringFieldModified('notification.disabled', !notification.enabled) ||
Expand All @@ -154,12 +168,7 @@ class LifeCycleEditModal extends React.Component {
stringFieldModified('pathGlob', initialRule.pathGlob) ||
objectFieldModified('transitionCriterion', initialRule.transitionCriterion) ||
stringFieldModified('transitionMethod', initialRule.transitionMethod) ||
arrayFieldModified(
'transitions',
initialRule.transitions,
(a, b) => (a.storageClass === b.storageClass &&
a.transitionAfterDays === b.transitionAfterDays)
) ||
transitionsModified() ||
arrayFieldModified(
'notification.recipients',
(initialRule.notification || {}).recipients,
Expand Down

0 comments on commit 315beba

Please sign in to comment.