mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fix PR review comments for databricks integration
This commit is contained in:
@@ -12,13 +12,12 @@ import { Button, Card, CardTitle, FormControl, Input } from "../../../components
|
|||||||
|
|
||||||
export default function DatabricksCreateIntegrationPage() {
|
export default function DatabricksCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { mutateAsync } = useSaveIntegrationAccessToken();
|
const { mutateAsync, isLoading } = useSaveIntegrationAccessToken();
|
||||||
|
|
||||||
const [apiKey, setApiKey] = useState("");
|
const [apiKey, setApiKey] = useState("");
|
||||||
const [instanceURL, setInstanceURL] = useState("");
|
const [instanceURL, setInstanceURL] = useState("");
|
||||||
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
const [apiKeyErrorText, setApiKeyErrorText] = useState("");
|
||||||
const [instanceURLErrorText, setInstanceURLErrorText] = useState("");
|
const [instanceURLErrorText, setInstanceURLErrorText] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
|
||||||
|
|
||||||
const handleButtonClick = async () => {
|
const handleButtonClick = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -33,17 +32,13 @@ export default function DatabricksCreateIntegrationPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsLoading(true);
|
|
||||||
|
|
||||||
const integrationAuth = await mutateAsync({
|
const integrationAuth = await mutateAsync({
|
||||||
workspaceId: localStorage.getItem("projectData.id"),
|
workspaceId: localStorage.getItem("projectData.id"),
|
||||||
integration: "databricks",
|
integration: "databricks",
|
||||||
url: instanceURL,
|
url: instanceURL.replace(/\/$/, ""),
|
||||||
accessToken: apiKey
|
accessToken: apiKey
|
||||||
});
|
});
|
||||||
|
|
||||||
setIsLoading(false);
|
|
||||||
|
|
||||||
router.push(`/integrations/databricks/create?integrationAuthId=${integrationAuth.id}`);
|
router.push(`/integrations/databricks/create?integrationAuthId=${integrationAuth.id}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
@@ -107,6 +102,7 @@ export default function DatabricksCreateIntegrationPage() {
|
|||||||
variant="outline_bg"
|
variant="outline_bg"
|
||||||
className="mb-6 mt-2 ml-auto mr-6 w-min"
|
className="mb-6 mt-2 ml-auto mr-6 w-min"
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
|
isDisabled={isLoading}
|
||||||
>
|
>
|
||||||
Connect to Databricks
|
Connect to Databricks
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import { useGetWorkspaceById } from "../../../hooks/api/workspace";
|
|||||||
|
|
||||||
export default function DatabricksCreateIntegrationPage() {
|
export default function DatabricksCreateIntegrationPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { mutateAsync } = useCreateIntegration();
|
const { mutateAsync, isLoading } = useCreateIntegration();
|
||||||
|
|
||||||
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
const { integrationAuthId } = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
|
||||||
@@ -50,8 +50,6 @@ export default function DatabricksCreateIntegrationPage() {
|
|||||||
const [targetScope, setTargetScope] = useState("");
|
const [targetScope, setTargetScope] = useState("");
|
||||||
const [secretPath, setSecretPath] = useState("/");
|
const [secretPath, setSecretPath] = useState("/");
|
||||||
|
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (workspace) {
|
if (workspace) {
|
||||||
setSelectedSourceEnvironment(workspace.environments[0].slug);
|
setSelectedSourceEnvironment(workspace.environments[0].slug);
|
||||||
@@ -67,12 +65,9 @@ export default function DatabricksCreateIntegrationPage() {
|
|||||||
type: "error",
|
type: "error",
|
||||||
text: "Please select a scope"
|
text: "Please select a scope"
|
||||||
});
|
});
|
||||||
setIsLoading(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsLoading(true);
|
|
||||||
|
|
||||||
const selectedScope = integrationAuthScopes?.find(
|
const selectedScope = integrationAuthScopes?.find(
|
||||||
(integrationAuthScope) => integrationAuthScope.name === targetScope
|
(integrationAuthScope) => integrationAuthScope.name === targetScope
|
||||||
);
|
);
|
||||||
@@ -82,7 +77,6 @@ export default function DatabricksCreateIntegrationPage() {
|
|||||||
type: "error",
|
type: "error",
|
||||||
text: "Invalid scope selected"
|
text: "Invalid scope selected"
|
||||||
});
|
});
|
||||||
setIsLoading(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,8 +88,6 @@ export default function DatabricksCreateIntegrationPage() {
|
|||||||
secretPath
|
secretPath
|
||||||
});
|
});
|
||||||
|
|
||||||
setIsLoading(false);
|
|
||||||
|
|
||||||
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
|
router.push(`/integrations/${localStorage.getItem("projectData.id")}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
@@ -193,7 +185,7 @@ export default function DatabricksCreateIntegrationPage() {
|
|||||||
variant="outline_bg"
|
variant="outline_bg"
|
||||||
className="mb-6 mt-2 ml-auto mr-6 w-min"
|
className="mb-6 mt-2 ml-auto mr-6 w-min"
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
isDisabled={integrationAuthScopes.length === 0}
|
isDisabled={integrationAuthScopes.length === 0 || isLoading}
|
||||||
>
|
>
|
||||||
Create Integration
|
Create Integration
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user