[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:
Sriman Achanta
2023-10-21 10:46:53 -04:00
committed by GitHub
parent 89908fc181
commit 8446c94508
6 changed files with 70 additions and 21 deletions

View File

@@ -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>

View File

@@ -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");