diff --git a/CHANGELOG.md b/CHANGELOG.md index aef3a338..fcbe3756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - UI Updates for the integrations page ([#2310](https://github.com/grafana/oncall/pull/2310)) +- Prefer shift start when displaying rotation start value for existing shifts ([#2316](https://github.com/grafana/oncall/pull/2316)) + +### Fixed + +- Fixed minor schedule preview issue missing last day ([#2316](https://github.com/grafana/oncall/pull/2316)) ## v1.2.46 (2023-06-22) diff --git a/grafana-plugin/src/containers/RotationForm/RotationForm.tsx b/grafana-plugin/src/containers/RotationForm/RotationForm.tsx index df9ac68b..7f818997 100644 --- a/grafana-plugin/src/containers/RotationForm/RotationForm.tsx +++ b/grafana-plugin/src/containers/RotationForm/RotationForm.tsx @@ -370,10 +370,11 @@ const RotationForm = observer((props: RotationFormProps) => { useEffect(() => { if (shift) { setRotationName(getShiftName(shift)); - const rotationStart = getDateTime(shift.rotation_start); - setRotationStart(rotationStart); - setRotationEnd(shift.until ? getDateTime(shift.until) : getDateTime(shift.shift_start).add(1, 'month')); const shiftStart = getDateTime(shift.shift_start); + // use shiftStart as rotationStart for existing shifts + // (original rotationStart defaulted to the shift creation timestamp) + setRotationStart(shiftStart); + setRotationEnd(shift.until ? getDateTime(shift.until) : getDateTime(shift.shift_start).add(1, 'month')); setShiftStart(shiftStart); const shiftEnd = getDateTime(shift.shift_end); setShiftEnd(shiftEnd); diff --git a/grafana-plugin/src/models/schedule/schedule.ts b/grafana-plugin/src/models/schedule/schedule.ts index c0a9ec48..4071088f 100644 --- a/grafana-plugin/src/models/schedule/schedule.ts +++ b/grafana-plugin/src/models/schedule/schedule.ts @@ -252,7 +252,7 @@ export class ScheduleStore extends BaseStore { const dayBefore = startMoment.subtract(1, 'day'); const response = await makeRequest(`/oncall_shifts/preview/`, { - params: { date: getFromString(dayBefore) }, + params: { date: getFromString(dayBefore), days: 8 }, data: { type, schedule: scheduleId, shift_pk: shiftId === 'new' ? undefined : shiftId, ...params }, method: 'POST', });