mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 22:27:48 +00:00
auto select relay for gateway quick setup
This commit is contained in:
+7
-4
@@ -80,7 +80,7 @@ export const GatewayCliDeploymentMethod = () => {
|
|||||||
const [relay, setRelay] = useState<null | {
|
const [relay, setRelay] = useState<null | {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
}>(null);
|
}>({ id: "_auto", name: "Auto Select Relay" });
|
||||||
const [identity, setIdentity] = useState<null | {
|
const [identity, setIdentity] = useState<null | {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -183,9 +183,8 @@ export const GatewayCliDeploymentMethod = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const command = useMemo(() => {
|
const command = useMemo(() => {
|
||||||
return `infisical gateway start --name=${name} --relay=${
|
const relayPart = relay?.id !== "_auto" ? ` --relay=${relay?.name || ""}` : "";
|
||||||
relay?.name || ""
|
return `infisical gateway start --name=${name}${relayPart} --domain=${siteURL} --token=${identityToken}`;
|
||||||
} --domain=${siteURL} --token=${identityToken}`;
|
|
||||||
}, [name, relay, identityToken, siteURL]);
|
}, [name, relay, identityToken, siteURL]);
|
||||||
|
|
||||||
if (step === "command") {
|
if (step === "command") {
|
||||||
@@ -256,6 +255,10 @@ export const GatewayCliDeploymentMethod = () => {
|
|||||||
}}
|
}}
|
||||||
isLoading={isRelaysLoading}
|
isLoading={isRelaysLoading}
|
||||||
options={[
|
options={[
|
||||||
|
{
|
||||||
|
id: "_auto",
|
||||||
|
name: "Auto Select Relay"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "_create",
|
id: "_create",
|
||||||
name: "Deploy New Relay"
|
name: "Deploy New Relay"
|
||||||
|
|||||||
+7
-1
@@ -1,6 +1,6 @@
|
|||||||
import { components, OptionProps } from "react-select";
|
import { components, OptionProps } from "react-select";
|
||||||
import { faCheckCircle } from "@fortawesome/free-regular-svg-icons";
|
import { faCheckCircle } from "@fortawesome/free-regular-svg-icons";
|
||||||
import { faPlus } from "@fortawesome/free-solid-svg-icons";
|
import { faPlus, faWandMagicSparkles } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
|
||||||
export const RelayOption = ({
|
export const RelayOption = ({
|
||||||
@@ -9,6 +9,7 @@ export const RelayOption = ({
|
|||||||
...props
|
...props
|
||||||
}: OptionProps<{ id: string; name: string }>) => {
|
}: OptionProps<{ id: string; name: string }>) => {
|
||||||
const isCreateOption = props.data.id === "_create";
|
const isCreateOption = props.data.id === "_create";
|
||||||
|
const isAutoOption = props.data.id === "_auto";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<components.Option isSelected={isSelected} {...props}>
|
<components.Option isSelected={isSelected} {...props}>
|
||||||
@@ -18,6 +19,11 @@ export const RelayOption = ({
|
|||||||
<FontAwesomeIcon icon={faPlus} size="sm" />
|
<FontAwesomeIcon icon={faPlus} size="sm" />
|
||||||
<span className="mr-auto">Deploy New Relay</span>
|
<span className="mr-auto">Deploy New Relay</span>
|
||||||
</div>
|
</div>
|
||||||
|
) : isAutoOption ? (
|
||||||
|
<div className="flex items-center gap-x-1 text-mineshaft-400">
|
||||||
|
<FontAwesomeIcon icon={faWandMagicSparkles} size="sm" />
|
||||||
|
<span className="mr-auto">Auto Select Relay</span>
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<p className="truncate">{children}</p>
|
<p className="truncate">{children}</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user