Commit Graph

676 Commits

Author SHA1 Message Date
David Kaltschmidt
d5196ab322 remove internal influx ifql datasource 2018-06-14 20:42:33 +01:00
bergquist
171a38df99 alerting: fixes broken table rename 2018-06-05 14:29:48 +02:00
David
45a156577c
Merge pull request #12143 from grafana/davkal/ifql-datasource
InfluxDB IFQL datasource (beta)
2018-06-05 14:23:21 +02:00
bergquist
7333d7b8d4 alerting: invert sendOnce to sendReminder 2018-06-05 10:44:17 +02:00
bergquist
0e647db485 Merge branch 'master' into alerting_reminder
* master: (30 commits)
  changelog: add notes about closing #11882
  renamed variable in tests
  added comment, variableChange -> variableValueChange
  added a test
  added if to check if new variable has been added
  Gravatar fallback does not respect 'AppSubUrl'-setting (#12149)
  change admin password after first login
  changelog: adds note about closing #11958
  revert: reverted singlestat panel position change PR #12004
  Revert "provisioning: turn relative symlinked path into absolut paths"
  provisioning: turn relative symlinked path into absolut paths
  changelog: adds note about closing #11670
  elasticsearch: sort bucket keys to fix issue wth response parser tests
  docs: what's new in v5.2
  changelog: add notes about closing #11167
  docs: docker secrets support. (#12141)
  alerting: show alerts for user with Viewer role
  datasource: added option no-direct-access to ds-http-settings diretive, closes #12138
  provisioning: adds fallback if evalsymlink/abs fails
  tests: uses different paths depending on os
  ...
2018-06-04 17:44:18 +02:00
Carl Bergquist
49d9235433
Merge pull request #12122 from grafana/provisioning_ha
Support provisioning in HA setup where modtime differs
2018-06-04 15:12:46 +02:00
John Baublitz
bdf433594a Implement code review changes 2018-06-04 13:19:14 +02:00
John Baublitz
fca97535d1 Fix multiple bugs 2018-06-04 13:19:14 +02:00
John Baublitz
3cb0e27e1c Revert changes post code review and move them to notification page 2018-06-04 13:19:14 +02:00
John Baublitz
e068be4c26 Feature for repeated alerting in grafana 2018-06-04 13:19:13 +02:00
David Kaltschmidt
08ee1da6b1 InfluxDB IFQL datasource 2018-06-04 12:24:47 +02:00
Patrick O'Carroll
0c269d64d0 Alert panel filters (#11712)
alert list panel: filter alerts by name, dashboard, folder, tags
2018-06-01 14:36:40 +02:00
bergquist
c817aecd66 provisioning: only update dashboard if hash of json changed 2018-05-31 21:05:52 +02:00
Marcus Efraimsson
fbc44025dc
add usage stats for datasource access mode 2018-05-25 16:06:35 +02:00
Marcus Efraimsson
2ea5b6fe33
add additional usage stats metrics
nr of folders
nr of folder permissions
nr of dashboard permissions
nr of snapshots
nr of teams
nr of provisioned dashboards
2018-05-25 14:33:37 +02:00
Dan Cech
417db13efb Fix dashboard snapshot deletion (#12025)
* fix issue deleting dashboard snapshots by deleteKey, add dedicated endopoint for authenticated requests, update frontend, tests & docs.
2018-05-24 08:55:16 +02:00
Torkel Ödegaard
e5e8b9800c merge: fixed conflicts in discord PR 2018-05-07 15:40:43 +02:00
Marcus Efraimsson
770acee56a
new property for current user indicating if edit permissions in folders 2018-04-30 15:34:31 +02:00
Karsten Weiss
b7adf28501 Remove redundancy in variable declarations (golint)
This commit fixes the following golint warnings:
pkg/api/avatar/avatar.go:229:12: should omit type *http.Client from declaration of var client; it will be inferred from the right-hand side
pkg/login/brute_force_login_protection.go:13:26: should omit type time.Duration from declaration of var loginAttemptsWindow; it will be inferred from the right-hand side
pkg/metrics/graphitebridge/graphite.go:58:26: should omit type []string from declaration of var metricCategoryPrefix; it will be inferred from the right-hand side
pkg/metrics/graphitebridge/graphite.go:69:22: should omit type []string from declaration of var trimMetricPrefix; it will be inferred from the right-hand side
pkg/models/alert.go:37:36: should omit type error from declaration of var ErrCannotChangeStateOnPausedAlert; it will be inferred from the right-hand side
pkg/models/alert.go:38:36: should omit type error from declaration of var ErrRequiresNewState; it will be inferred from the right-hand side
pkg/models/datasource.go:61:28: should omit type map[string]bool from declaration of var knownDatasourcePlugins; it will be inferred from the right-hand side
pkg/plugins/update_checker.go:16:13: should omit type http.Client from declaration of var httpClient; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:103:24: should omit type time.Duration from declaration of var unfinishedWorkTimeout; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:105:19: should omit type time.Duration from declaration of var alertTimeout; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:106:19: should omit type int from declaration of var alertMaxAttempts; it will be inferred from the right-hand side
pkg/services/alerting/notifier.go:143:23: should omit type map[string]*NotifierPlugin from declaration of var notifierFactories; it will be inferred from the right-hand side
pkg/services/alerting/rule.go:136:24: should omit type map[string]ConditionFactory from declaration of var conditionFactories; it will be inferred from the right-hand side
pkg/services/alerting/conditions/evaluator.go:12:15: should omit type []string from declaration of var defaultTypes; it will be inferred from the right-hand side
pkg/services/alerting/conditions/evaluator.go:13:15: should omit type []string from declaration of var rangedTypes; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/opsgenie.go:44:19: should omit type string from declaration of var opsgenieAlertURL; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/pagerduty.go:43:23: should omit type string from declaration of var pagerdutyEventApiUrl; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/telegram.go:21:17: should omit type string from declaration of var telegramApiUrl; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:11:24: should omit type string from declaration of var simpleDashboardConfig; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:12:24: should omit type string from declaration of var oldVersion; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:13:24: should omit type string from declaration of var brokenConfigs; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/file_reader.go:22:30: should omit type time.Duration from declaration of var checkDiskForChangesInterval; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/file_reader.go:24:23: should omit type error from declaration of var ErrFolderNameMissing; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:15:34: should omit type string from declaration of var twoDatasourcesConfig; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:16:34: should omit type string from declaration of var twoDatasourcesConfigPurgeOthers; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:17:34: should omit type string from declaration of var doubleDatasourcesConfig; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:18:34: should omit type string from declaration of var allProperties; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:19:34: should omit type string from declaration of var versionZero; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:20:34: should omit type string from declaration of var brokenYaml; it will be inferred from the right-hand side
pkg/services/sqlstore/stats.go:16:25: should omit type time.Duration from declaration of var activeUserTimeLimit; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/mysql_dialect.go:69:14: should omit type bool from declaration of var hasLen1; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/mysql_dialect.go:70:14: should omit type bool from declaration of var hasLen2; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/postgres_dialect.go:95:14: should omit type bool from declaration of var hasLen1; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/postgres_dialect.go:96:14: should omit type bool from declaration of var hasLen2; it will be inferred from the right-hand side
pkg/setting/setting.go:42:15: should omit type string from declaration of var Env; it will be inferred from the right-hand side
pkg/setting/setting.go:161:18: should omit type bool from declaration of var LdapAllowSignup; it will be inferred from the right-hand side
pkg/setting/setting.go:473:30: should omit type bool from declaration of var skipStaticRootValidation; it will be inferred from the right-hand side
pkg/tsdb/interval.go:14:21: should omit type time.Duration from declaration of var defaultMinInterval; it will be inferred from the right-hand side
pkg/tsdb/interval.go:15:21: should omit type time.Duration from declaration of var year; it will be inferred from the right-hand side
pkg/tsdb/interval.go:16:21: should omit type time.Duration from declaration of var day; it will be inferred from the right-hand side
pkg/tsdb/cloudwatch/credentials.go:26:24: should omit type map[string]cache from declaration of var awsCredentialCache; it will be inferred from the right-hand side
pkg/tsdb/influxdb/query.go:15:27: should omit type *regexp.Regexp from declaration of var regexpOperatorPattern; it will be inferred from the right-hand side
pkg/tsdb/influxdb/query.go:16:27: should omit type *regexp.Regexp from declaration of var regexpMeasurementPattern; it will be inferred from the right-hand side
pkg/tsdb/mssql/mssql_test.go:25:14: should omit type string from declaration of var serverIP; it will be inferred from the right-hand side
2018-04-27 22:14:36 +02:00
Marcus Efraimsson
d86ed679b1
return inherited property for permissions 2018-04-23 09:23:14 +02:00
bergquist
c22495b6f8 Merge branch 'master' into external-auth
* master:
  changelog: adds note about closing #11613 and #11602
  fix: sign in link should have target self to trigger full page reload, fixes #11626
  codespell: exclude by words instead of files
  Use sort.Strings() (gosimple)
  Remove unused return value assignment (gosimple)
  Remove unnecessary fmt.Sprintf() calls (gosimple)
  Merge variable declaration with assignment (gosimple)
  Use fmt.Errorf() (gosimple)
  Simplify make() (gosimple)
  Use raw strings to avoid double escapes (gosimple)
  Simplify if expression (gosimple)
  Simplify comparison to bool constant (gosimple)
  Simplify error returns (gosimple)
  Remove redundant break statements (gosimple)
2018-04-18 09:34:45 +02:00
Carl Bergquist
8367199a2d
Merge pull request #11613 from knweiss/gosimple
Code simplification (gosimple)
2018-04-17 22:40:40 +02:00
Dan Cech
e53e039b1b
restructure GetUserByAuthInfo 2018-04-17 14:06:25 -04:00
Dan Cech
65847da1df
use Result in GetAuthInfoQuery 2018-04-17 14:06:25 -04:00
Dan Cech
d837be91ec
switch to passing ReqContext as a property 2018-04-17 14:06:25 -04:00
Dan Cech
a1b1d2fe80
switch to Result 2018-04-17 14:06:25 -04:00
Dan Cech
23f163e8cf
fixes 2018-04-17 14:06:25 -04:00
Dan Cech
1c5afa731f
shared library for managing external user accounts 2018-04-17 14:06:25 -04:00
Marcus Efraimsson
d7688241c6
Merge branch 'master' into readonly_dashboards 2018-04-17 16:27:51 +02:00
Daniel Lee
26bb22bffa
Merge pull request #11554 from grafana/11553_viewer_general_access
User with org viewer role permission fixes
2018-04-17 13:50:45 +02:00
Marcus Efraimsson
8a5cb088d3
Merge branch 'master' into readonly_dashboards 2018-04-17 10:50:04 +02:00
Marcus Efraimsson
92768d5a2b
Merge branch 'master' into dashboard-acl-ux2 2018-04-17 09:19:36 +02:00
Marcus Efraimsson
bc8353ae14
Merge branch 'master' into dashboard-acl-ux2 2018-04-16 21:19:01 +02:00
Karsten Weiss
4d6386e97b Use fmt.Errorf() (gosimple)
This fixes:
pkg/cmd/grafana-cli/commands/install_command.go:36:11: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...)) (S1028)
pkg/models/org_user.go:53:11: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...)) (S1028)
pkg/services/notifications/mailer.go:138:16: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...)) (S1028)
2018-04-16 21:04:57 +02:00
Karsten Weiss
f61e69ce75 Simplify comparison to bool constant (gosimple)
This fixes:
build.go:553:6: should omit comparison to bool constant, can be simplified to !strings.Contains(path, ".sha256") (S1002)
pkg/cmd/grafana-cli/commands/ls_command.go:27:5: should omit comparison to bool constant, can be simplified to !pluginDirInfo.IsDir() (S1002)
pkg/components/dynmap/dynmap_test.go:24:5: should omit comparison to bool constant, can be simplified to !value (S1002)
pkg/components/dynmap/dynmap_test.go:122:14: should omit comparison to bool constant, can be simplified to b (S1002)
pkg/components/dynmap/dynmap_test.go:125:14: should omit comparison to bool constant, can be simplified to !b (S1002)
pkg/components/dynmap/dynmap_test.go:128:14: should omit comparison to bool constant, can be simplified to !b (S1002)
pkg/models/org_user.go:51:5: should omit comparison to bool constant, can be simplified to !(*r).IsValid() (S1002)
pkg/plugins/datasource/wrapper/datasource_plugin_wrapper_test.go:77:12: should omit comparison to bool constant, can be simplified to !haveBool (S1002)
pkg/services/alerting/conditions/evaluator.go:23:9: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/conditions/evaluator.go:48:5: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/conditions/evaluator.go:91:5: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/conditions/query.go:56:6: should omit comparison to bool constant, can be simplified to !reducedValue.Valid (S1002)
pkg/services/alerting/extractor.go:107:20: should omit comparison to bool constant, can be simplified to !enabled.MustBool() (S1002)
pkg/services/alerting/notifiers/telegram.go:222:41: should omit comparison to bool constant, can be simplified to this.UploadImage (S1002)
pkg/services/sqlstore/apikey.go:58:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/apikey.go:72:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/dashboard.go:66:33: should omit comparison to bool constant, can be simplified to !cmd.Overwrite (S1002)
pkg/services/sqlstore/dashboard.go:175:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/dashboard.go:311:13: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/dashboard.go:444:12: should omit comparison to bool constant, can be simplified to !exists (S1002)
pkg/services/sqlstore/dashboard.go:472:12: should omit comparison to bool constant, can be simplified to !exists (S1002)
pkg/services/sqlstore/dashboard.go:554:32: should omit comparison to bool constant, can be simplified to !cmd.Overwrite (S1002)
pkg/services/sqlstore/dashboard_snapshot.go:83:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/plugin_setting.go:39:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:34:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:111:6: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:136:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/quota.go:213:6: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/temp_user.go:129:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:157:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:182:5: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:191:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:212:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/services/sqlstore/user.go:307:12: should omit comparison to bool constant, can be simplified to !has (S1002)
pkg/social/generic_oauth.go:185:5: should omit comparison to bool constant, can be simplified to !s.extractToken(&data, token) (S1002)
pkg/tsdb/mssql/mssql.go:148:39: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/mssql/mssql.go:212:6: should omit comparison to bool constant, can be simplified to !query.Model.Get("fillNull").MustBool(false) (S1002)
pkg/tsdb/mssql/mssql.go:247:56: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/mssql/mssql.go:274:7: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/mssql/mssql.go:282:8: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/mysql/mysql.go:221:6: should omit comparison to bool constant, can be simplified to !query.Model.Get("fillNull").MustBool(false) (S1002)
pkg/tsdb/mysql/mysql.go:256:56: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/mysql/mysql.go:283:7: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/mysql/mysql.go:291:8: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/postgres/postgres.go:134:39: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/postgres/postgres.go:201:6: should omit comparison to bool constant, can be simplified to !query.Model.Get("fillNull").MustBool(false) (S1002)
pkg/tsdb/postgres/postgres.go:236:56: should omit comparison to bool constant, can be simplified to ok (S1002)
pkg/tsdb/postgres/postgres.go:263:7: should omit comparison to bool constant, can be simplified to !exist (S1002)
pkg/tsdb/postgres/postgres.go:271:8: should omit comparison to bool constant, can be simplified to !exist (S1002)
2018-04-16 21:04:57 +02:00
Mario Trangoni
ce941a004d fix unconvert issues 2018-04-16 20:04:58 +02:00
Mario Trangoni
91fb2e07ce pkg: fix codespell issues 2018-04-13 20:31:29 +02:00
Marcus Efraimsson
4f44376564
remove comment/unused variable 2018-04-13 17:11:52 +02:00
Marcus Efraimsson
b4863002c9
permission: fix user with org viewer save/move permissions
User with org viewer role should not be able to save/move dashboards
in/to general folder.
2018-04-11 00:23:50 +02:00
bergquist
949484b949 provisioning: simplify db query
the GetProvisionedDashboardQuery wasent used for anything
else than check if a dashboard is provisioned or not. So
we simplified this query to make it more maintainable.
2018-04-10 12:30:37 +02:00
bergquist
7845eab502 provisioning: fixes typo 2018-04-10 09:32:05 +02:00
Andrzej Ressel
30f048965c Merge branch 'master' into feature/discord 2018-04-08 20:09:56 +02:00
Marcus Efraimsson
6bbeb723ca Merge branch 'master' into readonly_dashboards 2018-04-05 20:30:27 +02:00
Daniel Lee
32264c61c4 Merge branch 'master' into dashboard-acl-ux2 2018-03-29 11:32:24 +02:00
bergquist
5596707531 alert: fixes broken link back to grafana
If Grafana was configured to use a subpath it
was included twice in the link from the
alert notification back to Grafana.

