various ui improvements

This commit is contained in:
miloschwartz
2026-08-13 14:54:09 -04:00
parent db716f781e
commit d9a9ae14fd
6 changed files with 102 additions and 83 deletions
@@ -271,14 +271,14 @@ export default function CreateAiProviderPage() {
value
)
);
const currentName =
form.getValues(
"name"
);
if (
value !==
"custom"
) {
const currentName =
form.getValues(
"name"
);
const previousLabel =
t(
aiProviderTypeLabelMap[
@@ -305,6 +305,30 @@ export default function CreateAiProviderPage() {
);
targetsRef.current =
[];
} else {
const isDefaultName =
Object.entries(
aiProviderTypeLabelMap
).some(
([
type,
key
]) =>
type !==
"custom" &&
currentName ===
t(
key
)
);
if (
isDefaultName
) {
form.setValue(
"name",
""
);
}
}
}}
/>
@@ -86,6 +86,13 @@ export type ProxyResourceTargetsFormHandle = {
save: (options?: { silent?: boolean }) => Promise<boolean>;
};
const DEFAULT_ALLOWED_METHODS: ("http" | "https" | "h2c")[] = [
"http",
"https",
"h2c"
];
const EMPTY_TARGETS: LocalTarget[] = [];
type ProxyResourceTargetsFormProps = {
orgId: string;
isHttp: boolean;
@@ -115,12 +122,12 @@ export const ProxyResourceTargetsForm = forwardRef<
{
orgId,
isHttp,
initialTargets = [],
initialTargets = EMPTY_TARGETS,
resource,
providerId,
updateResource,
onChange,
allowedMethods = ["http", "https", "h2c"],
allowedMethods = DEFAULT_ALLOWED_METHODS,
emptyMessage,
embedded = false,
hideSaveButton = false,
@@ -266,7 +273,7 @@ export const ProxyResourceTargetsForm = forwardRef<
);
});
},
[sites]
[]
);
const openHealthCheckDialog = useCallback((target: LocalTarget) => {
@@ -616,7 +623,6 @@ export const ProxyResourceTargetsForm = forwardRef<
}, [
isAdvancedMode,
isHttp,
sites,
updateTarget,
getDockerStateForSite,
refreshContainersForSite,