1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-09 11:14:29 +02:00
unleash.unleash/frontend/src/component/strategies/strategy-details-container.js
Ivar Conradi Østhus f669f96d49 wip: frontend should understand rbac permissions (#269)
* chore: update changelog

* 4.0.0-alpha.4

* wip: frontend should understand rbac permissions

* move all feature components to hasAccess

* fix: remove all change permissions

* fix all the tests

* fix all the tests x2

* fix snapshot for node 12

* fine tune perms a bit

* refactor: rewrite to ts

* refactor: use admin constant

* fix: import

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
2021-04-20 19:13:31 +02:00

34 lines
1.1 KiB
JavaScript

import { connect } from 'react-redux';
import ShowStrategy from './strategy-details-component';
import { fetchStrategies } from './../../store/strategy/actions';
import { fetchAll } from './../../store/application/actions';
import { fetchFeatureToggles } from './../../store/feature-toggle/actions';
const mapStateToProps = (state, props) => {
let strategy = state.strategies.get('list').find(n => n.name === props.strategyName);
const applications = state.applications
.get('list')
.filter(app => app.strategies && app.strategies.includes(props.strategyName));
const toggles = state.features.filter(
toggle => toggle.get('strategies').findIndex(s => s.name === props.strategyName) > -1
);
return {
strategy,
strategyName: props.strategyName,
applications: applications && applications.toJS(),
toggles: toggles && toggles.toJS(),
activeTab: props.activeTab,
};
};
const Constainer = connect(mapStateToProps, {
fetchStrategies,
fetchApplications: fetchAll,
fetchFeatureToggles,
})(ShowStrategy);
export default Constainer;