1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Add disabled prop to DownloadLogsDropdown

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-08-31 12:14:39 +03:00
parent 1e69ea9b27
commit d12b4241a0
2 changed files with 4 additions and 2 deletions

View File

@ -63,6 +63,7 @@ export const LogControls = observer(({ model }: LogControlsProps) => {
/> />
<DownloadLogsDropdown <DownloadLogsDropdown
disabled={logs.length === 0}
downloadVisibleLogs={model.downloadLogs} downloadVisibleLogs={model.downloadLogs}
downloadAllLogs={model.downloadAllLogs} downloadAllLogs={model.downloadAllLogs}
/> />

View File

@ -13,9 +13,10 @@ import { Dropdown } from "../../dropdown/dropdown";
interface DownloadLogsDropdownProps { interface DownloadLogsDropdownProps {
downloadVisibleLogs: () => void; downloadVisibleLogs: () => void;
downloadAllLogs: () => Promise<void> | undefined; downloadAllLogs: () => Promise<void> | undefined;
disabled?: boolean;
} }
export function DownloadLogsDropdown({ downloadAllLogs, downloadVisibleLogs }: DownloadLogsDropdownProps) { export function DownloadLogsDropdown({ downloadAllLogs, downloadVisibleLogs, disabled }: DownloadLogsDropdownProps) {
const [waiting, setWaiting] = useState(false); const [waiting, setWaiting] = useState(false);
const downloadAll = async () => { const downloadAll = async () => {
@ -35,7 +36,7 @@ export function DownloadLogsDropdown({ downloadAllLogs, downloadVisibleLogs }: D
<button <button
data-testid="download-logs-dropdown" data-testid="download-logs-dropdown"
className={styles.dropdown} className={styles.dropdown}
disabled={waiting} disabled={waiting || disabled}
> >
Download Download
<Icon material="arrow_drop_down" smallest/> <Icon material="arrow_drop_down" smallest/>