facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
229.04k stars 46.86k forks source link

How can i do to get downtime times? #20908

Closed hugonh closed 3 years ago

hugonh commented 3 years ago

Im trying to use an API from UpTimeRobot to monitor 2 cloud providers, Locaweb and AWS, so im using a git called "nocodeapi/status" ( https://github.com/nocodeapi/status ) that is a React program, that pulls data from here as example https://v1.nocodeapi.com/hugonh/uptime/XPBjzmgSBPYqMCNj?monitors=785820041-785820037-787326309-787325770 and convert to graphical interfaces on localhost:3000 as showed on images

Now im trying as facebook/react

How can i get how many times Down flag(red arrows) happened or Which downtime lasted most, more duration?

My first time using React (JS)

const statusComp = type => {
    let status = "";

    if (type === 1)

        status = (
            <>
                <ArrowDown color="red" size={14} /> Down
            </>
        );
    if (type === 2)
        status = (
            <>
                <ArrowUp color="green" size={14} /> Up
            </>
        );
    if (type === 98)
        status = (
            <>
                <Play color="blue" size={14} /> Started
            </>
        );

    return status;

};

image image

function getLastDown(logs){ const downLogIndex = logs.findIndex(log => log.type === 1) let message; if(downLogIndex === -1){ message = "No down time"

//else happens when its down and shows the time and duration }else { message = ${moment .unix(logs[downLogIndex].datetime) .format("YYYY-MM-DD, h:mm:ss")} (${secondsToHms(logs[downLogIndex].duration)}) } return message }

bvaughn commented 3 years ago

This does not seem like a React issue. Just because https://github.com/nocodeapi/status is a React application doesn't mean we can answer questions about it here :)

Looks like you've already asked there (https://github.com/nocodeapi/status/issues/11) which is the right place.