|
1 | 1 | import {
|
2 | 2 | EmbeddedScene,
|
3 | 3 | SceneFlexLayout,
|
4 |
| - SceneFlexItem, |
5 |
| - SceneQueryRunner, |
| 4 | + SceneFlexItem, |
6 | 5 | TextBoxVariable,
|
7 | 6 | VariableValueSelectors,
|
8 | 7 | SceneVariableSet,
|
9 |
| - SceneVariables, |
10 | 8 | } from '@grafana/scenes';
|
11 |
| -import { createRowQueries } from './Queries'; |
12 | 9 | import { ReplicasCell } from 'pages/Workloads/components/ReplicasCell';
|
13 | 10 | import { getSeriesValue } from 'common/seriesHelpers';
|
14 | 11 | import { buildExpandedRowScene } from './DeploymentExpandedRow';
|
15 | 12 | import { createNamespaceVariable } from 'common/variableHelpers';
|
16 |
| -import { Metrics } from 'metrics/metrics'; |
17 | 13 | import { TableRow } from './types';
|
18 |
| -import { AsyncTable, Column, ColumnSortingConfig, QueryBuilder } from 'components/AsyncTable'; |
| 14 | +import { AsyncTable, Column } from 'components/AsyncTable'; |
19 | 15 | import { SortingState } from 'common/sortingHelpers';
|
20 | 16 | import { prefixRoute } from 'utils/utils.routing';
|
21 | 17 | import { ROUTES } from '../../../../constants';
|
| 18 | +import { DeploymentQueryBuilder } from './Queries'; |
22 | 19 |
|
23 | 20 | const namespaceVariable = createNamespaceVariable();
|
24 | 21 |
|
@@ -83,39 +80,6 @@ function asyncRowMapper(row: TableRow, asyncRowData: any) {
|
83 | 80 | }
|
84 | 81 | }
|
85 | 82 |
|
86 |
| -class DeploymentQueryBuilder implements QueryBuilder<TableRow> { |
87 |
| - rootQueryBuilder(variables: SceneVariableSet | SceneVariables, sorting: SortingState, sortingConfig?: ColumnSortingConfig<TableRow>) { |
88 |
| - return new SceneQueryRunner({ |
89 |
| - datasource: { |
90 |
| - uid: '$datasource', |
91 |
| - type: 'prometheus', |
92 |
| - }, |
93 |
| - queries: [ |
94 |
| - { |
95 |
| - refId: 'deployments', |
96 |
| - expr: ` |
97 |
| - group( |
98 |
| - ${Metrics.kubeReplicasetOwner.name}{ |
99 |
| - cluster="$cluster", |
100 |
| - ${Metrics.kubeReplicasetOwner.labels.namespace}=~"$namespace", |
101 |
| - ${Metrics.kubeReplicasetOwner.labels.ownerName}=~".*$search.*", |
102 |
| - ${Metrics.kubeReplicasetOwner.labels.ownerKind}="Deployment" |
103 |
| - } |
104 |
| - ) by ( |
105 |
| - ${Metrics.kubeReplicasetOwner.labels.ownerName}, |
106 |
| - ${Metrics.kubeReplicasetOwner.labels.namespace} |
107 |
| - )`, |
108 |
| - instant: true, |
109 |
| - format: 'table' |
110 |
| - }, |
111 |
| - ], |
112 |
| - }) |
113 |
| - } |
114 |
| - rowQueryBuilder(rows: TableRow[], variables: SceneVariableSet | SceneVariables) { |
115 |
| - return createRowQueries(rows, variables) |
116 |
| - } |
117 |
| -} |
118 |
| - |
119 | 83 | function createRowId(row: TableRow) {
|
120 | 84 | return `${row.namespace}/${row.deployment}`
|
121 | 85 | }
|
|
0 commit comments