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

OCPBUGS-32523: [release-4.15] e2e-chart: copy label contents to clipboard when segment is clicked #28730

Open
wants to merge 2 commits into
base: release-4.15
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion e2echart/e2e-chart-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,14 @@ <h5 class="modal-title">Resource</h5>
return tt
}


function segmentTooltipFunc(d) {
return '<span style="max-inline-size: min-content; display: inline-block;">'
+ '<strong>' + d.labelVal + '</strong><br/>'
+ '<strong>From: </strong>' + new Date(d.timeRange[0]).toUTCString() + '<br>'
+ '<strong>To: </strong>' + new Date(d.timeRange[1]).toUTCString() + '</span>';
}

function createTimelineData(timelineVal, timelineData, rawEventIntervals, preconditionFunc, regex) {
const data = {}
var now = new Date();
Expand Down Expand Up @@ -514,6 +522,9 @@ <h5 class="modal-title">Resource</h5>
createTimelineData(interestingEvents, timelineGroups[timelineGroups.length - 1].data, eventIntervals, isInterestingOrPathological, regex)

var segmentFunc = function (segment) {
// Copy label to clipboard
navigator.clipboard.writeText(segment.labelVal);

// for (var i in data) {
// if (data[i].group == segment.group) {
// var groupdata = data[i].data
Expand Down Expand Up @@ -569,7 +580,8 @@ <h5 class="modal-title">Resource</h5>
maxHeight(10000).
zColorScale(ordinalScale).
zoomX([new Date(eventIntervals.items[0].from), new Date(eventIntervals.items[eventIntervals.items.length - 1].to)]).
onSegmentClick(segmentFunc)
onSegmentClick(segmentFunc).
segmentTooltipContent(segmentTooltipFunc)
(el);


Expand Down
12 changes: 11 additions & 1 deletion e2echart/non-spyglass-e2e-chart-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,13 @@ <h5 class="modal-title">Resource</h5>
return tt
}

function segmentTooltipFunc(d) {
return '<span style="max-inline-size: min-content; display: inline-block;">'
+ '<strong>' + d.labelVal + '</strong><br/>'
+ '<strong>From: </strong>' + new Date(d.timeRange[0]).toUTCString() + '<br>'
+ '<strong>To: </strong>' + new Date(d.timeRange[1]).toUTCString() + '</span>';
}

function createTimelineData(timelineVal, timelineData, filteredEventIntervals, category) {
const data = {}
var now = new Date();
Expand Down Expand Up @@ -815,6 +822,8 @@ <h5 class="modal-title">Resource</h5>
createTimelineData(interestingEvents, timelineGroups[timelineGroups.length - 1].data, filteredEvents, "interesting_events");

var segmentFunc = function (segment) {
// Copy label to clipboard
navigator.clipboard.writeText(segment.labelVal);
// for (var i in data) {
// if (data[i].group == segment.group) {
// var groupdata = data[i].data
Expand Down Expand Up @@ -870,7 +879,8 @@ <h5 class="modal-title">Resource</h5>
maxHeight(10000).
zColorScale(ordinalScale).
zoomX([new Date(eventIntervals.items[0].from), new Date(eventIntervals.items[eventIntervals.items.length - 1].to)]).
onSegmentClick(segmentFunc)
onSegmentClick(segmentFunc).
segmentTooltipContent(segmentTooltipFunc)
(el);


Expand Down
26 changes: 24 additions & 2 deletions test/extended/testdata/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.