/* * Copyright 2007-2017 Charles du Jeu - Abstrium SAS * This file is part of Pydio. * * Pydio 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. * * Pydio 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 Pydio. If not, see . * * The latest code can be found at . */ const React = require('react') const {List, Subheader, Divider} = require('material-ui') import WorkspaceEntryMaterial from './WorkspaceEntryMaterial' import Pydio from 'pydio' class WorkspacesListMaterial extends React.Component{ render(){ const {workspaces,showTreeForWorkspace, filterByType} = this.props; let inboxEntry, entries = [], sharedEntries = [], remoteShares = []; workspaces.forEach(function(object, key){ if (object.getId().indexOf('ajxp_') === 0) return; if (object.hasContentFilter()) return; if (object.getAccessStatus() === 'declined') return; const entry = ( ); if (object.getAccessType() == "inbox") { inboxEntry = entry; } else if(object.getOwner()) { if(object.getRepositoryType() === 'remote'){ remoteShares.push(entry); }else{ sharedEntries.push(entry); } } else { entries.push(entry); } }.bind(this)); const messages = pydio.MessageHash; let allEntries; if(sharedEntries.length){ sharedEntries.unshift({messages[626]}); } if(inboxEntry){ if(sharedEntries.length){ sharedEntries.unshift(); } sharedEntries.unshift(inboxEntry); sharedEntries.unshift({messages[630]}); } if(remoteShares.length){ remoteShares.unshift({messages[627]}) remoteShares.unshift() sharedEntries = sharedEntries.concat(remoteShares); } if(filterByType === 'entries'){ entries.unshift({messages[468]}); } if(filterByType){ allEntries = filterByType === 'shared' ? sharedEntries : entries }else{ allEntries = entries.concat(sharedEntries); } return ( {allEntries} ); } } WorkspacesListMaterial.propTypes = { pydio : React.PropTypes.instanceOf(Pydio), workspaces : React.PropTypes.instanceOf(Map), filterByType : React.PropTypes.oneOf(['shared', 'entries', 'create']), sectionTitleStyle : React.PropTypes.object, showTreeForWorkspace : React.PropTypes.string, onHoverLink : React.PropTypes.func, onOutLink : React.PropTypes.func, className : React.PropTypes.string, style : React.PropTypes.object } export {WorkspacesListMaterial as default}