closes #11403
2018-03-27 20:26:51 +02:00
bergquist
627df67992 dashboards: reject updates of provisioned dashboards 2018-03-27 15:12:47 +02:00
bergquist
d6faa3d06f provisioning: improve UX when saving provisioned dashboards 2018-03-26 15:08:46 +02:00
Marcus Efraimsson
d4beee2bb0 Merge branch 'master' into mssql_datasource 2018-03-13 16:03:02 +01:00
Dan Cech
c0ecdee375
rename Context to ReqContext 2018-03-07 11:54:50 -05:00
Dan Cech
338655dd37
move Context and session out of middleware 2018-03-06 18:16:49 -05:00
Marcus Efraimsson
f44e476580 permissions: fix validation of permissions before update
Did a bad pointer comparison so extended the tests for duplicate permissions.
2018-02-28 08:48:28 +01:00
Daniel Lee
3b836c9c5f
Merge pull request #10996 from grafana/snapshot_permissions
Snapshot fixes and changes to snapshot list
2018-02-23 09:17:59 +01:00
Daniel Lee
fe49182b9d snapshots: fixes cleanup of old snapshots
Snapshot cleanup did not work due to time.Now syntax error. Added test
for it as well to catch any future errors.

Added error and debug logging so that it is possible to see any errors in the future.

