/* * 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 {PydioContextConsumer} = require('pydio').requireLib('boot') import {RoleMessagesConsumerMixin} from '../util/MessagesMixin' import ParameterCreate from './ParameterCreate' import ParametersList from './ParametersList' import ParametersSummary from './ParametersSummary' import {FlatButton} from 'material-ui' let WorkspaceCard = React.createClass({ mixins:[RoleMessagesConsumerMixin], propTypes:{ id:React.PropTypes.string, label:React.PropTypes.string, role:React.PropTypes.object, roleParent:React.PropTypes.object, roleType:React.PropTypes.oneOf(['user', 'group', 'role']), pluginsFilter:React.PropTypes.func, paramsFilter:React.PropTypes.func, toggleEdit:React.PropTypes.func, editMode:React.PropTypes.bool, titleOnly:React.PropTypes.bool, editOnly:React.PropTypes.bool, noParamsListEdit:React.PropTypes.bool, uniqueScope:React.PropTypes.bool, showModal:React.PropTypes.func, hideModal:React.PropTypes.func, Controller:React.PropTypes.object }, toggleEdit: function(){ this.props.toggleEdit(this.props.id); }, toggleInherited: function(){ if(this.refs.parameters_list){ this.refs.parameters_list.toggleInherited(); } }, onCreateParameter:function(type, pluginName, paramName, attributes){ var controller = this.props.Controller; var value; if(type == 'parameter'){ if(attributes['default']) value = attributes['default']; else if(attributes['type'] == 'boolean') value = false; }else if(type == 'action'){ value = false; } controller.updateParameter(type, 'add', this.props.id, pluginName, paramName, value); }, addParameter:function(){ this.props.pydio.UI.openComponentInModal('AdminPeople', 'ParameterCreate', { pluginsFilter: this.props.pluginsFilter, workspaceScope: this.props.id, createParameter: this.onCreateParameter, roleType: this.props.roleType }); }, render: function(){ var wsId = this.props.id; if(this.props.editMode){ var rights,editButtons, scopeTitle, closeButton; if(!this.props.noParamsListEdit){ editButtons=(
); } if(!this.props.uniqueScope){ scopeTitle = (

{this.props.label}


); } if(!this.props.editOnly){ closeButton = (

); } var content = ( {scopeTitle}
{rights}
{editButtons}
{this.context.getMessage('18')}
{closeButton}
); return ( ); }else{ var secondLine, action; if(!this.props.titleOnly){ secondLine =( ); } return ( ); } } }); WorkspaceCard = PydioContextConsumer(WorkspaceCard); export {WorkspaceCard as default}