/* * 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 {Component, PropTypes} = require('react') import UsersList from '../addressbook/UsersList' const {Divider} = require('material-ui') const {UsersApi} = require('pydio/http/users-api') const {PydioContextConsumer} = require('pydio').requireLib('boot') /** * Display information about user or team relations */ class GraphPanel extends Component{ render(){ const {graph, userLabel, pydio, getMessage} = this.props; let elements = []; if(graph.teams && graph.teams.length){ const onDeleteAction = function(parentItem, team){ UsersApi.removeUserFromTeam(team[0].id, this.props.userId, (response) => { if(response.message) pydio.UI.displayMessage('SUCCESS', response.message); this.props.reloadAction(); }); }.bind(this); elements.push(
{}} item={{leafs: graph.teams}} mode="inner" onDeleteAction={onDeleteAction}/>
) } if(graph.source && Object.keys(graph.source).length){ elements.push(
{elements.length ? : null}
{getMessage(601).replace('%1', userLabel).replace('%2', Object.keys(graph.source).length)}
) } if(graph.target && Object.keys(graph.target).length){ elements.push(
{elements.length ? : null}
{getMessage(602).replace('%1', userLabel).replace('%2', Object.keys(graph.target).length)}
) } return
{elements}
; } } GraphPanel = PydioContextConsumer(GraphPanel); export {GraphPanel as default}