Skip to content

Commit

Permalink
fixed repo name in snapshot flyout; schedule entry during ploicy edit (
Browse files Browse the repository at this point in the history
…#824)

Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
  • Loading branch information
amsiglan committed Jul 24, 2023
1 parent cdb2f21 commit 274d9bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ const CronSchedule = ({
const [dayOfWeek, setWeek] = useState(initWeek);
const [dayOfMonth, setMonth] = useState(initMonth);

// When edit policy is clicked, during the initial render DEFAULT values get passed
// As a result when the actual policy details are passed, the state does not get updated and we end up
// showing incorrect values in schedule controls.
if (initHour !== hour) {
setHour(initHour);
}

if (initMin !== minute) {
setMinute(initMin);
}

if (initWeek !== dayOfWeek) {
setWeek(initWeek);
}

if (initMonth !== dayOfMonth) {
setMonth(initMonth);
}

useEffect(() => {
changeCron();
}, [minute, hour, dayOfWeek, dayOfMonth]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class SnapshotFlyout extends Component<SnapshotFlyoutProps, Snaps
};

render() {
const { onCloseFlyout } = this.props;
const { onCloseFlyout, repository } = this.props;
const { snapshot } = this.state;

const items1 = [
Expand All @@ -78,7 +78,7 @@ export default class SnapshotFlyout extends Component<SnapshotFlyoutProps, Snaps
const items2 = [
{ term: "Start time", value: snapshot?.start_time },
{ term: "End time", value: snapshot?.end_time },
{ term: "Repository", value: snapshot?.snapshot },
{ term: "Repository", value: repository },
{
term: "Policy",
value: (
Expand Down

0 comments on commit 274d9bc

Please sign in to comment.