Hide details when adaptor config is download-only (#938)
This commit is contained in:
parent
b99c57d43b
commit
be0506653d
1 changed files with 30 additions and 23 deletions
|
@ -12,7 +12,7 @@ import {
|
|||
TextArea,
|
||||
} from "@patternfly/react-core";
|
||||
import FileSaver from "file-saver";
|
||||
import React, { useState } from "react";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
|
||||
import { useServerInfo } from "../../context/server-info/ServerInfoProvider";
|
||||
|
@ -45,6 +45,11 @@ export const DownloadDialog = ({
|
|||
const [snippet, setSnippet] = useState("");
|
||||
const [openType, setOpenType] = useState(false);
|
||||
|
||||
const selectedConfig = useMemo(
|
||||
() => configFormats?.find((config) => config.id === selected) ?? null,
|
||||
[selected]
|
||||
);
|
||||
|
||||
useFetch(
|
||||
async () => {
|
||||
const snippet = await adminClient.clients.getInstallationProviders({
|
||||
|
@ -115,7 +120,7 @@ export const DownloadDialog = ({
|
|||
value={selected}
|
||||
selections={selected}
|
||||
onSelect={(_, value) => {
|
||||
setSelected(value as string);
|
||||
setSelected(value.toString());
|
||||
setOpenType(false);
|
||||
}}
|
||||
aria-label="Select Input"
|
||||
|
@ -132,6 +137,7 @@ export const DownloadDialog = ({
|
|||
</Select>
|
||||
</FormGroup>
|
||||
</StackItem>
|
||||
{!selectedConfig?.downloadOnly && (
|
||||
<StackItem isFilled>
|
||||
<FormGroup
|
||||
fieldId="details"
|
||||
|
@ -154,6 +160,7 @@ export const DownloadDialog = ({
|
|||
/>
|
||||
</FormGroup>
|
||||
</StackItem>
|
||||
)}
|
||||
</Stack>
|
||||
</Form>
|
||||
</ConfirmDialogModal>
|
||||
|
|
Loading…
Reference in a new issue