From bee99437063904aaa3c499752d8f688633f54326 Mon Sep 17 00:00:00 2001 From: Maxim Mordasov Date: Mon, 27 Feb 2023 19:27:11 +0300 Subject: [PATCH] #415 #1292 #940 #1293 #1002 bug fixes (#1356) # What this PR does ## Which issue(s) this PR fixes ## Checklist - [ ] Tests updated - [ ] Documentation added - [x] `CHANGELOG.md` updated --- CHANGELOG.md | 5 + .../src/components/Modal/Modal.module.css | 3 +- .../UserGroups/UserGroups.module.css | 3 +- .../RotationForm/RotationForm.module.css | 9 + .../containers/RotationForm/RotationForm.tsx | 286 +++++++++--------- .../ScheduleSlot/ScheduleSlot.module.css | 3 +- .../containers/ScheduleSlot/ScheduleSlot.tsx | 14 +- .../src/img/grafanaGlobalStyles.css | 4 + .../src/models/schedule/schedule.ts | 2 + .../src/pages/integrations/Integrations.tsx | 8 + .../src/pages/schedule/Schedule.module.css | 5 + .../src/pages/schedule/Schedule.tsx | 262 ++++++++-------- .../src/pages/schedules/Schedules.module.css | 1 - 13 files changed, 336 insertions(+), 269 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65182e34..dea6ad50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed UI permission related bug where Editors could not export their user iCal link - Fixed error when a shift is created using Etc/UTC as timezone - Fixed issue with refresh ical file task not considering empty string values +- Schedules: Long popup does not fit screen & buttons unreachable & objects outside of the popup ([1002](https://github.com/grafana/oncall/issues/1002)) +- Can't scroll on integration settings page ([415](https://github.com/grafana/oncall/issues/415)) +- Team change in the Integration page always causes 403 ([1292](https://github.com/grafana/oncall/issues/1292)) +- Schedules: Permalink doesn't work with multi-teams ([940](https://github.com/grafana/oncall/issues/940)) +- Schedules list -> expanded schedule blows page width ([1293](https://github.com/grafana/oncall/issues/1293)) ### Changed diff --git a/grafana-plugin/src/components/Modal/Modal.module.css b/grafana-plugin/src/components/Modal/Modal.module.css index d4cafe6a..49fedd9a 100644 --- a/grafana-plugin/src/components/Modal/Modal.module.css +++ b/grafana-plugin/src/components/Modal/Modal.module.css @@ -7,7 +7,7 @@ margin-left: auto; margin-right: auto; top: 10%; - max-height: 80%; + max-height: 90%; display: flex; flex-direction: column; border-image: initial; @@ -18,6 +18,7 @@ box-shadow: var(--shadows-z3); border-radius: 2px; z-index: 10; + overflow: scroll; } /* diff --git a/grafana-plugin/src/components/UserGroups/UserGroups.module.css b/grafana-plugin/src/components/UserGroups/UserGroups.module.css index df6ec4f8..1b49fb92 100644 --- a/grafana-plugin/src/components/UserGroups/UserGroups.module.css +++ b/grafana-plugin/src/components/UserGroups/UserGroups.module.css @@ -48,6 +48,8 @@ display: flex; flex-direction: column; gap: 1px; + max-height: 300px; + overflow: scroll; } .user { @@ -55,7 +57,6 @@ border-radius: 2px; display: flex; position: relative; - overflow: hidden; } .user-buttons { diff --git a/grafana-plugin/src/containers/RotationForm/RotationForm.module.css b/grafana-plugin/src/containers/RotationForm/RotationForm.module.css index 976ff2c8..dec76578 100644 --- a/grafana-plugin/src/containers/RotationForm/RotationForm.module.css +++ b/grafana-plugin/src/containers/RotationForm/RotationForm.module.css @@ -2,6 +2,15 @@ display: block; } +.title { + background: var(--background-primary); + top: -15px; + position: sticky; + margin: -15px -15px 0 -15px; + padding: 15px; + z-index: 10; +} + .draggable { top: 0; diff --git a/grafana-plugin/src/containers/RotationForm/RotationForm.tsx b/grafana-plugin/src/containers/RotationForm/RotationForm.tsx index e2b69877..ecb6da47 100644 --- a/grafana-plugin/src/containers/RotationForm/RotationForm.tsx +++ b/grafana-plugin/src/containers/RotationForm/RotationForm.tsx @@ -277,151 +277,155 @@ const RotationForm: FC = observer((props) => { )} > - - - - - [L{shiftId === 'new' ? layerPriority : shift?.priority_level}] - {shiftId === 'new' ? 'New Rotation' : 'Update Rotation'} - - - - {shiftId !== 'new' && ( - setShowDeleteRotationConfirmation(true)} - /> - )} - - - -
- -
- - Rotation start - - } - > - - - - - Rotation end - - - - } - > - {endLess ? ( -
- Endless -
- ) : ( - - )} -
-
+ <> +
+ + + + [L{shiftId === 'new' ? layerPriority : shift?.priority_level}] + {shiftId === 'new' ? 'New Rotation' : 'Update Rotation'} + + - - + + + + + + {(repeatEveryPeriod === 0 || repeatEveryPeriod === 1) && ( + + setSelectedDays(value)} + /> + + )} +
+ + Parent shift start + + } + > + + + + Parent shift end + + } + > + + +
+ + +
+ + Timezone: {getTzOffsetString(dayjs().tz(currentTimezone))} + + + + + +
+ {showDeleteRotationConfirmation && ( = observer((props) => { duration={duration} /> )} - {userIndex === 0 && label && ( -
- {label} -
- )} -
{title}
+
+ {userIndex === 0 && label && ( +
+ {label} +
+ )} + {title} +
); diff --git a/grafana-plugin/src/img/grafanaGlobalStyles.css b/grafana-plugin/src/img/grafanaGlobalStyles.css index 94d76b9f..525dd58d 100644 --- a/grafana-plugin/src/img/grafanaGlobalStyles.css +++ b/grafana-plugin/src/img/grafanaGlobalStyles.css @@ -1,5 +1,9 @@ /* Navigation/Layout */ +.drawer-content { + overflow: auto !important; /* fix https://github.com/grafana/oncall/issues/415 */ +} + .page-body { max-width: unset !important; } diff --git a/grafana-plugin/src/models/schedule/schedule.ts b/grafana-plugin/src/models/schedule/schedule.ts index 2be3e213..f02a43f8 100644 --- a/grafana-plugin/src/models/schedule/schedule.ts +++ b/grafana-plugin/src/models/schedule/schedule.ts @@ -147,6 +147,8 @@ export class ScheduleStore extends BaseStore { ...this.items, [item.id]: item, }; + + return item; } } diff --git a/grafana-plugin/src/pages/integrations/Integrations.tsx b/grafana-plugin/src/pages/integrations/Integrations.tsx index b7b30347..3a38ae45 100644 --- a/grafana-plugin/src/pages/integrations/Integrations.tsx +++ b/grafana-plugin/src/pages/integrations/Integrations.tsx @@ -58,6 +58,14 @@ class Integrations extends React.Component this.update().then(() => this.parseQueryParams(true)); } + componentDidUpdate(prevProps: Readonly): void { + if (prevProps.match.params.id && !this.props.match.params.id) { + this.setState({ errorData: initErrorDataState() }, () => { + this.parseQueryParams(); + }); + } + } + setSelectedAlertReceiveChannel = (alertReceiveChannelId: AlertReceiveChannel['id'], shouldRedirect = false) => { const { store, history } = this.props; store.selectedAlertReceiveChannel = alertReceiveChannelId; diff --git a/grafana-plugin/src/pages/schedule/Schedule.module.css b/grafana-plugin/src/pages/schedule/Schedule.module.css index 53c468e0..89860c7f 100644 --- a/grafana-plugin/src/pages/schedule/Schedule.module.css +++ b/grafana-plugin/src/pages/schedule/Schedule.module.css @@ -27,3 +27,8 @@ position: relative; width: 100%; } + +.not-found { + margin: 50px auto; + text-align: center; +} diff --git a/grafana-plugin/src/pages/schedule/Schedule.tsx b/grafana-plugin/src/pages/schedule/Schedule.tsx index d5364c62..918dc49f 100644 --- a/grafana-plugin/src/pages/schedule/Schedule.tsx +++ b/grafana-plugin/src/pages/schedule/Schedule.tsx @@ -6,7 +6,11 @@ import dayjs from 'dayjs'; import { observer } from 'mobx-react'; import { RouteComponentProps, withRouter } from 'react-router-dom'; -import PageErrorHandlingWrapper from 'components/PageErrorHandlingWrapper/PageErrorHandlingWrapper'; +import PageErrorHandlingWrapper, { PageBaseState } from 'components/PageErrorHandlingWrapper/PageErrorHandlingWrapper'; +import { + getWrongTeamResponseInfo, + initErrorDataState, +} from 'components/PageErrorHandlingWrapper/PageErrorHandlingWrapper.helpers'; import PluginLink from 'components/PluginLink/PluginLink'; import ScheduleWarning from 'components/ScheduleWarning/ScheduleWarning'; import Text from 'components/Text/Text'; @@ -33,7 +37,7 @@ const cx = cn.bind(styles); interface SchedulePageProps extends PageProps, WithStoreProps, RouteComponentProps<{ id: string }> {} -interface SchedulePageState { +interface SchedulePageState extends PageBaseState { startMoment: dayjs.Dayjs; schedulePeriodType: string; renderType: string; @@ -59,6 +63,7 @@ class SchedulePage extends React.Component isLoading: true, showEditForm: false, showScheduleICalSettings: false, + errorData: initErrorDataState(), }; } @@ -101,8 +106,11 @@ class SchedulePage extends React.Component shiftIdToShowOverridesForm, showEditForm, showScheduleICalSettings, + errorData, } = this.state; + const { isNotFoundError } = errorData; + const { scheduleStore, currentTimezone } = store; const users = store.userStore.getSearchResult().results; @@ -115,131 +123,147 @@ class SchedulePage extends React.Component shiftIdToShowOverridesForm; return ( - + {() => ( <>
- -
- - - - - - - {schedule?.name} - - {schedule && } - - - {users && ( - - Current timezone: - - - )} - - - - - - - {(schedule?.type === ScheduleType.Ical || schedule?.type === ScheduleType.Calendar) && ( - - )} - - { - this.setState({ showEditForm: true }); - }} - /> - - - - - - + {isNotFoundError ? ( +
+ + 404 + Schedule not found + + + +
-
- -
- -
-
+ ) : ( + +
- - - - - - - {startMoment.format('DD MMM')} - {startMoment.add(6, 'day').format('DD MMM')} + + + + + {schedule?.name} + {schedule && } + + + {users && ( + + Current timezone: + + + )} + + + + + + + {(schedule?.type === ScheduleType.Ical || schedule?.type === ScheduleType.Calendar) && ( + + )} + + { + this.setState({ showEditForm: true }); + }} + /> + + + +
- - - -
- +
+ +
+ +
+
+ + + + + + + + + {startMoment.format('DD MMM')} - {startMoment.add(6, 'day').format('DD MMM')} + + + +
+ + + +
+ + )}
{showEditForm && schedule && ( const { startMoment } = this.state; - store.scheduleStore.updateItem(scheduleId); // to refresh current oncall users + store.scheduleStore + .updateItem(scheduleId) // to refresh current oncall users + .catch((error) => this.setState({ errorData: { ...getWrongTeamResponseInfo(error) } })); store.scheduleStore.updateRelatedUsers(scheduleId); // to refresh related users return Promise.all([ diff --git a/grafana-plugin/src/pages/schedules/Schedules.module.css b/grafana-plugin/src/pages/schedules/Schedules.module.css index bd5b3bc9..986a7a22 100644 --- a/grafana-plugin/src/pages/schedules/Schedules.module.css +++ b/grafana-plugin/src/pages/schedules/Schedules.module.css @@ -1,7 +1,6 @@ .schedule { position: relative; margin: 20px 0; - max-width: calc(100vw - 104px); } .title {