/* * 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 . */ import ParamsMixins from './ParamsMixins' import {RoleMessagesConsumerMixin} from '../util/MessagesMixin' import ParameterEntry from './ParameterEntry' export default React.createClass({ mixins:[ParamsMixins, RoleMessagesConsumerMixin], propTypes:{ id:React.PropTypes.string, role:React.PropTypes.object, roleParent:React.PropTypes.object, pluginsFilter:React.PropTypes.func, paramsFilter:React.PropTypes.func, showInherited:React.PropTypes.bool, Controller:React.PropTypes.object }, getInitialState:function(){ return {showInherited:this.props.showInherited !== undefined?this.props.showInherited:true}; }, componentWillReceiveProps:function(newProps){ if(newProps.showInherited !== undefined){ this.setState({showInherited:newProps.showInherited}); } }, toggleInherited:function(){ this.setState({showInherited:!this.state.showInherited}); }, render: function(){ var roleParent = this.props.roleParent; var showInherited = this.state.showInherited; var controller = this.props.Controller; var wsId=this.props.id; var oThis = this; var render = function(pluginName, paramName, paramValue, paramAttributes, inherited, type){ if(inherited && !showInherited){ return null; } var label = paramAttributes['label'] || paramName; if(global.pydio && global.pydio.MessageHash && global.pydio.MessageHash[label]){ label = global.pydio.MessageHash[label]; } if(type=='action') { paramAttributes['type'] = 'boolean'; label = oThis.context.getMessage('7').replace('%s', label); } return ; }; var parameters = this.browseParams( this.props.role.PARAMETERS, this.props.roleParent.PARAMETERS, this.props.id, render, this.props.pluginsFilter, 'parameter', true, true ); var actions = this.browseParams( this.props.role.ACTIONS, this.props.roleParent.ACTIONS, this.props.id, render, this.props.pluginsFilter, 'action', true, true ); if(!parameters[0].length && !actions[0].length && !this.state.showInherited){ return (
{this.context.getMessage('1')}
); } return( {parameters[0]} {actions[0]} {parameters[1]} {actions[1]}
); } });