Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.6] Fixed repo name in snapshot flyout; Use schedule from policy during edit #832

Merged
merged 1 commit into from
Sep 6, 2023
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
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
Loading