Skip to content

Commit

Permalink
add refresh to analytics management list
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Aug 31, 2020
1 parent ae1d8df commit e9187c9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { SourceSelection } from '../source_selection';
import { filterAnalytics, AnalyticsSearchBar } from '../analytics_search_bar';
import { AnalyticsEmptyPrompt } from './empty_prompt';
import { useTableSettings } from './use_table_settings';
import { RefreshAnalyticsListButton } from '../refresh_analytics_list_button';

const filters: EuiSearchBarProps['filters'] = [
{
Expand Down Expand Up @@ -224,18 +225,30 @@ export const DataFrameAnalyticsList: FC<Props> = ({

const itemIdToExpandedRowMap = getItemIdToExpandedRowMap(expandedRowItemIds, analytics);

const stats = analyticsStats && (
<EuiFlexItem grow={false}>
<StatsBar stats={analyticsStats} dataTestSub={'mlAnalyticsStatsBar'} />
</EuiFlexItem>
);

const managementStats = (
<EuiFlexItem>
<EuiFlexGroup justifyContent="spaceBetween">
{stats}
<EuiFlexItem grow={false}>
<RefreshAnalyticsListButton />
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
);

return (
<>
{modals}
<EuiSpacer size="m" />
{!isManagementTable && <EuiSpacer size="m" />}
<EuiFlexGroup justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
{analyticsStats && (
<EuiFlexItem grow={false}>
<StatsBar stats={analyticsStats} dataTestSub={'mlAnalyticsStatsBar'} />
</EuiFlexItem>
)}
</EuiFlexItem>
{!isManagementTable && stats}
{isManagementTable && managementStats}
<EuiFlexItem grow={false}>
<EuiFlexGroup alignItems="center" gutterSize="s">
{!isManagementTable && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { getJobIdUrl, TAB_IDS } from '../../../../../util/get_selected_ids_url';

import { getAnalysisType, DataFrameAnalyticsId } from '../../../../common';
import {
getDataFrameAnalyticsProgress,
getDataFrameAnalyticsProgressPhase,
isDataFrameAnalyticsFailed,
isDataFrameAnalyticsRunning,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export function useTableSettings(items: DataFrameAnalyticsListRow[]): UseTableSe
sortField: string,
sortDirection: Direction
) => {
list = sortBy(list, (item) => get(item, jobPropertyMap[sortField] || sortField));
list = sortBy(list, (item) =>
get(item, jobPropertyMap[sortField as keyof typeof jobPropertyMap] || sortField)
);
list = sortDirection === 'asc' ? list : list.reverse();
const listLength = list.length;

Expand Down

0 comments on commit e9187c9

Please sign in to comment.