-
Notifications
You must be signed in to change notification settings - Fork 16
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
Create a widget to query ECSQL strings #213
base: master
Are you sure you want to change the base?
Conversation
common/changes/@itwin/viewer-react/leck-ecsql-widget_2022-08-15-20-49.json
Outdated
Show resolved
Hide resolved
packages/modules/viewer-react/src/components/app-ui/EcsqlWidget.tsx
Outdated
Show resolved
Hide resolved
You probably want to be using a Virtualized Table |
packages/modules/viewer-react/src/components/app-ui/EcsqlWidget.tsx
Outdated
Show resolved
Hide resolved
packages/modules/viewer-react/src/components/app-ui/EcsqlWidget.tsx
Outdated
Show resolved
Hide resolved
packages/modules/viewer-react/src/components/app-ui/EcsqlWidget.tsx
Outdated
Show resolved
Hide resolved
.forEach((key) => { | ||
row[key] = JSON.stringify(obj[key]); | ||
}); | ||
// Case 3: If the cell content is too long, put it inside an ExpandableBlock |
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.
what does this actually look like?
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.
what is the type for row here when this occurs? i dont think it matches what you had originally typed it as
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.
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.
still feels a little weird for me, have you looked at what the standard pattern we use is?
do we just show as much text as we can before showing an ellipses for overflow, and then on hover show the full text in a tool tip or something?
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.
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.
Or maybe I just have to customize it a bit more.
packages/modules/viewer-react/src/components/app-ui/EcsqlWidget.tsx
Outdated
Show resolved
Hide resolved
packages/modules/viewer-react/src/components/app-ui/EcsqlWidget.tsx
Outdated
Show resolved
Hide resolved
packages/modules/viewer-react/src/components/app-ui/EcsqlWidget.tsx
Outdated
Show resolved
Hide resolved
packages/modules/viewer-react/src/components/app-ui/EcsqlWidget.tsx
Outdated
Show resolved
Hide resolved
public readonly id = "EcsqlWidgetProvider"; | ||
|
||
public provideWidgets( | ||
stageId: string, |
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.
Take a look at what we do for stageId and stageUsage in the other providers in viewer-components-react
Unfortunately, the virtualized table loses the horizontal scrollbar if there are too many columns, and it can't be added back without some (hacky?) css The performance gain is very important though... |
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.
Good work! We'll take it over once you go back to school. Unless you want to continue contributing as an OpenSource Collaborator ;)
|
||
rows.push(row); | ||
for (const key of Object.keys(row)) { | ||
if (!columnHeaders.includes(key)) { |
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.
well wouldnt they always all not be in columnheaders to begin with?
re-read this block of code here
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.
Hmm, I'm pretty sure this is right. I wanted columnHeaders to be the superset of all keys in each row, because sometimes each row might have different keys. So every time columnHeaders encounters a new unique key, it should append the new key. columnHeaders is instantiated before we start iterating through each row.
On startup:
Bad query:
Successful query: