-
Notifications
You must be signed in to change notification settings - Fork 170
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
Issue 233 #311
Merged
Merged
Issue 233 #311
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
59eba4b
Initial work to add the commit timestamp to the stream viewer
krlawrence 9099e6c
Add UTC human readable timestamp
krlawrence bd2b07c
Put the human readable date in parens #233
krlawrence d6cbe8d
Initial support for isLastOp in stream viewer #233
krlawrence 92b9532
Center the operation column text #233
krlawrence 0cba04c
Improve hover help text #233
krlawrence cd6cd0e
Update changelog - still need to add PR info later. #233
krlawrence 69b2358
Add link to pR in the changelog
krlawrence ccd7479
Merge branch 'main' into ISSUE-233
michaelnchin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,9 +2,11 @@ | |||||
import json | ||||||
import ipywidgets as widgets | ||||||
import queue | ||||||
from datetime import datetime | ||||||
from IPython.display import display, HTML | ||||||
from graph_notebook.neptune.client import STREAM_AT, STREAM_AFTER, STREAM_TRIM, STREAM_EXCEPTION_NOT_FOUND,\ | ||||||
STREAM_EXCEPTION_NOT_ENABLED, STREAM_PG, STREAM_RDF, STREAM_ENDPOINTS | ||||||
STREAM_EXCEPTION_NOT_ENABLED, STREAM_PG, STREAM_RDF, STREAM_ENDPOINTS,\ | ||||||
STREAM_COMMIT_TIMESTAMP, STREAM_IS_LASTOP | ||||||
|
||||||
|
||||||
class EventId: | ||||||
|
@@ -176,30 +178,48 @@ def show_records(self, records): | |||||
html = '''<html><body><table style="border: 1px solid black">''' | ||||||
|
||||||
html += '''<tr> | ||||||
<th style="text-align: center" >Tx/Op#</th> | ||||||
<th style="text-align: center">Operation</th> | ||||||
<th style="text-align: center">Data</th> | ||||||
<th style="text-align: center" title="The transaction or op number within a transaction">Tx/Op#</th> | ||||||
<th style="text-align: center" title="The type of operation such as ADD or REMOVE">Operation</th> | ||||||
<th style="text-align: center" title="Indicates if this is the final Op of a transaction. This feature requires a Neptune engine version of 1.1.1.0 or higher.">LastOp</th> | ||||||
<th style="text-align: center;">Data</th> | ||||||
</tr>''' | ||||||
|
||||||
commit_num = None | ||||||
|
||||||
for record in records: | ||||||
current_commit_num = record['eventId']['commitNum'] | ||||||
|
||||||
timestamp = None | ||||||
lastop = False | ||||||
lastop_text = '' | ||||||
if STREAM_COMMIT_TIMESTAMP in record: | ||||||
timestamp = record[STREAM_COMMIT_TIMESTAMP] | ||||||
utc_text = datetime.utcfromtimestamp(timestamp/1000) | ||||||
|
||||||
data = json.dumps(record['data']).replace('&', '&').replace('<', '<') | ||||||
|
||||||
if commit_num is None or current_commit_num != commit_num: | ||||||
commit_num = current_commit_num | ||||||
html += '<tr title="The commit number for this transaction" style="border: 1px solid black; background-color: gainsboro ; font-weight: bold;">' | ||||||
html += '<td style="border: 1px solid black; vertical-align: top; text-align: left;" colspan="3">{}</td>'.format(commit_num) | ||||||
html += '<tr style="border: 1px solid black; background-color: gainsboro ; font-weight: bold;">' | ||||||
html += '<td title="The commit number for this transaction" style="border: 1px solid black; vertical-align: top; text-align: left;" colspan="4">{}'.format(commit_num) | ||||||
if timestamp != None: | ||||||
html += ' Timestamp = {}'.format(timestamp) | ||||||
html += ' ( {} UTC )'.format(utc_text) | ||||||
html += '</td>' | ||||||
html += '</tr><tr style="border: 1px solid black;">' | ||||||
|
||||||
html += '<tr title="The operation number within this transaction" style="border: 1px solid black; background-color: white;">' | ||||||
html += '''<td style="border: 1px solid black; vertical-align: top;">{}</td> | ||||||
<td style="border: 1px solid black; vertical-align: top;">{}</td> | ||||||
<td style="border: 1px solid black; vertical-align: top; text-align: left;">{}</td></tr>'''.format( | ||||||
if STREAM_IS_LASTOP in record: | ||||||
lastop = record[STREAM_IS_LASTOP] | ||||||
if lastop: | ||||||
lastop_text = 'Y' | ||||||
|
||||||
html += '<tr style="border: 1px solid black; background-color: white;">' | ||||||
html += '''<td title="The operation number within this transaction" style="border: 1px solid black; vertical-align: top;">{}</td> | ||||||
<td title="The operation performed"style="border: 1px solid black; vertical-align: top;text-align: center;">{}</td> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Minor]
Suggested change
|
||||||
<td title="A Y indicates the final Op for a transaction. Earlier Neptune versions do not support this option." style="border: 1px solid black; vertical-align: top;text-align: center;">{}</td> | ||||||
<td title="Details of the change made by this operation" style="border: 1px solid black; vertical-align: top; text-align: left;">{}</td></tr>'''.format( | ||||||
record['eventId']['opNum'], | ||||||
record['op'], | ||||||
lastop_text, | ||||||
data) | ||||||
|
||||||
html += '</table></body></html>' | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[Optional]