Added more statistics

This commit is contained in:
frikky
2020-05-14 09:20:47 +02:00
parent b8b67b87b7
commit 809a1824ff
5 changed files with 67 additions and 57 deletions
+2 -2
View File
@@ -38,12 +38,12 @@ import AlertTemplate from "react-alert-template-basic";
import { positions, Provider } from "react-alert";
// Testing - localhost
//const globalUrl = "http://192.168.3.6:5001"
const globalUrl = "http://192.168.3.6:5001"
//console.log("HOST: ", process.env)
// Production - backend proxy forwarding in nginx
const globalUrl = window.location.origin
//const globalUrl = window.location.origin
const surfaceColor = "#27292D"
const inputColor = "#383B40"
-1
View File
@@ -626,7 +626,6 @@ const Apps = (props) => {
const errorText = openApiError.length > 0 ? <div>Error: {openApiError}</div> : null
const circularLoader = validation ? <CircularProgress color="primary" /> : null
console.log(validation)
const modalView = openApiModal ?
<Dialog modal
open={openApiModal}
+23 -3
View File
@@ -1,4 +1,5 @@
import React, {useState} from 'react';
import { useInterval } from 'react-powerhooks';
// nodejs library that concatenates classes
import classNames from "classnames";
// react plugin used to create charts
@@ -76,6 +77,7 @@ const Dashboard = (props) => {
});
}
// All these are currently tracked.
const variables = [
"backend_executions",
"workflow_executions",
@@ -86,19 +88,37 @@ const Dashboard = (props) => {
"openapi_apps_created",
"total_apps_deleted",
"total_webhooks_ran",
"total_workflows",
"total_workflow_actions",
"total_workflow_triggers",
]
if (firstRequest) {
setFirstRequest(false)
const runUpdate = () => {
for (var key in variables) {
fetchdata(variables[key])
}
}
// Refresh every 60 seconds
const autoUpdate = 60000
const { start, stop } = useInterval({
duration: autoUpdate,
startImmediate: false,
callback: () => {
runUpdate()
}
});
if (firstRequest) {
setFirstRequest(false)
start()
runUpdate()
}
const newdata = Object.getOwnPropertyNames(stats).length > 0 ?
<div>
Autoupdate every {autoUpdate/1000} seconds
{variables.map(data => {
if (stats[data] === undefined || stats[data] === null) {
return null