-
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.
Changes to make screens more responsive + incident status toggler cha…
…nge (#1237) # What this PR does - Changes to make a few screens be more responsive - Removed incident actions and replaced incident status with a toggler - Renamed `IncidentStatus.new` to `IncidentStatus.Firing` - Removed old schedules code (unused) ## Which issue(s) this PR fixes #1000 ## Checklist - [x] `CHANGELOG.md` updated --------- Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
- Loading branch information
1 parent
89f2220
commit 81b5741
Showing
44 changed files
with
924 additions
and
484 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
53 changes: 53 additions & 0 deletions
53
grafana-plugin/src/components/MatchMediaTooltip/MatchMediaTooltip.tsx
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,53 @@ | ||
import React, { FC, useEffect, useState } from 'react'; | ||
|
||
import { Tooltip } from '@grafana/ui'; | ||
import { debounce } from 'throttle-debounce'; | ||
|
||
interface MatchMediaTooltipProps { | ||
placement: 'top' | 'bottom' | 'right' | 'left'; | ||
content: string; | ||
children: JSX.Element; | ||
|
||
maxWidth?: number; | ||
minWidth?: number; | ||
} | ||
|
||
const DEBOUNCE_MS = 200; | ||
|
||
export const MatchMediaTooltip: FC<MatchMediaTooltipProps> = ({ minWidth, maxWidth, placement, content, children }) => { | ||
const [match, setMatch] = useState<MediaQueryList>(getMatch()); | ||
|
||
useEffect(() => { | ||
const debouncedResize = debounce(DEBOUNCE_MS, onWindowResize); | ||
window.addEventListener('resize', debouncedResize); | ||
return () => { | ||
window.removeEventListener('resize', debouncedResize); | ||
}; | ||
}, []); | ||
|
||
if (match?.matches) { | ||
return ( | ||
<Tooltip placement={placement} content={content}> | ||
{children} | ||
</Tooltip> | ||
); | ||
} | ||
|
||
return <>{children}</>; | ||
|
||
function onWindowResize() { | ||
setMatch(getMatch()); | ||
} | ||
|
||
function getMatch() { | ||
if (minWidth && maxWidth) { | ||
return window.matchMedia(`(min-width: ${minWidth}px) and (max-width: ${maxWidth}px)`); | ||
} else if (minWidth) { | ||
return window.matchMedia(`(min-width: ${minWidth}px)`); | ||
} else if (maxWidth) { | ||
return window.matchMedia(`(max-width: ${maxWidth}px)`); | ||
} | ||
|
||
return undefined; | ||
} | ||
}; |
4 changes: 0 additions & 4 deletions
4
grafana-plugin/src/components/SchedulesFilters/SchedulesFilters.module.css
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
grafana-plugin/src/components/SchedulesFilters/SchedulesFilters.module.scss
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,13 @@ | ||
.right { | ||
display: flex; | ||
flex-wrap: wrap; | ||
row-gap: 4px; | ||
column-gap: 8px; | ||
} | ||
|
||
@media screen and (max-width: 1600px) { | ||
.right { | ||
order: 3; | ||
width: 100%; | ||
} | ||
} |
99 changes: 67 additions & 32 deletions
99
grafana-plugin/src/components/SchedulesFilters/SchedulesFilters.tsx
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
6 changes: 5 additions & 1 deletion
6
grafana-plugin/src/components/SchedulesFilters/SchedulesFilters.types.ts
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { ScheduleType } from 'models/schedule/schedule.types'; | ||
|
||
export interface SchedulesFiltersType { | ||
selectedDate: string; | ||
searchTerm: string; | ||
type: ScheduleType; | ||
status: string; | ||
} |
25 changes: 0 additions & 25 deletions
25
grafana-plugin/src/components/SchedulesFilters_NEW/SchedulesFilters.helpers.ts
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
grafana-plugin/src/components/SchedulesFilters_NEW/SchedulesFilters.module.css
This file was deleted.
Oops, something went wrong.
95 changes: 0 additions & 95 deletions
95
grafana-plugin/src/components/SchedulesFilters_NEW/SchedulesFilters.tsx
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
grafana-plugin/src/components/SchedulesFilters_NEW/SchedulesFilters.types.ts
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
Oops, something went wrong.