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

Sync event timestamp with timegraph #207

Merged
merged 1 commit into from Jan 12, 2021
Merged

Sync event timestamp with timegraph #207

merged 1 commit into from Jan 12, 2021

Conversation

ghost
Copy link

@ghost ghost commented Dec 23, 2020

Signed-off-by: muddana-satish [email protected]

depends on eclipse-cdt-cloud/timeline-chart#85

@bhufmann
Copy link
Collaborator

bhufmann commented Jan 7, 2021

@muddana-satish I currently reviewing this patch. I'll get back to you soon.

@@ -3,6 +3,7 @@ import { EventEmitter } from 'events';
export declare interface SignalManager {

fireTooltipSignal(tooltip: { [key: string]: string }): void;
fireEventClickSignal(payload: {[timeStamp: string]: number }): void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

"timestamp" should be a different name. Timestamp is one of the keys. Later on we might have multiple once.
I wonder if we should pass strings instead of numbers and the signal receivers have to convert them if necessary.
Name could be fireSelectionChangedSignal(), selection changed (see comment below on signal name)

@@ -12,7 +13,8 @@ export const Signals = {
EXPERIMENT_OPENED: 'experiment opened',
EXPERIMENT_CLOSED: 'experiment closed',
EXPERIMENT_SELECTED: 'experiment selected',
TOOLTIP_UPDATED: 'tooltip updated'
TOOLTIP_UPDATED: 'tooltip updated',
EVENT_CLICKED: 'Event clicked'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Event -> event: should lower case. I wonder if we will re-use this signal for other selections changes (e.g. chart to table). So, maybe we call it "selection changed".

>
</AgGridReact>
</div>;
}

private onEventClick(event: CellClickedEvent) {
const columns = event.columnApi.getAllColumns();
const timeStampHeader = columns.find(column => column.getColDef().headerName === "Timestamp (ns)");
Copy link
Collaborator

Choose a reason for hiding this comment

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

The column header string is acutally "Timestamp ns" in the trace compass server.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we need this, then it's a sign there's a problem with the TSP, this is the kind of string that should never be hard-coded. Time to work on eclipse-cdt-cloud/trace-server-protocol#35?

@@ -86,6 +87,7 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
}
this.onElementSelected(this.selectedElement);
});
signalManager().on(Signals.EVENT_CLICKED, ({ timeStamp }) => this.eventClicked(timeStamp));
Copy link
Collaborator

Choose a reason for hiding this comment

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

use payload instead of timestamp

@@ -141,6 +143,19 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
this.setState({ collapsedNodes: newList });
}

private eventClicked(timeStampObj: { [key: string]: number }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

use payload instead of timestamp.

start: newViewRangeStart,
end: newViewRangeStart
};
this.chartLayer.setEventClickedFlag(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would prefer to separate the timestamp sync and row sync in 2 different pull requests (in theia-trace-extesion and timeline-chart).

@mirsky-work
Copy link
Contributor

Should be linked to #111

@ghost
Copy link
Author

ghost commented Jan 8, 2021

@bhufmann Modified as per your suggestions. Now the selection cursor moves based on the timestamp from the event row.

@ghost ghost changed the title Sync events and timegraph states Sync event timestamp with timegraph Jan 8, 2021
@ghost ghost added the enhancement New feature or request label Jan 8, 2021
@ghost ghost self-assigned this Jan 8, 2021
@ghost ghost added this to the First MVP milestone Jan 8, 2021
@ghost ghost requested a review from bhufmann January 8, 2021 21:31
Copy link
Collaborator

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

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

Please update and rebase this patch to latest in master.

@@ -3,6 +3,7 @@ import { EventEmitter } from 'events';
export declare interface SignalManager {

fireTooltipSignal(tooltip: { [key: string]: string }): void;
fireEventClickSignal(payload: {[key: string]: number }): void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should send the keys and value as strings and the receiving side should convert to the number. Later on we'll add other key/value pairs to sync on.

if (timeStampHeader) {
const timeStamp = timeStampHeader.getColDef().field;
const payload = {
'timestamp': Number(event.data[timeStamp!])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Send the timestamp as a string

@@ -141,6 +143,17 @@ export class TimegraphOutputComponent extends AbstractTreeOutputComponent<Timegr
this.setState({ collapsedNodes: newList });
}

private selectionChanged(payload: { [key: string]: number }) {
const offset = this.props.viewRange.getOffset();
const rawTimeStamp = payload['timestamp'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here you need to convert it the string to a number. If conversion fails in the code then ignore signal.

Signed-off-by: muddana-satish <[email protected]>
@ghost ghost requested a review from bhufmann January 11, 2021 21:43
@ghost
Copy link
Author

ghost commented Jan 11, 2021

Please update and rebase this patch to latest in master.

Addressed all the review comments.

Copy link
Collaborator

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for the improvement.

Copy link
Contributor

@tahini tahini left a comment

Choose a reason for hiding this comment

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

Works well! Thanks!

@bhufmann bhufmann merged commit 7b9732c into eclipse-cdt-cloud:master Jan 12, 2021
@ghost ghost deleted the sync-events-states branch January 13, 2021 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants