diff --git a/src/components/experiment-tracking/run-dataset/run-dataset.scss b/src/components/experiment-tracking/run-dataset/run-dataset.scss index d13e72d28a..b59b8bf820 100644 --- a/src/components/experiment-tracking/run-dataset/run-dataset.scss +++ b/src/components/experiment-tracking/run-dataset/run-dataset.scss @@ -61,6 +61,7 @@ display: block; flex-shrink: 0; width: 310px; + word-wrap: break-word; &--single { width: 50%; diff --git a/src/components/experiment-tracking/run-metadata/index.js b/src/components/experiment-tracking/run-metadata/index.js index 4ce9f6f9f1..069276786c 100644 --- a/src/components/experiment-tracking/run-metadata/index.js +++ b/src/components/experiment-tracking/run-metadata/index.js @@ -4,6 +4,10 @@ import { toHumanReadableTime } from '../../../utils/date-utils'; import './run-metadata.css'; +// We are only checking for an empty string as it is the default value +// returned by the graphql endpoint for empty values ( not null or undefined ) +const sanitiseEmptyValue = (value) => (value !== '' ? value : '-'); + const RunMetadata = ({ isSingleRun, runs = [] }) => { let initialState = {}; for (let i = 0; i < runs.length; i++) { @@ -16,13 +20,12 @@ const RunMetadata = ({ isSingleRun, runs = [] }) => { setToggleNotes({ ...toggleNotes, [index]: !toggleNotes[index] }); }; - return runs.length === 0 ? ( -
- {run.title} + {sanitiseEmptyValue(run.title)} | ||
: null} - | {run.title} | ++ {sanitiseEmptyValue(run.title)} + |
Created By | : null} -{run.author} | +{sanitiseEmptyValue(run.author)} |
Creation Date | : null} -{`${humanReadableTime} (${run.timestamp})`} | +{`${humanReadableTime} (${sanitiseEmptyValue( + run.timestamp + )})`} |
Git SHA | : null} -{run.gitSha} | +{sanitiseEmptyValue(run.gitSha)} |
Git Branch | : null} -{run.gitBranch} | +{sanitiseEmptyValue(run.gitBranch)} |
Run Command | : null} -{run.runCommand} | +{sanitiseEmptyValue(run.runCommand)} |
Notes | : null}
- {run.notes} + style={toggleNotes[i] ? { display: 'block' } : null} + > + {sanitiseEmptyValue(run.notes)} {run.notes.length > 100 ? ( ) : null} diff --git a/src/components/experiment-tracking/run-metadata/run-metadata.scss b/src/components/experiment-tracking/run-metadata/run-metadata.scss index 56e916c4cd..8977d615fc 100644 --- a/src/components/experiment-tracking/run-metadata/run-metadata.scss +++ b/src/components/experiment-tracking/run-metadata/run-metadata.scss @@ -32,6 +32,7 @@ font-size: 1.4em; padding-bottom: 16px; vertical-align: top; + word-wrap: break-word; // For breaking potential long text, such as as git branch, title, etc &:first-of-type { width: 230px; diff --git a/src/components/experiment-tracking/run-metadata/run-metadata.test.js b/src/components/experiment-tracking/run-metadata/run-metadata.test.js index 995a768779..43df719f5e 100644 --- a/src/components/experiment-tracking/run-metadata/run-metadata.test.js +++ b/src/components/experiment-tracking/run-metadata/run-metadata.test.js @@ -6,6 +6,20 @@ import { configure, mount, shallow } from 'enzyme'; configure({ adapter: new Adapter() }); +const emptyRun = [ + { + id: '', + author: '', + bookmark: true, + timestamp: '', + gitSha: '', + gitBranch: '', + runCommand: '', + notes: '', + title: '', + }, +]; + describe('RunMetadata', () => { it('renders without crashing', () => { const wrapper = shallow( @@ -28,6 +42,11 @@ describe('RunMetadata', () => { expect(wrapper.find('.details-metadata__run--single').length).toBe(1); }); + it('shows a "-" for empty values ', () => { + const wrapper = mount( |