Commit Graph

317 Commits

Author SHA1 Message Date
Sven Klemm
265d5daf57 Merge branch 'master' into postgres-query-builder 2018-08-31 19:02:46 +02:00
Patrick O'Carroll
abbb6f933c added jsdoc-format rule and fixed files that didn't follow new rule (#13107) 2018-08-31 16:40:43 +02:00
Sven Klemm
d5cdeebf23 reset metric column when changing table 2018-08-30 15:46:57 +02:00
Sven Klemm
1cac061448 fix timeFilter resetting when changing table 2018-08-30 15:39:01 +02:00
Marcus Efraimsson
5ceaa21e3b
when changing table, refresh panel once after columns have been changed 2018-08-30 15:11:54 +02:00
Sven Klemm
a06a6b6517 fix timecolumn handling when table changes 2018-08-30 14:25:27 +02:00
Sven Klemm
015909dbff set default for timeGroup in query builder to $__interval 2018-08-30 14:16:42 +02:00
Sven Klemm
483f6cc5e1 when changing table reset columns 2018-08-30 14:11:53 +02:00
Sven Klemm
be978d1a8f fix metric column suggestions 2018-08-30 14:09:47 +02:00
Sven Klemm
e2c3b6c6c5 fix suggestions for metric column 2018-08-30 13:05:16 +02:00
Sven Klemm
aadff18e94 hide Query Builder button for table panels 2018-08-29 18:38:18 +02:00
Sven Klemm
a87b27c7d3 check for correct quoting of multiple singlequotes 2018-08-29 16:50:59 +02:00
Sven Klemm
70daa56a31 Merge branch 'master' into postgres-query-builder 2018-08-29 14:44:23 +02:00
Patrick O'Carroll
a702603e7b changed var to const 2 (#13068)
* changed var to const

* fixed typo created in last commit

* added or empty object to options in prometheus/datasource
2018-08-29 14:27:29 +02:00
Sven Klemm
1ee91a637f remove min time interval from datasource config 2018-08-29 13:02:25 +02:00
Sven Klemm
0b74ff5cf1 remove unneeded queryOptions 2018-08-29 12:51:58 +02:00
Sven Klemm
7a5b5906ed fix quoting 2018-08-29 12:24:28 +02:00
Sven Klemm
bfac6303d0 strip quotes when auto adding alias 2018-08-29 12:16:07 +02:00
Sven Klemm
ab4fbff454 handle quoting properly for table suggestion 2018-08-29 12:12:11 +02:00
Sven Klemm
e9ab4feeb0 link to github instead 2018-08-29 09:58:08 +02:00
Sven Klemm
955e5afa45 recheck timecolumn when changing table 2018-08-29 09:51:01 +02:00
Sven Klemm
84ec1ce624 update filter macro on time column change 2018-08-29 09:04:33 +02:00
Sven Klemm
30fce34d9c make default mode for table panels raw editor 2018-08-28 12:10:55 +02:00
Sven Klemm
62d82920e6 improve description for timescaledb option 2018-08-27 23:20:17 +02:00
Sven Klemm
7177f19436 Merge branch 'master' into postgres-query-builder 2018-08-27 11:23:55 +02:00
Sven Klemm
da8696ed95 fix handling of variable interpolation for IN expresions 2018-08-26 22:43:03 +02:00
Torkel Ödegaard
9b978b7203
tslint: autofix of let -> const (#13033) 2018-08-26 17:14:40 +02:00
Sven Klemm
21e7b0b92d add min interval to postgres datasource 2018-08-25 18:14:39 +02:00
Sven Klemm
02c5d36c0b fix tableSegment and timeColumnSegment after table suggestion 2018-08-21 20:12:45 +02:00
Sven Klemm
e04127e430 unify quoting 2018-08-18 16:09:12 +02:00
Sven Klemm
49319fbdea prefill editor with first metric table 2018-08-18 13:21:08 +02:00
Sven Klemm
ff2564900f only allow 1 filter macro in where clause 2018-08-18 12:34:19 +02:00
Sven Klemm
c1890dbb6d fix timeColumnType assignment 2018-08-18 12:28:05 +02:00
Sven Klemm
9699d7a166 make suggested filter macro depend on type 2018-08-18 12:11:10 +02:00
Sven Klemm
18ce6fc280 use unixEpochGroup macro for unix timestamp 2018-08-18 12:04:32 +02:00
Sven Klemm
998bb6ebe3 Merge branch 'master' into postgres-query-builder 2018-08-18 11:54:39 +02:00
Marcus Efraimsson
313a8bd033
Merge pull request #12891 from svenklemm/unixepochgroup
add $__unixEpochGroup and $__unixEpochGroupAlias to sql datasources
2018-08-17 14:41:33 +02:00
Sven Klemm
8e4db8cc3a suggest operators depending on datatype 2018-08-17 10:38:23 +02:00
Sven Klemm
28f97a2450 update persisted parts on param change 2018-08-16 13:23:38 +02:00
Sven Klemm
e84a1cbcc5 persist datatype information 2018-08-16 12:50:32 +02:00
Sven Klemm
8ced29a0e7 Don't do value suggestions for numeric and timestamp 2018-08-16 11:48:36 +02:00
Sven Klemm
735c4abe6c rename postgres_query.jest.ts to .test.ts 2018-08-15 12:06:32 +02:00
Sven Klemm
907e8fd77c fix variable escaping 2018-08-15 11:37:30 +02:00
Sven Klemm
a2f4441f9d autodetect timescaledb when version >= 9.6 2018-08-15 10:42:15 +02:00
Sven Klemm
2d12801186 detect postgres version for saved datasources 2018-08-15 09:48:06 +02:00
Sven Klemm
2606f6e715 use pointer cursor for buttons in query editor 2018-08-15 09:21:17 +02:00
Sven Klemm
6d8ad3b076 require postgres 9.4+ for ordered set aggregate functions 2018-08-14 15:49:37 +02:00
Sven Klemm
9d022766ee add postgres version to datasource config 2018-08-14 15:45:55 +02:00
Sven Klemm
c90eb45cef only show first/last aggregate when timescaledb is enabled 2018-08-14 15:29:29 +02:00
Sven Klemm
e12d07dd68 keep jsonData in PostgresDatasource 2018-08-14 15:27:58 +02:00
Sven Klemm
5b3b0295e8 Merge branch 'master' into postgres-query-builder 2018-08-14 15:10:16 +02:00
Marcus Efraimsson
660530a3a6
Merge pull request #12914 from dehrax/12224-final
Karma to Jest: rename and cleanup
2018-08-14 12:55:23 +02:00
Sven Klemm
15c8ef6c95 Merge branch 'master' into postgres-query-builder 2018-08-14 12:51:03 +02:00
Tobias Skarhed
a65589a5fb Rename test files 2018-08-14 10:52:41 +02:00
Sven Klemm
bfe28ee061 Add $__unixEpochGroup macro to postgres datasource 2018-08-13 12:08:14 +02:00
Sven Klemm
c9bbdf244c get timecolumn datatype on timecolumn change 2018-08-13 11:29:35 +02:00
Sven Klemm
1dd8192d51 fix datatype query 2018-08-13 09:57:46 +02:00
Sven Klemm
a4a33d80db mention time_bucket in timescaledb tooltip 2018-08-09 17:30:46 +02:00
Sven Klemm
c3aad10047 change timescaledb to checkbox instead of select 2018-08-09 10:05:35 +02:00
Sven Klemm
b987aee7cf add timescaledb option to postgres datasource
This adds an option to the postgres datasource config for
timescaledb support. When set to auto it will check for
timescaledb when testing the datasource.

When this option is enabled the $__timeGroup macro will
use the time_bucket function from timescaledb to group
times by an interval.

This also passes the datasource edit control to testDatasource
to allow for setting additional settings, this might be useful
for other datasources aswell which have optional or version
dependant features which can be queried.
2018-08-09 10:05:35 +02:00
Sven Klemm
13d0fa4b9a add previous fill mode to query builder 2018-08-08 12:23:41 +02:00
Sven Klemm
3b6454ab88 Merge branch 'master' into postgres-query-builder 2018-08-08 12:09:17 +02:00
Sven Klemm
52c7edf2f4 rename last fillmode to previous 2018-08-07 21:11:51 +02:00
Sven Klemm
6d07d825e9 dont break default parameters for functions 2018-08-03 18:38:40 +02:00
Sven Klemm
e4ae8be9fa fix suggestion query 2018-08-03 14:09:41 +02:00
Sven Klemm
aa830211fe dont order for aggregate 2018-08-03 10:15:28 +02:00
Sven Klemm
dabfd88cd9 add moving average to query builder 2018-08-03 07:44:36 +02:00
Sven Klemm
0b57e88f9e adjust frontend test 2018-08-03 06:19:53 +02:00
Sven Klemm
2cae966e6c use $__timeGroupAlias macro 2018-08-02 21:40:15 +02:00
Sven Klemm
bfc66a7ed0 add fillmode "last" to sql datasource
This adds a new fill mode last (last observation carried forward) for grafana
to the sql datasources. This fill mode will fill in the last seen value in a
series when a timepoint is missing or NULL if no value for that series has
been seen yet.
2018-08-02 20:35:09 +02:00
Sven Klemm
67edb9e9fe Merge remote-tracking branch 'upstream/master' into postgres-query-builder 2018-08-02 16:39:27 +02:00
Marcus Efraimsson
5cca478656
Merge pull request #12760 from svenklemm/postgres-timegroup
remove alias from postgres $__timeGroup macro

add $__timeGroupAlias macro to all sql datasources
2018-08-02 16:36:01 +02:00
Sven Klemm
7e9c9199c1 add warning when switching from raw sql mode 2018-08-02 10:15:53 +02:00
Sven Klemm
a221d9ec84 add more prominent button for switching edit mode 2018-08-02 09:50:21 +02:00
Sven Klemm
82c473e3af document $__timeGroupAlias 2018-08-01 21:23:00 +02:00
Brice Maron
bb7e583863 fix custom variable quoting in sql* query interpolations 2018-08-01 20:32:50 +02:00
Sven Klemm
43295f9c18 remove alias from postgres $__timeGroup macro 2018-08-01 08:50:19 +02:00
Sven Klemm
6613f11499 Merge remote-tracking branch 'upstream/master' into postgres-query-builder 2018-07-30 15:23:56 +02:00
Sven Klemm
ace999b13f rename special to windows 2018-07-29 15:56:22 +02:00
Sven Klemm
26ea88252b add first and last support 2018-07-29 15:00:13 +02:00
Sven Klemm
412bb6acab refactor function handling in query builder 2018-07-29 13:31:50 +02:00
Sven Klemm
5327580939 refactor column function handling 2018-07-28 21:41:23 +02:00
Sven Klemm
6ca7a03975 consistent nameing fro group and select 2018-07-28 12:53:36 +02:00
Sven Klemm
7905c29875 adjust metric prefix code to sql engine refactor 2018-07-27 15:34:04 +02:00
Sven Klemm
ad26a319c5 refactor schema query generation 2018-07-27 14:02:12 +02:00
Sven Klemm
97f24733f5 remove tableschema from query builder ui 2018-07-27 10:58:08 +02:00
Sven Klemm
b3ebc86093 fix window function query without group by 2018-07-23 07:52:42 +02:00
Sven Klemm
e1a37cf275 add order by to metadata queries 2018-07-22 17:12:30 +02:00
Sven Klemm
7af9cd7dfc set explicit order for rate and increase 2018-07-22 15:20:40 +02:00
Sven Klemm
84d7743939 fix pre gui queries shortcircuit 2018-07-21 10:38:34 +02:00
Sven Klemm
9f0b4e0aa7 add groupby when adding first aggregate 2018-07-18 13:29:47 +02:00
Sven Klemm
0e608a08c2 fix test for query generation 2018-07-15 22:58:25 +02:00
Sven Klemm
7f348f3836 dont run queries if target has no table set 2018-07-15 22:27:33 +02:00
Sven Klemm
43686616a0 add query to find metric table 2018-07-15 22:26:32 +02:00
Sven Klemm
b49d10104e add popover for metric column 2018-07-15 19:13:19 +02:00
Sven Klemm
b28bf1a4f9 rename PostgresQueryBuilder to PostgresMetaQuery 2018-07-15 17:12:03 +02:00
Sven Klemm
070b556fd3 dont expand variables in rawSql 2018-07-15 17:02:26 +02:00
Sven Klemm
2fcb09b23d filter datatype for groupby suggestions 2018-07-15 16:23:47 +02:00
Sven Klemm
6e824e81bf fix rate special function when using group by 2018-07-15 15:14:12 +02:00
Sven Klemm
c3c20ef2e2 remove unused import 2018-07-15 12:52:00 +02:00
Sven Klemm
f85c9c012e refactor adding sqlPart 2018-07-15 12:26:22 +02:00
Sven Klemm
f48060a1bb remove render code from sql_part 2018-07-15 09:53:22 +02:00
Sven Klemm
d9648f1fe7 fix bug in query generation with metricColumn 2018-07-15 09:43:38 +02:00
Sven Klemm
fa66645b0f refactor PostgresQuery 2018-07-15 09:36:49 +02:00
Sven Klemm
844beb660d refactor PostgresQueryCtrl 2018-07-14 21:00:06 +02:00
Sven Klemm
d7ed706e12 refactor PostgresQueryCtrl and PostgresQuery 2018-07-14 20:28:34 +02:00
Sven Klemm
2dc9d4e960 refactor addGroupBy and removeGroupByPart 2018-07-14 16:46:53 +02:00
Sven Klemm
569a8567f9 use let for variable declaration 2018-07-14 11:32:00 +02:00
Sven Klemm
d0c2b19c51 Add templateSrv to PostgresQuery tests 2018-07-14 11:05:35 +02:00
Sven Klemm
b745fab190 add tests for query generation 2018-07-13 22:29:10 +02:00
Sven Klemm
17591ca29f fix tests for postgres datasource 2018-07-13 10:15:55 +02:00
Sven Klemm
693efda4d5 send timerange with metricFindQuery 2018-07-13 09:31:39 +02:00
Sven Klemm
bf21f1bf76 indent generated SQL 2018-07-12 22:36:41 +02:00
Sven Klemm
a24a6624e3 handle counter overflow and resets in rate 2018-07-12 13:15:19 +02:00
Sven Klemm
0935526d23 partition by metricColumn when using increase 2018-07-12 10:13:21 +02:00
Sven Klemm
bbe7b9b908 add rate and increase special functions 2018-07-12 09:57:04 +02:00
Sven Klemm
2784a2df6b Refactor value column SQL generation 2018-07-11 13:03:06 +02:00
Sven Klemm
9ba42f63f1 Refactor metric column sql generation 2018-07-11 12:33:37 +02:00
Sven Klemm
a86e77fc68 Refactor group by query generation 2018-07-11 12:20:24 +02:00
Sven Klemm
b9edc3c611 Refactor where clause generation 2018-07-11 11:50:02 +02:00
Sven Klemm
5dd236bf05 refactor SQL generation for value columns 2018-07-11 11:09:28 +02:00
Sven Klemm
772825ed09 Refactor time column sql generation 2018-07-11 11:00:12 +02:00
Sven Klemm
c5bde0ef45 Refactor render function on PostgresQuery 2018-07-11 10:50:49 +02:00
Sven Klemm
1d711924bc Merge remote-tracking branch 'upstream/master' into postgres-query-builder 2018-07-11 10:21:13 +02:00
Sven Klemm
c8a11d597f prepare sql part for special functions 2018-07-10 21:43:57 +02:00
Sven Klemm
0e610cad1b set query gui as default handle old panels gracefully 2018-07-10 21:40:59 +02:00
Sven Klemm
9d5b4cb91d dont throw exception for unknown types 2018-07-10 14:45:36 +02:00
Sven Klemm
e8e24f6139 add alias when adding group by 2018-07-10 11:32:23 +02:00
Sven Klemm
6e7161f238 add aggregates when adding group by 2018-07-10 11:14:00 +02:00
Sven Klemm
dc93055a10 add column alias when add aggregate function 2018-07-10 10:19:30 +02:00
Sven Klemm
5b5dcabd22 add None to metric column suggestions 2018-07-07 21:21:11 +02:00
Sven Klemm
8490ae41b6 handle pre query gui queries gracefully 2018-07-07 20:41:24 +02:00
Sven Klemm
eb170e741b dont break on panels that dont have rawQuery set 2018-07-07 19:59:25 +02:00
Sven Klemm
b2b4860bdb refactor transformToSegments 2018-07-07 19:43:21 +02:00
Sven Klemm
e4b4b3a772 rename quoteLiteral to quoteIdentAsLiteral 2018-07-06 12:38:43 +02:00
Sven Klemm
a63298bca2 remove unused function removeSelect 2018-07-06 11:25:20 +02:00
Sven Klemm
6143924ec6 fix where clause generation 2018-07-06 10:56:47 +02:00
Sven Klemm
7600c6efcb remove hardcoded $__timeFilter, make macros functional in where clause 2018-07-06 10:38:52 +02:00
Sven Klemm
85ab1cfa8f fix constraint removal 2018-07-06 09:28:34 +02:00
Sven Klemm
d8c7756489 dont autoquote, suggest quoted values if requried 2018-07-05 21:36:39 +02:00
Sven Klemm
3f614e635b do not autoquote identifiers 2018-07-05 11:27:19 +02:00
Sven Klemm
c604651092 fix group by ui 2018-07-05 10:19:22 +02:00
Sven Klemm
3595436614 fix where constraint handling 2018-07-04 18:57:55 +02:00
Sven Klemm
7d30ca04de remove dead code from sql_part
fix where clause query generation
2018-07-04 15:37:06 +02:00
Tobias Skarhed
74bf80962d Add mock to test files 2018-07-04 14:32:22 +02:00
Tobias Skarhed
962340bcd1 Create new instance in beforeEach 2018-07-04 14:32:22 +02:00
Tobias Skarhed
3bbe39c5ad Karma to Jest: postgres datasource 2018-07-04 14:30:36 +02:00
Sven Klemm
fee36b2b35 include where constraints in query generation 2018-07-04 12:22:45 +02:00
Sven Klemm
ced0a5828f rearrange elements of query builder 2018-07-04 11:56:26 +02:00
Sven Klemm
9847c2186f mv query_part to sql_part 2018-07-04 11:39:58 +02:00