mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: filter for projects
This commit is contained in:
		
							parent
							
								
									fc15144a15
								
							
						
					
					
						commit
						718c4fa608
					
				| @ -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 }; | ||||
| }; | ||||
|  | ||||
| @ -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); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -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 ( | ||||
|  | ||||
| @ -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 { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user