mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-05 04:57:42 +03:00
only allow admins to edit sub labels and plates
This commit is contained in:
parent
1fb76c340b
commit
f3e790890e
@ -76,6 +76,7 @@ import { FaPencilAlt } from "react-icons/fa";
|
|||||||
import TextEntryDialog from "@/components/overlay/dialog/TextEntryDialog";
|
import TextEntryDialog from "@/components/overlay/dialog/TextEntryDialog";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { TbFaceId } from "react-icons/tb";
|
import { TbFaceId } from "react-icons/tb";
|
||||||
|
import { useIsAdmin } from "@/hooks/use-is-admin";
|
||||||
|
|
||||||
const SEARCH_TABS = [
|
const SEARCH_TABS = [
|
||||||
"details",
|
"details",
|
||||||
@ -295,6 +296,10 @@ function ObjectDetailsTab({
|
|||||||
|
|
||||||
const mutate = useGlobalMutation();
|
const mutate = useGlobalMutation();
|
||||||
|
|
||||||
|
// users
|
||||||
|
|
||||||
|
const isAdmin = useIsAdmin();
|
||||||
|
|
||||||
// data
|
// data
|
||||||
|
|
||||||
const [desc, setDesc] = useState(search?.data.description);
|
const [desc, setDesc] = useState(search?.data.description);
|
||||||
@ -687,23 +692,25 @@ function ObjectDetailsTab({
|
|||||||
{getIconForLabel(search.label, "size-4 text-primary")}
|
{getIconForLabel(search.label, "size-4 text-primary")}
|
||||||
{t(search.label, { ns: "objects" })}
|
{t(search.label, { ns: "objects" })}
|
||||||
{search.sub_label && ` (${search.sub_label})`}
|
{search.sub_label && ` (${search.sub_label})`}
|
||||||
<Tooltip>
|
{isAdmin && (
|
||||||
<TooltipTrigger asChild>
|
<Tooltip>
|
||||||
<span>
|
<TooltipTrigger asChild>
|
||||||
<FaPencilAlt
|
<span>
|
||||||
className="size-4 cursor-pointer text-primary/40 hover:text-primary/80"
|
<FaPencilAlt
|
||||||
onClick={() => {
|
className="size-4 cursor-pointer text-primary/40 hover:text-primary/80"
|
||||||
setIsSubLabelDialogOpen(true);
|
onClick={() => {
|
||||||
}}
|
setIsSubLabelDialogOpen(true);
|
||||||
/>
|
}}
|
||||||
</span>
|
/>
|
||||||
</TooltipTrigger>
|
</span>
|
||||||
<TooltipPortal>
|
</TooltipTrigger>
|
||||||
<TooltipContent>
|
<TooltipPortal>
|
||||||
{t("details.editSubLabel.title")}
|
<TooltipContent>
|
||||||
</TooltipContent>
|
{t("details.editSubLabel.title")}
|
||||||
</TooltipPortal>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</TooltipPortal>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{search?.data.recognized_license_plate && (
|
{search?.data.recognized_license_plate && (
|
||||||
@ -716,23 +723,25 @@ function ObjectDetailsTab({
|
|||||||
{search.data.recognized_license_plate}{" "}
|
{search.data.recognized_license_plate}{" "}
|
||||||
{recognizedLicensePlateScore &&
|
{recognizedLicensePlateScore &&
|
||||||
` (${recognizedLicensePlateScore}%)`}
|
` (${recognizedLicensePlateScore}%)`}
|
||||||
<Tooltip>
|
{isAdmin && (
|
||||||
<TooltipTrigger asChild>
|
<Tooltip>
|
||||||
<span>
|
<TooltipTrigger asChild>
|
||||||
<FaPencilAlt
|
<span>
|
||||||
className="size-4 cursor-pointer text-primary/40 hover:text-primary/80"
|
<FaPencilAlt
|
||||||
onClick={() => {
|
className="size-4 cursor-pointer text-primary/40 hover:text-primary/80"
|
||||||
setIsLPRDialogOpen(true);
|
onClick={() => {
|
||||||
}}
|
setIsLPRDialogOpen(true);
|
||||||
/>
|
}}
|
||||||
</span>
|
/>
|
||||||
</TooltipTrigger>
|
</span>
|
||||||
<TooltipPortal>
|
</TooltipTrigger>
|
||||||
<TooltipContent>
|
<TooltipPortal>
|
||||||
{t("details.editLPR.title")}
|
<TooltipContent>
|
||||||
</TooltipContent>
|
{t("details.editLPR.title")}
|
||||||
</TooltipPortal>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</TooltipPortal>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user