diff --git a/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluate.tsx b/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluate.tsx index c9aed0c979a..69022c3b5db 100644 --- a/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluate.tsx +++ b/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluate.tsx @@ -1,13 +1,25 @@ import { MuiButton } from "@fiftyone/components"; import { Add } from "@mui/icons-material"; +import { Box } from "@mui/material"; import React from "react"; export default function Evaluate(props: EvaluateProps) { - const { onEvaluate } = props; + const { onEvaluate, permissions } = props; + const canEvaluate = permissions.can_evaluate; return ( - } variant="contained"> - Evaluate Model - + + } + variant="contained" + disabled={!canEvaluate} + > + Evaluate Model + + ); } diff --git a/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx b/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx index eb5b401efce..db050651261 100644 --- a/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx +++ b/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Evaluation.tsx @@ -51,6 +51,7 @@ import { formatValue, getNumericDifference, useTriggerEvent } from "./utils"; const KEY_COLOR = "#ff6d04"; const COMPARE_KEY_COLOR = "#03a9f4"; const DEFAULT_BAR_CONFIG = { sortBy: "default" }; +const NONE_CLASS = "(none)"; export default function Evaluation(props: EvaluationProps) { const { @@ -611,20 +612,26 @@ export default function Evaluation(props: EvaluationProps) { Evaluation notes - {can_edit_note && ( - - { - setEditNoteState((note) => ({ ...note, open: true })); - }} - > - - - - )} + + { + setEditNoteState((note) => ({ ...note, open: true })); + }} + disabled={!can_edit_note} + > + + + @@ -1656,12 +1663,23 @@ function getMatrix(matrices, config, maskTargets, compareMaskTargets?) { if (!matrices) return; const { sortBy = "az", limit } = config; const parsedLimit = typeof limit === "number" ? limit : undefined; - const classes = matrices[`${sortBy}_classes`].slice(0, parsedLimit); - const matrix = matrices[`${sortBy}_matrix`].slice(0, parsedLimit); + const originalClasses = matrices[`${sortBy}_classes`]; + const originalMatrix = matrices[`${sortBy}_matrix`]; + const classes = originalClasses.slice(0, parsedLimit); + const matrix = originalMatrix.slice(0, parsedLimit); const colorscale = matrices[`${sortBy}_colorscale`]; const labels = classes.map((c) => { return compareMaskTargets?.[c] || maskTargets?.[c] || c; }); + const noneIndex = originalClasses.indexOf(NONE_CLASS); + if (parsedLimit < originalClasses.length) { + labels.push( + compareMaskTargets?.[NONE_CLASS] || + maskTargets?.[NONE_CLASS] || + NONE_CLASS + ); + matrix.push(originalMatrix[noneIndex]); + } return { labels, matrix, colorscale }; } @@ -1687,7 +1705,7 @@ function useActiveFilter(evaluation, compareEvaluation) { const { _cls, kwargs } = stage; if (_cls.endsWith("FilterLabels")) { const [_, filter] = kwargs; - const filterEq = filter[1].$eq; + const filterEq = filter[1].$eq || []; const [filterEqLeft, filterEqRight] = filterEq; if (filterEqLeft === "$$this.label") { return { type: "label", value: filterEqRight }; diff --git a/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Overview.tsx b/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Overview.tsx index b0aa8f99d8c..643ec14b7d1 100644 --- a/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Overview.tsx +++ b/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Overview.tsx @@ -97,7 +97,7 @@ function EvaluationCard(props: EvaluationCardProps) { } /> )} - {status && } + {status && } {note && } diff --git a/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Status.tsx b/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Status.tsx index 346cbb3245a..bc3eb526355 100644 --- a/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Status.tsx +++ b/app/packages/core/src/plugins/SchemaIO/components/NativeModelEvaluationView/Status.tsx @@ -4,10 +4,10 @@ import React from "react"; import { useTriggerEvent } from "./utils"; export default function Status(props: StatusProps) { - const { status, canEdit, setStatusEvent } = props; + const { status, canEdit, readOnly, setStatusEvent } = props; const triggerEvent = useTriggerEvent(); - if (canEdit) { + if (!readOnly) { return (