From 2199d99db066a1f1e820d01a0f4367253c5ac2b0 Mon Sep 17 00:00:00 2001 From: Morisse Date: Wed, 24 Oct 2018 15:48:27 +0200 Subject: [PATCH] replace server state by send report button (not working yet) replace post email api by put --- src/StatsTab.js | 43 +++++++++++-------------------------------- src/User.css | 4 ++++ src/UserRightPanel.js | 2 +- 3 files changed, 16 insertions(+), 33 deletions(-) diff --git a/src/StatsTab.js b/src/StatsTab.js index 717ce5b..58c9139 100644 --- a/src/StatsTab.js +++ b/src/StatsTab.js @@ -1,8 +1,7 @@ import React, { Component } from 'react'; import CardStats from './CardStats'; -import ServerBar from './serverBar'; -import { PageHeader, Panel} from 'react-bootstrap'; +import { PageHeader, Button} from 'react-bootstrap'; export default class StatsTab extends Component { @@ -42,25 +41,25 @@ export default class StatsTab extends Component { } getServerState = async () => { - let serverState; + let serverReport; const homeServer = this.props.server; const accessToken = this.props.token; try { - const serverStateRequest = await fetch(homeServer+ '_matrix/client/r0/watcha_server_state', { + const serverReportRequest = await fetch(homeServer+ '_matrix/client/r0/watcha_server_state', { method: 'GET', headers: { 'Authorization': 'Bearer '+accessToken, }, }); - serverState = JSON.parse(await serverStateRequest.text()); + serverReport = JSON.parse(await serverReportRequest.text()); } catch (e) { console.log('error: ' + e); return; } this.setState({ - serverState: serverState, + serverReport: serverReport, }); } @@ -71,7 +70,6 @@ export default class StatsTab extends Component { let bigRoomsData; let oneOnOneData; let activeRooms; - let serverState; const usersLines = []; const roomsLines = []; if (this.state.stats) { @@ -86,42 +84,23 @@ export default class StatsTab extends Component { {label: 'One on One', data: oneOnOneData}, {label: 'Inactive', data: bigRoomsData-activeRooms}); } - if (this.state.serverState) { - serverState = + let buttonReport; + if (this.state.serverReport) { + buttonReport =
- - - +
; } return (
- Statistics for Watcha server { this.props.server.replace('https://', '').replace('/', '') } + Statistics for Watcha server
-
- - - Server State - - - { serverState } - - - - - - Server Log - - - log - - -
+ { buttonReport }
); } diff --git a/src/User.css b/src/User.css index 39ebef4..337b2f1 100644 --- a/src/User.css +++ b/src/User.css @@ -119,3 +119,7 @@ .textFilter{ margin-top: 1vh; } + +.ServerStatePanelBody{ + background:grey; +} diff --git a/src/UserRightPanel.js b/src/UserRightPanel.js index 4e72154..a6c5d2a 100644 --- a/src/UserRightPanel.js +++ b/src/UserRightPanel.js @@ -67,7 +67,7 @@ export default class UserRightPanel extends Component { const userRequest = await fetch(homeServer+ '_matrix/client/r0/watcha_update_email/'+ encodeURIComponent(this.props.data['User Id']['data']), { - method: 'POST', + method: 'PUT', headers: { 'Authorization': 'Bearer '+ accessToken, 'Accept': 'application/json',