Make tracker pattern displayName read-only
The displayName field was always predictable from pattern + matchType and allowing edits added unnecessary complexity. Remove displayName from UpdateTrackerPatternInput across all surfaces (GraphQL, MCP, CLI, n8n) and make the frontend show it as non-editable text. Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -251,12 +251,11 @@ export function DetectionPatternRow({ patternKey, connectionId }: DetectionPatte
|
||||
});
|
||||
};
|
||||
|
||||
const handleSaveEdit = (data: { displayName: string; description: string; maxAgeSeconds: number | null }) => {
|
||||
const handleSaveEdit = (data: { description: string; maxAgeSeconds: number | null }) => {
|
||||
updatePattern({
|
||||
variables: {
|
||||
input: {
|
||||
trackerPatternId: pattern.id,
|
||||
displayName: data.displayName,
|
||||
description: data.description,
|
||||
maxAgeSeconds: data.maxAgeSeconds,
|
||||
},
|
||||
@@ -278,7 +277,7 @@ export function DetectionPatternRow({ patternKey, connectionId }: DetectionPatte
|
||||
if (isEditing) {
|
||||
return (
|
||||
<DetectionPatternRowEdit
|
||||
displayName={pattern.displayName}
|
||||
pattern={pattern.displayName}
|
||||
description={pattern.description}
|
||||
maxAgeSeconds={pattern.maxAgeSeconds ?? null}
|
||||
isUpdating={isUpdating}
|
||||
|
||||
@@ -18,22 +18,21 @@ import { Button, DurationInput, Input, Td, Tr } from "@probo/ui";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
interface FormValues {
|
||||
displayName: string;
|
||||
duration: { value: string; unit: string };
|
||||
description: string;
|
||||
}
|
||||
|
||||
interface DetectionPatternRowEditProps {
|
||||
displayName: string;
|
||||
pattern: string;
|
||||
description: string;
|
||||
maxAgeSeconds: number | null;
|
||||
isUpdating: boolean;
|
||||
onSave: (data: { displayName: string; description: string; maxAgeSeconds: number | null }) => void;
|
||||
onSave: (data: { description: string; maxAgeSeconds: number | null }) => void;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
export function DetectionPatternRowEdit({
|
||||
displayName,
|
||||
pattern,
|
||||
description,
|
||||
maxAgeSeconds,
|
||||
isUpdating,
|
||||
@@ -45,7 +44,6 @@ export function DetectionPatternRowEdit({
|
||||
|
||||
const { register, handleSubmit, control } = useForm<FormValues>({
|
||||
defaultValues: {
|
||||
displayName,
|
||||
duration: initial,
|
||||
description,
|
||||
},
|
||||
@@ -53,7 +51,6 @@ export function DetectionPatternRowEdit({
|
||||
|
||||
const onSubmit = (data: FormValues) => {
|
||||
onSave({
|
||||
displayName: data.displayName,
|
||||
description: data.description,
|
||||
maxAgeSeconds: toMaxAgeSeconds(data.duration.value, data.duration.unit),
|
||||
});
|
||||
@@ -62,10 +59,7 @@ export function DetectionPatternRowEdit({
|
||||
return (
|
||||
<Tr>
|
||||
<Td className="pr-3">
|
||||
<Input
|
||||
{...register("displayName")}
|
||||
placeholder={__("Cookie name")}
|
||||
/>
|
||||
<span className="font-medium">{pattern}</span>
|
||||
</Td>
|
||||
<Td />
|
||||
<Td className="pr-3">
|
||||
|
||||
@@ -397,12 +397,10 @@ export function CategorySection({ categoryKey, connectionId }: CategorySectionPr
|
||||
};
|
||||
|
||||
const handleSaveEditCookie = (patternId: string, cookie: CookieEntry) => {
|
||||
if (!cookie.name.trim()) return;
|
||||
updatePattern({
|
||||
variables: {
|
||||
input: {
|
||||
trackerPatternId: patternId,
|
||||
displayName: cookie.name,
|
||||
maxAgeSeconds: cookie.maxAgeSeconds,
|
||||
description: cookie.description,
|
||||
excluded: cookie.excluded,
|
||||
|
||||
@@ -33,7 +33,6 @@ export const editCookieRowFragment = graphql`
|
||||
`;
|
||||
|
||||
interface CookieFormValues {
|
||||
name: string;
|
||||
duration: { value: string; unit: string };
|
||||
description: string;
|
||||
excluded: boolean;
|
||||
@@ -58,7 +57,6 @@ export function EditCookieRow({
|
||||
|
||||
const { register, handleSubmit, control } = useForm<CookieFormValues>({
|
||||
defaultValues: {
|
||||
name: cookie.displayName,
|
||||
duration: initial,
|
||||
description: cookie.description,
|
||||
excluded: cookie.excluded,
|
||||
@@ -67,7 +65,7 @@ export function EditCookieRow({
|
||||
|
||||
const onSubmit = (data: CookieFormValues) => {
|
||||
onSave({
|
||||
name: data.name,
|
||||
name: cookie.displayName,
|
||||
maxAgeSeconds: toMaxAgeSeconds(data.duration.value, data.duration.unit),
|
||||
description: data.description,
|
||||
excluded: data.excluded,
|
||||
@@ -90,10 +88,7 @@ export function EditCookieRow({
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<Input
|
||||
{...register("name")}
|
||||
placeholder={__("Cookie name")}
|
||||
/>
|
||||
<code className="text-sm font-mono">{cookie.displayName}</code>
|
||||
</div>
|
||||
</Td>
|
||||
<Td />
|
||||
|
||||
Reference in New Issue
Block a user