1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

fix: cleanup application view (#553)

This commit is contained in:
Ivar Conradi Østhus 2021-12-10 10:59:09 +01:00 committed by GitHub
parent 264d9e997a
commit c63e301c3c
2 changed files with 27 additions and 53 deletions

View File

@ -278,44 +278,16 @@ exports[`renders correctly with permissions 1`] = `
<div
className="MuiListItemAvatar-root"
>
<span
className="MuiSwitch-root"
<svg
aria-hidden={true}
className="MuiSvgIcon-root"
focusable="false"
viewBox="0 0 24 24"
>
<span
aria-disabled={true}
className="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-15 MuiSwitch-switchBase MuiSwitch-colorSecondary PrivateSwitchBase-disabled-17 Mui-disabled Mui-disabled Mui-disabled"
onBlur={[Function]}
onDragLeave={[Function]}
onFocus={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
onMouseDown={[Function]}
onMouseLeave={[Function]}
onMouseUp={[Function]}
onTouchEnd={[Function]}
onTouchMove={[Function]}
onTouchStart={[Function]}
tabIndex={-1}
>
<span
className="MuiIconButton-label"
>
<input
className="PrivateSwitchBase-input-18 MuiSwitch-input"
disabled={true}
onChange={[Function]}
type="checkbox"
value={true}
/>
<span
className="MuiSwitch-thumb"
/>
</span>
</span>
<span
className="MuiSwitch-track"
<path
d="M14.4 6l-.24-1.2c-.09-.46-.5-.8-.98-.8H6c-.55 0-1 .45-1 1v15c0 .55.45 1 1 1s1-.45 1-1v-6h5.6l.24 1.2c.09.47.5.8.98.8H19c.55 0 1-.45 1-1V7c0-.55-.45-1-1-1h-4.6z"
/>
</span>
</svg>
</div>
<div
className="MuiListItemText-root MuiListItemText-multiline"
@ -348,6 +320,11 @@ exports[`renders correctly with permissions 1`] = `
aria-hidden={true}
className="MuiSvgIcon-root"
focusable="false"
style={
Object {
"color": "red",
}
}
viewBox="0 0 24 24"
>
<path
@ -362,7 +339,7 @@ exports[`renders correctly with permissions 1`] = `
className="MuiTypography-root MuiListItemText-primary MuiTypography-body1 MuiTypography-displayBlock"
>
<a
href="/projects/default/create-toggle?name=ToggleB"
href="/projects/default/create-toggle2?name=ToggleB"
onClick={[Function]}
>
ToggleB
@ -443,6 +420,11 @@ exports[`renders correctly with permissions 1`] = `
aria-hidden={true}
className="MuiSvgIcon-root"
focusable="false"
style={
Object {
"color": "red",
}
}
viewBox="0 0 24 24"
>
<path

View File

@ -7,10 +7,9 @@ import {
ListItem,
ListItemText,
ListItemAvatar,
Switch,
Typography,
} from '@material-ui/core';
import { Report, Extension, Timeline } from '@material-ui/icons';
import { Report, Extension, Timeline, FlagRounded } from '@material-ui/icons';
import { shorten } from '../common';
import {
@ -33,7 +32,7 @@ function ApplicationView({
show={
<ListItem key={`not_found_${name}`}>
<ListItemAvatar>
<Report />
<Report style={{color: 'red'}} />
</ListItemAvatar>
<ListItemText
primary={<Link to={`${createUrl}`}>{name}</Link>}
@ -59,19 +58,13 @@ function ApplicationView({
const foundListItem = ({
viewUrl,
name,
showSwitch,
enabled,
description,
Icon,
i,
}) => (
<ListItem key={`found_${name}-${i}`}>
<ListItemAvatar>
<ConditionallyRender
key={`conditional_avatar_${name}`}
condition={showSwitch}
show={<Switch disabled value={!!enabled} />}
elseShow={<Extension />}
/>
<Icon />
</ListItemAvatar>
<ListItemText
primary={
@ -91,14 +84,14 @@ function ApplicationView({
<List>
{seenToggles.map(
(
{ name, description, enabled, notFound, project },
{ name, description, notFound, project },
i
) => (
<ConditionallyRender
key={`toggle_conditional_${name}`}
condition={notFound}
show={notFoundListItem({
createUrl: `/projects/default/create-toggle?name=${name}`,
createUrl: `/projects/default/create-toggle2?name=${name}`,
name,
permission: CREATE_FEATURE,
i,
@ -106,9 +99,8 @@ function ApplicationView({
elseShow={foundListItem({
viewUrl: getTogglePath(project, name),
name,
showSwitch: true,
enabled,
description,
Icon: FlagRounded,
i,
})}
/>
@ -135,7 +127,7 @@ function ApplicationView({
elseShow={foundListItem({
viewUrl: '/strategies/view',
name,
showSwitch: false,
Icon: Extension,
enabled: undefined,
description,
i,