From e1360ced6c61bcab0da15f898668dd08af23b43e Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 12 Oct 2022 08:54:20 +0100 Subject: [PATCH] minor fix --- .../TimelineMarks/TimelineMarks.tsx | 4 +- .../ScheduleForm/ScheduleForm.config.ts | 50 ++-- .../containers/ScheduleForm/ScheduleForm.tsx | 4 +- .../src/pages/schedule/Schedule.tsx | 218 ++++++++++-------- 4 files changed, 156 insertions(+), 120 deletions(-) diff --git a/grafana-plugin/src/components/TimelineMarks/TimelineMarks.tsx b/grafana-plugin/src/components/TimelineMarks/TimelineMarks.tsx index 0ad40e76..82244568 100644 --- a/grafana-plugin/src/components/TimelineMarks/TimelineMarks.tsx +++ b/grafana-plugin/src/components/TimelineMarks/TimelineMarks.tsx @@ -62,10 +62,12 @@ const TimelineMarks: FC = (props) => { )} {momentsToRender.map((m, i) => { + const isCurrentDay = currentMoment.isSame(m.moment, 'day'); + return (
- + {m.moment.format('ddd D MMM')}
diff --git a/grafana-plugin/src/containers/ScheduleForm/ScheduleForm.config.ts b/grafana-plugin/src/containers/ScheduleForm/ScheduleForm.config.ts index a3b92a0b..62b6df1f 100644 --- a/grafana-plugin/src/containers/ScheduleForm/ScheduleForm.config.ts +++ b/grafana-plugin/src/containers/ScheduleForm/ScheduleForm.config.ts @@ -5,6 +5,18 @@ import { PRIVATE_CHANNEL_NAME } from 'models/slack_channel/slack_channel.config' import { DEFAULT_USER_ROLES } from 'models/user/user.config'; const commonFields: FormItem[] = [ + { + name: 'team', + label: 'Assign to team', + type: FormItemType.GSelect, + extra: { + modelName: 'grafanaTeamStore', + displayField: 'name', + valueField: 'id', + showSearch: true, + allowClear: true, + }, + }, { name: 'slack_channel_id', label: 'Slack channel', @@ -19,6 +31,19 @@ const commonFields: FormItem[] = [ description: 'Calendar parsing errors and notifications about the new on-call shift will be published in this channel.', }, + { + name: 'user_group', + label: 'Slack user group', + type: FormItemType.GSelect, + extra: { + modelName: 'userGroupStore', + displayField: 'handle', + showSearch: true, + allowClear: true, + }, + description: + 'Group members will be automatically updated with current on-call. In case you want to ping on-call with @group_name.', + }, { name: 'notify_oncall_shift_freq', label: 'Notification frequency', @@ -67,37 +92,12 @@ const commonFields: FormItem[] = [ }, description: 'Specify how to notify a team member when their shift is the next one scheduled', }, - { - name: 'user_group', - label: 'Slack user group', - type: FormItemType.GSelect, - extra: { - modelName: 'userGroupStore', - displayField: 'handle', - showSearch: true, - allowClear: true, - }, - description: - 'Group members will be automatically updated with current on-call. In case you want to ping on-call with @group_name.', - }, // { // name: 'send_empty_shifts_report', // normalize: (value) => Boolean(value), // label: 'Send reports about empty shifts to Slack', // type: FormItemType.Switch, // }, - { - name: 'team', - label: 'Assign to team', - type: FormItemType.GSelect, - extra: { - modelName: 'grafanaTeamStore', - displayField: 'name', - valueField: 'id', - showSearch: true, - allowClear: true, - }, - }, ]; export const iCalForm: { name: string; fields: FormItem[] } = { diff --git a/grafana-plugin/src/containers/ScheduleForm/ScheduleForm.tsx b/grafana-plugin/src/containers/ScheduleForm/ScheduleForm.tsx index 2c58562e..fe84dfeb 100644 --- a/grafana-plugin/src/containers/ScheduleForm/ScheduleForm.tsx +++ b/grafana-plugin/src/containers/ScheduleForm/ScheduleForm.tsx @@ -78,10 +78,10 @@ const ScheduleForm = observer((props: ScheduleFormProps) => { >
- + {/* Manage on-call schedules using your favourite calendar app, such as Google Calendar or Microsoft Outlook. To schedule on-call shifts create a new calendar and use events with the teammates usernames - + */} - - - + + + + + + {startMoment.format('DD MMM')} - {startMoment.add(6, 'day').format('DD MMM')} + - - {startMoment.format('DD MMM')} - {startMoment.add(6, 'day').format('DD MMM')} - - - {/* + {/* onChange={this.handleRenderTypeChange} /> */} - + +
+ + +
- - - - - - + + + {showEditForm && ( + { + this.setState({ showEditForm: false }); + }} + /> + )} + ); } + update = () => { + const { store, query } = this.props; + const { id: scheduleId } = query; + const { scheduleStore } = store; + + return scheduleStore.updateItem(scheduleId); + }; + handleShowForm = async (shiftId: Shift['id'] | 'new') => { const { store: { scheduleStore },