Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [BUG] Flyteconsole not showing latest LaunchPlan details #867

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 10 additions & 27 deletions packages/oss-console/src/components/Entities/EntityInputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
import CheckIcon from '@mui/icons-material/Check';
import ExpandLess from '@mui/icons-material/ExpandLess';
import ExpandMore from '@mui/icons-material/ExpandMore';
import { FilterOperationName } from '@clients/common/types/adminEntityTypes';
import { useLaunchPlans } from '../hooks/useLaunchPlans';
import keys from 'lodash/keys';
import { formatType, getInputDefintionForLiteralType } from '../Launch/LaunchForm/utils';
import { ResourceIdentifier } from '../../models/Common/types';
import { LaunchPlanClosure, LaunchPlanSpec } from '../../models/Launch/types';
import { LaunchPlan } from '../../models/Launch/types';
import t from './strings';
import { transformLiterals } from '../Literals/helpers';
import { useLatestLaunchPlans } from '../LaunchPlan/hooks/useLatestLaunchPlans';

const coerceDefaultValue = (value: string | object | undefined): string | undefined => {
if (typeof value === 'object') {
Expand All @@ -34,9 +34,6 @@
'& .MuiTableHead-root .MuiTableCell-root': {
borderTop: 'none',
},
'& .MuiTableCell-root:first-of-type': {
paddingLeft: 0,
},
'& .configs': {
listStyleType: 'none',
paddingInlineStart: 0,
Expand Down Expand Up @@ -69,27 +66,13 @@
export const EntityInputs: React.FC<{
id: ResourceIdentifier;
}> = ({ id }) => {
const launchPlanState = useLaunchPlans(
{ project: id.project, domain: id.domain },
{
limit: 1,
filter: [
{
key: 'launch_plan.name',
operation: FilterOperationName.EQ,
value: id.name,
},
],
},
);

const closure = launchPlanState?.value?.length
? launchPlanState.value[0].closure
: ({} as LaunchPlanClosure);
const latestLaunchPlanQuery = useLatestLaunchPlans({

Check warning on line 69 in packages/oss-console/src/components/Entities/EntityInputs.tsx

View check run for this annotation

Codecov / codecov/patch

packages/oss-console/src/components/Entities/EntityInputs.tsx#L69

Added line #L69 was not covered by tests
id,
limit: 1,
});

const spec = launchPlanState?.value?.length
? launchPlanState.value[0].spec
: ({} as LaunchPlanSpec);
const latestLaunchPlan = latestLaunchPlanQuery.data?.entities?.[0];
const { closure, spec } = latestLaunchPlan || ({} as LaunchPlan);

Check warning on line 75 in packages/oss-console/src/components/Entities/EntityInputs.tsx

View check run for this annotation

Codecov / codecov/patch

packages/oss-console/src/components/Entities/EntityInputs.tsx#L74-L75

Added lines #L74 - L75 were not covered by tests

const expectedInputs = useMemo<Input[]>(() => {
const results: Input[] = [];
Expand All @@ -110,7 +93,7 @@

const fixedInputs = useMemo<Input[]>(() => {
const inputsMap = transformLiterals(spec?.fixedInputs?.literals ?? {});
return Object.keys(inputsMap).map((name) => ({
return keys(inputsMap).map((name) => ({

Check warning on line 96 in packages/oss-console/src/components/Entities/EntityInputs.tsx

View check run for this annotation

Codecov / codecov/patch

packages/oss-console/src/components/Entities/EntityInputs.tsx#L96

Added line #L96 was not covered by tests
name,
defaultValue: inputsMap[name],
}));
Expand Down
Loading