Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const ElasticsearchNodesPage: React.FC<ComponentProps> = ({ clusters }) =
const globalState = useContext(GlobalStateContext);
const { showCgroupMetricsElasticsearch } = useContext(ExternalConfigContext);
const { services } = useKibana<{ data: any }>();
const [isLoading, setIsLoading] = React.useState(false);
const { generate: generateBreadcrumbs } = useContext(BreadcrumbContainer.Context);
const { getPaginationRouteOptions, updateTotalItemCount, getPaginationTableProps } =
useTable('elasticsearch.nodes');
Expand Down Expand Up @@ -64,6 +65,7 @@ export const ElasticsearchNodesPage: React.FC<ComponentProps> = ({ clusters }) =
const bounds = services.data?.query.timefilter.timefilter.getBounds();
const url = `../api/monitoring/v1/clusters/${clusterUuid}/elasticsearch/nodes`;
if (services.http?.fetch && clusterUuid) {
setIsLoading(true);
const response = await services.http?.fetch(url, {
method: 'POST',
body: JSON.stringify({
Expand All @@ -76,6 +78,7 @@ export const ElasticsearchNodesPage: React.FC<ComponentProps> = ({ clusters }) =
}),
});

setIsLoading(false);
setData(response);
updateTotalItemCount(response.totalNodeCount);
const alertsResponse = await fetchAlerts({
Expand Down Expand Up @@ -125,6 +128,7 @@ export const ElasticsearchNodesPage: React.FC<ComponentProps> = ({ clusters }) =
setupMode={setupMode}
nodes={data.nodes}
alerts={alerts}
isLoading={isLoading}
showCgroupMetricsElasticsearch={showCgroupMetricsElasticsearch}
{...getPaginationTableProps()}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function EuiMonitoringSSPTable({
...props
}) {
const [queryText, setQueryText] = React.useState('');
const [isLoading, setIsLoading] = React.useState(false);
const [page, setPage] = React.useState({
index: pagination.pageIndex,
size: pagination.pageSize,
Expand Down Expand Up @@ -72,7 +73,9 @@ export function EuiMonitoringSSPTable({
setSort({ sort });
// angular version
if (props.fetchMoreData) {
setIsLoading(true);
await props.fetchMoreData({ page, sort: { sort }, queryText });
setIsLoading(false);
onTableChange({ page, sort });
}
// react version
Expand All @@ -87,7 +90,9 @@ export function EuiMonitoringSSPTable({
setQueryText(queryText);
// angular version
if (props.fetchMoreData) {
setIsLoading(true);
await props.fetchMoreData({ page: newPage, sort, queryText });
setIsLoading(false);
} else {
// react version
onTableChange({ page, sort: sort.sort, queryText });
Expand All @@ -105,6 +110,7 @@ export function EuiMonitoringSSPTable({
pagination={pagination}
onChange={onChange}
columns={columns}
loading={props.isLoading || isLoading}
Copy link
Contributor Author

@neptunian neptunian Oct 12, 2021

Choose a reason for hiding this comment

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

if props.isLoading (react version) else isLoading (angular). this is because we make the fetch higher up now and need to pass the state down in the react version.

/>
{footerContent}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function MonitoringElasticsearchNodesProvider({ getService, getPageObject

async clickNameCol() {
await find.clickByCssSelector(`[data-test-subj="${SUBJ_TABLE_SORT_NAME_COL}"] > button`);
await find.byCssSelector('.euiBasicTable-loading');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just added this to make sure the indicator exists first

await this.waitForTableToFinishLoading();
}

Expand Down