2016-12-03 15:54:15 +01:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import ApplicationList from './application-list-component';
|
2018-02-16 09:19:30 +01:00
|
|
|
import { fetchAll } from './../../store/application/actions';
|
2020-09-24 19:31:49 +02:00
|
|
|
import { updateSettingForGroup } from '../../store/settings/actions';
|
2016-12-03 15:54:15 +01:00
|
|
|
|
2020-09-24 19:31:49 +02:00
|
|
|
const mapStateToProps = state => {
|
|
|
|
const applications = state.applications.get('list').toJS();
|
|
|
|
const settings = state.settings.toJS().application || {};
|
2016-12-03 15:54:15 +01:00
|
|
|
|
2020-09-24 19:31:49 +02:00
|
|
|
const regex = new RegExp(settings.filter, 'i');
|
|
|
|
|
|
|
|
return {
|
|
|
|
applications: settings.filter ? applications.filter(a => regex.test(a.appName)) : applications,
|
|
|
|
settings,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const mapDispatchToProps = { fetchAll, updateSetting: updateSettingForGroup('application') };
|
|
|
|
|
|
|
|
const Container = connect(mapStateToProps, mapDispatchToProps)(ApplicationList);
|
2016-12-03 15:54:15 +01:00
|
|
|
|
2016-12-05 15:15:01 +01:00
|
|
|
export default Container;
|