Skip to content

Commit

Permalink
fix: stop displaying empty descriptions (#346)
Browse files Browse the repository at this point in the history
* fix: stop displaying empty descriptions
* fix: remove unused const
Signed-off-by: Olga Nad <[email protected]>
  • Loading branch information
olga-union authored Mar 28, 2022
1 parent 831d738 commit 6a964f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const navBarContentId = 'nav-bar-content';

export const unknownValueString = '(unknown)';
export const dashedValueString = '----';
export const noDescriptionString = '(No description)';
export const noneString = '(none)';
export const noExecutionsFoundString = 'No executions found.';
export const noWorkflowVersionsFoundString = 'No workflow versions found.';
Expand Down
11 changes: 6 additions & 5 deletions src/components/Task/SearchableTaskNameList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { makeStyles, Theme } from '@material-ui/core/styles';
import ChevronRight from '@material-ui/icons/ChevronRight';
import ErrorOutline from '@material-ui/icons/ErrorOutline';
import classnames from 'classnames';
import { noDescriptionString } from 'common/constants';
import { SearchResult } from 'components/common/SearchableList';
import {
SearchableNamedEntity,
Expand Down Expand Up @@ -79,15 +78,17 @@ const TaskNameRow: React.FC<TaskNameRowProps> = ({ label, entityName }) => {
const styles = useStyles();
const listStyles = useNamedEntityListStyles();
const [inViewRef, inView] = useInView(intersectionOptions);
const description = entityName.metadata.description || noDescriptionString;
const description = entityName?.metadata?.description;

return (
<div ref={inViewRef} className={listStyles.searchResult}>
<div className={listStyles.itemName}>
<div className={styles.taskName}>{label}</div>
<Typography variant="body2" className={styles.description}>
{description}
</Typography>
{description && (
<Typography variant="body2" className={styles.description}>
{description}
</Typography>
)}
{!!inView && <TaskInterface taskName={entityName} />}
</div>
<ChevronRight className={listStyles.itemChevron} />
Expand Down
9 changes: 6 additions & 3 deletions src/components/Workflow/SearchableWorkflowNameList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { WorkflowExecutionPhase } from 'models/Execution/enums';
import { Shimmer } from 'components/common/Shimmer';
import { WorkflowExecutionIdentifier } from 'models/Execution/types';
import { debounce } from 'lodash';
import { Typography } from '@material-ui/core';
import { WorkflowListStructureItem } from './types';
import ProjectStatusBar from '../Project/ProjectStatusBar';
import { workflowNoInputsString } from '../Launch/LaunchForm/constants';
Expand Down Expand Up @@ -120,9 +121,11 @@ const SearchableWorkflowNameItem: React.FC<SearchableWorkflowNameItemProps> = Re
<DeviceHub className={styles.itemIcon} />
<div>{id.name}</div>
</div>
<div className={styles.itemDescriptionRow}>
{description?.length ? description : 'This workflow has no description.'}
</div>
{description && (
<Typography variant="body2" className={styles.itemDescriptionRow}>
{description}
</Typography>
)}
<div className={styles.itemRow}>
<div className={styles.itemLabel}>Last execution time</div>
<div className={styles.w100}>
Expand Down

0 comments on commit 6a964f6

Please sign in to comment.