Skip to content
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

Adds support for editing preset name #8101

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions src/Components/Facility/Consultations/LiveFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { FieldLabel } from "../../Form/FormFields/FormField";
import useFullscreen from "../../../Common/hooks/useFullscreen";
import ReactPlayer from "react-player";
import { isIOS } from "../../../Utils/utils";
import TextFormField from "../../Form/FormFields/TextFormField";

const LiveFeed = (props: any) => {
const middlewareHostname = props.middlewareHostname;
Expand All @@ -39,7 +40,7 @@ const LiveFeed = (props: any) => {
);
const [videoStartTime, setVideoStartTime] = useState<Date | null>(null);
const [bed, setBed] = useState<BedModel>({});
const [preset, setNewPreset] = useState<string>("");
const [presetName, setPresetName] = useState("");
const [loading, setLoading] = useState<string | undefined>();
const dispatch: any = useDispatch();
const [page, setPage] = useState({
Expand Down Expand Up @@ -145,7 +146,7 @@ const LiveFeed = (props: any) => {
const updatePreset = async (currentPreset: any) => {
const data = {
bed_id: bed.id,
preset_name: preset,
preset_name: presetName,
};
const response = await dispatch(
partialUpdateAssetBed(
Expand Down Expand Up @@ -187,7 +188,7 @@ const LiveFeed = (props: any) => {
}, []);

useEffect(() => {
setNewPreset(toUpdate?.meta?.preset_name);
setPresetName(toUpdate?.meta?.preset_name);
setBed(toUpdate?.bed_object);
}, [toUpdate]);

Expand Down Expand Up @@ -334,23 +335,30 @@ const LiveFeed = (props: any) => {
<ConfirmDialog
show
title="Update Preset"
description={"Preset: " + toUpdate.meta.preset_name}
action="Update"
variant="primary"
onClose={() => setToUpdate(null)}
onConfirm={() => updatePreset(toUpdate)}
>
<div className="mt-4 flex flex-col">
<FieldLabel required>Bed</FieldLabel>
<BedSelect
name="bed"
setSelected={(selected) => setBed(selected as BedModel)}
selected={bed}
error=""
multiple={false}
location={cameraAsset.location_id}
facility={cameraAsset.facility_id}
<div className="mt-4">
<TextFormField
name="preset_name"
label="Preset Name"
value={presetName}
onChange={({ value }) => setPresetName(value)}
/>
<div className="flex flex-col">
<FieldLabel required>Bed</FieldLabel>
<BedSelect
name="bed"
setSelected={(selected) => setBed(selected as BedModel)}
selected={bed}
error=""
multiple={false}
location={cameraAsset.location_id}
facility={cameraAsset.facility_id}
/>
</div>
</div>
</ConfirmDialog>
)}
Expand Down
Loading