1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

fix: filter for projects

This commit is contained in:
Ivar Conradi Østhus 2020-11-23 21:32:05 +01:00
parent fc15144a15
commit 718c4fa608
4 changed files with 14 additions and 6 deletions

View File

@ -8,6 +8,16 @@ import { loadNameFromHash } from './util';
const defaultStrategy = { name: 'default' };
function resolveCurrentProjectId(settings) {
if (!settings.currentProjectId) {
return 'default';
} else if (settings.currentProjectId === '*') {
return 'default';
} else {
return settings.currentProjectId;
}
}
class WrapperComponent extends Component {
constructor(props) {
super(props);
@ -126,7 +136,7 @@ const mapDispatchToProps = dispatch => ({
const mapStateToProps = state => {
const settings = state.settings.toJS().feature || {};
const currentProjectId = settings.currentProjectId || 'default';
const currentProjectId = resolveCurrentProjectId(settings);
return { currentProjectId };
};

View File

@ -10,7 +10,7 @@ export const mapStateToPropsConfigurable = isFeature => state => {
const settings = state.settings.toJS().feature || {};
let features = isFeature ? state.features.toJS() : state.archive.get('list').toArray();
if (settings.currentProjectId) {
if (settings.currentProjectId && settings.currentProjectId !== '*') {
features = features.filter(f => f.project === settings.currentProjectId);
}

View File

@ -3,7 +3,7 @@ import { Menu, MenuItem } from 'react-mdl';
import { DropdownButton } from '../common';
import PropTypes from 'prop-types';
const ALL_PROJECTS = { id: undefined, name: '> All projects' };
const ALL_PROJECTS = { id: '*', name: '> All projects' };
function projectItem(selectedId, item) {
return (

View File

@ -6,9 +6,7 @@ import { USER_LOGOUT, USER_LOGIN } from '../user/actions';
const localStorage = window.localStorage || {};
const SETTINGS = 'settings';
const DEFAULT = fromJS({
feature: { currentProjectId: 'default' },
});
const DEFAULT = fromJS({});
function getInitState() {
try {