-
Notifications
You must be signed in to change notification settings - Fork 44
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
Allow more powerful queries for Realms/Users tables #1147
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
// | ||
//////////////////////////////////////////////////////////////////////////// | ||
|
||
import * as electron from 'electron'; | ||
import * as React from 'react'; | ||
import { Column } from 'react-virtualized'; | ||
import { Button } from 'reactstrap'; | ||
|
@@ -39,6 +40,22 @@ const FilterableRealmTable: React.ComponentType< | |
IFilterableTableProps<RealmFile> | ||
> = FilterableTable; | ||
|
||
const onQueryHelp = () => { | ||
const url = | ||
'https://realm.io/docs/javascript/latest/api/tutorial-query-language.html'; | ||
electron.shell.openExternal(url); | ||
}; | ||
|
||
const queryHelpTooltip = ( | ||
<div style={{ textAlign: 'left' }}> | ||
Start a query with ! to pass in a verbatim realm-js query. For example: | ||
<ul> | ||
<li>!path = "/default"</li> | ||
<li>!userId ENDSWITH "123"</li> | ||
</ul> | ||
</div> | ||
); | ||
|
||
export const RealmsTable = ({ | ||
deletionProgress, | ||
getRealmPermissions, | ||
|
@@ -52,6 +69,7 @@ export const RealmsTable = ({ | |
onSearchStringChange, | ||
realms, | ||
searchString, | ||
queryError, | ||
selectedRealms, | ||
onRealmSizeRecalculate, | ||
shouldShowRealmSize, | ||
|
@@ -68,6 +86,7 @@ export const RealmsTable = ({ | |
onSearchStringChange: (query: string) => void; | ||
realms: Realm.Results<RealmFile>; | ||
searchString: string; | ||
queryError?: Error; | ||
selectedRealms: RealmFile[]; | ||
onRealmSizeRecalculate: (realm: RealmFile) => void; | ||
shouldShowRealmSize: boolean; | ||
|
@@ -81,8 +100,11 @@ export const RealmsTable = ({ | |
onElementDoubleClick={onRealmOpened} | ||
onElementsDeselection={onRealmsDeselection} | ||
onSearchStringChange={onSearchStringChange} | ||
searchPlaceholder="Search Realms" | ||
searchPlaceholder="Search Realms (start with ! to write a verbatim realm-js query)" | ||
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. I believe this placeholder is a bit (too) cryptic - perhaps we could move this explanation, with a couple of examples to a tooltip which is shown when pressing "?" button at the end of the input field or perhaps a placeholder in the table when the query doesn't return any results? 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. @nirinchev I see now that my comment doesn't make that much sense, as you did in-fact add a tooltip with examples 😄I think this placeholder can be greatly simplified as we have that. |
||
onQueryHelp={onQueryHelp} | ||
queryHelpTooltip={queryHelpTooltip} | ||
searchString={searchString} | ||
queryError={queryError} | ||
selectedElements={selectedRealms} | ||
isElementsEqual={(a, b) => a.path === b.path} | ||
> | ||
|
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.
Not a big fan of this change @nirinchev.
Having a pre-commit hook makes it easier to help contributors remember to run linting.
If you think this was really necessary, I think it should have been a separate PR to make it easier to revert in the future.
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 couldn't commit due to an error that I showed you some time ago. While I agree it could have been done in a separate PR, it didn't seem worth the effort. I'll create an issue to track enabling it.
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.
☝️ did you create an issue to track enabling it @nirinchev? I can't seem to find it ..
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.
Of course - #1166 - it's the latest issue in the repo 😝