-
Notifications
You must be signed in to change notification settings - Fork 521
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
Python Panels #4528
Open
ritch
wants to merge
144
commits into
develop
Choose a base branch
from
py-panels-develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Python Panels #4528
Changes from 115 commits
Commits
Show all changes
144 commits
Select commit
Hold shift + click to select a range
07737bf
add panel state built in operators
ritch 04c3d44
current panel and operations utils
ritch 8b3bda2
register panel operator
ritch 369dc3c
register panel op
ritch d99055d
panel state refactor
ritch 20ca72c
improve operator prompts
ritch fafd001
python panel improvements
ritch 43444a7
python panel cleanup
ritch e76b387
property change handlers
ritch e87a5b0
python panel syntactic sugar
ritch b8bb4f8
fix python panel layout and add loading state
imanjra 33a5fcb
persist python panel on app reload
imanjra 8d7e3ac
add GridView with layout customization
imanjra b8f6333
operator callback and handle panel onload error
imanjra c061ff6
rename VirtualPanel PanelRef
ritch 04d0fa3
Merge remote-tracking branch 'origin/py-panels-develop' into py-panel…
ritch 443ff0b
fix merge
ritch 1ac64fb
add ctx.prompt
ritch d1ba8fb
fix ctx.prompt panel_state
ritch 22839c7
add explicit plot events
ritch fb03c5b
Merge pull request #4321 from voxel51/py-panels-syntax-and-events
ritch 599225c
remove logs
ritch 79285df
Merge pull request #4332 from voxel51/ctx-prompt
ritch 975c602
heatmap on click
ritch de23850
notify operator
ritch 1e08693
fix panel state merge
ritch 00ff4ba
Merge pull request #4343 from voxel51/heatmap-on-click
ritch d9c5e65
Merge pull request #4344 from voxel51/notify-op
ritch 331d107
Merge remote-tracking branch 'origin/develop' into py-panels-develop
ritch 5a097ea
add plot util
ritch 84c8ff4
remove stray logs
ritch 676f127
plot util doc string
ritch 5f49925
Merge pull request #4361 from voxel51/plot-util
ritch 3465d19
persist python panel state in session
imanjra 1d987b3
invoke python panel on load on external state changes
imanjra 8900d15
move data and panel schema to local state
imanjra e52c5c1
fix duplicate PANEL_LOAD_TIMEOUT
ritch 8a5dd01
add results to prompt success
ritch 0f2b2ec
add ctx change panel events
ritch df6b469
add all ctx change panel event
ritch 33a3131
add MuiIconFont component
imanjra e8762ee
add IconButtonView to operators
imanjra aa459fd
python panel icon support
imanjra e3c972a
IconButtonView fixes and enhancements
imanjra ade432b
Merge pull request #4376 from voxel51/prompt-success-callback
ritch 1d634f5
Merge pull request #4377 from voxel51/panel-ctx-callbacks
ritch 5ba14e1
plot on_selected panel event
ritch db4dcd8
Merge pull request #4385 from voxel51/plot-on-selected
ritch 4d35f9e
fix panel state changes
ritch 198b5b4
Merge pull request #4408 from voxel51/fix-panel-prop-change
ritch 3e0f984
fix missing panel id
ritch 61bcf45
add set extended selection op
ritch 77d9939
Merge pull request #4409 from voxel51/fix-panel-id
ritch ca5c7a7
py panels embeddings extended selection
ritch 46cb107
add ctx.extended_selection and change event
ritch 85c0a7a
add panel state deep get and set methods
ritch f207751
Merge pull request #4413 from voxel51/ctx-extended-selection
ritch c926bc3
Merge pull request #4412 from voxel51/py-panels-ex-selection
ritch e21cd5c
remove panel.data getter
ritch 4fa01ea
Merge branch 'py-panels-develop' into panel-state-utils
ritch 9610ad1
Merge pull request #4414 from voxel51/panel-state-utils
ritch 9d27c31
panel.py tests
ritch 753e22b
fix panel test
ritch 09ddb30
Merge pull request #4418 from voxel51/py-panel-tests
ritch ce7caa1
css grid based GridView
imanjra adb1b0b
show panel render error
imanjra 111b349
remove plotly view internal selected points state
ritch b663c13
add new layout views
ritch e54b1b1
Merge pull request #4451 from voxel51/btn-group-view
ritch 98c0b7c
add media player
ritch 4189742
Merge pull request #4333 from voxel51/bugfix/show-render-err
ritch d0c2fe4
Merge pull request #4454 from voxel51/react-player
ritch 947ee9f
Merge pull request #4450 from voxel51/remove-plotly-view-selection-state
ritch c9ba1b0
Merge remote-tracking branch 'origin/develop' into py-panels-develop
ritch 6349001
fix operator uri resolution
ritch 7cdb3e7
Merge pull request #4470 from voxel51/py-panels-develop-syncd
ritch ff948e5
add space to btn()
ritch 695a682
fix missing py dep
ritch c99e559
fix executeOperator options
imanjra 7ed1786
scrollable add panel popout
imanjra 141ecb3
fix python panel state persistence on app reload
imanjra 689f284
enhancements for ButtonView and IconButtonView
imanjra 06d28b5
add active fields op
ritch 3bc44cb
Merge pull request #4482 from voxel51/active-paths-op
ritch e6409a0
event tracker
ritch 0d28c2b
add error tracking
ritch 2167a12
only track anonymous params or param names
ritch b4737d9
fix ctx.panel.close operation
imanjra 7e1f22f
add ctx.panel.set_title operation
imanjra 128ca5d
PlotlyView visual tweaks
imanjra c664250
add force option to open_panel operation
imanjra 35ed40d
refactor analytics
ritch 8093092
debounce spaces updates to session
imanjra 5bbe262
finalize segment int
ritch b0050fa
fix track_event op
ritch 4ce0cb4
Merge remote-tracking branch 'origin/py-panels-develop' into segment-int
ritch 86cb626
refactor analytics take 2
ritch 381a400
stray logs
ritch 5e77e74
python error tracking
ritch 167e011
stray logs
ritch 2901f41
Merge pull request #4489 from voxel51/segment-int
ritch 47ce163
move event tracker to Dataset
ritch fccbb0e
Merge remote-tracking branch 'origin/py-panels-develop' into segment-int
ritch 2637445
improve analytics debugging
ritch 4808ed1
viewbar tracking
ritch 3c2962d
operator browser open event
ritch e21ea2c
saved view tracking
ritch 79c5f28
Merge pull request #4495 from voxel51/analytics-follow-ups
ritch 98b9041
fix ctx event race condition
ritch d9e6637
Merge pull request #4498 from voxel51/fix-ctx-ev-rc
ritch 0d662c3
add force_duplicate param for open_panel operation
imanjra 3d2f501
fix markdown spacing
ritch f1affd5
Merge pull request #4502 from voxel51/markdown-spacing
ritch 5ed49ce
Merge pull request #4501 from voxel51/open_panel_force_duplicate
ritch 1bc0563
Merge remote-tracking branch 'origin/develop' into py-panels-develop
ritch 4cb1724
fix resolve output for operators in app
imanjra b6955c9
fix missing python panel load error trace
imanjra 3e3b533
overridable panel not found component
imanjra d4276cd
initial python panel e2e test
imanjra effc006
fix grid based views
imanjra 19da5f6
Merge remote-tracking branch 'origin/develop' into py-panels-develop
ritch a2b1587
Merge pull request #4523 from voxel51/bugfix/grid-based-views
ritch 52e81cf
Merge pull request #4514 from voxel51/bugfix/resolve-output
ritch ad00391
Merge pull request #4516 from voxel51/bugfix/py-panel-load-error
ritch 2eb5d95
Merge pull request #4364 from voxel51/bugfix/spaces-session-debounce
ritch 57edf02
Merge pull request #4522 from voxel51/feat/panel-not-found
ritch fd59b0f
Merge pull request #4270 from voxel51/e2e/python-panel
ritch 027ed03
event path
ritch e2d6679
Merge pull request #4540 from voxel51/plot-path-on-click
ritch 280d3b2
operator ButtonView enhancements
imanjra 3c09d52
add ArrowNavView for operator
imanjra fc1a7cd
add support for containerizing operators views
imanjra 534063e
add overlay support for composite views of operators
imanjra 5e1f1cf
enhance views to support displaying in menu-friendly style
imanjra 463b727
fix notify operation variant
imanjra 1f71557
switch some built-in operators from listed/unlisted
imanjra dc67397
visual tweaks for menu and views in menu
imanjra e678555
fix PlotlyView layout issue
imanjra 68e64b3
make on_load optional for panel operator
imanjra 0c85106
onChange support for all the views
imanjra 5726176
operator views enhancements
imanjra 9dcd204
enhancement for grid layout
imanjra 95188e9
Analytics Consent (#4559)
benjaminpkane 0595d8f
merge develop
benjaminpkane 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"react-hooks/rules-of-hooks": "off" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.DS_Store | ||
build/** | ||
node_modules/** | ||
|
||
.yarn/* | ||
!.yarn/releases | ||
!.yarn/plugins | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
yarn-error.log |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# FiftyOne Analytics | ||
|
||
FiftyOne Analytics package. | ||
|
||
## Configuring Analytics | ||
|
||
```typescript | ||
const [info, setInfo] = useAnalyticsInfo(); | ||
|
||
setInfo({ | ||
writeKey: "<segment_write_key>", | ||
userId: "123", | ||
userGroup: "group1", | ||
doNotTrack: false, | ||
}); | ||
``` | ||
|
||
## Tracking Events from React | ||
|
||
```typescript | ||
function MyComponent() { | ||
const trackEvent = useTrackEvent(); | ||
|
||
useEffect(() => { | ||
trackEvent("my_component_loaded", { customProp: 42 }); | ||
}, []); | ||
} | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* global module */ | ||
module.exports = { | ||
presets: [ | ||
["@babel/preset-env", { targets: { node: "current" } }], | ||
"@babel/preset-typescript", | ||
], | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "@fiftyone/analytics", | ||
"author": "Voxel51, Inc.", | ||
"version": "0.0.0", | ||
"description": "FiftyOne analytics", | ||
"homepage": "https://github.com/voxel51/fiftyone/app/packages/analytics", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/voxel51/fiftyone/" | ||
}, | ||
"main": "./src/index.ts", | ||
"private": true, | ||
"dependencies": { | ||
"@segment/analytics-next": "^1.70.0" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export { default as useTrackEvent } from "./useTrackEvent"; | ||
export { default as usingAnalytics, Analytics } from "./usingAnalytics"; | ||
export { default as useAnalyticsInfo } from "./useAnalyticsInfo"; | ||
export { analyticsInfo } from "./state"; | ||
export { DEFAULT_WRITE_KEYS } from "./keys"; | ||
export type { AnalyticsInfo } from "./usingAnalytics"; |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const DEFAULT_WRITE_KEYS = { | ||
dev: "MrAGfUuvQq2FOJIgAgbwgjMQgRNgruRa", // oss-dev | ||
prod: "SjCRPH72QTHlVhFZIT5067V9rhuq80Dl", // oss-prod | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { atom } from "recoil"; | ||
import { AnalyticsInfo } from "./usingAnalytics"; | ||
|
||
export const analyticsInfo = atom<AnalyticsInfo>({ | ||
key: "analyticsInfo", | ||
default: null, | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useRecoilState } from "recoil"; | ||
import { analyticsInfo } from "./state"; | ||
import { AnalyticsInfo } from "./usingAnalytics"; | ||
|
||
export default function useAnalyticsInfo(): [ | ||
AnalyticsInfo, | ||
(info: AnalyticsInfo) => void | ||
] { | ||
return useRecoilState<AnalyticsInfo>(analyticsInfo); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as fos from "@fiftyone/state"; | ||
import usingAnalytics, { AnalyticsInfo } from "./usingAnalytics"; | ||
import { useRecoilValue } from "recoil"; | ||
import { useCallback } from "react"; | ||
import { analyticsInfo } from "./state"; | ||
|
||
/** | ||
* Track an event. This can be called from any component to track an event, however | ||
* only when a user is opted in to analytics, will an event be sent to the analytics | ||
* service. | ||
*/ | ||
export default function useTrackEvent() { | ||
const info = useRecoilValue<AnalyticsInfo>(analyticsInfo); | ||
return useCallback( | ||
(eventName: string, properties?: Record<string, any>) => { | ||
const analytics = usingAnalytics(info); | ||
analytics.trackEvent(eventName, properties); | ||
}, | ||
[info] | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { AnalyticsBrowser } from "@segment/analytics-next"; | ||
|
||
export type AnalyticsInfo = { | ||
writeKey: string; | ||
userId: string; | ||
userGroup: string; | ||
doNotTrack?: boolean; | ||
debug: boolean; | ||
}; | ||
|
||
let _analytics: Analytics = null; | ||
|
||
export default function usingAnalytics(info: AnalyticsInfo): Analytics { | ||
if (!_analytics) { | ||
_analytics = new Analytics(); | ||
} | ||
if (info) { | ||
_analytics.load(info); | ||
} | ||
return _analytics; | ||
} | ||
|
||
export class Analytics { | ||
private _segment?: AnalyticsBrowser; | ||
private _debug = false; | ||
load(info: AnalyticsInfo) { | ||
if (this._segment) return; | ||
this._debug = info?.debug; | ||
if (!info || info.doNotTrack) { | ||
console.warn("Analytics disabled"); | ||
console.log(info); | ||
this.disable(); | ||
return; | ||
} | ||
if (!info.writeKey) { | ||
console.warn("Analytics disabled (no write key)"); | ||
this.disable(); | ||
return; | ||
} | ||
this.enable(info); | ||
} | ||
|
||
enable(info: AnalyticsInfo) { | ||
this._segment = AnalyticsBrowser.load({ | ||
writeKey: info.writeKey, | ||
}); | ||
if (info.userId) { | ||
this.identify(info.userId); | ||
} | ||
if (info.userGroup) { | ||
this.group(info.userGroup); | ||
} | ||
} | ||
|
||
disable() { | ||
this._segment = null; | ||
} | ||
|
||
page(name?: string, properties?: {}) { | ||
if (!this._segment) return; | ||
this._segment.page(name, properties); | ||
} | ||
|
||
track(name: string, properties?: {}) { | ||
if (this._debug) { | ||
console.log("track", name, properties); | ||
} | ||
if (!this._segment) return; | ||
this._segment.track(name, properties); | ||
} | ||
|
||
trackEvent(name: string, properties?: {}) { | ||
if (!this._segment) return; | ||
this.track(name, properties); | ||
} | ||
|
||
identify(userId: string, traits?: {}) { | ||
if (!this._segment) return; | ||
this._segment.identify(userId, traits); | ||
} | ||
|
||
group(groupId: string, traits?: {}) { | ||
if (!this._segment) return; | ||
this._segment.group(groupId, traits); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"lib": ["ESNext", "DOM", "DOM.Iterable"], | ||
"moduleResolution": "Node", | ||
"sourceMap": true, | ||
"resolveJsonModule": true, | ||
"esModuleInterop": true, | ||
"noEmit": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noImplicitAny": false, | ||
"plugins": [], | ||
"types": ["vite/client"], | ||
"jsx": "react-jsx" | ||
}, | ||
"include": ["./src"], | ||
"references": [ | ||
{ "path": "../components" }, | ||
{ "path": "../looker" }, | ||
{ "path": "../flashlight" }, | ||
{ "path": "../utilities" } | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { UserConfig } from "vite"; | ||
|
||
export default <UserConfig>{ | ||
esbuild: true, | ||
build: { | ||
lib: { | ||
entry: "src/index.ts", | ||
formats: ["es"], | ||
}, | ||
target: "es2015", | ||
minify: false, | ||
}, | ||
resolve: { | ||
alias: { | ||
"@fiftyone/looker": "@fiftyone/looker/src/index.ts", | ||
}, | ||
}, | ||
}; |
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
22 changes: 22 additions & 0 deletions
22
app/packages/components/src/components/CenteredStack/index.tsx
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Stack, StackProps } from "@mui/material"; | ||
import React, { PropsWithChildren } from "react"; | ||
|
||
export default function CenteredStack(props: CenteredStackPropsType) { | ||
const { children, sx = {}, ...otherProps } = props; | ||
return ( | ||
<Stack | ||
sx={{ | ||
width: "100%", | ||
height: "100%", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
...sx, | ||
}} | ||
{...otherProps} | ||
> | ||
{children} | ||
</Stack> | ||
); | ||
} | ||
|
||
type CenteredStackPropsType = PropsWithChildren<StackProps>; |
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.
Why are we bringing it in when we already have
@mui/icons-material
? This will cause significant bloating otherwise.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.
This is font-based and it's to support dynamic icon by name. In a separate PR, we should probably replace all the icons from
@mui/icons-material
to this instead. It will reduce build size/time