mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
fix: tweak deprecated strategies view
This commit is contained in:
parent
3014c0029d
commit
33e16a2536
@ -55,6 +55,7 @@ exports[`renders correctly with one strategy 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<react-mdl-List>
|
<react-mdl-List>
|
||||||
<react-mdl-ListItem
|
<react-mdl-ListItem
|
||||||
|
className=""
|
||||||
twoLine={true}
|
twoLine={true}
|
||||||
>
|
>
|
||||||
<react-mdl-ListItemContent
|
<react-mdl-ListItemContent
|
||||||
@ -64,24 +65,27 @@ exports[`renders correctly with one strategy 1`] = `
|
|||||||
<a
|
<a
|
||||||
href="/strategies/view/Another"
|
href="/strategies/view/Another"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
|
title=""
|
||||||
>
|
>
|
||||||
<strong>
|
<strong>
|
||||||
Another
|
Another
|
||||||
|
|
||||||
|
|
||||||
</strong>
|
</strong>
|
||||||
</a>
|
</a>
|
||||||
</react-mdl-ListItemContent>
|
</react-mdl-ListItemContent>
|
||||||
<react-mdl-Button
|
<span>
|
||||||
name="remove"
|
<react-mdl-IconButton
|
||||||
|
color="#"
|
||||||
|
disabled={false}
|
||||||
|
name="visibility_off"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
>
|
title="Deprecate acitvation strategy"
|
||||||
Deprecate
|
/>
|
||||||
</react-mdl-Button>
|
|
||||||
<react-mdl-IconButton
|
<react-mdl-IconButton
|
||||||
name="delete"
|
name="delete"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
|
title="Delete acitvation strategy"
|
||||||
/>
|
/>
|
||||||
|
</span>
|
||||||
</react-mdl-ListItem>
|
</react-mdl-ListItem>
|
||||||
</react-mdl-List>
|
</react-mdl-List>
|
||||||
</react-mdl-Card>
|
</react-mdl-Card>
|
||||||
@ -128,6 +132,7 @@ exports[`renders correctly with one strategy without permissions 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<react-mdl-List>
|
<react-mdl-List>
|
||||||
<react-mdl-ListItem
|
<react-mdl-ListItem
|
||||||
|
className=""
|
||||||
twoLine={true}
|
twoLine={true}
|
||||||
>
|
>
|
||||||
<react-mdl-ListItemContent
|
<react-mdl-ListItemContent
|
||||||
@ -137,21 +142,28 @@ exports[`renders correctly with one strategy without permissions 1`] = `
|
|||||||
<a
|
<a
|
||||||
href="/strategies/view/Another"
|
href="/strategies/view/Another"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
|
title=""
|
||||||
>
|
>
|
||||||
<strong>
|
<strong>
|
||||||
Another
|
Another
|
||||||
|
|
||||||
|
|
||||||
</strong>
|
</strong>
|
||||||
</a>
|
</a>
|
||||||
</react-mdl-ListItemContent>
|
</react-mdl-ListItemContent>
|
||||||
<react-mdl-Button
|
<span>
|
||||||
name="remove"
|
<react-mdl-IconButton
|
||||||
|
color="#"
|
||||||
|
disabled={false}
|
||||||
|
name="visibility_off"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
>
|
title="Deprecate acitvation strategy"
|
||||||
Deprecate
|
/>
|
||||||
</react-mdl-Button>
|
<react-mdl-IconButton
|
||||||
|
disabled={true}
|
||||||
|
name="delete"
|
||||||
|
onClick={[Function]}
|
||||||
|
title="You can not delete a built-in strategy"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
</react-mdl-ListItem>
|
</react-mdl-ListItem>
|
||||||
</react-mdl-List>
|
</react-mdl-List>
|
||||||
</react-mdl-Card>
|
</react-mdl-Card>
|
||||||
|
@ -2,10 +2,12 @@ import React, { Component } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import { List, ListItem, ListItemContent, IconButton, Card, Button } from 'react-mdl';
|
import { List, ListItem, ListItemContent, IconButton, Card } from 'react-mdl';
|
||||||
import { HeaderTitle, styles as commonStyles } from '../common';
|
import { HeaderTitle, styles as commonStyles } from '../common';
|
||||||
import { CREATE_STRATEGY, DELETE_STRATEGY } from '../../permissions';
|
import { CREATE_STRATEGY, DELETE_STRATEGY } from '../../permissions';
|
||||||
|
|
||||||
|
import styles from './strategies.module.scss';
|
||||||
|
|
||||||
class StrategiesListComponent extends Component {
|
class StrategiesListComponent extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
strategies: PropTypes.array.isRequired,
|
strategies: PropTypes.array.isRequired,
|
||||||
@ -44,28 +46,47 @@ class StrategiesListComponent extends Component {
|
|||||||
<List>
|
<List>
|
||||||
{strategies.length > 0 ? (
|
{strategies.length > 0 ? (
|
||||||
strategies.map((strategy, i) => (
|
strategies.map((strategy, i) => (
|
||||||
<ListItem key={i} twoLine>
|
<ListItem key={i} twoLine className={strategy.deprecated ? styles.deprecated : ''}>
|
||||||
<ListItemContent icon="extension" subtitle={strategy.description}>
|
<ListItemContent icon="extension" subtitle={strategy.description}>
|
||||||
<Link to={`/strategies/view/${strategy.name}`}>
|
<Link
|
||||||
<strong>
|
to={`/strategies/view/${strategy.name}`}
|
||||||
{strategy.name} {strategy.deprecated ? <span>- Deprecated</span> : ''}
|
title={strategy.deprecated ? 'Deprecated' : ''}
|
||||||
</strong>
|
>
|
||||||
|
<strong>{strategy.name}</strong>
|
||||||
|
{strategy.deprecated ? <small> (Deprecated)</small> : null}
|
||||||
</Link>
|
</Link>
|
||||||
</ListItemContent>
|
</ListItemContent>
|
||||||
|
<span>
|
||||||
{strategy.deprecated ? (
|
{strategy.deprecated ? (
|
||||||
<Button name="add" onClick={() => reactivateStrategy(strategy)}>
|
<IconButton
|
||||||
Reactivate
|
name="visibility"
|
||||||
</Button>
|
title="Reactivate acitvation strategy"
|
||||||
|
onClick={() => reactivateStrategy(strategy)}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Button name="remove" onClick={() => deprecateStrategy(strategy)}>
|
<IconButton
|
||||||
Deprecate
|
name="visibility_off"
|
||||||
</Button>
|
title="Deprecate acitvation strategy"
|
||||||
|
disabled={strategy.name === 'default'}
|
||||||
|
color="#"
|
||||||
|
onClick={() => deprecateStrategy(strategy)}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{strategy.editable === false || !hasPermission(DELETE_STRATEGY) ? (
|
{strategy.editable === false || !hasPermission(DELETE_STRATEGY) ? (
|
||||||
''
|
<IconButton
|
||||||
|
name="delete"
|
||||||
|
title="You can not delete a built-in strategy"
|
||||||
|
disabled
|
||||||
|
onClick={() => {}}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<IconButton name="delete" onClick={() => removeStrategy(strategy)} />
|
<IconButton
|
||||||
|
name="delete"
|
||||||
|
title="Delete acitvation strategy"
|
||||||
|
onClick={() => removeStrategy(strategy)}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
</span>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
|
@ -6,3 +6,10 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.deprecated {
|
||||||
|
a {
|
||||||
|
color: #1d1818;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user