-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat(ui): Support Unix epoch timestamps in links #5666
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5666 +/- ##
==========================================
- Coverage 47.12% 47.10% -0.02%
==========================================
Files 242 242
Lines 15135 15135
==========================================
- Hits 7133 7130 -3
- Misses 7095 7096 +1
- Partials 907 909 +2
Continue to review full report at Codecov.
|
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
# Adds a button to the workflow page but the timestamps are converted to Unix epoch time instead. | ||
- name: Example Workflow Link | ||
scope: workflow | ||
url: "http://logging-facility?namespace=${metadata.namespace}&workflowName=${metadata.name}&startedAt=${status.startedAt | date: '%s'}&finishedAt=${ status.finishedAt | date: '%s' | default: 'now' }" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an example to demonstrate filters.
window.open(url, '_blank'); | ||
} else { | ||
document.location.href = url; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like archived workflow links don't support opening with a new tab before. So fixed that.
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
@@ -99,6 +100,7 @@ export const EventSourceLogsViewer = ({ | |||
}} | |||
/> | |||
)} | |||
<Links scope='event-source-logs' object={eventSource} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like event source logs were not actually added. We have this in the example configmap tho. So have to fix this.
@@ -34,7 +34,7 @@ export const Links = ({scope, object, button}: {scope: string; object: {metadata | |||
}; | |||
|
|||
const openLink = (url: string) => { | |||
if ((window.event as MouseEvent).ctrlKey) { | |||
if ((window.event as MouseEvent).ctrlKey || (window.event as MouseEvent).metaKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In MacOS we have to use command + left click to open in a new tab.
docs/links.md
Outdated
| `${status.startedAt}` | Start timestamp of the workflow/pod, in the format of `2021-01-01T10:35:56Z` | | ||
| `${status.finishedAt}` | End timestamp of the workflow/pod, in the format of `2021-01-01T10:35:56Z`. If the workflow/pod is still running, this variable will be an empty string. | | ||
|
||
> v3.1 and after |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see 3.1 branch created yet so I assume this change will go in 3.1 release (if merged)?
Thanks for the review @alexec! I've done some investigation.
Luckily, I found LiquidJS which is safe and lightweight with useful built-in filters like For example, to convert
I've pushed all my changes. Let me know what you think. Thanks! |
7f1cae2
to
e3af497
Compare
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
Great stuff! 🚢 |
Fixes #5557
This PR enables us to use
${status.startedAtEpoch}
and${status.finishedAtEpoch}
in Argo links.This is very useful for users who want to link to a logging facility that only supports epoch timestamps as URL parameters.
For example, by setting the following link:
We can link to a Grafana / DataDog dashboard by the timestamp.
Showcase:
Docs:
Would ❤️ to hear some feedback. Thanks!