Skip to content

Commit

Permalink
fix: [BUG] Flyteconsole not showing latest LaunchPlan details (#867)
Browse files Browse the repository at this point in the history
Signed-off-by: Carina Ursu <[email protected]>
  • Loading branch information
ursucarina authored Apr 24, 2024
1 parent 7bf5a25 commit 7fff412
Showing 1 changed file with 10 additions and 27 deletions.
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 styled from '@mui/system/styled';
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 @@ const EntityInputsContainer = styled(Grid)(({ theme }) => ({
'& .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 @@ interface Input {
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({
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);

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

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

0 comments on commit 7fff412

Please sign in to comment.