Removed an unused configuration value and deprecated the remove expired snapshots
setting.
2018-02-22 16:12:16 +01:00
Marcus Efraimsson
3f588b4c48 dashboards: created/updated and createdby/updatedby should be set before save
If creating a new folder/dashboard created/updated and createdby/updatedby should always be set.
If updating an existing folder/dashboard updated and updatedby should always be set.
2018-02-22 11:54:28 +01:00
Daniel Lee
7d9a9fa29c snapshots: change to snapshot list query
Admins can see all snapshots. Other roles can only see their own
snapshots.

Added permission check for deleting snapshots - admins can delete
any snapshot, other roles can delete their own snapshots or
snapshots that they have access to via dashboard permissions.
2018-02-21 13:39:08 +01:00
Marcus Efraimsson
3c6bc263dc Merge branch 'master' into 10630_folder_api 2018-02-21 11:25:56 +01:00
Marcus Efraimsson
a167e19b37 folders: folder api tests 2018-02-21 11:24:54 +01:00
Torkel Ödegaard
3964d6b797 fix: added new known data source plugins, and minor migration fix for v1 dashboards 2018-02-20 16:08:43 +01:00
Marcus Efraimsson
892bdecb19 folders: folder permission api routes 2018-02-20 15:25:16 +01:00
Marcus Efraimsson
268fb4dc6c folders: new folder service for managing folders 2018-02-20 13:56:22 +01:00
Marcus Efraimsson
fce1e3f7f1 Merge branch 'master' into 10630_folder_api 2018-02-19 13:32:45 +01:00
Marcus Efraimsson
53cd39fde5 Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900)
* dashboards: new command for validating dashboard before update

