Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to make screens more responsive + incident status toggler change #1237

Merged
merged 40 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
797425f
changes on incidents table
teodosii Jan 23, 2023
b0cf4e0
use boundingRect to position withContextMenu manually
teodosii Jan 23, 2023
16699e0
add silence incident dropdown, stop event propagation within contextMenu
teodosii Jan 23, 2023
634b569
changes for incident status
teodosii Jan 25, 2023
8127cd2
force open status only during network request
teodosii Jan 25, 2023
0e1f198
removed old logs, fix left margin push on absolute positioning of Wit…
teodosii Jan 25, 2023
3b24a67
Merge branch 'dev' into rares/responsive-rc-tables
teodosii Jan 26, 2023
86e67c6
permissions, add min width for tags, fixed onSelect callback
teodosii Jan 26, 2023
e0c75e8
added match media tooltip, fixed layout responsiveness in alert rules…
teodosii Jan 27, 2023
a1110d3
Merge branch 'dev' into rares/responsive-rc-tables
teodosii Jan 27, 2023
e5205f4
use match.matches
teodosii Jan 27, 2023
5ca2b3a
remove old schedules code, more responsive changes added
teodosii Jan 27, 2023
17d6c76
same for schedules
teodosii Jan 27, 2023
ef2b20e
linter
teodosii Jan 27, 2023
107d5bf
u-disabled
teodosii Jan 27, 2023
899d201
Merge branch 'dev' into rares/responsive-rc-tables
teodosii Jan 30, 2023
5a5aefd
debounce matchMediaTooltip, added changelog
teodosii Jan 30, 2023
3040e76
hook change to make linter happy
teodosii Jan 30, 2023
8f6b40e
Merge branch 'dev' into rares/responsive-rc-tables
teodosii Jan 30, 2023
c08394e
export
teodosii Jan 30, 2023
59d3658
Merge branch 'dev' into rares/responsive-rc-tables
joeyorlando Jan 30, 2023
f35210a
Merge branch 'dev' into rares/responsive-rc-tables
teodosii Feb 1, 2023
c921e95
added flex-wrap to prevent horizontal scrolling
teodosii Feb 1, 2023
02c4337
working fix for schedule screen responsiveness
teodosii Feb 1, 2023
adba0cb
more changes on css
teodosii Feb 1, 2023
c7aeccc
break-word for table column class
teodosii Feb 1, 2023
ca4b195
better handling for incident status, split silence components into 2
teodosii Feb 1, 2023
e769323
set correct action
teodosii Feb 1, 2023
7a620a3
review feedback changes
teodosii Feb 2, 2023
913f775
Merge branch 'dev' into rares/responsive-rc-tables
teodosii Feb 2, 2023
698f505
Merge branch 'dev' into rares/responsive-rc-tables
teodosii Feb 3, 2023
e24b737
use tag colors from css instead
teodosii Feb 6, 2023
68dbab5
ux/ui suggestions from Raphael
teodosii Feb 6, 2023
fdf62b9
snapshots updated
teodosii Feb 6, 2023
471b902
Merge branch 'dev' into rares/responsive-rc-tables
teodosii Feb 6, 2023
3bc4b5c
hide on scroll
teodosii Feb 7, 2023
44add4e
Merge branch 'dev' into rares/responsive-rc-tables
teodosii Feb 7, 2023
d9b5717
changelog
teodosii Feb 7, 2023
8db1c5e
same for window resize
teodosii Feb 7, 2023
2c097f0
css var for warning
teodosii Feb 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.1.24 (2023-02-06)
## Unreleased

### Fixed

