Skip to content

Commit

Permalink
[7.x] [Uptime] Enable loading on monitor list (#65670) (#66172)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed May 12, 2020
1 parent 17eb94c commit 6ab929b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface Props {
}

export const CertificateList: React.FC<Props> = ({ page, sort, onChange }) => {
const certificates = useSelector(certificatesSelector);
const { data: certificates, loading } = useSelector(certificatesSelector);

const onTableChange = (newVal: Partial<Props>) => {
onChange(newVal.page as Page, newVal.sort as CertSort);
Expand Down Expand Up @@ -98,6 +98,7 @@ export const CertificateList: React.FC<Props> = ({ page, sort, onChange }) => {

return (
<EuiBasicTable
loading={loading}
columns={columns}
items={certificates?.certs ?? []}
pagination={pagination}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ export const FingerprintCol: React.FC<Props> = ({ cert }) => {
<EmptyButton>{text} </EmptyButton>
</EuiToolTip>
<EuiCopy textToCopy={val ?? ''}>
{copy => <EuiButtonIcon onClick={copy} iconType="copy" title={COPY_FINGERPRINT} />}
{copy => (
<EuiButtonIcon
aria-label={COPY_FINGERPRINT}
onClick={copy}
iconType="copy"
title={COPY_FINGERPRINT}
/>
)}
</EuiCopy>
</Span>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,7 @@ export const MonitorListComponent: React.FC<Props> = ({
<EuiBasicTable
aria-label={labels.getDescriptionLabel(items.length)}
error={error?.message}
// Only set loading to true when there are no items present to prevent the bug outlined in
// in https://github.com/elastic/eui/issues/2393 . Once that is fixed we can simply set the value here to
// loading={loading}
loading={loading && (!items || items.length < 1)}
loading={loading}
isExpandable={true}
hasActions={true}
itemId="monitor_id"
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/uptime/public/pages/certificates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const CertificatesPage: React.FC = () => {
);
}, [dispatch, page, search, sort.direction, sort.field, lastRefresh]);

const certificates = useSelector(certificatesSelector);
const { data: certificates } = useSelector(certificatesSelector);

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ export function* fetchCertificatesEffect() {
);
}

export const certificatesSelector = ({ certificates }: AppState) => certificates.certs.data;
export const certificatesSelector = ({ certificates }: AppState) => certificates.certs;

0 comments on commit 6ab929b

Please sign in to comment.