Removes validation logic from saveDashboard and later on use the new command for validating
dashboard before saving a dashboard. This due to the fact that we need to validate permissions
for overwriting other dashboards by uid and title.

* dashboards: use the new command for validating dashboard before saving

Had to refactor dashboard provisioning a bit to be able to sidetrack the permission validation
in a somewhat reasonable way.
Adds some initial tests of the dashboard repository, but needs to be extended later. At least
now you can mock the dashboard guardian

* dashboards: removes validation logic in the save dashboard api layer

Use the dashboard repository solely for create/update dashboards and let it do all
the validation. One exception regarding quota validation which still is in api layer
since that logic is in a macaron middleware.
Need to move out-commented api tests later.

* dashboards: fix database tests for validate and saving dashboards

* dashboards: rename dashboard repository to dashboard service

Split the old dashboard repository interface in two new interfaces, IDashboardService and
IDashboardProvisioningService. Makes it more explicit when using it from the provisioning package
and there's no possibility of calling an incorrect method for saving a dashboard.

* database: make the InitTestDB function available to use from other packages

* dashboards: rename ValidateDashboardForUpdateCommand and some refactoring

* dashboards: integration tests of dashboard service

* dashboard: fix sqlstore test due to folder exist validation

* dashboards: move dashboard service integration tests to sqlstore package

