Skip to content

Commit

Permalink
Add ability to rename camera groups (#14339)
Browse files Browse the repository at this point in the history
* Add ability to rename camera groups

* clean up

* ampersand consistency
  • Loading branch information
hawkeye217 authored Oct 14, 2024
1 parent 0ee32cf commit dd7a07b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions web/src/components/filter/CameraGroupSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,11 @@ export function CameraGroupEdit({

setIsLoading(true);

let renamingQuery = "";
if (editingGroup && editingGroup[0] !== values.name) {
renamingQuery = `camera_groups.${editingGroup[0]}&`;
}

const order =
editingGroup === undefined
? currentGroups.length + 1
Expand All @@ -655,9 +660,12 @@ export function CameraGroupEdit({
.join("");

axios
.put(`config/set?${orderQuery}&${iconQuery}${cameraQueries}`, {
requires_restart: 0,
})
.put(
`config/set?${renamingQuery}${orderQuery}&${iconQuery}${cameraQueries}`,
{
requires_restart: 0,
},
)
.then((res) => {
if (res.status === 200) {
toast.success(`Camera group (${values.name}) has been saved.`, {
Expand Down Expand Up @@ -712,7 +720,6 @@ export function CameraGroupEdit({
<Input
className="text-md w-full border border-input bg-background p-2 hover:bg-accent hover:text-accent-foreground dark:[color-scheme:dark]"
placeholder="Enter a name..."
disabled={editingGroup !== undefined}
{...field}
/>
</FormControl>
Expand Down

0 comments on commit dd7a07b

Please sign in to comment.