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

[Uptime] Refresh index and also show more info to user regarding index/data #62606

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
82480b8
Refresh index and also show more info to user
shahzad31 Apr 6, 2020
e7298a5
updated type
shahzad31 Apr 6, 2020
3830f1b
updated type
shahzad31 Apr 6, 2020
a734be4
updated test
shahzad31 Apr 6, 2020
1620e32
updated formatting
shahzad31 Apr 7, 2020
d7e76f8
Merge branch 'master' into refresh-uptime-app-after-data-added
shahzad31 Apr 7, 2020
6b2202a
update text
shahzad31 Apr 7, 2020
92a09f5
updated types
shahzad31 Apr 7, 2020
8c3482f
updated translation
shahzad31 Apr 7, 2020
9618059
Merge branch 'master' into refresh-uptime-app-after-data-added
elasticmachine Apr 8, 2020
5620a39
Merge branch 'master' into refresh-uptime-app-after-data-added
shahzad31 Apr 10, 2020
2bef8ba
Merge branch 'refresh-uptime-app-after-data-added' of https://github.…
shahzad31 Apr 10, 2020
957adac
Merge branch 'master' into refresh-uptime-app-after-data-added
elasticmachine Apr 13, 2020
c76b990
Merge branch 'master' into refresh-uptime-app-after-data-added
shahzad31 Apr 13, 2020
f0c815f
Merge branch 'master' into refresh-uptime-app-after-data-added
elasticmachine Apr 13, 2020
8f89573
Merge branch 'master' into refresh-uptime-app-after-data-added
shahzad31 Apr 15, 2020
e7f5015
update
shahzad31 Apr 15, 2020
8e7b78f
Merge branch 'refresh-uptime-app-after-data-added' of https://github.…
shahzad31 Apr 15, 2020
059e46f
fixed types
shahzad31 Apr 15, 2020
2ef2fd4
Merge branch 'master' into refresh-uptime-app-after-data-added
shahzad31 Apr 17, 2020
2d40913
Merge branch 'master' into refresh-uptime-app-after-data-added
shahzad31 Apr 17, 2020
ba23491
updated code
shahzad31 Apr 17, 2020
e43915f
fixed types
shahzad31 Apr 17, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,44 @@
import React, { useContext, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { indexStatusAction } from '../../../state/actions';
import { indexStatusSelector } from '../../../state/selectors';
import { indexStatusSelector, selectDynamicSettings } from '../../../state/selectors';
import { EmptyStateComponent } from '../../functional/empty_state/empty_state';
import { UptimeRefreshContext } from '../../../contexts';
import { getDynamicSettings } from '../../../state/actions/dynamic_settings';

export const EmptyState: React.FC = ({ children }) => {
const { data, loading, error } = useSelector(indexStatusSelector);
const { lastRefresh } = useContext(UptimeRefreshContext);

const { settings } = useSelector(selectDynamicSettings);

const heartbeatIndices = settings?.heartbeatIndices || '';

const dispatch = useDispatch();

useEffect(() => {
dispatch(indexStatusAction.get());
if (!data || data?.docCount === 0 || data?.indexExists === false) {
dispatch(indexStatusAction.get());
}
// Don't add data , it will create endless loop
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [dispatch, lastRefresh]);

useEffect(() => {
dispatch(indexStatusAction.get());
}, [dispatch, heartbeatIndices]);

useEffect(() => {
dispatch(getDynamicSettings());
}, [dispatch]);

return (
<EmptyStateComponent
statesIndexStatus={data}
loading={loading}
errors={error ? [error] : undefined}
children={children as React.ReactElement}
settings={settings}
/>
);
};

This file was deleted.

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

Loading