Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce machine learning table spacing when new home page enabled #377

Merged
Show file tree
Hide file tree
Changes from 3 commits
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
7 changes: 6 additions & 1 deletion public/components/common/refresh_interval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,14 @@ export const RefreshInterval = ({
}
} else {
if (interval !== null) {
/**
* According https://developer.mozilla.org/en-US/docs/Web/API/setInterval#return_value
* the max delayed value of setInterval is 2147483647, the inner function will be executed immediately
* if the delayed value is greater than 2147483647. Add a Math.min here to avoid been executed immediately.
**/
intervalId = window.setInterval(() => {
onRefresh();
}, interval);
}, Math.min(interval, 2147483647));
Copy link
Member

Choose a reason for hiding this comment

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

Better to give it a name: MAX_SIGNED_32_BIT_INTEGER

}
}

Expand Down
39 changes: 20 additions & 19 deletions public/components/monitoring/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,28 +104,29 @@ export const Monitoring = (props: MonitoringProps) => {
/>
<EuiPanel>
{!useNewPageHeader && (
<EuiText size="s">
<h2>
<FormattedMessage
id="machineLearning.aiModels.table.header.title"
defaultMessage="Models {records}"
values={{
records:
pageStatus === 'normal' ? (
<EuiTextColor aria-label="total number of results" color="subdued">
({pagination?.totalRecords ?? 0})
</EuiTextColor>
) : undefined,
}}
/>
</h2>
</EuiText>
<>
<EuiText size="s">
<h2>
<FormattedMessage
id="machineLearning.aiModels.table.header.title"
defaultMessage="Models {records}"
values={{
records:
pageStatus === 'normal' ? (
<EuiTextColor aria-label="total number of results" color="subdued">
({pagination?.totalRecords ?? 0})
</EuiTextColor>
) : undefined,
}}
/>
</h2>
</EuiText>
<EuiSpacer size="m" />
</>
)}

<EuiSpacer size="m" />
{pageStatus !== 'empty' && (
<>
<EuiFlexGroup gutterSize="l">
<EuiFlexGroup gutterSize={useNewPageHeader ? 's' : 'l'}>
<EuiFlexItem>
<SearchBar inputRef={setInputRef} onSearch={searchByNameOrId} />
</EuiFlexItem>
Expand Down
6 changes: 5 additions & 1 deletion public/components/monitoring/monitoring_page_header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export const MonitoringPageHeader = ({
if (useNewPageHeader) {
return [
{
renderComponent: <RefreshInterval onRefresh={onRefresh} />,
renderComponent: (
<div style={{ width: 227 }}>
<RefreshInterval onRefresh={onRefresh} />
</div>
),
},
];
}
Expand Down
Loading