Users profile tweaks (#3443)
## Which issue(s) this PR fixes https://github.com/grafana/oncall/issues/3340 https://github.com/grafana/oncall/issues/3341
This commit is contained in:
parent
fb4bad21d2
commit
4a821f52d3
7 changed files with 59 additions and 22 deletions
|
|
@ -5,6 +5,12 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- User profile UI tweaks ([#3443](https://github.com/grafana/oncall/pull/3443))
|
||||||
|
|
||||||
## v1.3.64 (2023-11-28)
|
## v1.3.64 (2023-11-28)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
.root {
|
|
||||||
}
|
|
||||||
|
|
@ -2,7 +2,6 @@ import React, { forwardRef, useCallback, useImperativeHandle, useState } from 'r
|
||||||
|
|
||||||
import { ServiceLabels, ServiceLabelsProps } from '@grafana/labels';
|
import { ServiceLabels, ServiceLabelsProps } from '@grafana/labels';
|
||||||
import { Field } from '@grafana/ui';
|
import { Field } from '@grafana/ui';
|
||||||
import cn from 'classnames/bind';
|
|
||||||
import { isEmpty } from 'lodash-es';
|
import { isEmpty } from 'lodash-es';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
|
|
||||||
|
|
@ -10,10 +9,6 @@ import { LabelKeyValue } from 'models/label/label.types';
|
||||||
import { useStore } from 'state/useStore';
|
import { useStore } from 'state/useStore';
|
||||||
import { openErrorNotification } from 'utils';
|
import { openErrorNotification } from 'utils';
|
||||||
|
|
||||||
import styles from './Labels.module.css';
|
|
||||||
|
|
||||||
const cx = cn.bind(styles);
|
|
||||||
|
|
||||||
export interface LabelsProps {
|
export interface LabelsProps {
|
||||||
value: LabelKeyValue[];
|
value: LabelKeyValue[];
|
||||||
errors: any;
|
errors: any;
|
||||||
|
|
@ -107,7 +102,7 @@ const Labels = observer(
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cx('root')}>
|
<div>
|
||||||
<Field label="Labels">
|
<Field label="Labels">
|
||||||
<ServiceLabels
|
<ServiceLabels
|
||||||
loadById
|
loadById
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,11 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { SelectableValue } from '@grafana/data';
|
import { SelectableValue } from '@grafana/data';
|
||||||
import cn from 'classnames/bind';
|
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
|
|
||||||
import LabelsFilterComponent from 'components/LabelsFilter/LabelsFilter';
|
import LabelsFilterComponent from 'components/LabelsFilter/LabelsFilter';
|
||||||
import { useStore } from 'state/useStore';
|
import { useStore } from 'state/useStore';
|
||||||
|
|
||||||
import styles from './Labels.module.css';
|
|
||||||
|
|
||||||
const cx = cn.bind(styles);
|
|
||||||
|
|
||||||
interface LabelsFilterProps {
|
interface LabelsFilterProps {
|
||||||
filterType: 'labels' | 'alert_group_labels';
|
filterType: 'labels' | 'alert_group_labels';
|
||||||
autoFocus: boolean;
|
autoFocus: boolean;
|
||||||
|
|
@ -77,7 +72,7 @@ const LabelsFilter = observer((props: LabelsFilterProps) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cx('root', className)}>
|
<div className={className}>
|
||||||
<LabelsFilterComponent
|
<LabelsFilterComponent
|
||||||
autoFocus={autoFocus}
|
autoFocus={autoFocus}
|
||||||
labelField="name"
|
labelField="name"
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,20 @@
|
||||||
import React, { useCallback } from 'react';
|
import React, { useCallback } from 'react';
|
||||||
|
|
||||||
import { Alert, Button, HorizontalGroup, InlineField, Input } from '@grafana/ui';
|
import { Alert, Button, HorizontalGroup, InlineField, Input, VerticalGroup } from '@grafana/ui';
|
||||||
|
import cn from 'classnames/bind';
|
||||||
|
|
||||||
|
import Tag from 'components/Tag/Tag';
|
||||||
|
import Text from 'components/Text/Text';
|
||||||
import WithConfirm from 'components/WithConfirm/WithConfirm';
|
import WithConfirm from 'components/WithConfirm/WithConfirm';
|
||||||
import { UserSettingsTab } from 'containers/UserSettings/UserSettings.types';
|
import { UserSettingsTab } from 'containers/UserSettings/UserSettings.types';
|
||||||
import { User } from 'models/user/user.types';
|
import { User } from 'models/user/user.types';
|
||||||
import { AppFeature } from 'state/features';
|
import { AppFeature } from 'state/features';
|
||||||
import { useStore } from 'state/useStore';
|
import { useStore } from 'state/useStore';
|
||||||
|
import { getVar } from 'utils/DOM';
|
||||||
|
|
||||||
|
import styles from 'containers/UserSettings/parts/index.module.css';
|
||||||
|
|
||||||
|
const cx = cn.bind(styles);
|
||||||
|
|
||||||
interface PhoneConnectorProps {
|
interface PhoneConnectorProps {
|
||||||
id: User['pk'];
|
id: User['pk'];
|
||||||
|
|
@ -122,10 +130,21 @@ const PhoneConnector = (props: PhoneConnectorProps) => {
|
||||||
</InlineField>
|
</InlineField>
|
||||||
</div>
|
</div>
|
||||||
) : storeUser.unverified_phone_number ? (
|
) : storeUser.unverified_phone_number ? (
|
||||||
<div>
|
<VerticalGroup spacing="xs">
|
||||||
<InlineField label="Phone" labelWidth={12}>
|
<div className={cx('tag-container')}>
|
||||||
<HorizontalGroup spacing="xs">
|
<Tag
|
||||||
|
color={getVar('--tag-secondary-transparent')}
|
||||||
|
border={getVar('--border-weak')}
|
||||||
|
className={cx('tag', 'tag-left')}
|
||||||
|
>
|
||||||
|
<Text type="primary" size="small">
|
||||||
|
Phone
|
||||||
|
</Text>
|
||||||
|
</Tag>
|
||||||
|
|
||||||
|
<div className={cx('tag-right')}>
|
||||||
<Input disabled={true} value={storeUser.unverified_phone_number} />
|
<Input disabled={true} value={storeUser.unverified_phone_number} />
|
||||||
|
|
||||||
{isCurrentUser ? (
|
{isCurrentUser ? (
|
||||||
<Button onClick={handleClickConfirmPhoneButton}>Verify</Button>
|
<Button onClick={handleClickConfirmPhoneButton}>Verify</Button>
|
||||||
) : (
|
) : (
|
||||||
|
|
@ -133,10 +152,11 @@ const PhoneConnector = (props: PhoneConnectorProps) => {
|
||||||
<Button onClick={handleClickConfirmPhoneButton}>Verify</Button>
|
<Button onClick={handleClickConfirmPhoneButton}>Verify</Button>
|
||||||
</WithConfirm>
|
</WithConfirm>
|
||||||
)}
|
)}
|
||||||
</HorizontalGroup>
|
</div>
|
||||||
</InlineField>
|
</div>
|
||||||
|
|
||||||
<Alert title="Phone number is not verified. Verify or change" severity="warning" />
|
<Alert title="Phone number is not verified. Verify or change" severity="warning" />
|
||||||
</div>
|
</VerticalGroup>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<InlineField label="Phone" labelWidth={12}>
|
<InlineField label="Phone" labelWidth={12}>
|
||||||
|
|
|
||||||
|
|
@ -28,3 +28,26 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tag-container {
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 12px;
|
||||||
|
height: 32px;
|
||||||
|
line-height: 32px;
|
||||||
|
padding: 0 8px;
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-left {
|
||||||
|
flex-basis: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-right {
|
||||||
|
flex-basis: calc(100% - 120px);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ const PhoneVerification = observer((props: PhoneVerificationProps) => {
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
code: '',
|
code: '',
|
||||||
phone: user.verified_phone_number || '+',
|
phone: user.verified_phone_number || user.unverified_phone_number || '+',
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isCodeSent: false,
|
isCodeSent: false,
|
||||||
isPhoneCallInitiated: false,
|
isPhoneCallInitiated: false,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue