1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

Add confirm for deleting toggle

This commit is contained in:
ivaosthu 2016-12-22 16:06:30 +01:00
parent a256e7c44d
commit 37c879e2e4

View File

@ -23,6 +23,13 @@ const Feature = ({
calc(metricsLastHour.yes, metricsLastHour.yes + metricsLastHour.no, 0) :
calc(metricsLastMinute.yes, metricsLastMinute.yes + metricsLastMinute.no, 0)
);
const removeToggle = () => {
if (window.confirm('Are you sure you want to remove this toggle?')) { // eslint-disable-line no-alert
onFeatureRemove(name);
}
};
return (
<li key={name} className="mdl-list__item">
<span className="mdl-list__item-primary-content">
@ -51,7 +58,7 @@ const Feature = ({
{strategies && strategies.map((s, i) => <Chip className={[style.iconListItemChip, style.hideLt960].join(' ')} key={i}>
<small>{s.name}</small>
</Chip>)}
<IconButton name="delete" onClick={() => onFeatureRemove(name)} className={style.iconListItem} />
<IconButton name="delete" onClick={removeToggle} className={style.iconListItem} />
</span>
</li>