src: Fix new errors after linter bump
This addresses problems caused by dependency updates.
This commit is contained in:
parent
21d038f47b
commit
44dc900370
6 changed files with 41 additions and 20 deletions
|
|
@ -50,6 +50,7 @@ export const BuildImagesButton = () => {
|
|||
addNotification({
|
||||
variant: 'warning',
|
||||
title: 'No blueprint was build',
|
||||
description: imageBuildError?.data?.error?.message,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
@ -164,8 +165,9 @@ export const BuildImagesButtonEmptyState = ({
|
|||
const [buildBlueprint, { isLoading: imageBuildLoading }] =
|
||||
useComposeBlueprintMutation();
|
||||
const onBuildHandler = async () => {
|
||||
selectedBlueprintId &&
|
||||
(await buildBlueprint({ id: selectedBlueprintId, body: {} }));
|
||||
if (selectedBlueprintId) {
|
||||
await buildBlueprint({ id: selectedBlueprintId, body: {} });
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -13,8 +13,10 @@ import {
|
|||
Modal,
|
||||
ModalVariant,
|
||||
} from '@patternfly/react-core';
|
||||
import { addNotification } from '@redhat-cloud-services/frontend-components-notifications/redux';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import { useAppDispatch } from '../../store/hooks';
|
||||
import { BlueprintResponse } from '../../store/imageBuilderApi';
|
||||
import { wizardState } from '../../store/wizardSlice';
|
||||
import { resolveRelPath } from '../../Utilities/path';
|
||||
|
|
@ -38,6 +40,7 @@ export const ImportBlueprintModal: React.FunctionComponent<
|
|||
const [filename, setFilename] = React.useState('');
|
||||
const [isLoading, setIsLoading] = React.useState(false);
|
||||
const [isRejected, setIsRejected] = React.useState(false);
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const handleFileInputChange = (
|
||||
_event: React.ChangeEvent<HTMLInputElement> | React.DragEvent<HTMLElement>,
|
||||
|
|
@ -67,6 +70,13 @@ export const ImportBlueprintModal: React.FunctionComponent<
|
|||
setJsonContent(value);
|
||||
} catch (error) {
|
||||
setIsInvalidFormat(true);
|
||||
dispatch(
|
||||
addNotification({
|
||||
variant: 'warning',
|
||||
title: 'No blueprint was build',
|
||||
description: error?.data?.error?.message,
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
const handleFileRejected = () => {
|
||||
|
|
|
|||
|
|
@ -141,14 +141,18 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
|||
// IMPORTANT: Ensure the wizard starts with a fresh initial state
|
||||
useEffect(() => {
|
||||
dispatch(initializeWizard());
|
||||
searchParams.get('release') === 'rhel8' &&
|
||||
if (searchParams.get('release') === 'rhel8') {
|
||||
dispatch(changeDistribution(RHEL_8));
|
||||
searchParams.get('arch') === AARCH64 &&
|
||||
}
|
||||
if (searchParams.get('arch') === AARCH64) {
|
||||
dispatch(changeArchitecture(AARCH64));
|
||||
searchParams.get('target') === 'iso' &&
|
||||
}
|
||||
if (searchParams.get('target') === 'iso') {
|
||||
dispatch(addImageType('image-installer'));
|
||||
searchParams.get('target') === 'qcow2' &&
|
||||
}
|
||||
if (searchParams.get('target') === 'qcow2') {
|
||||
dispatch(addImageType('guest-image'));
|
||||
}
|
||||
// This useEffect hook should run *only* on mount and therefore has an empty
|
||||
// dependency array. eslint's exhaustive-deps rule does not support this use.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ export const PopoverActivation = () => {
|
|||
};
|
||||
|
||||
type EmptyActivationsKeyStateProps = {
|
||||
handleActivationKeyFn: Function;
|
||||
handleActivationKeyFn: () => void;
|
||||
isLoading: boolean;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,12 @@ export const EditSaveAndBuildBtn = ({
|
|||
const onSaveAndBuild = async () => {
|
||||
const requestBody = await getBlueprintPayload();
|
||||
setIsOpen(false);
|
||||
requestBody &&
|
||||
(await updateBlueprint({
|
||||
if (requestBody) {
|
||||
await updateBlueprint({
|
||||
id: blueprintId,
|
||||
createBlueprintRequest: requestBody,
|
||||
}));
|
||||
});
|
||||
}
|
||||
buildBlueprint({ id: blueprintId, body: {} });
|
||||
};
|
||||
|
||||
|
|
@ -69,8 +70,9 @@ export const EditSaveButton = ({
|
|||
const onSave = async () => {
|
||||
const requestBody = await getBlueprintPayload();
|
||||
setIsOpen(false);
|
||||
requestBody &&
|
||||
if (requestBody) {
|
||||
updateBlueprint({ id: blueprintId, createBlueprintRequest: requestBody });
|
||||
}
|
||||
};
|
||||
return (
|
||||
<MenuToggleAction
|
||||
|
|
|
|||
21
src/test/fixtures/repositories.ts
vendored
21
src/test/fixtures/repositories.ts
vendored
|
|
@ -33,20 +33,22 @@ const numFillerRepos = 1000;
|
|||
const filterRepos = (args: repoArgs): ApiRepositoryResponse[] => {
|
||||
let repos = testingRepos;
|
||||
|
||||
args.available_for_arch &&
|
||||
(repos = repos.filter(
|
||||
if (args.available_for_arch) {
|
||||
repos = repos.filter(
|
||||
(repo) =>
|
||||
repo.distribution_arch === 'any' ||
|
||||
repo.distribution_arch === args.available_for_arch
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
args.available_for_version &&
|
||||
(repos = repos.filter((repo) => {
|
||||
if (args.available_for_version) {
|
||||
repos = repos.filter((repo) => {
|
||||
return (
|
||||
repo.distribution_versions?.includes(args.available_for_version!) ||
|
||||
repo.distribution_versions?.includes('any')
|
||||
);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
// Filler repos will always appear in response as they have distribution_versions
|
||||
// and distribution_arch of 'any'. High count is useful for testing pagination.
|
||||
|
|
@ -54,11 +56,12 @@ const filterRepos = (args: repoArgs): ApiRepositoryResponse[] => {
|
|||
|
||||
repos = [...repos, ...fillerRepos];
|
||||
|
||||
args.search &&
|
||||
(repos = repos.filter(
|
||||
if (args.search) {
|
||||
repos = repos.filter(
|
||||
(repo) =>
|
||||
repo.name?.includes(args.search!) || repo.url?.includes(args.search!)
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
return repos;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue