Skip to content

Commit

Permalink
Merge branch 'release/v1.2.0' of https://github.com/voxel51/fiftyone
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
voxel51-bot committed Dec 19, 2024
2 parents add8ff1 + 79349af commit 8d5be1f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -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 (
<MuiButton onClick={onEvaluate} startIcon={<Add />} variant="contained">
Evaluate Model
</MuiButton>
<Box
title={canEvaluate ? "" : "You do not have permission to evaluate model"}
sx={{ cursor: canEvaluate ? "pointer" : "not-allowed" }}
>
<MuiButton
onClick={onEvaluate}
startIcon={<Add />}
variant="contained"
disabled={!canEvaluate}
>
Evaluate Model
</MuiButton>
</Box>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,20 +611,26 @@ export default function Evaluation(props: EvaluationProps) {
<Card sx={{ p: 2 }}>
<Stack direction="row" sx={{ justifyContent: "space-between" }}>
<Typography color="secondary">Evaluation notes</Typography>
{can_edit_note && (
<Box>
<IconButton
size="small"
color="secondary"
sx={{ borderRadius: 16 }}
onClick={() => {
setEditNoteState((note) => ({ ...note, open: true }));
}}
>
<EditNote />
</IconButton>
</Box>
)}
<Box
title={
can_edit_note
? ""
: "You do not have permission to edit evaluation notes"
}
sx={{ cursor: can_edit_note ? "pointer" : "not-allowed" }}
>
<IconButton
size="small"
color="secondary"
sx={{ borderRadius: 16 }}
onClick={() => {
setEditNoteState((note) => ({ ...note, open: true }));
}}
disabled={!can_edit_note}
>
<EditNote />
</IconButton>
</Box>
</Stack>
<EvaluationNotes notes={evaluationNotes} variant="details" />
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function EvaluationCard(props: EvaluationCardProps) {
}
/>
)}
{status && <Status status={status} />}
{status && <Status status={status} readOnly />}
</Stack>
{note && <EvaluationNotes notes={note} variant="overview" />}
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Select
sx={{
Expand All @@ -22,6 +22,12 @@ export default function Status(props: StatusProps) {
onChange={(e) => {
triggerEvent(setStatusEvent, { status: e.target.value });
}}
title={
canEdit
? ""
: "You do not have permission to update evaluation status"
}
disabled={!canEdit}
>
{STATUSES.map((status) => {
const color = COLOR_BY_STATUS[status];
Expand Down Expand Up @@ -63,7 +69,8 @@ export default function Status(props: StatusProps) {
type StatusProps = {
status?: string;
canEdit?: boolean;
setStatusEvent?: string;
readOnly?: boolean;
setStatusEvent: string;
};

const STATUS_LABELS = {
Expand Down

0 comments on commit 8d5be1f

Please sign in to comment.