mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
[photon-client] Fix camera and pipeline name editing (#969)
closes #965 Had to disable the eslint rule that was causing the bug. Disallows disabling driver mode when there are no other pipelines to swap to Also adds icons for saving and canceling name edits Adds the option to create a new pipeline in driver mode if there are no other pipelines Adds disable prop to the driver mode switch on the camera settings page
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
iconName: string;
|
||||
disabled?: boolean;
|
||||
color?: string;
|
||||
tooltip?: string;
|
||||
right?: boolean;
|
||||
@@ -9,6 +10,7 @@ const props = withDefaults(
|
||||
}>(),
|
||||
{
|
||||
right: false,
|
||||
disabled: false,
|
||||
hover: false
|
||||
}
|
||||
);
|
||||
@@ -24,7 +26,14 @@ const hoverClass = props.hover ? "hover" : "";
|
||||
<div>
|
||||
<v-tooltip :right="right" :bottom="!right" nudge-right="10" :disabled="tooltip === undefined">
|
||||
<template #activator="{ on, attrs }">
|
||||
<v-icon :class="hoverClass" :color="color" v-bind="attrs" v-on="on" @click="$emit('click')">
|
||||
<v-icon
|
||||
:class="hoverClass"
|
||||
:color="color"
|
||||
v-bind="attrs"
|
||||
:disabled="disabled"
|
||||
v-on="on"
|
||||
@click="$emit('click')"
|
||||
>
|
||||
{{ iconName }}
|
||||
</v-icon>
|
||||
</template>
|
||||
|
||||
@@ -35,9 +35,10 @@ const localValue = computed({
|
||||
const handleKeydown = ({ key }) => {
|
||||
switch (key) {
|
||||
case "Enter":
|
||||
if (!(props.rules || []).some((v) => v(localValue.value) === false || typeof v(localValue.value) === "string")) {
|
||||
emit("onEnter", localValue.value);
|
||||
}
|
||||
// Explicitly check that all rule props return true
|
||||
if (!props.rules?.every((rule) => rule(localValue.value) === true)) return;
|
||||
|
||||
emit("onEnter", localValue.value);
|
||||
break;
|
||||
case "Escape":
|
||||
emit("onEscape");
|
||||
|
||||
Reference in New Issue
Block a user