/*
Copyright (C) 2017 Cloudbase Solutions SRL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
import React, { PropTypes } from 'react';
import Reflux from 'reflux';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import Location from '../../core/Location';
import s from './ProjectList.scss';
import UserStore from '../../stores/UserStore';
import UserActions from '../../actions/UserActions';
import TextTruncate from 'react-text-truncate';
import UserIcon from '../UserIcon';
import NotificationIcon from '../NotificationIcon';
import ProjectsDropdown from '../ProjectsDropdown';
import MainList from '../MainList';
const title = 'Projects';
const projectActions = null
class ProjectList extends Reflux.Component {
filters = [
{
field: "enabled",
options: [
{ value: null, label: "All" },
{ value: true, label: "Enabled" },
{ value: false, label: "Disabled" }
]
},
{
field: "is_domain",
options: [
{ value: null, label: "All" },
{ value: true, label: "Is Domain" },
{ value: false, label: "Is Not Domain" }
]
}
]
constructor(props) {
super(props)
this.store = UserStore
this.state = {
currentUser: {
projects: null
}
}
this.renderItem = this.renderItem.bind(this)
}
static contextTypes = {
onSetTitle: PropTypes.func.isRequired,
};
componentWillMount() {
super.componentWillMount.call(this)
this.context.onSetTitle(title);
UserActions.getScopedProjects()
}
projectDetail(item) {
Location.push('/project/details/' + item.id + "/")
}
switchProject(project) {
UserActions.switchProject(project.id)
}
renderItem(item) {
let projectId = Reflux.GlobalState.userStore.currentUser.project.id
return (