fix(dashboard): resolve popover overflow, resilience API schema reject (#1039)

This commit is contained in:
diegosouzapw
2026-04-07 23:29:56 -03:00
parent 7674059899
commit 6ea545df05
3 changed files with 19 additions and 6 deletions

View File

@@ -529,7 +529,8 @@ function ModelCompatPopover({
const ref = useRef<HTMLDivElement>(null);
const panelRef = useRef<HTMLDivElement | null>(null);
const [portalPanelRect, setPortalPanelRect] = useState<{
top: number;
top?: number;
bottom?: number;
left: number;
width: number;
} | null>(null);
@@ -621,7 +622,16 @@ function ModelCompatPopover({
const width = Math.min(window.innerWidth - 2 * margin, 24 * 16);
let left = rect.right - width;
left = Math.max(margin, Math.min(left, window.innerWidth - width - margin));
setPortalPanelRect({ top: rect.bottom + 8, left, width });
// Estimated panel height: capped at min(82vh, 42rem=672px)
const estimatedPanelHeight = Math.min(window.innerHeight * 0.82, 672);
const spaceBelow = window.innerHeight - rect.bottom - margin;
const spaceAbove = rect.top - margin;
if (spaceBelow < estimatedPanelHeight && spaceAbove > spaceBelow) {
// Not enough space below — open upward
setPortalPanelRect({ bottom: window.innerHeight - rect.top + 8, left, width });
} else {
setPortalPanelRect({ top: rect.bottom + 8, left, width });
}
}, [open]);
useLayoutEffect(() => {
@@ -662,7 +672,9 @@ function ModelCompatPopover({
className={panelChromeClass}
style={{
position: "fixed",
top: portalPanelRect.top,
...(portalPanelRect.top !== undefined
? { top: portalPanelRect.top }
: { bottom: portalPanelRect.bottom }),
left: portalPanelRect.left,
width: portalPanelRect.width,
zIndex: 10040,

View File

@@ -116,11 +116,10 @@ export default function AutoDisableCard() {
onChange={(e) =>
setDraft((prev) => ({ ...prev, threshold: parseInt(e.target.value) || 1 }))
}
disabled={!draft.enabled}
/>
) : (
<span className={`text-sm font-mono ${!data.enabled && "opacity-50"}`}>
{data.threshold} {t("failures", { count: data.threshold })}
{t("failures", { count: data.threshold })}
</span>
)}
<p className="text-xs text-text-muted mt-2">{t("autoDisableThresholdDesc")}</p>

View File

@@ -79,7 +79,9 @@ function ProviderProfilesCard({ profiles, onSave, saving }) {
];
const handleSave = () => {
onSave(draft);
// Only send 'oauth' and 'apikey' — the API schema rejects any other keys (e.g. 'local')
const { oauth, apikey } = draft ?? {};
onSave({ ...(oauth ? { oauth } : {}), ...(apikey ? { apikey } : {}) });
setEditMode(false);
};