Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
80030413
Commit
80030413
authored
Sep 03, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: everything seems to be working again
parent
8272dc87
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
60 deletions
+41
-60
public/app/features/explore/utils/ResultProcessor.ts
+41
-58
public/app/plugins/datasource/prometheus/datasource.ts
+0
-2
No files found.
public/app/features/explore/utils/ResultProcessor.ts
View file @
80030413
import
{
TableData
,
LogsModel
,
TimeSeries
,
GraphSeriesXY
,
DataFram
e
}
from
'@grafana/data'
;
import
{
LogsModel
,
GraphSeriesXY
,
DataFrame
,
FieldTyp
e
}
from
'@grafana/data'
;
import
{
ExploreItemState
,
ExploreMode
}
from
'app/types/explore'
;
import
{
ExploreItemState
,
ExploreMode
}
from
'app/types/explore'
;
import
TableModel
,
{
mergeTablesIntoModel
}
from
'app/core/table_model'
;
import
TableModel
,
{
mergeTablesIntoModel
}
from
'app/core/table_model'
;
...
@@ -33,13 +33,46 @@ export class ResultProcessor {
...
@@ -33,13 +33,46 @@ export class ResultProcessor {
return
new
TableModel
();
return
new
TableModel
();
}
}
return
new
TableModel
();
// For now ignore time series
// const tables = this.panelData.series.map(frame => {
// We can change this later, just need to figure out how to
// });
// Ignore time series only for prometheus
// const prevTableResults: any[] | TableModel = this.state.tableResult || [];
const
onlyTables
=
this
.
dataFrames
.
filter
(
frame
=>
{
// const tablesToMerge = this.replacePreviousResults ? this.tables : [].concat(prevTableResults, this.tables);
if
(
frame
.
fields
.
length
===
2
)
{
//
if
(
frame
.
fields
[
1
].
type
===
FieldType
.
time
)
{
// return mergeTablesIntoModel(new TableModel(), ...tablesToMerge);
return
false
;
}
}
return
true
;
});
const
tables
=
onlyTables
.
map
(
frame
=>
{
const
{
fields
}
=
frame
;
const
fieldCount
=
fields
.
length
;
const
rowCount
=
fields
[
0
].
values
.
length
;
const
columns
=
fields
.
map
(
field
=>
({
text
:
field
.
name
,
type
:
field
.
type
,
filterable
:
field
.
config
.
filterable
,
}));
const
rows
:
any
[][]
=
[];
for
(
let
i
=
0
;
i
<
rowCount
;
i
++
)
{
const
row
:
any
[]
=
[];
for
(
let
j
=
0
;
j
<
fieldCount
;
j
++
)
{
row
.
push
(
frame
.
fields
[
j
].
values
.
get
(
i
));
}
rows
.
push
(
row
);
}
return
new
TableModel
({
columns
,
rows
,
meta
:
frame
.
meta
,
});
});
return
mergeTablesIntoModel
(
new
TableModel
(),
...
tables
);
}
}
getLogsResult
():
LogsModel
{
getLogsResult
():
LogsModel
{
...
@@ -79,54 +112,4 @@ export class ResultProcessor {
...
@@ -79,54 +112,4 @@ export class ResultProcessor {
return
{
...
sortedNewResults
,
rows
,
series
};
return
{
...
sortedNewResults
,
rows
,
series
};
}
}
// private isSameGraphSeries = (a: GraphSeriesXY, b: GraphSeriesXY) => {
// if (a.hasOwnProperty('label') && b.hasOwnProperty('label')) {
// const aValue = a.label;
// const bValue = b.label;
// if (aValue !== undefined && bValue !== undefined && aValue === bValue) {
// return true;
// }
// }
//
// return false;
// };
//
// private mergeGraphResults = (newResults: GraphSeriesXY[], prevResults: GraphSeriesXY[]): GraphSeriesXY[] => {
// if (!prevResults || prevResults.length === 0 || this.replacePreviousResults) {
// return newResults; // Hack before we use GraphSeriesXY instead
// }
//
// const results: GraphSeriesXY[] = prevResults.slice() as GraphSeriesXY[];
//
// // update existing results
// for (let index = 0; index < results.length; index++) {
// const prevResult = results[index];
// for (const newResult of newResults) {
// const isSame = this.isSameGraphSeries(prevResult, newResult);
//
// if (isSame) {
// prevResult.data = prevResult.data.concat(newResult.data);
// break;
// }
// }
// }
//
// // add new results
// for (const newResult of newResults) {
// let isNew = true;
// for (const prevResult of results) {
// const isSame = this.isSameGraphSeries(prevResult, newResult);
// if (isSame) {
// isNew = false;
// break;
// }
// }
//
// if (isNew) {
// results.push(newResult);
// }
// }
// return results;
// };
}
}
public/app/plugins/datasource/prometheus/datasource.ts
View file @
80030413
...
@@ -181,8 +181,6 @@ export class PrometheusDatasource extends DataSourceApi<PromQuery, PromOptions>
...
@@ -181,8 +181,6 @@ export class PrometheusDatasource extends DataSourceApi<PromQuery, PromOptions>
activeTargets
:
PromQuery
[],
activeTargets
:
PromQuery
[],
end
:
number
end
:
number
)
=>
{
)
=>
{
const
lastTimeSeriesQuery
=
queries
.
filter
(
query
=>
!
query
.
instant
).
pop
();
for
(
let
index
=
0
;
index
<
queries
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
queries
.
length
;
index
++
)
{
const
query
=
queries
[
index
];
const
query
=
queries
[
index
];
const
target
=
activeTargets
[
index
];
const
target
=
activeTargets
[
index
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment