-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Schedules 2nd iteration updates (#1720)
# What this PR does Features and bugs related to [[Q1 2023] Iteration with Schedules](https://github.com/grafana/oncall-private/issues/1660) milestone ## Which issue(s) this PR fixes ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --------- Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com> Co-authored-by: Matias Bordese <mbordese@gmail.com>
- Loading branch information
1 parent
9f7bdac
commit 5c19610
Showing
57 changed files
with
2,358 additions
and
957 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.collapse { | ||
margin-bottom: 16px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,5 @@ export interface FormItem { | |
validation?: (v: any) => boolean; | ||
}; | ||
extra?: any; | ||
collapsed?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.root { | ||
display: block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React, { useCallback } from 'react'; | ||
|
||
import { InlineSwitch } from '@grafana/ui'; | ||
import cn from 'classnames/bind'; | ||
|
||
import { User } from 'models/user/user.types'; | ||
|
||
import styles from './ScheduleFilters.module.scss'; | ||
import { ScheduleFiltersType } from './ScheduleFilters.types'; | ||
|
||
const cx = cn.bind(styles); | ||
|
||
interface SchedulesFiltersProps { | ||
value: ScheduleFiltersType; | ||
currentUserPk: User['pk']; | ||
onChange: (filters: ScheduleFiltersType) => void; | ||
} | ||
|
||
const SchedulesFilters = (props: SchedulesFiltersProps) => { | ||
const { value, currentUserPk, onChange } = props; | ||
|
||
const handleShowMyShiftsOnlyClick = useCallback( | ||
(event: React.ChangeEvent<HTMLInputElement>) => { | ||
const newUsers = [...value.users]; | ||
|
||
if (event.target.checked && !value.users.includes(currentUserPk)) { | ||
newUsers.push(currentUserPk); | ||
} else { | ||
const index = value.users.findIndex((pk) => pk === currentUserPk); | ||
newUsers.splice(index, 1); | ||
} | ||
|
||
onChange({ ...value, users: newUsers }); | ||
}, | ||
[value] | ||
); | ||
|
||
return ( | ||
<div className={cx('root')}> | ||
<InlineSwitch | ||
showLabel | ||
label="Highlight my shifts" | ||
value={value.users.includes(currentUserPk)} | ||
onChange={handleShowMyShiftsOnlyClick} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SchedulesFilters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { User } from 'models/user/user.types'; | ||
|
||
export interface ScheduleFiltersType { | ||
users: Array<User['pk']>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
src/components/SchedulesFilters/SchedulesFilters.helpers.ts
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
src/components/SchedulesFilters/SchedulesFilters.module.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.