Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
salazarm committed Sep 19, 2023
1 parent 4e5d4ba commit cdfb192
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const AssetsCatalogRoot = () => {
assetKey={{path: currentPath}}
right={
<Box flex={{gap: 12, alignItems: 'center'}}>
<AssetGlobalLineageLink />
<ReloadAllButton label="Reload definitions" />
</Box>
}
Expand Down
27 changes: 18 additions & 9 deletions js_modules/dagster-ui/packages/ui-core/src/runs/LogsToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ interface ILogsToolbarProps {
computeLogUrl: string | null;

children?: React.ReactNode;
}

interface WithExpandCollapseProps extends ILogsToolbarProps {
isSectionExpanded: boolean;
toggleExpanded: () => void;
}

const logQueryToString = (logQuery: LogFilterValue[]) =>
logQuery.map(({token, value}) => (token ? `${token}:${value}` : value)).join(' ');

export const LogsToolbar: React.FC<ILogsToolbarProps> = (props) => {
export const LogsToolbar: React.FC<ILogsToolbarProps | WithExpandCollapseProps> = (props) => {
const {
steps,
metadata,
Expand All @@ -64,10 +66,15 @@ export const LogsToolbar: React.FC<ILogsToolbarProps> = (props) => {
computeLogFileKey,
onSetComputeLogKey,
computeLogUrl,
isSectionExpanded,
toggleExpanded,
children,
} = props;
let isSectionExpanded;
let toggleExpanded;

if ('isSectionExpanded' in props) {
isSectionExpanded = props.isSectionExpanded;
toggleExpanded = props.toggleExpanded;
}

const activeItems = React.useMemo(() => new Set([logType]), [logType]);

Expand Down Expand Up @@ -101,12 +108,14 @@ export const LogsToolbar: React.FC<ILogsToolbarProps> = (props) => {
/>
)}
{children}
<Tooltip content={isSectionExpanded ? 'Collapse' : 'Expand'}>
<Button
icon={<Icon name={isSectionExpanded ? 'collapse_arrows' : 'expand_arrows'} />}
onClick={toggleExpanded}
/>
</Tooltip>
{toggleExpanded ? (
<Tooltip content={isSectionExpanded ? 'Collapse' : 'Expand'}>
<Button
icon={<Icon name={isSectionExpanded ? 'collapse_arrows' : 'expand_arrows'} />}
onClick={toggleExpanded}
/>
</Tooltip>
) : null}
</OptionsContainer>
);
};
Expand Down

0 comments on commit cdfb192

Please sign in to comment.