- Design polishing ([1290](https://github.com/grafana/oncall/pull/1290))
- Not showing contact details in User tooltip if User does not have edit/admin access

### Changes

- Incidents - Removed buttons column and replaced status with toggler ([#1237](https://github.com/grafana/oncall/issues/1237))
- Responsiveness changes across multiple pages (Incidents, Integrations, Schedules) ([#1237](https://github.com/grafana/oncall/issues/1237))

## v1.1.23 (2023-02-06)

### Fixed
Expand Down
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 {
teodosii marked this conversation as resolved.
Show resolved Hide resolved
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;
}
};

This file was deleted.

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%;
}
}
Original file line number Diff line number Diff line change
@@ -1,60 +1,95 @@
import React, { useCallback, useMemo } from 'react';
import React, { ChangeEvent, useCallback } from 'react';

import { DatePickerWithInput, Field, HorizontalGroup, RadioButtonGroup } from '@grafana/ui';
import { Field, Icon, Input, RadioButtonGroup } from '@grafana/ui';
import cn from 'classnames/bind';
import moment from 'moment-timezone';

import { dateStringToOption, optionToDateString } from './SchedulesFilters.helpers';
import { SchedulesFiltersType } from './SchedulesFilters.types';
import { ScheduleType } from 'models/schedule/schedule.types';

import styles from './SchedulesFilters.module.css';
import styles from './SchedulesFilters.module.scss';
import { SchedulesFiltersType } from './SchedulesFilters.types';

const cx = cn.bind(styles);

interface SchedulesFiltersProps {
value: SchedulesFiltersType;
onChange: (filters: SchedulesFiltersType) => void;
className?: string;
}

const SchedulesFilters = ({ value, onChange, className }: SchedulesFiltersProps) => {
const handleDateChange = useCallback(
(date: Date) => {
onChange({ selectedDate: moment(date).format('YYYY-MM-DD') });
const SchedulesFilters = (props: SchedulesFiltersProps) => {
Copy link
Member Author

@teodosii teodosii Feb 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I haven't touched these parts. Don't know why these changes show up in here

These show up as changes because

  1. Old files of Schedules_NEW were moved into Schedules
  2. Did minor changes to rendering

const { value, onChange } = props;

const onSearchTermChangeCallback = useCallback(
(e: ChangeEvent<HTMLInputElement>) => {
onChange({ ...value, searchTerm: e.currentTarget.value });
},
[onChange]
[value]
);

const option = useMemo(() => dateStringToOption(value.selectedDate), [value]);

const handleOptionChange = useCallback(
(option: string) => {
onChange({ ...value, selectedDate: optionToDateString(option) });
const handleStatusChange = useCallback(
(status) => {
onChange({ ...value, status });
},
[onChange, value]
[value]
);

const datePickerValue = useMemo(() => moment(value.selectedDate).toDate(), [value]);
const handleTypeChange = useCallback(
(type) => {
onChange({ ...value, type });
},
[value]
);

return (
<div className={cx('root', className)}>
<HorizontalGroup>
<Field label="Filter events">
<>
<div className={cx('left')}>
<Field label="Search by name">
<Input
autoFocus
className={cx('search')}
prefix={<Icon name="search" />}
placeholder="Search..."
value={value.searchTerm}
onChange={onSearchTermChangeCallback}
/>
</Field>
</div>
<div className={cx('right')}>
<Field label="Status">
<RadioButtonGroup
options={[
{ value: 'today', label: 'Today' },
{ value: 'tomorrow', label: 'Tomorrow' },
{ value: 'custom', label: 'Custom' },
{ label: 'All', value: 'all' },
{
label: 'Used in escalations',
value: 'used',
},
{ label: 'Unused', value: 'unused' },
]}
value={option}
onChange={handleOptionChange}
value={value.status}
onChange={handleStatusChange}
/>
</Field>
<Field label="Date">
<DatePickerWithInput closeOnSelect width={40} value={datePickerValue} onChange={handleDateChange} />
<Field label="Type">
<RadioButtonGroup
options={[
{ label: 'All', value: undefined },
{
label: 'Web',
value: ScheduleType.API,
},
{
label: 'ICal',
value: ScheduleType.Ical,
},
{
label: 'API',
value: ScheduleType.Calendar,
},
]}
value={value?.type}
onChange={handleTypeChange}
/>
</Field>
</HorizontalGroup>
</div>
</div>
</>
);
};

Expand Down
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;
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 9 additions & 2 deletions grafana-plugin/src/components/Tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@ interface TagProps {
color: string;
className?: string;
children?: any;
onClick?: (ev) => void;
forwardedRef?: React.MutableRefObject<HTMLSpanElement>;
}

const cx = cn.bind(styles);

const Tag: FC<TagProps> = (props) => {
const { children, color, className } = props;
const { children, color, className, onClick } = props;

return (
<span style={{ backgroundColor: color }} className={cx('root', className)}>
<span
style={{ backgroundColor: color }}
className={cx('root', className)}
onClick={onClick}
ref={props.forwardedRef}
>
{children}
</span>
);
Expand Down
Loading