Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Up/Down time in Device List #9951

Merged
merged 12 commits into from Mar 18, 2019

Conversation

Projects
None yet
2 participants
@PipoCanaja
Copy link
Contributor

commented Mar 13, 2019

This is an attempt for Uptime Downtime display in the device list. Thought ? I tried to reuse most of existing code, only adding the minimum.

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926
After you are done testing, you can remove the changes with ./scripts/github-remove. If there are schema changes, you can ask on discord how to revert.

@PipoCanaja PipoCanaja self-assigned this Mar 13, 2019

@PipoCanaja PipoCanaja added the WebUI label Mar 13, 2019

@PipoCanaja

This comment has been minimized.

Copy link
Contributor Author

commented Mar 13, 2019

Capture d’écran 2019-03-14 à 00 09 03

Show resolved Hide resolved app/Models/Device.php Outdated

@PipoCanaja PipoCanaja force-pushed the PipoCanaja:downtime branch from e23a1e8 to 2a29bf5 Mar 14, 2019

Show resolved Hide resolved app/Models/Device.php Outdated
@murrant

This comment has been minimized.

Copy link
Member

commented Mar 15, 2019

@PipoCanaja ok, I remembered you have to add it to casts on the device model:

    protected $casts = [
        'last_polled' => 'datetime',
        'status' => 'boolean',
    ];

Then you can get downtime like this:

$device->last_polled->diffInSeconds()
@murrant

This comment has been minimized.

Copy link
Member

commented Mar 15, 2019

Also, you should update Device:formatUptime() to use Time::formatInterval() to remove code duplication. (or remove it entirely)

Sorry this PR has been a bit of monkeying around, but the Eloquent models haven't settled in yet, so sometimes they need to be improved a bit.

@PipoCanaja

This comment has been minimized.

Copy link
Contributor Author

commented Mar 15, 2019

Much better now. Cleaning of the various formatUptime() I found using grep :) statrs to look more consistant.
Full remove is a little more job but I'll check.

@PipoCanaja PipoCanaja changed the title WIP - Attempt of Up/Down time in Device List Display Up/Down time in Device List Mar 16, 2019

@@ -387,6 +364,16 @@ public function statusName()
// ---- Accessors/Mutators ----
public function getStatus()

This comment has been minimized.

Copy link
@murrant

murrant Mar 17, 2019

Member

Can you please remove getStatus() and getLastPolled(), just use the property accessors: ->status and ->last_polled

@murrant
Copy link
Member

left a comment

LGTM

@murrant murrant merged commit a2d378e into librenms:master Mar 18, 2019

5 of 7 checks passed

codeclimate 2 issues to fix
Details
Travis CI - Pull Request Build Created
Details
Inspection Summary
Details
Node: analysis
Details
Travis CI - Pull Request Build Passed
Details
WIP Ready for review
Details
license/cla Contributor License Agreement is signed.
Details

funzoneq added a commit to funzoneq/librenms that referenced this pull request Apr 30, 2019

Display Up/Down time in Device List (librenms#9951)
* First attempt of Up/Down time

* First attempt of Up/Down time

* Moved to Time::formatInterval()

* cleaning

* last polled in casts

* Cleaning the variants of formatUptime()

* Cleaning in ./html/includes/dev-overview-data.inc.php

* Cleaning in ./html/includes/dev-overview-data.inc.php

* Cleaning in ./html/includes/dev-overview-data.inc.php

* updated includes/polling/core.inc.php

* updated includes/alerts.inc.php

* clean accessors

@lock lock bot locked as resolved and limited conversation to collaborators May 17, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.