/* * 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, ListItem, FlatButton, Paper, Divider} = require('material-ui') const PydioApi = require('pydio/http/api') const {Loader, PydioContextConsumer} = require('pydio').requireLib('boot') const {ClipboardTextField} = require('pydio').requireLib('components') class DiagnosticDashboard extends React.Component{ constructor(props, context){ super(props,context); this.state = {loaded: false, entries: {}, copy: false}; } componentDidMount(){ if(this.state.loaded) return; this.setState({loading: true}); PydioApi.getClient().request({ get_action:'ls', dir: this.props.access || '/admin/diagnostic', format: 'json' }, (transport) => { const resp = transport.responseJSON; if(!resp || !resp.children) return; this.setState({loaded: true, loading: false, entries: resp.children}); }); } render(){ const {entries, loading, copy} = this.state; let content, copyPanel, copyContent = ''; if(loading){ content = ; }else{ let listItems = []; Object.keys(entries).forEach((k) => { const entry = entries[k]; let data = entry.data; if(typeof data === 'boolean'){ data = data ? 'Yes' : 'No'; } listItems.push(); listItems.push( ); copyContent += entry.label + ' : ' + data + '\n'; }); content = {listItems}; } if(copy){ copyPanel = (
Copy Diagnostic
{this.setState({copy:false})}} secondary={true}/>
) } return (
{copyPanel}
{this.props.displayMode === 'card' &&

{this.props.getMessage('5', 'ajxp_conf')}

} {!this.props.displayMode &&

{this.props.getMessage('5', 'ajxp_conf')}

} {this.setState({copy:true})}} secondary={true} style={{marginRight: 16}}/>
{content}
); } } DiagnosticDashboard = PydioContextConsumer(DiagnosticDashboard) export {DiagnosticDashboard as default}