mirror of https://github.com/apache/druid.git
fix refresh button (#9195)
This commit is contained in:
parent
92ac22d060
commit
09efd20b42
|
@ -224,7 +224,7 @@ export class SegmentsView extends React.PureComponent<SegmentsViewProps, Segment
|
||||||
` "segment_id", "datasource", "start", "end", "size", "version", "partition_num", "num_replicas", "num_rows", "is_published", "is_available", "is_realtime", "is_overshadowed", "payload"`,
|
` "segment_id", "datasource", "start", "end", "size", "version", "partition_num", "num_replicas", "num_rows", "is_published", "is_available", "is_realtime", "is_overshadowed", "payload"`,
|
||||||
`FROM sys.segments`,
|
`FROM sys.segments`,
|
||||||
`WHERE`,
|
`WHERE`,
|
||||||
` ("start" || '/' || "end") IN (${intervals})`,
|
intervals ? ` ("start" || '/' || "end") IN (${intervals})` : 'FALSE',
|
||||||
whereClause ? ` AND ${whereClause}` : '',
|
whereClause ? ` AND ${whereClause}` : '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -311,16 +311,14 @@ export class SegmentsView extends React.PureComponent<SegmentsViewProps, Segment
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
const results: SegmentQueryResultRow[] = nestedResults.flat().sort((d1: any, d2: any) => {
|
return nestedResults.flat().sort((d1: any, d2: any) => {
|
||||||
return d2.start.localeCompare(d1.start);
|
return d2.start.localeCompare(d1.start);
|
||||||
});
|
});
|
||||||
|
|
||||||
return results.slice(0, SegmentsView.PAGE_SIZE);
|
|
||||||
},
|
},
|
||||||
onStateChange: ({ result, loading, error }) => {
|
onStateChange: ({ result, loading, error }) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
allSegments: result,
|
allSegments: result,
|
||||||
segments: result,
|
segments: result ? result.slice(0, SegmentsView.PAGE_SIZE) : undefined,
|
||||||
segmentsLoading: loading,
|
segmentsLoading: loading,
|
||||||
segmentsError: error,
|
segmentsError: error,
|
||||||
});
|
});
|
||||||
|
@ -360,6 +358,11 @@ export class SegmentsView extends React.PureComponent<SegmentsViewProps, Segment
|
||||||
const sortPivot = sorted[0].id;
|
const sortPivot = sorted[0].id;
|
||||||
const sortDesc = sorted[0].desc;
|
const sortDesc = sorted[0].desc;
|
||||||
const selectedSegments = allSegments
|
const selectedSegments = allSegments
|
||||||
|
.filter((d: any) => {
|
||||||
|
return filtered.every((f: any) => {
|
||||||
|
return d[f.id].includes(f.value);
|
||||||
|
});
|
||||||
|
})
|
||||||
.sort((d1: any, d2: any) => {
|
.sort((d1: any, d2: any) => {
|
||||||
const v1 = d1[sortPivot];
|
const v1 = d1[sortPivot];
|
||||||
const v2 = d2[sortPivot];
|
const v2 = d2[sortPivot];
|
||||||
|
@ -369,14 +372,10 @@ export class SegmentsView extends React.PureComponent<SegmentsViewProps, Segment
|
||||||
return sortDesc ? v2 - v1 : v1 - v2;
|
return sortDesc ? v2 - v1 : v1 - v2;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter((d: any) => {
|
.slice(startPage, endPage);
|
||||||
return filtered.every((f: any) => {
|
|
||||||
return d[f.id].includes(f.value);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
const segments = selectedSegments.slice(startPage, endPage);
|
|
||||||
this.setState({
|
this.setState({
|
||||||
segments,
|
segments: selectedSegments,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -683,9 +682,9 @@ export class SegmentsView extends React.PureComponent<SegmentsViewProps, Segment
|
||||||
<ViewControlBar label="Segments">
|
<ViewControlBar label="Segments">
|
||||||
<RefreshButton
|
<RefreshButton
|
||||||
onRefresh={auto =>
|
onRefresh={auto =>
|
||||||
capabilities
|
capabilities.hasSql()
|
||||||
? this.segmentsNoSqlQueryManager.rerunLastQuery(auto)
|
? this.segmentsSqlQueryManager.rerunLastQuery(auto)
|
||||||
: this.segmentsSqlQueryManager.rerunLastQuery(auto)
|
: this.segmentsNoSqlQueryManager.rerunLastQuery(auto)
|
||||||
}
|
}
|
||||||
localStorageKey={LocalStorageKeys.SEGMENTS_REFRESH_RATE}
|
localStorageKey={LocalStorageKeys.SEGMENTS_REFRESH_RATE}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue