Merge pull request #528 from grafana/fix-typescript
fix typescript errors
This commit is contained in:
commit
3c3f611fd2
24 changed files with 79 additions and 823 deletions
|
|
@ -8,7 +8,7 @@ ReactModal.setAppElement('#reactRoot');
|
|||
import styles from './Modal.module.css';
|
||||
|
||||
export interface ModalProps {
|
||||
title: string | JSX.Element;
|
||||
title?: string | JSX.Element;
|
||||
className?: string;
|
||||
contentClassName?: string;
|
||||
closeOnEscape?: boolean;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import React, { FC, useCallback } from 'react';
|
||||
|
||||
import { HorizontalGroup, VerticalGroup, Icon, IconButton, Tooltip } from '@grafana/ui';
|
||||
import { HorizontalGroup, VerticalGroup, Icon, IconButton, Tooltip, IconName } from '@grafana/ui';
|
||||
import cn from 'classnames/bind';
|
||||
|
||||
import Text from 'components/Text/Text';
|
||||
import Text, { TextType } from 'components/Text/Text';
|
||||
|
||||
import styles from './ScheduleCounter.module.css';
|
||||
|
||||
interface ScheduleCounterProps {
|
||||
type: 'link' | 'warning';
|
||||
type: Partial<TextType>;
|
||||
count: number;
|
||||
tooltipTitle: string;
|
||||
tooltipContent: React.ReactNode;
|
||||
|
|
@ -55,8 +55,8 @@ const ScheduleCounter: FC<ScheduleCounterProps> = (props) => {
|
|||
>
|
||||
<div className={cx('root', { [`root__type_${type}`]: true })} onMouseEnter={onHover}>
|
||||
<HorizontalGroup spacing="xs">
|
||||
<Icon className={cx('icon', { [`icon__type_${type}`]: true })} name={typeToIcon[type]} />
|
||||
<Text type={typeToColor[type]}>{count}</Text>
|
||||
<Icon className={cx('icon', { [`icon__type_${type}`]: true })} name={typeToIcon[type] as IconName} />
|
||||
<Text type={typeToColor[type] as TextType}>{count}</Text>
|
||||
</HorizontalGroup>
|
||||
</div>
|
||||
</Tooltip>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ const ScheduleQuality: FC<ScheduleQualityProps> = (props) => {
|
|||
<Tooltip placement="bottom-end" interactive content={<SheduleQualityDetails quality={quality} />}>
|
||||
<div className={cx('root')}>
|
||||
<HorizontalGroup spacing="sm">
|
||||
<Icon name="like" />
|
||||
<Text type="secondary">Quality:</Text>
|
||||
<Text type="primary">{Math.floor(quality * 100)}%</Text>
|
||||
</HorizontalGroup>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,7 @@
|
|||
import { Moment } from 'moment';
|
||||
|
||||
enum ScheduleType {
|
||||
Web = 'Web',
|
||||
iCal = 'iCal',
|
||||
API = 'API',
|
||||
}
|
||||
import { ScheduleType } from 'models/schedule/schedule.types';
|
||||
|
||||
export interface SchedulesFiltersType {
|
||||
searchTerm: string;
|
||||
type: string;
|
||||
type: ScheduleType;
|
||||
status: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export interface Props<RecordType = unknown> extends TableProps<RecordType> {
|
|||
expandable?: {
|
||||
expandedRowKeys: string[];
|
||||
expandedRowRender: (item: any) => React.ReactNode;
|
||||
onExpandedRowsChange: (rows: string[]) => void;
|
||||
onExpandedRowsChange?: (rows: string[]) => void;
|
||||
expandRowByClick: boolean;
|
||||
expandIcon?: (props: { expanded: boolean; record: any }) => React.ReactNode;
|
||||
onExpand?: (expanded: boolean, item: any) => void;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@ import { openNotification } from 'utils';
|
|||
|
||||
import styles from './Text.module.scss';
|
||||
|
||||
export type TextType = 'primary' | 'secondary' | 'disabled' | 'link' | 'success' | 'warning';
|
||||
|
||||
interface TextProps extends HTMLAttributes<HTMLElement> {
|
||||
type?: 'primary' | 'secondary' | 'disabled' | 'link' | 'success' | 'warning';
|
||||
type?: TextType;
|
||||
strong?: boolean;
|
||||
underline?: boolean;
|
||||
size?: 'small' | 'medium' | 'large';
|
||||
|
|
@ -24,7 +26,7 @@ interface TextProps extends HTMLAttributes<HTMLElement> {
|
|||
editModalTitle?: string;
|
||||
}
|
||||
|
||||
interface TextType extends React.FC<TextProps> {
|
||||
interface TextInterface extends React.FC<TextProps> {
|
||||
Title: React.FC<TitleProps>;
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +34,7 @@ const PLACEHOLDER = '**********';
|
|||
|
||||
const cx = cn.bind(styles);
|
||||
|
||||
const Text: TextType = (props) => {
|
||||
const Text: TextInterface = (props) => {
|
||||
const {
|
||||
type,
|
||||
size = 'medium',
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React, { FC, useMemo } from 'react';
|
||||
|
||||
import cn from 'classnames/bind';
|
||||
import * as dayjs from 'dayjs';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import styles from './TimelineMarks.module.css';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import { Item, ItemData } from './UserGroups.types';
|
||||
|
||||
export const toPlainArray = (groups: string[][], getItemData: (item: Item['item']) => ItemData) => {
|
||||
let i = 0;
|
||||
import { Item } from './UserGroups.types';
|
||||
|
||||
export const toPlainArray = (groups: string[][]) => {
|
||||
const items: Item[] = [];
|
||||
groups.forEach((group: string[], groupIndex: number) => {
|
||||
items.push({
|
||||
|
|
@ -15,8 +13,7 @@ export const toPlainArray = (groups: string[][], getItemData: (item: Item['item'
|
|||
items.push({
|
||||
key: `item-${groupIndex}-${itemIndex}`,
|
||||
type: 'item',
|
||||
item,
|
||||
data: getItemData(item),
|
||||
data: item,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -25,8 +22,6 @@ export const toPlainArray = (groups: string[][], getItemData: (item: Item['item'
|
|||
};
|
||||
|
||||
export const fromPlainArray = (items: Item[], createNewGroup = false, deleteEmptyGroups = true) => {
|
||||
const groups = [];
|
||||
|
||||
return items
|
||||
.reduce((memo: any, item: Item, currentIndex: number) => {
|
||||
if (item.type === 'item') {
|
||||
|
|
@ -35,7 +30,7 @@ export const fromPlainArray = (items: Item[], createNewGroup = false, deleteEmpt
|
|||
lastGroup = [];
|
||||
memo.push(lastGroup);
|
||||
}
|
||||
lastGroup.push(item.item);
|
||||
lastGroup.push(item.data);
|
||||
} else {
|
||||
memo.push([]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,15 @@
|
|||
import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import React, { useCallback, useEffect, useMemo } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { VerticalGroup, HorizontalGroup, IconButton, Field, Input } from '@grafana/ui';
|
||||
import { arrayMoveImmutable } from 'array-move';
|
||||
import cn from 'classnames/bind';
|
||||
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
||||
|
||||
import Text from 'components/Text/Text';
|
||||
import WorkingHours from 'components/WorkingHours/WorkingHours';
|
||||
import GSelect from 'containers/GSelect/GSelect';
|
||||
import RemoteSelect from 'containers/RemoteSelect/RemoteSelect';
|
||||
import UserTooltip from 'containers/UserTooltip/UserTooltip';
|
||||
import { User } from 'models/user/user.types';
|
||||
|
||||
import { fromPlainArray, toPlainArray } from './UserGroups.helpers';
|
||||
import { Item, ItemData } from './UserGroups.types';
|
||||
import { Item } from './UserGroups.types';
|
||||
|
||||
import styles from './UserGroups.module.css';
|
||||
|
||||
|
|
@ -22,7 +17,6 @@ interface UserGroupsProps {
|
|||
value: Array<Array<User['pk']>>;
|
||||
onChange: (value: Array<Array<User['pk']>>) => void;
|
||||
isMultipleGroups: boolean;
|
||||
getItemData: (id: string) => ItemData;
|
||||
renderUser: (id: string) => React.ReactElement;
|
||||
showError?: boolean;
|
||||
}
|
||||
|
|
@ -34,7 +28,7 @@ const DragHandle = () => <IconButton name="draggabledots" />;
|
|||
const SortableHandleHoc = SortableHandle(DragHandle);
|
||||
|
||||
const UserGroups = (props: UserGroupsProps) => {
|
||||
const { value, onChange, isMultipleGroups, getItemData, renderUser, showError } = props;
|
||||
const { value, onChange, isMultipleGroups, renderUser, showError } = props;
|
||||
|
||||
const handleAddUserGroup = useCallback(() => {
|
||||
onChange([...value, []]);
|
||||
|
|
@ -59,7 +53,7 @@ const UserGroups = (props: UserGroupsProps) => {
|
|||
};
|
||||
|
||||
const handleUserAdd = useCallback(
|
||||
(pk: User['pk'], user: User) => {
|
||||
(pk: User['pk']) => {
|
||||
if (!pk) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -78,7 +72,7 @@ const UserGroups = (props: UserGroupsProps) => {
|
|||
[value]
|
||||
);
|
||||
|
||||
const items = useMemo(() => toPlainArray(value, getItemData), [value]);
|
||||
const items = useMemo(() => toPlainArray(value), [value]);
|
||||
|
||||
const onSortEnd = useCallback(
|
||||
({ oldIndex, newIndex }) => {
|
||||
|
|
@ -97,7 +91,7 @@ const UserGroups = (props: UserGroupsProps) => {
|
|||
|
||||
const renderItem = (item: Item, index: number) => (
|
||||
<li className={cx('user')}>
|
||||
{renderUser(item.item)}
|
||||
{renderUser(item.data)}
|
||||
<div className={cx('user-buttons')}>
|
||||
<HorizontalGroup>
|
||||
<IconButton className={cx('delete-icon')} name="trash-alt" onClick={getDeleteItemHandler(index)} />
|
||||
|
|
@ -140,7 +134,7 @@ interface SortableItemProps {
|
|||
children: React.ReactElement;
|
||||
}
|
||||
|
||||
const SortableItem = SortableElement(({ children }: SortableItemProps) => children);
|
||||
const SortableItem = SortableElement<SortableItemProps>(({ children }) => children);
|
||||
|
||||
interface SortableListProps {
|
||||
items: Item[];
|
||||
|
|
@ -150,31 +144,29 @@ interface SortableListProps {
|
|||
renderItem: (item: Item, index: number) => React.ReactElement;
|
||||
}
|
||||
|
||||
const SortableList = SortableContainer(
|
||||
({ items, handleAddGroup, handleDeleteItem, isMultipleGroups, renderItem }: SortableListProps) => {
|
||||
return (
|
||||
<ul className={cx('groups')}>
|
||||
{items.map((item, index) =>
|
||||
item.type === 'item' ? (
|
||||
<SortableItem key={item.key} index={index}>
|
||||
{renderItem(item, index)}
|
||||
</SortableItem>
|
||||
) : isMultipleGroups ? (
|
||||
<SortableItem key={item.key} index={index}>
|
||||
<li className={cx('separator')}>{item.data.name}</li>
|
||||
</SortableItem>
|
||||
) : null
|
||||
)}
|
||||
{isMultipleGroups && items[items.length - 1]?.type === 'item' && (
|
||||
<SortableItem disabled key="New Group" index={items.length + 1}>
|
||||
<li onClick={handleAddGroup} className={cx('separator', { separator__clickable: true })}>
|
||||
Add user group +
|
||||
</li>
|
||||
const SortableList = SortableContainer<SortableListProps>(({ items, handleAddGroup, isMultipleGroups, renderItem }) => {
|
||||
return (
|
||||
<ul className={cx('groups')}>
|
||||
{items.map((item, index) =>
|
||||
item.type === 'item' ? (
|
||||
<SortableItem key={item.key} index={index}>
|
||||
{renderItem(item, index)}
|
||||
</SortableItem>
|
||||
)}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
);
|
||||
) : isMultipleGroups ? (
|
||||
<SortableItem key={item.key} index={index}>
|
||||
<li className={cx('separator')}>{item.data.name}</li>
|
||||
</SortableItem>
|
||||
) : null
|
||||
)}
|
||||
{isMultipleGroups && items[items.length - 1]?.type === 'item' && (
|
||||
<SortableItem disabled key="New Group" index={items.length + 1}>
|
||||
<li onClick={handleAddGroup} className={cx('separator', { separator__clickable: true })}>
|
||||
Add user group +
|
||||
</li>
|
||||
</SortableItem>
|
||||
)}
|
||||
</ul>
|
||||
);
|
||||
});
|
||||
|
||||
export default UserGroups;
|
||||
|
|
|
|||
|
|
@ -2,5 +2,4 @@ export interface Item {
|
|||
key: string;
|
||||
type: string;
|
||||
data: any;
|
||||
item?: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,12 +120,9 @@ const Rotation: FC<RotationProps> = (props) => {
|
|||
{events.map((event, index) => {
|
||||
return (
|
||||
<ScheduleSlot
|
||||
index={index}
|
||||
scheduleId={scheduleId}
|
||||
key={event.start}
|
||||
event={event}
|
||||
layerIndex={layerIndex}
|
||||
rotationIndex={rotationIndex}
|
||||
startMoment={startMoment}
|
||||
currentTimezone={currentTimezone}
|
||||
color={color}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ import { observer } from 'mobx-react';
|
|||
import Draggable from 'react-draggable';
|
||||
|
||||
import Modal from 'components/Modal/Modal';
|
||||
import ScheduleSlot from 'components/ScheduleSlot/ScheduleSlot';
|
||||
import Text from 'components/Text/Text';
|
||||
import UserGroups from 'components/UserGroups/UserGroups';
|
||||
import { Item } from 'components/UserGroups/UserGroups.types';
|
||||
|
|
@ -110,13 +109,6 @@ const RotationForm: FC<RotationFormProps> = observer((props) => {
|
|||
|
||||
const [userGroups, setUserGroups] = useState([[]]);
|
||||
|
||||
const getUser = (pk: User['pk']) => {
|
||||
return {
|
||||
name: store.userStore.items[pk]?.username,
|
||||
desc: store.userStore.items[pk]?.timezone,
|
||||
};
|
||||
};
|
||||
|
||||
const renderUser = (userPk: User['pk']) => {
|
||||
const name = store.userStore.items[userPk]?.username;
|
||||
const desc = store.userStore.items[userPk]?.timezone;
|
||||
|
|
@ -274,7 +266,6 @@ const RotationForm: FC<RotationFormProps> = observer((props) => {
|
|||
value={userGroups}
|
||||
onChange={setUserGroups}
|
||||
isMultipleGroups={true}
|
||||
getItemData={getUser}
|
||||
renderUser={renderUser}
|
||||
showError={!userGroups.some((group) => group.length)}
|
||||
/>
|
||||
|
|
@ -379,7 +370,7 @@ const RotationForm: FC<RotationFormProps> = observer((props) => {
|
|||
<HorizontalGroup justify="space-between">
|
||||
<Text type="secondary">Timezone: {getTzOffsetString(dayjs().tz(currentTimezone))}</Text>
|
||||
<HorizontalGroup>
|
||||
<Button variant="secondary">+ Override</Button>
|
||||
{/*<Button variant="secondary">+ Override</Button>*/}
|
||||
<Button variant="primary" onClick={handleCreate}>
|
||||
{shiftId === 'new' ? 'Create' : 'Update'}
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -89,13 +89,6 @@ const ScheduleOverrideForm: FC<RotationFormProps> = (props) => {
|
|||
|
||||
const [userGroups, setUserGroups] = useState([[]]);
|
||||
|
||||
const getUser = (pk: User['pk']) => {
|
||||
return {
|
||||
name: store.userStore.items[pk]?.username,
|
||||
desc: store.userStore.items[pk]?.timezone,
|
||||
};
|
||||
};
|
||||
|
||||
const renderUser = (userPk: User['pk']) => {
|
||||
const name = store.userStore.items[userPk]?.username;
|
||||
const desc = store.userStore.items[userPk]?.timezone;
|
||||
|
|
@ -214,7 +207,6 @@ const ScheduleOverrideForm: FC<RotationFormProps> = (props) => {
|
|||
value={userGroups}
|
||||
onChange={setUserGroups}
|
||||
isMultipleGroups={false}
|
||||
getItemData={getUser}
|
||||
renderUser={renderUser}
|
||||
showError={!userGroups.some((group) => group.length)}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import React, { Component, useMemo, useState } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { ValuePicker, IconButton, Icon, HorizontalGroup, Button, LoadingPlaceholder } from '@grafana/ui';
|
||||
import cn from 'classnames/bind';
|
||||
import dayjs from 'dayjs';
|
||||
|
|
@ -218,7 +219,7 @@ class Rotations extends Component<RotationsProps, RotationsState> {
|
|||
this.setState({ shiftIdToShowRotationForm: 'new', layerPriority, shiftMomentToShowRotationForm: moment });
|
||||
};
|
||||
|
||||
handleAddRotation = (option: SelectOption) => {
|
||||
handleAddRotation = (option: SelectableValue) => {
|
||||
const { startMoment } = this.props;
|
||||
|
||||
this.setState({
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { CSSTransition, TransitionGroup } from 'react-transition-group';
|
|||
import TimelineMarks from 'components/TimelineMarks/TimelineMarks';
|
||||
import Rotation from 'containers/Rotation/Rotation';
|
||||
import { getColor, getFromString, getOverrideColor } from 'models/schedule/schedule.helpers';
|
||||
import { Layer, Schedule } from 'models/schedule/schedule.types';
|
||||
import { Event, Layer, Schedule } from 'models/schedule/schedule.types';
|
||||
import { Timezone } from 'models/timezone/timezone.types';
|
||||
import { WithStoreProps } from 'state/types';
|
||||
import { withMobXProviderContext } from 'state/withStore';
|
||||
|
|
@ -50,7 +50,10 @@ class ScheduleFinal extends Component<ScheduleFinalProps, ScheduleOverridesState
|
|||
|
||||
const shifts = store.scheduleStore.finalPreview
|
||||
? store.scheduleStore.finalPreview
|
||||
: store.scheduleStore.events[scheduleId]?.['final']?.[getFromString(startMoment)];
|
||||
: (store.scheduleStore.events[scheduleId]?.['final']?.[getFromString(startMoment)] as Array<{
|
||||
shiftId: string;
|
||||
events: Event[];
|
||||
}>);
|
||||
|
||||
const layers = store.scheduleStore.rotationPreview
|
||||
? store.scheduleStore.rotationPreview
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import Rotation from 'containers/Rotation/Rotation';
|
|||
import { RotationCreateData } from 'containers/RotationForm/RotationForm.types';
|
||||
import ScheduleOverrideForm from 'containers/RotationForm/ScheduleOverrideForm';
|
||||
import { getFromString, getOverrideColor } from 'models/schedule/schedule.helpers';
|
||||
import { Schedule, Shift } from 'models/schedule/schedule.types';
|
||||
import { Event, Schedule, Shift } from 'models/schedule/schedule.types';
|
||||
import { Timezone } from 'models/timezone/timezone.types';
|
||||
import { WithStoreProps } from 'state/types';
|
||||
import { withMobXProviderContext } from 'state/withStore';
|
||||
|
|
@ -50,7 +50,11 @@ class ScheduleOverrides extends Component<ScheduleOverridesProps, ScheduleOverri
|
|||
|
||||
const shifts = store.scheduleStore.overridePreview
|
||||
? store.scheduleStore.overridePreview
|
||||
: store.scheduleStore.events[scheduleId]?.['override']?.[getFromString(startMoment)];
|
||||
: (store.scheduleStore.events[scheduleId]?.['override']?.[getFromString(startMoment)] as Array<{
|
||||
shiftId: string;
|
||||
events: Event[];
|
||||
isPreview?: boolean;
|
||||
}>);
|
||||
|
||||
const base = 7 * 24 * 60; // in minutes
|
||||
const diff = dayjs().tz(currentTimezone).diff(startMoment, 'minutes');
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ interface ScheduleFormProps {
|
|||
id: Schedule['id'] | 'new';
|
||||
onHide: () => void;
|
||||
onUpdate: () => void;
|
||||
onCreate: (data: Schedule) => void;
|
||||
onCreate?: (data: Schedule) => void;
|
||||
type?: ScheduleType;
|
||||
}
|
||||
|
||||
|
|
@ -63,16 +63,6 @@ const ScheduleForm = observer((props: ScheduleFormProps) => {
|
|||
[id]
|
||||
);
|
||||
|
||||
const getOptionLabel = (item: SelectableValue) => {
|
||||
const team = grafanaTeamStore.items[item.value];
|
||||
return (
|
||||
<HorizontalGroup>
|
||||
{item.label}
|
||||
<Avatar src={team?.avatar_url} size="small" />
|
||||
</HorizontalGroup>
|
||||
);
|
||||
};
|
||||
|
||||
const formConfig = scheduleTypeToForm[data.type];
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export class ScheduleStore extends BaseStore {
|
|||
events: {
|
||||
[scheduleId: string]: {
|
||||
[type: string]: {
|
||||
[startMoment: string]: Array<{ shiftId: string; events: Event[] }> | Layer[];
|
||||
[startMoment: string]: Array<{ shiftId: string; events: Event[]; isPreview?: boolean }> | Layer[];
|
||||
};
|
||||
};
|
||||
} = {};
|
||||
|
|
@ -200,7 +200,7 @@ export class ScheduleStore extends BaseStore {
|
|||
|
||||
if (isOverride) {
|
||||
this.overridePreview = enrichOverrides(
|
||||
[...this.events[scheduleId]?.['override']?.[fromString]],
|
||||
[...(this.events[scheduleId]?.['override']?.[fromString] as Array<{ shiftId: string; events: Event[] }>)],
|
||||
response.rotation,
|
||||
shiftId
|
||||
);
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ export interface Shift {
|
|||
shift_end: string;
|
||||
shift_start: string;
|
||||
title: string;
|
||||
type: 2;
|
||||
until: null;
|
||||
type: number;
|
||||
until: string | null;
|
||||
updated_shift: null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,666 +1,8 @@
|
|||
import { dateTime, DateTime } from '@grafana/data';
|
||||
import { DateTime, dateTime } from '@grafana/data';
|
||||
import dayjs from 'dayjs';
|
||||
import { subtract } from 'lodash-es';
|
||||
|
||||
import { Timezone } from 'models/timezone/timezone.types';
|
||||
|
||||
const tzs = [
|
||||
'Africa/Abidjan',
|
||||
'Africa/Accra',
|
||||
'Africa/Addis_Ababa',
|
||||
'Africa/Algiers',
|
||||
'Africa/Asmara',
|
||||
'Africa/Asmera',
|
||||
'Africa/Bamako',
|
||||
'Africa/Bangui',
|
||||
'Africa/Banjul',
|
||||
'Africa/Bissau',
|
||||
'Africa/Blantyre',
|
||||
'Africa/Brazzaville',
|
||||
'Africa/Bujumbura',
|
||||
'Africa/Cairo',
|
||||
'Africa/Casablanca',
|
||||
'Africa/Ceuta',
|
||||
'Africa/Conakry',
|
||||
'Africa/Dakar',
|
||||
'Africa/Dar_es_Salaam',
|
||||
'Africa/Djibouti',
|
||||
'Africa/Douala',
|
||||
'Africa/El_Aaiun',
|
||||
'Africa/Freetown',
|
||||
'Africa/Gaborone',
|
||||
'Africa/Harare',
|
||||
'Africa/Johannesburg',
|
||||
'Africa/Juba',
|
||||
'Africa/Kampala',
|
||||
'Africa/Khartoum',
|
||||
'Africa/Kigali',
|
||||
'Africa/Kinshasa',
|
||||
'Africa/Lagos',
|
||||
'Africa/Libreville',
|
||||
'Africa/Lome',
|
||||
'Africa/Luanda',
|
||||
'Africa/Lubumbashi',
|
||||
'Africa/Lusaka',
|
||||
'Africa/Malabo',
|
||||
'Africa/Maputo',
|
||||
'Africa/Maseru',
|
||||
'Africa/Mbabane',
|
||||
'Africa/Mogadishu',
|
||||
'Africa/Monrovia',
|
||||
'Africa/Nairobi',
|
||||
'Africa/Ndjamena',
|
||||
'Africa/Niamey',
|
||||
'Africa/Nouakchott',
|
||||
'Africa/Ouagadougou',
|
||||
'Africa/Porto-Novo',
|
||||
'Africa/Sao_Tome',
|
||||
'Africa/Timbuktu',
|
||||
'Africa/Tripoli',
|
||||
'Africa/Tunis',
|
||||
'Africa/Windhoek',
|
||||
'America/Adak',
|
||||
'America/Anchorage',
|
||||
'America/Anguilla',
|
||||
'America/Antigua',
|
||||
'America/Araguaina',
|
||||
'America/Argentina/Buenos_Aires',
|
||||
'America/Argentina/Catamarca',
|
||||
'America/Argentina/ComodRivadavia',
|
||||
'America/Argentina/Cordoba',
|
||||
'America/Argentina/Jujuy',
|
||||
'America/Argentina/La_Rioja',
|
||||
'America/Argentina/Mendoza',
|
||||
'America/Argentina/Rio_Gallegos',
|
||||
'America/Argentina/Salta',
|
||||
'America/Argentina/San_Juan',
|
||||
'America/Argentina/San_Luis',
|
||||
'America/Argentina/Tucuman',
|
||||
'America/Argentina/Ushuaia',
|
||||
'America/Aruba',
|
||||
'America/Asuncion',
|
||||
'America/Atikokan',
|
||||
'America/Atka',
|
||||
'America/Bahia',
|
||||
'America/Bahia_Banderas',
|
||||
'America/Barbados',
|
||||
'America/Belem',
|
||||
'America/Belize',
|
||||
'America/Blanc-Sablon',
|
||||
'America/Boa_Vista',
|
||||
'America/Bogota',
|
||||
'America/Boise',
|
||||
'America/Buenos_Aires',
|
||||
'America/Cambridge_Bay',
|
||||
'America/Campo_Grande',
|
||||
'America/Cancun',
|
||||
'America/Caracas',
|
||||
'America/Catamarca',
|
||||
'America/Cayenne',
|
||||
'America/Cayman',
|
||||
'America/Chicago',
|
||||
'America/Chihuahua',
|
||||
'America/Coral_Harbour',
|
||||
'America/Cordoba',
|
||||
'America/Costa_Rica',
|
||||
'America/Creston',
|
||||
'America/Cuiaba',
|
||||
'America/Curacao',
|
||||
'America/Danmarkshavn',
|
||||
'America/Dawson',
|
||||
'America/Dawson_Creek',
|
||||
'America/Denver',
|
||||
'America/Detroit',
|
||||
'America/Dominica',
|
||||
'America/Edmonton',
|
||||
'America/Eirunepe',
|
||||
'America/El_Salvador',
|
||||
'America/Ensenada',
|
||||
'America/Fort_Nelson',
|
||||
'America/Fort_Wayne',
|
||||
'America/Fortaleza',
|
||||
'America/Glace_Bay',
|
||||
'America/Godthab',
|
||||
'America/Goose_Bay',
|
||||
'America/Grand_Turk',
|
||||
'America/Grenada',
|
||||
'America/Guadeloupe',
|
||||
'America/Guatemala',
|
||||
'America/Guayaquil',
|
||||
'America/Guyana',
|
||||
'America/Halifax',
|
||||
'America/Havana',
|
||||
'America/Hermosillo',
|
||||
'America/Indiana/Indianapolis',
|
||||
'America/Indiana/Knox',
|
||||
'America/Indiana/Marengo',
|
||||
'America/Indiana/Petersburg',
|
||||
'America/Indiana/Tell_City',
|
||||
'America/Indiana/Vevay',
|
||||
'America/Indiana/Vincennes',
|
||||
'America/Indiana/Winamac',
|
||||
'America/Indianapolis',
|
||||
'America/Inuvik',
|
||||
'America/Iqaluit',
|
||||
'America/Jamaica',
|
||||
'America/Jujuy',
|
||||
'America/Juneau',
|
||||
'America/Kentucky/Louisville',
|
||||
'America/Kentucky/Monticello',
|
||||
'America/Knox_IN',
|
||||
'America/Kralendijk',
|
||||
'America/La_Paz',
|
||||
'America/Lima',
|
||||
'America/Los_Angeles',
|
||||
'America/Louisville',
|
||||
'America/Lower_Princes',
|
||||
'America/Maceio',
|
||||
'America/Managua',
|
||||
'America/Manaus',
|
||||
'America/Marigot',
|
||||
'America/Martinique',
|
||||
'America/Matamoros',
|
||||
'America/Mazatlan',
|
||||
'America/Mendoza',
|
||||
'America/Menominee',
|
||||
'America/Merida',
|
||||
'America/Metlakatla',
|
||||
'America/Mexico_City',
|
||||
'America/Miquelon',
|
||||
'America/Moncton',
|
||||
'America/Monterrey',
|
||||
'America/Montevideo',
|
||||
'America/Montreal',
|
||||
'America/Montserrat',
|
||||
'America/Nassau',
|
||||
'America/New_York',
|
||||
'America/Nipigon',
|
||||
'America/Nome',
|
||||
'America/Noronha',
|
||||
'America/North_Dakota/Beulah',
|
||||
'America/North_Dakota/Center',
|
||||
'America/North_Dakota/New_Salem',
|
||||
'America/Ojinaga',
|
||||
'America/Panama',
|
||||
'America/Pangnirtung',
|
||||
'America/Paramaribo',
|
||||
'America/Phoenix',
|
||||
'America/Port-au-Prince',
|
||||
'America/Port_of_Spain',
|
||||
'America/Porto_Acre',
|
||||
'America/Porto_Velho',
|
||||
'America/Puerto_Rico',
|
||||
'America/Punta_Arenas',
|
||||
'America/Rainy_River',
|
||||
'America/Rankin_Inlet',
|
||||
'America/Recife',
|
||||
'America/Regina',
|
||||
'America/Resolute',
|
||||
'America/Rio_Branco',
|
||||
'America/Rosario',
|
||||
'America/Santa_Isabel',
|
||||
'America/Santarem',
|
||||
'America/Santiago',
|
||||
'America/Santo_Domingo',
|
||||
'America/Sao_Paulo',
|
||||
'America/Scoresbysund',
|
||||
'America/Shiprock',
|
||||
'America/Sitka',
|
||||
'America/St_Barthelemy',
|
||||
'America/St_Johns',
|
||||
'America/St_Kitts',
|
||||
'America/St_Lucia',
|
||||
'America/St_Thomas',
|
||||
'America/St_Vincent',
|
||||
'America/Swift_Current',
|
||||
'America/Tegucigalpa',
|
||||
'America/Thule',
|
||||
'America/Thunder_Bay',
|
||||
'America/Tijuana',
|
||||
'America/Toronto',
|
||||
'America/Tortola',
|
||||
'America/Vancouver',
|
||||
'America/Virgin',
|
||||
'America/Whitehorse',
|
||||
'America/Winnipeg',
|
||||
'America/Yakutat',
|
||||
'America/Yellowknife',
|
||||
'Antarctica/Casey',
|
||||
'Antarctica/Davis',
|
||||
'Antarctica/DumontDUrville',
|
||||
'Antarctica/Macquarie',
|
||||
'Antarctica/Mawson',
|
||||
'Antarctica/McMurdo',
|
||||
'Antarctica/Palmer',
|
||||
'Antarctica/Rothera',
|
||||
'Antarctica/South_Pole',
|
||||
'Antarctica/Syowa',
|
||||
'Antarctica/Troll',
|
||||
'Antarctica/Vostok',
|
||||
'Arctic/Longyearbyen',
|
||||
'Asia/Aden',
|
||||
'Asia/Almaty',
|
||||
'Asia/Amman',
|
||||
'Asia/Anadyr',
|
||||
'Asia/Aqtau',
|
||||
'Asia/Aqtobe',
|
||||
'Asia/Ashgabat',
|
||||
'Asia/Ashkhabad',
|
||||
'Asia/Atyrau',
|
||||
'Asia/Baghdad',
|
||||
'Asia/Bahrain',
|
||||
'Asia/Baku',
|
||||
'Asia/Bangkok',
|
||||
'Asia/Barnaul',
|
||||
'Asia/Beirut',
|
||||
'Asia/Bishkek',
|
||||
'Asia/Brunei',
|
||||
'Asia/Calcutta',
|
||||
'Asia/Chita',
|
||||
'Asia/Choibalsan',
|
||||
'Asia/Chongqing',
|
||||
'Asia/Chungking',
|
||||
'Asia/Colombo',
|
||||
'Asia/Dacca',
|
||||
'Asia/Damascus',
|
||||
'Asia/Dhaka',
|
||||
'Asia/Dili',
|
||||
'Asia/Dubai',
|
||||
'Asia/Dushanbe',
|
||||
'Asia/Famagusta',
|
||||
'Asia/Gaza',
|
||||
'Asia/Harbin',
|
||||
'Asia/Hebron',
|
||||
'Asia/Ho_Chi_Minh',
|
||||
'Asia/Hong_Kong',
|
||||
'Asia/Hovd',
|
||||
'Asia/Irkutsk',
|
||||
'Asia/Istanbul',
|
||||
'Asia/Jakarta',
|
||||
'Asia/Jayapura',
|
||||
'Asia/Jerusalem',
|
||||
'Asia/Kabul',
|
||||
'Asia/Kamchatka',
|
||||
'Asia/Karachi',
|
||||
'Asia/Kashgar',
|
||||
'Asia/Kathmandu',
|
||||
'Asia/Katmandu',
|
||||
'Asia/Khandyga',
|
||||
'Asia/Kolkata',
|
||||
'Asia/Krasnoyarsk',
|
||||
'Asia/Kuala_Lumpur',
|
||||
'Asia/Kuching',
|
||||
'Asia/Kuwait',
|
||||
'Asia/Macao',
|
||||
'Asia/Macau',
|
||||
'Asia/Magadan',
|
||||
'Asia/Makassar',
|
||||
'Asia/Manila',
|
||||
'Asia/Muscat',
|
||||
'Asia/Nicosia',
|
||||
'Asia/Novokuznetsk',
|
||||
'Asia/Novosibirsk',
|
||||
'Asia/Omsk',
|
||||
'Asia/Oral',
|
||||
'Asia/Phnom_Penh',
|
||||
'Asia/Pontianak',
|
||||
'Asia/Pyongyang',
|
||||
'Asia/Qatar',
|
||||
'Asia/Qyzylorda',
|
||||
'Asia/Rangoon',
|
||||
'Asia/Riyadh',
|
||||
'Asia/Saigon',
|
||||
'Asia/Sakhalin',
|
||||
'Asia/Samarkand',
|
||||
'Asia/Seoul',
|
||||
'Asia/Shanghai',
|
||||
'Asia/Singapore',
|
||||
'Asia/Srednekolymsk',
|
||||
'Asia/Taipei',
|
||||
'Asia/Tashkent',
|
||||
'Asia/Tbilisi',
|
||||
'Asia/Tehran',
|
||||
'Asia/Tel_Aviv',
|
||||
'Asia/Thimbu',
|
||||
'Asia/Thimphu',
|
||||
'Asia/Tokyo',
|
||||
'Asia/Tomsk',
|
||||
'Asia/Ujung_Pandang',
|
||||
'Asia/Ulaanbaatar',
|
||||
'Asia/Ulan_Bator',
|
||||
'Asia/Urumqi',
|
||||
'Asia/Ust-Nera',
|
||||
'Asia/Vientiane',
|
||||
'Asia/Vladivostok',
|
||||
'Asia/Yakutsk',
|
||||
'Asia/Yangon',
|
||||
'Asia/Yekaterinburg',
|
||||
'Asia/Yerevan',
|
||||
'Atlantic/Azores',
|
||||
'Atlantic/Bermuda',
|
||||
'Atlantic/Canary',
|
||||
'Atlantic/Cape_Verde',
|
||||
'Atlantic/Faeroe',
|
||||
'Atlantic/Faroe',
|
||||
'Atlantic/Jan_Mayen',
|
||||
'Atlantic/Madeira',
|
||||
'Atlantic/Reykjavik',
|
||||
'Atlantic/South_Georgia',
|
||||
'Atlantic/St_Helena',
|
||||
'Atlantic/Stanley',
|
||||
'Australia/ACT',
|
||||
'Australia/Adelaide',
|
||||
'Australia/Brisbane',
|
||||
'Australia/Broken_Hill',
|
||||
'Australia/Canberra',
|
||||
'Australia/Currie',
|
||||
'Australia/Darwin',
|
||||
'Australia/Eucla',
|
||||
'Australia/Hobart',
|
||||
'Australia/LHI',
|
||||
'Australia/Lindeman',
|
||||
'Australia/Lord_Howe',
|
||||
'Australia/Melbourne',
|
||||
'Australia/NSW',
|
||||
'Australia/North',
|
||||
'Australia/Perth',
|
||||
'Australia/Queensland',
|
||||
'Australia/South',
|
||||
'Australia/Sydney',
|
||||
'Australia/Tasmania',
|
||||
'Australia/Victoria',
|
||||
'Australia/West',
|
||||
'Australia/Yancowinna',
|
||||
'Brazil/Acre',
|
||||
'Brazil/DeNoronha',
|
||||
'Brazil/East',
|
||||
'Brazil/West',
|
||||
'CET',
|
||||
'CST6CDT',
|
||||
'Canada/Atlantic',
|
||||
'Canada/Central',
|
||||
'Canada/Eastern',
|
||||
'Canada/Mountain',
|
||||
'Canada/Newfoundland',
|
||||
'Canada/Pacific',
|
||||
'Canada/Saskatchewan',
|
||||
'Canada/Yukon',
|
||||
'Chile/Continental',
|
||||
'Chile/EasterIsland',
|
||||
'Cuba',
|
||||
'EET',
|
||||
'EST',
|
||||
'EST5EDT',
|
||||
'Egypt',
|
||||
'Eire',
|
||||
'Etc/GMT',
|
||||
'Etc/GMT+0',
|
||||
'Etc/GMT+1',
|
||||
'Etc/GMT+10',
|
||||
'Etc/GMT+11',
|
||||
'Etc/GMT+12',
|
||||
'Etc/GMT+2',
|
||||
'Etc/GMT+3',
|
||||
'Etc/GMT+4',
|
||||
'Etc/GMT+5',
|
||||
'Etc/GMT+6',
|
||||
'Etc/GMT+7',
|
||||
'Etc/GMT+8',
|
||||
'Etc/GMT+9',
|
||||
'Etc/GMT-0',
|
||||
'Etc/GMT-1',
|
||||
'Etc/GMT-10',
|
||||
'Etc/GMT-11',
|
||||
'Etc/GMT-12',
|
||||
'Etc/GMT-13',
|
||||
'Etc/GMT-14',
|
||||
'Etc/GMT-2',
|
||||
'Etc/GMT-3',
|
||||
'Etc/GMT-4',
|
||||
'Etc/GMT-5',
|
||||
'Etc/GMT-6',
|
||||
'Etc/GMT-7',
|
||||
'Etc/GMT-8',
|
||||
'Etc/GMT-9',
|
||||
'Etc/GMT0',
|
||||
'Etc/Greenwich',
|
||||
'Etc/UCT',
|
||||
'Etc/UTC',
|
||||
'Etc/Universal',
|
||||
'Etc/Zulu',
|
||||
'Europe/Amsterdam',
|
||||
'Europe/Andorra',
|
||||
'Europe/Astrakhan',
|
||||
'Europe/Athens',
|
||||
'Europe/Belfast',
|
||||
'Europe/Belgrade',
|
||||
'Europe/Berlin',
|
||||
'Europe/Bratislava',
|
||||
'Europe/Brussels',
|
||||
'Europe/Bucharest',
|
||||
'Europe/Budapest',
|
||||
'Europe/Busingen',
|
||||
'Europe/Chisinau',
|
||||
'Europe/Copenhagen',
|
||||
'Europe/Dublin',
|
||||
'Europe/Gibraltar',
|
||||
'Europe/Guernsey',
|
||||
'Europe/Helsinki',
|
||||
'Europe/Isle_of_Man',
|
||||
'Europe/Istanbul',
|
||||
'Europe/Jersey',
|
||||
'Europe/Kaliningrad',
|
||||
'Europe/Kiev',
|
||||
'Europe/Kirov',
|
||||
'Europe/Lisbon',
|
||||
'Europe/Ljubljana',
|
||||
'Europe/London',
|
||||
'Europe/Luxembourg',
|
||||
'Europe/Madrid',
|
||||
'Europe/Malta',
|
||||
'Europe/Mariehamn',
|
||||
'Europe/Minsk',
|
||||
'Europe/Monaco',
|
||||
'Europe/Moscow',
|
||||
'Europe/Nicosia',
|
||||
'Europe/Oslo',
|
||||
'Europe/Paris',
|
||||
'Europe/Podgorica',
|
||||
'Europe/Prague',
|
||||
'Europe/Riga',
|
||||
'Europe/Rome',
|
||||
'Europe/Samara',
|
||||
'Europe/San_Marino',
|
||||
'Europe/Sarajevo',
|
||||
'Europe/Saratov',
|
||||
'Europe/Simferopol',
|
||||
'Europe/Skopje',
|
||||
'Europe/Sofia',
|
||||
'Europe/Stockholm',
|
||||
'Europe/Tallinn',
|
||||
'Europe/Tirane',
|
||||
'Europe/Tiraspol',
|
||||
'Europe/Ulyanovsk',
|
||||
'Europe/Uzhgorod',
|
||||
'Europe/Vaduz',
|
||||
'Europe/Vatican',
|
||||
'Europe/Vienna',
|
||||
'Europe/Vilnius',
|
||||
'Europe/Volgograd',
|
||||
'Europe/Warsaw',
|
||||
'Europe/Zagreb',
|
||||
'Europe/Zaporozhye',
|
||||
'Europe/Zurich',
|
||||
'GB',
|
||||
'GB-Eire',
|
||||
'GMT',
|
||||
'GMT+0',
|
||||
'GMT-0',
|
||||
'GMT0',
|
||||
'Greenwich',
|
||||
'HST',
|
||||
'Hongkong',
|
||||
'Iceland',
|
||||
'Indian/Antananarivo',
|
||||
'Indian/Chagos',
|
||||
'Indian/Christmas',
|
||||
'Indian/Cocos',
|
||||
'Indian/Comoro',
|
||||
'Indian/Kerguelen',
|
||||
'Indian/Mahe',
|
||||
'Indian/Maldives',
|
||||
'Indian/Mauritius',
|
||||
'Indian/Mayotte',
|
||||
'Indian/Reunion',
|
||||
'Iran',
|
||||
'Israel',
|
||||
'Jamaica',
|
||||
'Japan',
|
||||
'Kwajalein',
|
||||
'Libya',
|
||||
'MET',
|
||||
'MST',
|
||||
'MST7MDT',
|
||||
'Mexico/BajaNorte',
|
||||
'Mexico/BajaSur',
|
||||
'Mexico/General',
|
||||
'NZ',
|
||||
'NZ-CHAT',
|
||||
'Navajo',
|
||||
'PRC',
|
||||
'PST8PDT',
|
||||
'Pacific/Apia',
|
||||
'Pacific/Auckland',
|
||||
'Pacific/Bougainville',
|
||||
'Pacific/Chatham',
|
||||
'Pacific/Chuuk',
|
||||
'Pacific/Easter',
|
||||
'Pacific/Efate',
|
||||
'Pacific/Enderbury',
|
||||
'Pacific/Fakaofo',
|
||||
'Pacific/Fiji',
|
||||
'Pacific/Funafuti',
|
||||
'Pacific/Galapagos',
|
||||
'Pacific/Gambier',
|
||||
'Pacific/Guadalcanal',
|
||||
'Pacific/Guam',
|
||||
'Pacific/Honolulu',
|
||||
'Pacific/Johnston',
|
||||
'Pacific/Kiritimati',
|
||||
'Pacific/Kosrae',
|
||||
'Pacific/Kwajalein',
|
||||
'Pacific/Majuro',
|
||||
'Pacific/Marquesas',
|
||||
'Pacific/Midway',
|
||||
'Pacific/Nauru',
|
||||
'Pacific/Niue',
|
||||
'Pacific/Norfolk',
|
||||
'Pacific/Noumea',
|
||||
'Pacific/Pago_Pago',
|
||||
'Pacific/Palau',
|
||||
'Pacific/Pitcairn',
|
||||
'Pacific/Pohnpei',
|
||||
'Pacific/Ponape',
|
||||
'Pacific/Port_Moresby',
|
||||
'Pacific/Rarotonga',
|
||||
'Pacific/Saipan',
|
||||
'Pacific/Samoa',
|
||||
'Pacific/Tahiti',
|
||||
'Pacific/Tarawa',
|
||||
'Pacific/Tongatapu',
|
||||
'Pacific/Truk',
|
||||
'Pacific/Wake',
|
||||
'Pacific/Wallis',
|
||||
'Pacific/Yap',
|
||||
'Poland',
|
||||
'Portugal',
|
||||
'ROC',
|
||||
'ROK',
|
||||
'Singapore',
|
||||
'Turkey',
|
||||
'UCT',
|
||||
'US/Alaska',
|
||||
'US/Aleutian',
|
||||
'US/Arizona',
|
||||
'US/Central',
|
||||
'US/East-Indiana',
|
||||
'US/Eastern',
|
||||
'US/Hawaii',
|
||||
'US/Indiana-Starke',
|
||||
'US/Michigan',
|
||||
'US/Mountain',
|
||||
'US/Pacific',
|
||||
'US/Pacific-New',
|
||||
'US/Samoa',
|
||||
'UTC',
|
||||
'Universal',
|
||||
'W-SU',
|
||||
'WET',
|
||||
'Zulu',
|
||||
];
|
||||
|
||||
const USERS = [
|
||||
'Innokentii Konstantinov',
|
||||
'Ildar Iskhakov',
|
||||
'Matias Bordese',
|
||||
'Michael Derynck',
|
||||
'Vadim Stepanov',
|
||||
'Matvey Kukuy',
|
||||
'Yulya Artyukhina',
|
||||
'Raphael Batyrbaev',
|
||||
];
|
||||
|
||||
function getRandomUser() {
|
||||
return USERS[Math.floor(Math.random() * USERS.length)];
|
||||
}
|
||||
|
||||
export const getRandomTimezone = () => {
|
||||
return tzs[Math.floor(Math.random() * tzs.length)];
|
||||
};
|
||||
|
||||
export const getRandomUsers = (count = 7) => {
|
||||
const users = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
users.push({
|
||||
//name: getRandomUser(),
|
||||
pk: i,
|
||||
name: [
|
||||
'Some UTC user',
|
||||
'Matias Bordese',
|
||||
'Michael Derynck',
|
||||
'Yulia Shanyrova',
|
||||
'Maxim Mordasov',
|
||||
'Vadim Stepanov',
|
||||
'Ildar Iskhakov',
|
||||
/* 'Matvey Kukuy',*/
|
||||
][i],
|
||||
//avatar: `https://i.pravatar.cc/32?rnd=${Math.random()}`,
|
||||
avatar: [
|
||||
'https://image.shutterstock.com/image-vector/male-avatar-icon-simple-man-600w-1504887869.jpg',
|
||||
'https://avatars.githubusercontent.com/u/260710?v=4',
|
||||
'https://avatars.githubusercontent.com/u/28077050?s=60&v=4',
|
||||
'https://avatars.githubusercontent.com/u/20494436?v=4',
|
||||
'https://avatars.githubusercontent.com/u/3278022?v=4',
|
||||
'https://avatars.githubusercontent.com/u/20116910?s=60&v=4',
|
||||
'https://avatars.githubusercontent.com/u/2262529?v=4',
|
||||
][i],
|
||||
//tz: getRandomTimezone(),
|
||||
tz: [
|
||||
'UTC',
|
||||
'America/Montevideo',
|
||||
'America/Vancouver',
|
||||
'Europe/Amsterdam',
|
||||
'Europe/Moscow',
|
||||
'Europe/London',
|
||||
'Asia/Yerevan',
|
||||
/*'Asia/Tel_Aviv',*/
|
||||
][i],
|
||||
});
|
||||
}
|
||||
|
||||
return users;
|
||||
};
|
||||
|
||||
export const getStartOfWeek = (tz: Timezone) => {
|
||||
return dayjs().tz(tz).utcOffset() === 0 ? dayjs().utc().startOf('isoWeek') : dayjs().tz(tz).startOf('isoWeek');
|
||||
};
|
||||
|
|
@ -671,7 +13,7 @@ export const getUTCString = (moment: dayjs.Dayjs | DateTime, timezone: Timezone)
|
|||
const browserTimezoneOffset = dayjs().tz(browserTimezone).utcOffset();
|
||||
const timezoneOffset = dayjs().tz(timezone).utcOffset();
|
||||
|
||||
return moment
|
||||
return (moment as dayjs.Dayjs)
|
||||
.clone()
|
||||
.utc()
|
||||
.add(browserTimezoneOffset, 'minutes') // we need these calculations because we can't specify timezone for DateTimePicker directly
|
||||
|
|
|
|||
|
|
@ -21,12 +21,10 @@ import ScheduleFinal from 'containers/Rotations/ScheduleFinal';
|
|||
import ScheduleOverrides from 'containers/Rotations/ScheduleOverrides';
|
||||
import UsersTimezones from 'containers/UsersTimezones/UsersTimezones';
|
||||
import { Timezone } from 'models/timezone/timezone.types';
|
||||
import { User } from 'models/user/user.types';
|
||||
import { AppFeature } from 'state/features';
|
||||
import { WithStoreProps } from 'state/types';
|
||||
import { withMobXProviderContext } from 'state/withStore';
|
||||
|
||||
import { getRandomUsers, getStartOfWeek, getUTCString } from './Schedule.helpers';
|
||||
import { getStartOfWeek, getUTCString } from './Schedule.helpers';
|
||||
|
||||
import styles from './Schedule.module.css';
|
||||
|
||||
|
|
@ -125,8 +123,8 @@ class SchedulePage extends React.Component<SchedulePageProps, SchedulePageState>
|
|||
{users && (
|
||||
<UserTimezoneSelect value={currentTimezone} users={users} onChange={this.handleTimezoneChange} />
|
||||
)}
|
||||
{/*<ScheduleQuality quality={0.89} />
|
||||
<ToolbarButton icon="copy" tooltip="Copy" />
|
||||
<ScheduleQuality quality={0.89} />
|
||||
{/*<ToolbarButton icon="copy" tooltip="Copy" />
|
||||
<ToolbarButton icon="brackets-curly" tooltip="Code" />
|
||||
<ToolbarButton icon="share-alt" tooltip="Share" />
|
||||
<ToolbarButton icon="cog" tooltip="Settings" />*/}
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
import dayjs from 'dayjs';
|
||||
|
||||
import { getColor, getOverrideColor, getRandomUser } from 'components/Rotations/Rotations.helpers';
|
||||
import { getRandomUsers } from 'pages/schedule/Schedule.helpers';
|
||||
|
||||
export const getRandomSchedules = () => {
|
||||
const schedules = [];
|
||||
for (let i = 0; i < 20; i++) {
|
||||
schedules.push({
|
||||
id: i + 1,
|
||||
name: `Schedule Team ${i + 1}`,
|
||||
users: getRandomUsers(2),
|
||||
chatOps: '#irm-incidents-primary',
|
||||
quality: 20 + Math.floor(Math.random() * 80),
|
||||
});
|
||||
}
|
||||
|
||||
return schedules;
|
||||
};
|
||||
|
||||
export const getRandomTimeslots = (count = 6) => {
|
||||
const slots = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
const start = dayjs()
|
||||
.startOf('day')
|
||||
.add(i * 4, 'hour');
|
||||
const end = dayjs()
|
||||
.startOf('day')
|
||||
.add(i * 4 + 2, 'hour');
|
||||
//const inactive = end.isBefore(dayjs());
|
||||
const inactive = false;
|
||||
|
||||
slots.push({
|
||||
start,
|
||||
end,
|
||||
inactive,
|
||||
users: [getRandomUser()],
|
||||
color: getOverrideColor(i),
|
||||
});
|
||||
}
|
||||
return slots;
|
||||
};
|
||||
|
|
@ -153,7 +153,6 @@ class SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSta
|
|||
onExpand: this.handleExpandRow,
|
||||
expandedRowRender: this.renderSchedule,
|
||||
expandRowByClick: true,
|
||||
expandedRowClassName: () => cx('expanded-row'),
|
||||
}}
|
||||
emptyText={
|
||||
<div className={cx('loader')}>
|
||||
|
|
@ -306,15 +305,15 @@ class SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSta
|
|||
return null;
|
||||
};
|
||||
|
||||
renderChatOps = (item: Schedule) => {
|
||||
/* renderChatOps = (item: Schedule) => {
|
||||
return item.chatOps;
|
||||
};
|
||||
}; */
|
||||
|
||||
renderQuality = (item: Schedule) => {
|
||||
/* renderQuality = (item: Schedule) => {
|
||||
const type = item.quality > 70 ? 'primary' : 'warning';
|
||||
|
||||
return <Text type={type}>{item.quality || 70}%</Text>;
|
||||
};
|
||||
}; */
|
||||
|
||||
renderButtons = (item: Schedule) => {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"extends": "@grafana/toolkit/src/config/tsconfig.plugin.json",
|
||||
"include": ["src/dummy"],
|
||||
"include": ["src", "frontend_enterprise/src"],
|
||||
"types": ["node", "@emotion/core"],
|
||||
"compilerOptions": {
|
||||
"rootDirs": ["src"],
|
||||
"rootDirs": ["src", "frontend_enterprise/src"],
|
||||
"baseUrl": "src",
|
||||
"typeRoots": ["./node_modules/@types"],
|
||||
"noUnusedLocals": false,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue