Skip to content

Commit 9fadaee

Browse files
author
vikasrohit
authored
Merge pull request #1238 from appirio-tech/feature/new_project_types_in_filter
Github issue#1212, Filter project types in admin view
2 parents b1a691c + 4852751 commit 9fadaee

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/components/TopBar/Filters.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@ import React, {PropTypes} from 'react'
22
import _ from 'lodash'
33
import { Dropdown, DropdownItem, SwitchButton } from 'appirio-tech-react-components'
44
import { PROJECT_STATUS } from '../../config/constants'
5-
6-
const projectTypes = [
7-
{ val: null, label: 'All Types' },
8-
{ val: 'generic', label: 'Work Project' },
9-
{ val: 'visual_design', label: 'Visual Design' },
10-
{ val: 'visual_prototype', label: 'Visual Prototype' },
11-
{ val: 'app_dev', label: 'App Development' }
12-
]
5+
import { projectTypes } from '../../config/projectWizard'
136

147
const projectStatuses = [
158
{ val: 'in(draft,in_review,reviewed,active)', label: 'Open' },
@@ -19,12 +12,15 @@ const projectStatuses = [
1912

2013
const Filters = ({ criteria, handleMyProjectsFilter, applyFilters }) => {
2114

22-
const type = _.find(projectTypes, t => t.val === (criteria.type || null))
15+
const type = _.find(projectTypes, t => t.id === (criteria.type || null))
2316
const status = _.find(projectStatuses, t => t.val === (criteria.status || null))
2417

2518
const _types = _.map(projectTypes, p => {
26-
return { val: { type: p.val }, label: p.label }
19+
return { val: { type: p.id }, label: p.name }
2720
})
21+
// adds null valued object for All Types selection
22+
_types.splice(0, 0, { val: { type: null}, label: 'All Types' })
23+
2824
const _statuses = _.map(projectStatuses, p => {
2925
return { val: { status: p.val }, label: p.label }
3026
})
@@ -36,7 +32,7 @@ const Filters = ({ criteria, handleMyProjectsFilter, applyFilters }) => {
3632
<label className="first">Project Type</label>
3733
<div className="search-select-widget">
3834
<Dropdown theme="new-theme" noPointer pointerShadow>
39-
<a className="dropdown-menu-header">{ type.label || 'All Types' }</a>
35+
<a className="dropdown-menu-header">{ _.get(type, 'name') || 'All Types' }</a>
4036
<ul className="dropdown-menu-list">
4137
{
4238
_types.map((item, i) =>

src/config/projectWizard/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ const products = {
177177

178178
export default products
179179

180+
// exports all project types as an array
181+
export const projectTypes = _.mapValues(products, (p, key) => ({...p, name: key }) )
182+
180183
export function findProduct(product) {
181184
if (product === 'generic_dev') {
182185
return 'Development'

0 commit comments

Comments
 (0)