Skip to content

Commit

Permalink
better segment timeline init
Browse files Browse the repository at this point in the history
  • Loading branch information
vogievetsky committed Mar 4, 2025
1 parent 068e952 commit 91e1961
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions web-console/src/views/datasources-view/datasources-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {
compact,
countBy,
deepGet,
findMap,
formatBytes,
formatInteger,
formatMillions,
Expand Down Expand Up @@ -1709,7 +1710,7 @@ GROUP BY 1, 2`;
}

render() {
const { capabilities, goToSegments } = this.props;
const { capabilities, filters, goToSegments } = this.props;
const {
showUnused,
visibleColumns,
Expand Down Expand Up @@ -1737,7 +1738,16 @@ GROUP BY 1, 2`;
label="Show segment timeline"
onChange={() =>
this.setState({
showSegmentTimeline: showSegmentTimeline ? undefined : { capabilities },
showSegmentTimeline: showSegmentTimeline
? undefined
: {
capabilities,
datasource: findMap(filters, filter =>
filter.id === 'datasource' && /^=[^=|]+$/.exec(String(filter.value))
? filter.value.slice(1)
: undefined,
),
},
})
}
disabled={!capabilities.hasSqlOrCoordinatorAccess()}
Expand Down
14 changes: 12 additions & 2 deletions web-console/src/views/segments-view/segments-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
compact,
countBy,
filterMap,
findMap,
formatBytes,
formatInteger,
getApiArray,
Expand Down Expand Up @@ -1004,7 +1005,7 @@ export class SegmentsView extends React.PureComponent<SegmentsViewProps, Segment
}

render() {
const { capabilities, onFiltersChange } = this.props;
const { capabilities, filters, onFiltersChange } = this.props;
const {
segmentTableActionDialogId,
datasourceTableActionDialogId,
Expand Down Expand Up @@ -1047,7 +1048,16 @@ export class SegmentsView extends React.PureComponent<SegmentsViewProps, Segment
label="Show segment timeline"
onChange={() =>
this.setState({
showSegmentTimeline: showSegmentTimeline ? undefined : { capabilities },
showSegmentTimeline: showSegmentTimeline
? undefined
: {
capabilities,
datasource: findMap(filters, filter =>
filter.id === 'datasource' && /^=[^=|]+$/.exec(String(filter.value))
? filter.value.slice(1)
: undefined,
),
},
})
}
disabled={!capabilities.hasSqlOrCoordinatorAccess()}
Expand Down

0 comments on commit 91e1961

Please sign in to comment.