-
Notifications
You must be signed in to change notification settings - Fork 591
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
Merge release/v1.1.0
to develop
#5154
Changes from all commits
828ec5c
597b32f
01ea636
ebf8784
90c4838
45c82b1
3246d80
d9b2a81
8593a1a
9967d21
29c03fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import { PanelCTA } from "@fiftyone/components"; | ||
import { constants } from "@fiftyone/utilities"; | ||
import { Box } from "@mui/material"; | ||
import React, { useCallback, useMemo } from "react"; | ||
import EmptyOverview from "./EmptyOverview"; | ||
import Evaluate from "./Evaluate"; | ||
import Evaluation from "./Evaluation"; | ||
import Overview from "./Overview"; | ||
import { useTriggerEvent } from "./utils"; | ||
import { PanelCTA } from "@fiftyone/components"; | ||
import { constants } from "@fiftyone/utilities"; | ||
import Evaluate from "./Evaluate"; | ||
|
||
const TRY_LINK = "http://voxel51.com/try-evaluation"; | ||
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. 💡 Codebase verification Move URL constant to centralized configuration and ensure URL consistency The codebase shows inconsistent URL patterns that should be standardized:
Recommendations:
🔗 Analysis chainConsider moving the URL constant to a centralized configuration. The hardcoded URL should be moved to a centralized configuration file for better maintainability and consistency. Let's verify if similar URLs are defined elsewhere: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for similar URL patterns across the codebase
rg -i "voxel51\.com/try-" --type ts --type tsx
Length of output: 76 Script: #!/bin/bash
# Search for similar URL patterns across the codebase with correct file extensions
rg -i "voxel51\.com/try" -t ts -t typescript -t jsx -t tsx
# Search for any configuration files that might contain URLs
fd -e ts -e tsx -e json "config|constants" --exec grep -l "voxel51.com"
# Look for any centralized URL or link configurations
ast-grep --pattern 'const $_ = "https?://voxel51.com/$_"'
Length of output: 269 Script: #!/bin/bash
# Let's check the content of the constants file that was found
cat ./app/packages/utilities/src/constants.ts
# Also search with ripgrep without file type restrictions
rg -i "voxel51\.com/try"
Length of output: 3109 |
||
|
||
export default function NativeModelEvaluationView(props) { | ||
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. 🛠️ Refactor suggestion Add TypeScript type annotations for better type safety. The component and its props lack TypeScript type annotations. Consider adding proper type definitions to improve type safety and developer experience. Example improvement: interface NativeModelEvaluationViewProps {
data?: {
evaluations?: Array<{ key: string; id: string }>;
view?: Record<string, unknown>;
statuses?: Record<string, unknown>;
notes?: Record<string, unknown>;
permissions?: Record<string, unknown>;
pending_evaluations?: Array<unknown>;
};
schema: {
view: {
on_change_view: string;
on_evaluate_model: string;
load_evaluation: string;
load_evaluation_view: string;
set_status: string;
set_note: string;
load_view: string;
};
};
onChange: (path: string, value: unknown) => void;
layout: unknown;
}
export default function NativeModelEvaluationView(props: NativeModelEvaluationViewProps) {
// ... rest of the component
} |
||
const { data = {}, schema, onChange, layout } = props; | ||
|
@@ -87,10 +88,11 @@ export default function NativeModelEvaluationView(props) { | |
(showEmptyOverview || showCTA ? ( | ||
<PanelCTA | ||
label="Create you first model evaluation" | ||
demoLabel="Upgrade to Fiftyone Teams to Evaluate Models" | ||
demoLabel="Upgrade to FiftyOne Teams to Evaluate Models" | ||
description="Analyze and improve models collaboratively with your team" | ||
docLink="https://docs.voxel51.com/user_guide/evaluation.html" | ||
docCaption="Not ready to upgrade yet? Learn how to create model evaluation via code." | ||
docCaption="Learn how to create model evaluation via code." | ||
demoDocCaption="Not ready to upgrade yet? Learn how to create model evaluation via code." | ||
icon="ssid_chart" | ||
Actions={() => { | ||
return ( | ||
|
@@ -106,6 +108,7 @@ export default function NativeModelEvaluationView(props) { | |
setShowCTA(false); | ||
}} | ||
mode={showCTA ? "default" : "onboarding"} | ||
tryLink={TRY_LINK} | ||
/> | ||
) : ( | ||
<Overview | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ import { | |
TableContainer, | ||
TableHead, | ||
TableRow, | ||
Tooltip, | ||
useTheme, | ||
} from "@mui/material"; | ||
import { isPlainObject } from "lodash"; | ||
|
@@ -34,6 +35,7 @@ export default function TableView(props: ViewPropsType) { | |
size = "small", | ||
variant = "filled", | ||
max_inline_actions = 1, | ||
tooltips = [] | ||
} = view; | ||
const { rows, selectedCells, selectedRows, selectedColumns } = | ||
getTableData(props); | ||
|
@@ -63,6 +65,14 @@ export default function TableView(props: ViewPropsType) { | |
return computedRowActions; | ||
}, []); | ||
|
||
const getTooltips = useCallback((tooltipList) => { | ||
const tooltipDict = {}; | ||
for (const { value, row, column } of tooltipList) { | ||
tooltipDict[`${row},${column}`] = value; // Create a key from row and column | ||
} | ||
return tooltipDict; | ||
}, []); | ||
Comment on lines
+68
to
+74
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. 🛠️ Refactor suggestion Enhance type safety and memoization of getTooltips The function implementation could be improved in several ways:
Consider this implementation: - const getTooltips = useCallback((tooltipList) => {
+ type TooltipItem = { value: string; row: number; column: number };
+ type TooltipMap = { [key: string]: string };
+
+ const getTooltips = useCallback((tooltipList: TooltipItem[]): TooltipMap => {
const tooltipDict = {};
for (const { value, row, column } of tooltipList) {
- tooltipDict[`${row},${column}`] = value; // Create a key from row and column
+ tooltipDict[`${row},${column}`] = value;
}
return tooltipDict;
- }, []);
+ }, [tooltipList]);
|
||
|
||
const handleCellClick = useCallback( | ||
(row, column) => { | ||
if (on_click_cell) { | ||
|
@@ -93,6 +103,7 @@ export default function TableView(props: ViewPropsType) { | |
color: theme.palette.text.secondary, | ||
}; | ||
const filled = variant === "filled"; | ||
const tooltipMap = getTooltips(tooltips); | ||
|
||
return ( | ||
<Box {...getComponentProps(props, "container")}> | ||
|
@@ -170,23 +181,33 @@ export default function TableView(props: ViewPropsType) { | |
selectedCells.has(coordinate) || | ||
isRowSelected || | ||
selectedColumns.has(columnIndex); | ||
return ( | ||
|
||
const tooltip = tooltipMap[coordinate]; // Check if there's a tooltip for the cell | ||
|
||
const cell = ( | ||
<TableCell | ||
key={key} | ||
sx={{ | ||
background: isSelected | ||
? selectedCellColor | ||
: "unset", | ||
background: isSelected ? selectedCellColor : "unset", | ||
}} | ||
onClick={() => { | ||
handleCellClick(rowIndex, columnIndex); | ||
}} | ||
{...getComponentProps(props, "tableBodyCell")} | ||
> | ||
{formatCellValue(item[key], props)} | ||
{tooltip ? ( | ||
<Tooltip title={tooltip} arrow> | ||
<span>{formatCellValue(item[key], props)}</span> {/* Wrap content with Tooltip */} | ||
</Tooltip> | ||
) : ( | ||
formatCellValue(item[key], props) // No Tooltip for cells without tooltips | ||
)} | ||
</TableCell> | ||
); | ||
|
||
return cell; | ||
})} | ||
|
||
{hasRowActions && ( | ||
<TableCell | ||
align="right" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Embeddings Fiftyone Plugin Example | ||
# Embeddings FiftyOne Plugin Example |
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 security attributes for external link.
When using
target="_blank"
, it's recommended to addrel="noopener noreferrer"
to prevent potential security vulnerabilities: