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 ? ( -
Loading...
- ) : ( + return (
+ })} + > {runs.map((run, i) => { const humanReadableTime = toHumanReadableTime(run.timestamp); @@ -31,53 +34,60 @@ const RunMetadata = ({ isSingleRun, runs = [] }) => { className={classnames('details-metadata__run', { 'details-metadata__run--single': isSingleRun, })} - key={run.gitSha}> + key={run.title + i} // note: this should revert back to use gitSha once the BE returns the actual value + > {isSingleRun ? ( ) : ( {i === 0 ? : null} - + )} {i === 0 ? : null} - + {i === 0 ? : null} - + {i === 0 ? : null} - + {i === 0 ? : null} - + {i === 0 ? : null} - + {i === 0 ? : null}
- {run.title} + {sanitiseEmptyValue(run.title)}
{run.title} + {sanitiseEmptyValue(run.title)} +
Created By{run.author}{sanitiseEmptyValue(run.author)}
Creation Date{`${humanReadableTime} (${run.timestamp})`}{`${humanReadableTime} (${sanitiseEmptyValue( + run.timestamp + )})`}
Git SHA{run.gitSha}{sanitiseEmptyValue(run.gitSha)}
Git Branch{run.gitBranch}{sanitiseEmptyValue(run.gitBranch)}
Run Command{run.runCommand}{sanitiseEmptyValue(run.runCommand)}
Notes

- {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(); + expect(wrapper.find('.details-metadata__title').text()).toMatch('-'); + }); + it('handles show more/less button click event', () => { const setToggleNotes = jest.fn(); const wrapper = mount(