mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
fix: archive should not allow viewing additional details about toggle
This commit is contained in:
parent
012cfc1806
commit
cb35d73135
@ -19,7 +19,7 @@ const sortingOptions = [
|
|||||||
{ type: 'stale', displayName: 'Stale' },
|
{ type: 'stale', displayName: 'Stale' },
|
||||||
{ type: 'created', displayName: 'Created' },
|
{ type: 'created', displayName: 'Created' },
|
||||||
{ type: 'Last seen', displayName: 'Last seen' },
|
{ type: 'Last seen', displayName: 'Last seen' },
|
||||||
{ type: 'strategies', displayName: 'Strategies' },
|
{ type: 'project', displayName: 'Project' },
|
||||||
{ type: 'metrics', displayName: 'Metrics' },
|
{ type: 'metrics', displayName: 'Metrics' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -3,12 +3,11 @@ import PropTypes from 'prop-types';
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { IconButton, ListItem } from '@material-ui/core';
|
import { Chip, IconButton, ListItem } from '@material-ui/core';
|
||||||
import { Undo } from '@material-ui/icons';
|
import { Undo } from '@material-ui/icons';
|
||||||
|
|
||||||
import TimeAgo from 'react-timeago';
|
import TimeAgo from 'react-timeago';
|
||||||
import Status from '../../status-component';
|
import Status from '../../status-component';
|
||||||
import FeatureToggleListItemChip from './FeatureToggleListItemChip';
|
|
||||||
import ConditionallyRender from '../../../common/ConditionallyRender/ConditionallyRender';
|
import ConditionallyRender from '../../../common/ConditionallyRender/ConditionallyRender';
|
||||||
|
|
||||||
import { UPDATE_FEATURE } from '../../../AccessProvider/permissions';
|
import { UPDATE_FEATURE } from '../../../AccessProvider/permissions';
|
||||||
@ -33,14 +32,11 @@ const FeatureToggleListItem = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const styles = useStyles();
|
const styles = useStyles();
|
||||||
|
|
||||||
|
const isArchive = !!revive;
|
||||||
|
|
||||||
const { name, description, type, stale, createdAt, project, lastSeenAt } =
|
const { name, description, type, stale, createdAt, project, lastSeenAt } =
|
||||||
feature;
|
feature;
|
||||||
|
|
||||||
const featureUrl =
|
|
||||||
toggleFeature === undefined
|
|
||||||
? `/projects/${feature.project}/archived/${name}/metrics`
|
|
||||||
: getTogglePath(feature.project, name);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem
|
<ListItem
|
||||||
{...rest}
|
{...rest}
|
||||||
@ -53,8 +49,9 @@ const FeatureToggleListItem = ({
|
|||||||
<FeatureType type={type} />
|
<FeatureType type={type} />
|
||||||
</span>
|
</span>
|
||||||
<span className={classnames(styles.listItemLink)}>
|
<span className={classnames(styles.listItemLink)}>
|
||||||
|
<ConditionallyRender condition={!isArchive} show={
|
||||||
<Link
|
<Link
|
||||||
to={featureUrl}
|
to={getTogglePath(feature.project, name)}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
commonStyles.listLink,
|
commonStyles.listLink,
|
||||||
commonStyles.truncate
|
commonStyles.truncate
|
||||||
@ -74,6 +71,26 @@ const FeatureToggleListItem = ({
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
} elseShow={
|
||||||
|
<>
|
||||||
|
<span className={commonStyles.toggleName}>
|
||||||
|
{name}
|
||||||
|
</span>
|
||||||
|
<span className={styles.listItemToggle}>
|
||||||
|
</span>
|
||||||
|
<small>
|
||||||
|
<TimeAgo date={createdAt} live={false} />
|
||||||
|
</small>
|
||||||
|
<div>
|
||||||
|
<span className={commonStyles.truncate}>
|
||||||
|
<small>{description}</small>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
}/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className={classnames(
|
className={classnames(
|
||||||
@ -82,7 +99,7 @@ const FeatureToggleListItem = ({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Status stale={stale} showActive={false} />
|
<Status stale={stale} showActive={false} />
|
||||||
<FeatureToggleListItemChip type={type} />
|
<Chip color="primary" variant="outlined" className={styles.typeChip} style={{marginLeft: '8px'}} title={`Project: ${project}`} label={project}/>
|
||||||
</span>
|
</span>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={revive}
|
condition={revive}
|
||||||
|
@ -95,7 +95,25 @@ exports[`renders correctly with one feature 1`] = `
|
|||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className="makeStyles-listItemStrategies-6 hideLt920"
|
className="makeStyles-listItemStrategies-6 hideLt920"
|
||||||
/>
|
>
|
||||||
|
<div
|
||||||
|
className="MuiChip-root MuiChip-colorPrimary MuiChip-outlined MuiChip-outlinedPrimary"
|
||||||
|
onKeyDown={[Function]}
|
||||||
|
onKeyUp={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"marginLeft": "8px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
title="Project: default"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="MuiChip-label"
|
||||||
|
>
|
||||||
|
default
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -194,6 +212,22 @@ exports[`renders correctly with one feature without permission 1`] = `
|
|||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className="makeStyles-listItemStrategies-6 hideLt920"
|
className="makeStyles-listItemStrategies-6 hideLt920"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="MuiChip-root MuiChip-colorPrimary MuiChip-outlined MuiChip-outlinedPrimary"
|
||||||
|
onKeyDown={[Function]}
|
||||||
|
onKeyUp={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"marginLeft": "8px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
title="Project: undefined"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className="MuiChip-label"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
`;
|
`;
|
||||||
|
@ -92,9 +92,9 @@ export const mapStateToPropsConfigurable = isFeature => state => {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
} else if (settings.sort === 'strategies') {
|
} else if (settings.sort === 'project') {
|
||||||
features = features.sort((a, b) =>
|
features = features.sort((a, b) =>
|
||||||
a.strategies.length > b.strategies.length ? -1 : 1
|
a.project.length > b.project.length ? -1 : 1
|
||||||
);
|
);
|
||||||
} else if (settings.sort === 'type') {
|
} else if (settings.sort === 'type') {
|
||||||
features = features.sort((a, b) => {
|
features = features.sort((a, b) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user