mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
A11y/Dashboard: Fix various dashboard settings issues (#40641)
See #39429
This commit is contained in:
parent
5b6831ab4d
commit
565537c6e2
@ -7,6 +7,7 @@ import { SlideOutTransition } from '../transitions/SlideOutTransition';
|
|||||||
import { FadeTransition } from '../transitions/FadeTransition';
|
import { FadeTransition } from '../transitions/FadeTransition';
|
||||||
import { Spinner } from '../Spinner/Spinner';
|
import { Spinner } from '../Spinner/Spinner';
|
||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
|
import tinycolor from 'tinycolor2';
|
||||||
|
|
||||||
const getStyles = (theme: GrafanaTheme2) => {
|
const getStyles = (theme: GrafanaTheme2) => {
|
||||||
const singleValue = css`
|
const singleValue = css`
|
||||||
@ -35,7 +36,7 @@ const getStyles = (theme: GrafanaTheme2) => {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const disabled = css`
|
const disabled = css`
|
||||||
color: ${theme.colors.action.disabledText};
|
color: ${tinycolor(theme.colors.text.disabled).setAlpha(0.64).toString()};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
return { singleValue, container, item, disabled };
|
return { singleValue, container, item, disabled };
|
||||||
|
@ -100,11 +100,12 @@ class AddPermissions extends Component<Props, NewDashboardAclItem> {
|
|||||||
{() => (
|
{() => (
|
||||||
<HorizontalGroup>
|
<HorizontalGroup>
|
||||||
<Select
|
<Select
|
||||||
menuShouldPortal
|
aria-label="Role to add new permission to"
|
||||||
isSearchable={false}
|
isSearchable={false}
|
||||||
value={this.state.type}
|
value={this.state.type}
|
||||||
options={dashboardAclTargets}
|
options={dashboardAclTargets}
|
||||||
onChange={this.onTypeChanged}
|
onChange={this.onTypeChanged}
|
||||||
|
menuShouldPortal
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{newItem.type === AclTarget.User ? (
|
{newItem.type === AclTarget.User ? (
|
||||||
@ -118,12 +119,13 @@ class AddPermissions extends Component<Props, NewDashboardAclItem> {
|
|||||||
<span className={styles.label}>Can</span>
|
<span className={styles.label}>Can</span>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
menuShouldPortal
|
aria-label="Permission level"
|
||||||
isSearchable={false}
|
isSearchable={false}
|
||||||
value={this.state.permission}
|
value={this.state.permission}
|
||||||
options={dashboardPermissionLevels}
|
options={dashboardPermissionLevels}
|
||||||
onChange={this.onPermissionChanged}
|
onChange={this.onPermissionChanged}
|
||||||
width={25}
|
width={25}
|
||||||
|
menuShouldPortal
|
||||||
/>
|
/>
|
||||||
<Button data-save-permission type="submit" disabled={!isValid}>
|
<Button data-save-permission type="submit" disabled={!isValid}>
|
||||||
Save
|
Save
|
||||||
|
@ -25,16 +25,17 @@ export default class DisabledPermissionListItem extends Component<Props, any> {
|
|||||||
<td>
|
<td>
|
||||||
<div className="gf-form">
|
<div className="gf-form">
|
||||||
<Select
|
<Select
|
||||||
menuShouldPortal
|
aria-label={`Permission level for "${item.name}"`}
|
||||||
options={dashboardPermissionLevels}
|
options={dashboardPermissionLevels}
|
||||||
onChange={() => {}}
|
onChange={() => {}}
|
||||||
disabled={true}
|
disabled={true}
|
||||||
value={currentPermissionLevel}
|
value={currentPermissionLevel}
|
||||||
|
menuShouldPortal
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Button size="sm" disabled icon="lock" />
|
<Button aria-label={`Remove permission for "${item.name}"`} size="sm" icon="lock" disabled />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
|
@ -75,20 +75,27 @@ export default class PermissionsListItem extends PureComponent<Props> {
|
|||||||
<td className="query-keyword">Can</td>
|
<td className="query-keyword">Can</td>
|
||||||
<td>
|
<td>
|
||||||
<Select
|
<Select
|
||||||
menuShouldPortal
|
aria-label={`Permission level for "${item.name}"`}
|
||||||
isSearchable={false}
|
isSearchable={false}
|
||||||
options={dashboardPermissionLevels}
|
options={dashboardPermissionLevels}
|
||||||
onChange={this.onPermissionChanged}
|
onChange={this.onPermissionChanged}
|
||||||
disabled={item.inherited}
|
disabled={item.inherited}
|
||||||
value={currentPermissionLevel}
|
value={currentPermissionLevel}
|
||||||
width={25}
|
width={25}
|
||||||
|
menuShouldPortal
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{!item.inherited ? (
|
{!item.inherited ? (
|
||||||
<Button size="sm" variant="destructive" icon="times" onClick={this.onRemoveItem} />
|
<Button
|
||||||
|
aria-label={`Remove permission for "${item.name}"`}
|
||||||
|
size="sm"
|
||||||
|
variant="destructive"
|
||||||
|
icon="times"
|
||||||
|
onClick={this.onRemoveItem}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Button size="sm" disabled icon="times" />
|
<Button aria-label={`Remove permission for "${item.name}" (Disabled)`} size="sm" disabled icon="times" />
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -65,6 +65,7 @@ export class TeamPicker extends Component<Props, State> {
|
|||||||
className={className}
|
className={className}
|
||||||
placeholder="Select a team"
|
placeholder="Select a team"
|
||||||
noOptionsMessage="No teams found"
|
noOptionsMessage="No teams found"
|
||||||
|
aria-label="Team picker"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -76,6 +76,7 @@ export class UserPicker extends Component<Props, State> {
|
|||||||
onChange={onSelected}
|
onChange={onSelected}
|
||||||
placeholder="Start typing to search for user"
|
placeholder="Start typing to search for user"
|
||||||
noOptionsMessage="No users found"
|
noOptionsMessage="No users found"
|
||||||
|
aria-label="User picker"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -41,6 +41,12 @@ export const DiffViewer: React.FC<ReactDiffViewerProps> = ({ oldValue, newValue
|
|||||||
codeFold: {
|
codeFold: {
|
||||||
fontSize: theme.typography.size.sm,
|
fontSize: theme.typography.size.sm,
|
||||||
},
|
},
|
||||||
|
gutter: `
|
||||||
|
pre {
|
||||||
|
color: ${tinycolor(theme.colors.textFaint).setAlpha(1).toString()};
|
||||||
|
opacity: 0.61;
|
||||||
|
}
|
||||||
|
`,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -25,6 +25,7 @@ export const VersionHistoryTable: React.FC<VersionsTableProps> = ({ versions, on
|
|||||||
<tr key={version.id}>
|
<tr key={version.id}>
|
||||||
<td>
|
<td>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
aria-label={`Toggle selection of version ${version.version}`}
|
||||||
className={css`
|
className={css`
|
||||||
display: inline;
|
display: inline;
|
||||||
`}
|
`}
|
||||||
|
Loading…
Reference in New Issue
Block a user