Had to move it to the sqlstore package due to concurrency problems when running
against mysql and postgres. Using InitTestDB from two packages added conflicts
when clearing and running migrations on the test database

* dashboards: refactor how to find id to be used for save permission check

* dashboards: remove duplicated dashboard tests

* dashboards: cleanup dashboard service integration tests

* dashboards: handle save dashboard errors and return correct http status

* fix: remove log statement

* dashboards: import dashboard should use dashboard service

Had to move alerting commands to models package due to problems with import cycles of packages.

* dashboards: cleanup dashboard api tests and add some tests for post dashboard

* dashboards: rename dashboard service interfaces

* dashboards: rename dashboard guardian interface
2018-02-19 11:12:56 +01:00
Leonard Gram
0053be9882 login: uses epochs for login throtting.
Closes #10937
2018-02-16 17:25:46 +01:00
Torkel Ödegaard
5323971c21
refactoring: alert rule query refactoring (#10941) 2018-02-16 13:56:04 +01:00
Daniel Lee
b9d572bdec teams: adds some validation to the API 2018-02-16 11:46:20 +01:00
Leonard Gram
fa1b92a12b
provisioning: uses unix epoch timestamps. (#10907)
* provisioning: uses unix epoch timestamps.
2018-02-14 15:28:30 +01:00
Torkel Ödegaard
fcaa8227a6
Dashboard acl query fixes (#10909)
* initial fixes for dashboard permission acl list query, fixes #10864

* permissions: refactoring of acl api and query
2018-02-14 15:04:26 +01:00
Torkel Ödegaard
73eaba076e wip: dashboard acl ux2, #10747 2018-02-14 15:03:22 +01:00
Torkel Ödegaard
ec6f0f94b8 permissions: refactoring of acl api and query 2018-02-14 14:31:20 +01:00
Torkel Ödegaard
8dd4d505ee Merge branch 'dashboard-search-permissions-filter' 2018-02-14 10:48:55 +01:00
Marcus Efraimsson
cb8c82f7f6 Merge branch 'master' into 10630_folder_api 2018-02-12 15:14:41 +01:00
Leonard Gram
9a7eb5c327 Merge branch 'master' into provisioning 2018-02-12 14:19:20 +01:00
Marcus Efraimsson
e1e0b5f951 teams: use orgId in all team and team member operations (#10862)
Also fixes issue in org users tests for postgres
2018-02-09 17:26:15 +01:00
bergquist
59cd2d5102 provisioning: avoid caching and use updated field from db 2018-02-09 15:23:38 +01:00
Torkel Ödegaard
e949eb3f58 Merge branch 'master' into dashboard-search-permissions-filter 2018-02-09 15:16:34 +01:00
Marcus Efraimsson
a86f2fa34b user picker should only include users from current org (#10845) 2018-02-09 10:42:37 +01:00
Torkel Ödegaard
8e8f3c4332 dashboard and folder search with permissions 2018-02-08 17:11:01 +01:00
Leonard Gram
5a85fb6d32 Merge branch 'master' into provisioning 2018-02-08 13:43:19 +01:00
Marcus Efraimsson
0e8377a9f4 Update logic for create/update dashboard, validation and plugin dashboard links (#10809)
* enables overwrite if dashboard allready exist in folder

* dashboard: Don't allow creating a folder named General

* dashboards: update logic for save/update dashboard

No id and uid creates a new dashboard/folder.
No id and uid, with an existing title in folder allows overwrite
  of dashboard.
Id without uid, allows update of existing dashboard/folder without
  overwrite.
Uid without id allows update of existing dashboard/folder without
  overwrite.
Id without uid, with an existing title in folder allows overwrite
  of dashboard/folder and updated will have the uid of overwritten.
Uid without id, with an existing title in folder allows overwrite
  of dashboard/folder and new will have the same uid as provided.
Trying to change an existing folder to a dashboard yields error.
Trying to change an existing dashboard to a folder yields error.

* dashboards: include folder id when confirmed to save with overwrite

* dashboards: fixes due to new url structure

Return importedUrl property in response to importing dashboards and
getting plugin dashboards and use this for redirects/links in the
frontend.
2018-02-08 12:48:38 +01:00
Leonard Gram
b549d29319 Merge branch 'master' into provisioning 2018-02-08 11:01:09 +01:00
Daniel Lee
2d1bd270fb Stale permissions (#10768)
* dashfolders: hide permissions in settings if folder has changed

and the dashboard has not been saved yet. Otherwise the use will
see stale permissions from the original folder.

* dashfolders: return folder url for inherited permissions
2018-02-05 14:28:24 +01:00
Carl Bergquist
cc0cc8dd73 changes to new urlformat for home dashboard (#10738) 2018-02-05 10:24:48 +01:00
Marcus Efraimsson
04a9a650e7 folders: changes and updated tests after merging permissions and new url structure 2018-02-01 22:07:27 +01:00
Marcus Efraimsson
b07ac3c054 Merge branch '7883_new_url_structure' into 10630_folder_api 2018-02-01 18:29:00 +01:00
bergquist
fcd86fb24f make it easier for dashboards to generate ur; 2018-02-01 14:08:51 +01:00
bergquist
992fd37010 alert: use new url format 2018-02-01 14:08:51 +01:00
Marcus Efraimsson
ef90b3e49c Merge branch '7883_new_url_structure' into 7883_frontend_step2 2018-02-01 11:08:39 +01:00
Marcus Efraimsson
b135df9a6c Merge remote-tracking branch 'upstream/master' into 7883_new_url_structure 2018-02-01 10:48:06 +01:00
Carl Bergquist
eff687bece
Merge pull request #10694 from grafana/7883_backend
backend for new url structure.
2018-02-01 09:35:00 +01:00
Marcus Efraimsson
90933b0621 dashboard: refactor logic for retrieving url for folder/dashboard 2018-01-31 23:14:48 +01:00
Marcus Efraimsson
b23560ed5a dashboards: add validation to delete dashboard by slug
Validates that there are only one folder/dashboard having that slug,
otherwise returns 412 Precondition Failed
2018-01-31 18:40:54 +01:00
bergquist
58cfb23625 retry uid generation 2018-01-31 17:29:17 +01:00
bergquist
7e96052594 ensure dashboard title is unique in folder 2018-01-31 14:18:54 +01:00
bergquist
bb3183f6cd removes uniqnes check on slug when saving dashboards 2018-01-31 10:29:52 +01:00
Daniel Lee
eb765d288c alertlist: disable pause button when user does not have permission 2018-01-30 23:35:27 +01:00
Marcus Efraimsson
fd59241e35 dashboards: revert adding api for retrieving uid by slug
Since we're already have possibility to get a dashboard by slug
it makes little sense to have a separate endpoint in api for
retrieving uid by slug.
#7883
2018-01-30 23:18:34 +01:00
Marcus Efraimsson
4829ea0e9f util: remove retry logic in shortid_generator
Use shortid.MustGenerate() instead of shortid.Generate(). Instead
of returning errors it will panic.
2018-01-30 23:18:34 +01:00
Marcus Efraimsson
9fb7b887db dashboards: add url property to dashboard meta and search api responses
#7883
2018-01-30 23:18:34 +01:00
Marcus Efraimsson
7ee691dc48 dashboards: api for retrieving uid by slug. #7883 2018-01-30 23:18:34 +01:00
Marcus Efraimsson
13d5db7d19 dashboards: add support for retrieving a dashboard by uid
Introduces new url in api /dashboards/<uid> for fetching dashboard by unique id
Leave the old dashboard by slug url /dashboards/db/<slug> for backward
compatibility and for supporting fallback
WIP for #7883
2018-01-30 23:18:34 +01:00