-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: Add custom data views with aggregation query #2888
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
1e707d5
feat: add custom views page
mtrezza 5f61237
chore: address lint issues
mtrezza eab8cf3
fix: populate classes in Views dialog
mtrezza d485379
fix: handle view query errors
mtrezza 8825239
fix: align view table headers
mtrezza 49cd9fc
feat: link pointers in views
mtrezza 6ed37ba
fix: preserve filter URL for pointer links
mtrezza bb8eabd
fix: improve views table usability
mtrezza e97fbd9
fix: sync views column widths
mtrezza 1de7b4c
fix: align resizable view columns
mtrezza 5781c2b
fix: align view headers with columns
mtrezza c0ca3e2
fix: stabilize column resize
mtrezza 0404b3e
fix: sync view headers with scroll
mtrezza 1708ad9
fix: allow route for views page
mtrezza d490260
fix: parse route query string
mtrezza 7c6230a
Revert "fix: sync view headers with scroll"
mtrezza 510dea2
Revert "fix: allow route for views page"
mtrezza d18cb6a
Revert "fix: parse route query string"
mtrezza 80ef8c1
feat: Allow editing views (#2889)
mtrezza eef72bd
fix: Prevent stale pointer navigation (#2890)
mtrezza 146ec5d
fix: Handle invalid pointers in Views results (#2891)
mtrezza 5b96bea
Update TableView.scss
mtrezza f9514dd
Cell height fix
mtrezza dc36630
fix: Center pill in Views table cells (#2895)
mtrezza d74b4f8
docs: Add Views feature (#2896)
mtrezza d657be1
fix: Display ISO string for date objects in views (#2897)
mtrezza 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import Dropdown from 'components/Dropdown/Dropdown.react'; | ||
import Field from 'components/Field/Field.react'; | ||
import Label from 'components/Label/Label.react'; | ||
import Modal from 'components/Modal/Modal.react'; | ||
import Option from 'components/Dropdown/Option.react'; | ||
import React from 'react'; | ||
import TextInput from 'components/TextInput/TextInput.react'; | ||
import Checkbox from 'components/Checkbox/Checkbox.react'; | ||
|
||
function isValidJSON(value) { | ||
try { | ||
JSON.parse(value); | ||
return true; | ||
} catch { | ||
return false; | ||
} | ||
} | ||
|
||
export default class CreateViewDialog extends React.Component { | ||
constructor() { | ||
super(); | ||
this.state = { | ||
name: '', | ||
className: '', | ||
query: '[]', | ||
showCounter: false, | ||
}; | ||
} | ||
|
||
valid() { | ||
return ( | ||
this.state.name.length > 0 && | ||
this.state.className.length > 0 && | ||
isValidJSON(this.state.query) | ||
); | ||
} | ||
|
||
render() { | ||
const { classes, onConfirm, onCancel } = this.props; | ||
return ( | ||
<Modal | ||
type={Modal.Types.INFO} | ||
icon="plus" | ||
iconSize={40} | ||
title="Create a new view?" | ||
subtitle="Define a custom query to display data." | ||
confirmText="Create" | ||
cancelText="Cancel" | ||
disabled={!this.valid()} | ||
onCancel={onCancel} | ||
onConfirm={() => | ||
onConfirm({ | ||
name: this.state.name, | ||
className: this.state.className, | ||
query: JSON.parse(this.state.query), | ||
showCounter: this.state.showCounter, | ||
}) | ||
} | ||
> | ||
<Field | ||
label={<Label text="Name" />} | ||
input={ | ||
<TextInput | ||
value={this.state.name} | ||
onChange={name => this.setState({ name })} | ||
/> | ||
} | ||
/> | ||
<Field | ||
label={<Label text="Class" />} | ||
input={ | ||
<Dropdown | ||
value={this.state.className} | ||
onChange={className => this.setState({ className })} | ||
> | ||
{classes.map(c => ( | ||
<Option key={c} value={c}> | ||
{c} | ||
</Option> | ||
))} | ||
</Dropdown> | ||
} | ||
/> | ||
<Field | ||
label={ | ||
<Label | ||
text="Query" | ||
description="An aggregation pipeline that returns an array of items." | ||
/> | ||
} | ||
input={ | ||
<TextInput | ||
multiline={true} | ||
value={this.state.query} | ||
onChange={query => this.setState({ query })} | ||
/> | ||
} | ||
/> | ||
<Field | ||
label={<Label text="Show object counter" />} | ||
input={ | ||
<Checkbox | ||
checked={this.state.showCounter} | ||
onChange={showCounter => this.setState({ showCounter })} | ||
/> | ||
} | ||
/> | ||
</Modal> | ||
); | ||
} | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Field from 'components/Field/Field.react'; | ||
import Label from 'components/Label/Label.react'; | ||
import Modal from 'components/Modal/Modal.react'; | ||
import React from 'react'; | ||
import TextInput from 'components/TextInput/TextInput.react'; | ||
|
||
export default class DeleteViewDialog extends React.Component { | ||
constructor() { | ||
super(); | ||
this.state = { | ||
confirmation: '', | ||
}; | ||
} | ||
|
||
valid() { | ||
return this.state.confirmation === this.props.name; | ||
} | ||
|
||
render() { | ||
return ( | ||
<Modal | ||
type={Modal.Types.DANGER} | ||
icon="warn-outline" | ||
title="Delete view?" | ||
subtitle="This action cannot be undone!" | ||
disabled={!this.valid()} | ||
confirmText="Delete" | ||
cancelText="Cancel" | ||
onCancel={this.props.onCancel} | ||
onConfirm={this.props.onConfirm} | ||
> | ||
<Field | ||
label={<Label text="Confirm this action" description="Enter the view name to continue." />} | ||
input={ | ||
<TextInput | ||
placeholder="View name" | ||
value={this.state.confirmation} | ||
onChange={confirmation => this.setState({ confirmation })} | ||
/> | ||
} | ||
/> | ||
</Modal> | ||
); | ||
} | ||
} | ||
Oops, something went wrong.
Oops, something went wrong.
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.
🛠️ Refactor suggestion
Add prop validation for required props.
The component expects
name
,onCancel
, andonConfirm
props but doesn't validate them. Consider adding PropTypes validation to ensure proper usage.Add prop validation after the component class:
And import PropTypes at the top:
+import PropTypes from 'prop-types'; import Field from 'components/Field/Field.react';
🤖 Prompt for AI Agents