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

Add support for Templated Countdown Target Date / Time #98

Merged
merged 7 commits into from Feb 8, 2022

Conversation

KMurphs
Copy link
Contributor

@KMurphs KMurphs commented Dec 7, 2021

There are use cases where a countdown target should be dynamically set. E.g, while monitoring some testing activities that are supposed to take x amount of minutes.
Proposed solution is to use a dashboard variable to accomplish this. E.g

  1. Define a variable for the dashboard (i.e. the end time for the countdown):

    • Name: countdown_target
    • Type: Constant
    • Label:
    • Description:
    • (Default) Value:
  2. Use this variable in the panel setting:

    • Set 'Countdown > EndTime' as ${countdown_target}
  3. Use the panel with the variable as in

url = http://localhost:3000/d/hDzucFh7z/new-dashboard?orgId=1&var-countdown_target=2021-12-06T22:04:19.019Z

This will preserve initial functionality, i.e. when a hard-coded value is set for the countdown

@CLAassistant
Copy link

CLAassistant commented Dec 7, 2021

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@leventebalogh leventebalogh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks a lot for the contribution @KMurphs! 👏

Tested it out and it's working as expected. I left one comment regarding the failing build, plus I think it would be good to add a few lines in the README so it's easier to discovered and used by others.

src/ClockPanel.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@jackw jackw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

Thanks so much for the contribution @KMurphs. Have made one minor suggestion as we try to follow semver as much as possible with versioning this plugin.

package.json Outdated Show resolved Hide resolved
@gigillo73
Copy link

Hi. I would extract a value from a MySQL database; if this value is not null, I would use it to start the countdown. The use case is referred to the load control at home. My device read the power from the meter and receive the seconds before the switch off. I write this value into a MySQL database. I need to show this countdown (tipically 2 hours or 2 minutes) on the grafana clock panel . Thanks.

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
@zuchka zuchka merged commit 65c50ba into grafana:master Feb 8, 2022
@zuchka zuchka linked an issue Feb 8, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

make countdown timer more flexible
6 participants