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
8c39cd35
Commit
8c39cd35
authored
Jan 11, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
progress on interval built in variable
parent
e2188373
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
14 deletions
+18
-14
public/app/core/components/query_part/query_part.ts
+1
-1
public/app/features/templating/specs/template_srv_specs.ts
+2
-2
public/app/features/templating/templateSrv.js
+4
-0
public/app/plugins/datasource/elasticsearch/query_builder.js
+1
-1
public/app/plugins/datasource/influxdb/influx_query.ts
+1
-1
public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts
+9
-9
No files found.
public/app/core/components/query_part/query_part.ts
View file @
8c39cd35
...
@@ -89,7 +89,7 @@ export function functionRenderer(part, innerExpr) {
...
@@ -89,7 +89,7 @@ export function functionRenderer(part, innerExpr) {
var
paramType
=
part
.
def
.
params
[
index
];
var
paramType
=
part
.
def
.
params
[
index
];
if
(
paramType
.
type
===
'time'
)
{
if
(
paramType
.
type
===
'time'
)
{
if
(
value
===
'auto'
)
{
if
(
value
===
'auto'
)
{
value
=
'$interval'
;
value
=
'$
__
interval'
;
}
}
}
}
if
(
paramType
.
quote
===
'single'
)
{
if
(
paramType
.
quote
===
'single'
)
{
...
...
public/app/features/templating/specs/template_srv_specs.ts
View file @
8c39cd35
...
@@ -245,8 +245,8 @@ describe('templateSrv', function() {
...
@@ -245,8 +245,8 @@ describe('templateSrv', function() {
initTemplateSrv
([]);
initTemplateSrv
([]);
});
});
it
(
'should replace $interval_ms with interval milliseconds'
,
function
()
{
it
(
'should replace $
__
interval_ms with interval milliseconds'
,
function
()
{
var
target
=
_templateSrv
.
replace
(
'10 * $
interval_ms'
,
{
"
interval_ms"
:
{
text
:
"100"
,
value
:
"100"
}});
var
target
=
_templateSrv
.
replace
(
'10 * $
__interval_ms'
,
{
"__
interval_ms"
:
{
text
:
"100"
,
value
:
"100"
}});
expect
(
target
).
to
.
be
(
'10 * 100'
);
expect
(
target
).
to
.
be
(
'10 * 100'
);
});
});
...
...
public/app/features/templating/templateSrv.js
View file @
8c39cd35
...
@@ -42,6 +42,10 @@ function (angular, _, kbn) {
...
@@ -42,6 +42,10 @@ function (angular, _, kbn) {
this
.
_index
[
variable
.
name
]
=
variable
;
this
.
_index
[
variable
.
name
]
=
variable
;
}
}
// default built ins
this
.
_index
[
'__interval'
]
=
{
text
:
'1s'
,
value
:
'1s'
};
this
.
_index
[
'__interval_ms'
]
=
{
text
:
'100'
,
value
:
'100'
};
};
};
this
.
variableInitialized
=
function
(
variable
)
{
this
.
variableInitialized
=
function
(
variable
)
{
...
...
public/app/plugins/datasource/elasticsearch/query_builder.js
View file @
8c39cd35
...
@@ -66,7 +66,7 @@ function (queryDef) {
...
@@ -66,7 +66,7 @@ function (queryDef) {
esAgg
.
format
=
"epoch_millis"
;
esAgg
.
format
=
"epoch_millis"
;
if
(
esAgg
.
interval
===
'auto'
)
{
if
(
esAgg
.
interval
===
'auto'
)
{
esAgg
.
interval
=
"$interval"
;
esAgg
.
interval
=
"$
__
interval"
;
}
}
if
(
settings
.
missing
)
{
if
(
settings
.
missing
)
{
...
...
public/app/plugins/datasource/influxdb/influx_query.ts
View file @
8c39cd35
...
@@ -23,7 +23,7 @@ export default class InfluxQuery {
...
@@ -23,7 +23,7 @@ export default class InfluxQuery {
target
.
resultFormat
=
target
.
resultFormat
||
'time_series'
;
target
.
resultFormat
=
target
.
resultFormat
||
'time_series'
;
target
.
tags
=
target
.
tags
||
[];
target
.
tags
=
target
.
tags
||
[];
target
.
groupBy
=
target
.
groupBy
||
[
target
.
groupBy
=
target
.
groupBy
||
[
{
type
:
'time'
,
params
:
[
'$interval'
]},
{
type
:
'time'
,
params
:
[
'$
__
interval'
]},
{
type
:
'fill'
,
params
:
[
'null'
]},
{
type
:
'fill'
,
params
:
[
'null'
]},
];
];
target
.
select
=
target
.
select
||
[[
target
.
select
=
target
.
select
||
[[
...
...
public/app/plugins/datasource/influxdb/specs/influx_query_specs.ts
View file @
8c39cd35
...
@@ -12,7 +12,7 @@ describe('InfluxQuery', function() {
...
@@ -12,7 +12,7 @@ describe('InfluxQuery', function() {
},
templateSrv
,
{});
},
templateSrv
,
{});
var
queryText
=
query
.
render
();
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($interval) fill(null)'
);
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE $timeFilter GROUP BY time($
__
interval) fill(null)'
);
});
});
});
});
...
@@ -24,7 +24,7 @@ describe('InfluxQuery', function() {
...
@@ -24,7 +24,7 @@ describe('InfluxQuery', function() {
},
templateSrv
,
{});
},
templateSrv
,
{});
var
queryText
=
query
.
render
();
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "5m_avg"."cpu" WHERE $timeFilter GROUP BY time($interval) fill(null)'
);
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "5m_avg"."cpu" WHERE $timeFilter GROUP BY time($
__
interval) fill(null)'
);
});
});
});
});
...
@@ -43,7 +43,7 @@ describe('InfluxQuery', function() {
...
@@ -43,7 +43,7 @@ describe('InfluxQuery', function() {
},
templateSrv
,
{});
},
templateSrv
,
{});
var
queryText
=
query
.
render
();
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($interval) fill(null)'
);
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") /100 AS "text" FROM "cpu" WHERE $timeFilter GROUP BY time($
__
interval) fill(null)'
);
});
});
});
});
...
@@ -58,7 +58,7 @@ describe('InfluxQuery', function() {
...
@@ -58,7 +58,7 @@ describe('InfluxQuery', function() {
var
queryText
=
query
.
render
();
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE "hostname" =
\'
server
\\\\
1
\'
AND $timeFilter'
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE "hostname" =
\'
server
\\\\
1
\'
AND $timeFilter'
+
' GROUP BY time($interval)'
);
+
' GROUP BY time($
__
interval)'
);
});
});
it
(
'should switch regex operator with tag value is regex'
,
function
()
{
it
(
'should switch regex operator with tag value is regex'
,
function
()
{
...
@@ -69,7 +69,7 @@ describe('InfluxQuery', function() {
...
@@ -69,7 +69,7 @@ describe('InfluxQuery', function() {
},
templateSrv
,
{});
},
templateSrv
,
{});
var
queryText
=
query
.
render
();
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE "app" =~ /e.*/ AND $timeFilter GROUP BY time($interval)'
);
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE "app" =~ /e.*/ AND $timeFilter GROUP BY time($
__
interval)'
);
});
});
});
});
...
@@ -83,7 +83,7 @@ describe('InfluxQuery', function() {
...
@@ -83,7 +83,7 @@ describe('InfluxQuery', function() {
var
queryText
=
query
.
render
();
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE "hostname" =
\'
server1
\'
AND "app" =
\'
email
\'
AND '
+
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE "hostname" =
\'
server1
\'
AND "app" =
\'
email
\'
AND '
+
'$timeFilter GROUP BY time($interval)'
);
'$timeFilter GROUP BY time($
__
interval)'
);
});
});
});
});
...
@@ -97,7 +97,7 @@ describe('InfluxQuery', function() {
...
@@ -97,7 +97,7 @@ describe('InfluxQuery', function() {
var
queryText
=
query
.
render
();
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE "hostname" =
\'
server1
\'
OR "hostname" =
\'
server2
\'
AND '
+
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE "hostname" =
\'
server1
\'
OR "hostname" =
\'
server2
\'
AND '
+
'$timeFilter GROUP BY time($interval)'
);
'$timeFilter GROUP BY time($
__
interval)'
);
});
});
});
});
...
@@ -124,7 +124,7 @@ describe('InfluxQuery', function() {
...
@@ -124,7 +124,7 @@ describe('InfluxQuery', function() {
var
queryText
=
query
.
render
();
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE $timeFilter '
+
expect
(
queryText
).
to
.
be
(
'SELECT mean("value") FROM "cpu" WHERE $timeFilter '
+
'GROUP BY time($interval), "host"'
);
'GROUP BY time($
__
interval), "host"'
);
});
});
});
});
...
@@ -148,7 +148,7 @@ describe('InfluxQuery', function() {
...
@@ -148,7 +148,7 @@ describe('InfluxQuery', function() {
groupBy
:
[{
type
:
'time'
},
{
type
:
'fill'
,
params
:
[
'0'
]}],
groupBy
:
[{
type
:
'time'
},
{
type
:
'fill'
,
params
:
[
'0'
]}],
},
templateSrv
,
{});
},
templateSrv
,
{});
var
queryText
=
query
.
render
();
var
queryText
=
query
.
render
();
expect
(
queryText
).
to
.
be
(
'SELECT "value" FROM "cpu" WHERE $timeFilter GROUP BY time($interval) fill(0)'
);
expect
(
queryText
).
to
.
be
(
'SELECT "value" FROM "cpu" WHERE $timeFilter GROUP BY time($
__
interval) fill(0)'
);
});
});
});
});
...
...
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