mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-07 04:58:44 +02:00
disabled advanced mode on the providers
This commit is contained in:
@@ -374,6 +374,7 @@ export default function AiProviderNetworkPage() {
|
|||||||
emptyMessage={t("aiProviderTargetNoOne")}
|
emptyMessage={t("aiProviderTargetNoOne")}
|
||||||
embedded
|
embedded
|
||||||
hideSaveButton
|
hideSaveButton
|
||||||
|
disableAdvancedMode
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -591,6 +591,7 @@ export default function CreateAiProviderPage() {
|
|||||||
)}
|
)}
|
||||||
embedded
|
embedded
|
||||||
hideSaveButton
|
hideSaveButton
|
||||||
|
disableAdvancedMode
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ type ProxyResourceTargetsFormProps = {
|
|||||||
embedded?: boolean;
|
embedded?: boolean;
|
||||||
/** Hide the built-in save button (use ref.save from parent) */
|
/** Hide the built-in save button (use ref.save from parent) */
|
||||||
hideSaveButton?: boolean;
|
hideSaveButton?: boolean;
|
||||||
|
/** Hide the advanced mode toggle and always use non-advanced mode (e.g. AI providers) */
|
||||||
|
disableAdvancedMode?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ProxyResourceTargetsForm = forwardRef<
|
export const ProxyResourceTargetsForm = forwardRef<
|
||||||
@@ -121,7 +123,8 @@ export const ProxyResourceTargetsForm = forwardRef<
|
|||||||
allowedMethods = ["http", "https", "h2c"],
|
allowedMethods = ["http", "https", "h2c"],
|
||||||
emptyMessage,
|
emptyMessage,
|
||||||
embedded = false,
|
embedded = false,
|
||||||
hideSaveButton = false
|
hideSaveButton = false,
|
||||||
|
disableAdvancedMode = false
|
||||||
},
|
},
|
||||||
ref
|
ref
|
||||||
) {
|
) {
|
||||||
@@ -221,6 +224,9 @@ export const ProxyResourceTargetsForm = forwardRef<
|
|||||||
);
|
);
|
||||||
|
|
||||||
const [isAdvancedMode, setIsAdvancedMode] = useState(() => {
|
const [isAdvancedMode, setIsAdvancedMode] = useState(() => {
|
||||||
|
if (disableAdvancedMode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
const saved = localStorage.getItem("proxy-advanced-mode");
|
const saved = localStorage.getItem("proxy-advanced-mode");
|
||||||
return saved === "true";
|
return saved === "true";
|
||||||
@@ -709,13 +715,14 @@ export const ProxyResourceTargetsForm = forwardRef<
|
|||||||
}, [sites]);
|
}, [sites]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (disableAdvancedMode) return;
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"proxy-advanced-mode",
|
"proxy-advanced-mode",
|
||||||
isAdvancedMode.toString()
|
isAdvancedMode.toString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [isAdvancedMode]);
|
}, [isAdvancedMode, disableAdvancedMode]);
|
||||||
|
|
||||||
const [, formAction, isSubmitting] = useActionState(
|
const [, formAction, isSubmitting] = useActionState(
|
||||||
async () => {
|
async () => {
|
||||||
@@ -940,19 +947,21 @@ export const ProxyResourceTargetsForm = forwardRef<
|
|||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
<div className="flex items-center justify-between w-full gap-2">
|
<div className="flex items-center justify-between w-full gap-2">
|
||||||
{addTargetButton}
|
{addTargetButton}
|
||||||
<div className="flex items-center gap-2">
|
{!disableAdvancedMode && (
|
||||||
<Switch
|
<div className="flex items-center gap-2">
|
||||||
id={advancedModeToggleId}
|
<Switch
|
||||||
checked={isAdvancedMode}
|
id={advancedModeToggleId}
|
||||||
onCheckedChange={setIsAdvancedMode}
|
checked={isAdvancedMode}
|
||||||
/>
|
onCheckedChange={setIsAdvancedMode}
|
||||||
<label
|
/>
|
||||||
htmlFor={advancedModeToggleId}
|
<label
|
||||||
className="text-sm"
|
htmlFor={advancedModeToggleId}
|
||||||
>
|
className="text-sm"
|
||||||
{t("advancedMode")}
|
>
|
||||||
</label>
|
{t("advancedMode")}
|
||||||
</div>
|
</label>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user