Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

add tooltip when there is no data in overview table #2318

Merged
merged 2 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/webui/src/components/overview/SuccessTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DefaultMetric from '../public-child/DefaultMetric';
import Details from './Details';
import { convertDuration } from '../../static/function';
import { TRIALS } from '../../static/datamodel';
import { DETAILTABS } from '../stateless-component/NNItabs';
import '../../static/style/succTable.scss';
import '../../static/style/openRow.scss';

Expand All @@ -21,7 +22,7 @@ class SuccessTable extends React.Component<SuccessTableProps, SuccessTableState>
super(props);
this.state = { columns: this.columns, source: TRIALS.table(this.props.trialIds) };
}

private onRenderRow: IDetailsListProps['onRenderRow'] = props => {
if (props) {
return <Details detailsProps={props} />;
Expand Down Expand Up @@ -55,6 +56,15 @@ class SuccessTable extends React.Component<SuccessTableProps, SuccessTableState>
return items.slice(0).sort((a: T, b: T) => ((isSortedDescending ? a[key] < b[key] : a[key] > b[key]) ? 1 : -1));
}

private tooltipStr = (): React.ReactNode => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this can be a variable instead of a function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK!

return (
<div>
<p>The experiment is running, please wait for the final metric patiently.</p>
<div className="link">You could also find status of trial job with <span>{DETAILTABS}</span> button.</div>
</div>
);
};

columns = [
{
name: 'Trial No.',
Expand Down Expand Up @@ -125,17 +135,20 @@ class SuccessTable extends React.Component<SuccessTableProps, SuccessTableState>

render(): React.ReactNode {
const { columns, source } = this.state;
const isNoneData = (source.length === 0) ? true : false;

return (
<div id="succTable">
{/* TODO: [style] lineHeight question */}
<DetailsList
columns={columns}
items={source}
setKey="set"
compact={true}
onRenderRow={this.onRenderRow}
selectionMode={0} // close selector function
className="succTable"
/>
{isNoneData && <div className="succTable-tooltip">{this.tooltipStr()}</div>}
</div>
);
}
Expand Down
13 changes: 13 additions & 0 deletions src/webui/src/static/style/succTable.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#succTable{
height: 404px;
overflow-y: scroll;
position: relative;
.succTable-tooltip{
position: absolute;
top: 40%;
left: 17%;
.link{
margin-left: 15px;
a{
font-weight: 500;
color: blue;
}
}
}
}