Will Browne
a8577c21ba
Plugins: Migrate PluginStore mock to pre-existing fakes package ( #71664 )
...
* migrate to existing fakes package
* fix imports
2023-07-17 10:21:44 +00:00
Eng Zer Jun
cf1945d0c3
Tests: use t.Setenv
to set env vars ( #69516 )
...
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.
Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-06-05 11:31:03 +02:00
Will Browne
94f39e69a3
Plugins: Migrate plugincontext
, adapters
and pluginsettings
to pkg/services/pluginsintegration package ( #64154 )
...
* migrate plugincontext, adapter and pluginsettings
* add to CODEOWNERS
* fix imports
* fix CODEOWNERS
* take pluginsettings
* migrate wire stuff
2023-03-07 11:22:30 -05:00
Serge Zaitsev
bc2813ef06
Chore: Fix goimports grouping in pkg/services ( #62420 )
...
* fix goimports
* fix goimports order
2023-01-30 08:21:27 +00:00
Kristin Laemmert
6e9eb0d931
chore: move plugins models into pluginsettings svc ( #61944 )
2023-01-23 13:56:20 -05:00
Alexander Zobnin
f1b5014efd
Preferences: Add pagination to org configuration page ( #60896 )
...
* Add auth labels and access control metadata to org users search results
* Fix search result JSON model
* Org users: Use API for pagination
* Fix default page size
* Refactor: UsersListPage to functional component
* Refactor: update UsersTable component code style
* Add pagination to the /orgs/{org_id}/users endpoint
* Use pagination on the AdminEditOrgPage
* Add /orgs/{org_id}/users/search endpoint to prevent breaking API
* Use existing search store method
* Remove unnecessary error
* Remove unused
* Add query param to search endpoint
* Fix endpoint docs
* Minor refactor
* Fix number of pages calculation
* Use SearchOrgUsers for all org users methods
* Refactor: GetOrgUsers as a service method
* Minor refactor: rename orgId => orgID
* Fix integration tests
* Fix tests
2023-01-09 11:54:33 +03:00
idafurjes
bb35f37b66
Chore: Delete org model duplicates ( #60940 )
...
* Delete org model duplicates
* Fix lint
* Move OrgDetailsDTO to org pkg
2023-01-04 16:20:26 +01:00
Serge Zaitsev
43f40e6c7c
Chore: Replace yaml.v2 with yaml.v3 ( #59897 )
...
* replace yaml.v2 with yaml.v3
* fix a few tests due to the yaml.v3 api changes
* and another goconvey mistake in tests
2022-12-06 21:17:17 +01:00
Kat Yang
7715672fb3
Chore: use org service methods ( #55768 )
...
* Chore: use org service methods
* fix tests
* fix errors
* adjust func signatures for getbyname
* 💩
* Use the same fake service to get the user in AC and in HS
* Fix middleware test
* Fix more middleware test
* Fix api tests
Co-authored-by: gamab <gabi.mabs@gmail.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
2022-10-04 14:48:02 -04:00
Torkel Ödegaard
e31cb93ec0
NavTree: Make it possible to configure where in nav tree plugins live ( #55484 )
...
* NewIA: Plugin nav config
* progress
* Progress
* Things are working
* Add monitoring node
* Add alerts and incidents
* added experiment with standalone page
* Refactoring by adding a type for navtree root
* First test working
* More tests
* more tests
* Progress on richer config and sorting
* Sort weight working
* Path config
* Improving logic for not including admin or cfg nodes, making it the last step so that enterprise can add admin nodes without having to worry about the section not existing
* fixed index routes
* removed file
* Fixes
* Fixing tests
* Fixing more tests and adding support for weight config
* Updates
* Remove unused fake
* More fixes
* Minor tweak
* Minor fix
* Can now control position using sortweight even when existing items have no sortweight
* Added tests for frontend standalone page logic
* more tests
* Remove unused fake and fixed lint issue
* Moving reading settings to navtree impl package
* remove nav_id setting prefix
* Remove old test file
* Fix trailing newline
* Fixed bug with adding nil node
* fixing lint issue
* remove some code we have to rethink
* move read settings to PrivideService and switch to util.SplitString
2022-09-28 08:29:35 +02:00
Will Browne
b25ea75bac
Plugins: Add secure JSON fields to plugin setting DTO ( #55313 )
...
* add secure JSON fields to plugin setting DTO
* add nil pointer fix
* adding secureJsonFields to the plugin meta.
Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2022-09-21 12:20:11 +02:00
Jo
ca72cd570e
Remove ioutil.ReadDir from usage ( #53550 )
...
* add depguard rule for ioutil
* replace ioutil.ReadDir with os.ReadDir
* use legacy option in depguard supported in golangci-lint v1.40
* replace ioutil.ReadDir with os.ReadDir
* return error for file info
2022-08-11 07:21:12 -04:00
Jo
062d255124
Handle ioutil deprecations ( #53526 )
...
* replace ioutil.ReadFile -> os.ReadFile
* replace ioutil.ReadAll -> io.ReadAll
* replace ioutil.TempFile -> os.CreateTemp
* replace ioutil.NopCloser -> io.NopCloser
* replace ioutil.WriteFile -> os.WriteFile
* replace ioutil.TempDir -> os.MkdirTemp
* replace ioutil.Discard -> io.Discard
2022-08-10 15:37:51 +02:00
Will Browne
bda3f860a8
Plugins: Add plugin settings DTO ( #46283 )
...
* add clearer service layer
* re-order frontend settings for clarity
* fix fetch fail
* fix API response
* fix mockstore
* in -> where
2022-03-18 20:49:13 +01:00
Will Browne
6a8cbd8663
Plugins: Plugin settings refactor ( #46246 )
...
* remove bus and direct use of sqlStore
* add decryption to interface
* return nil
* rename field
* re-order fields
* rename file
2022-03-04 17:09:50 +01:00
idafurjes
e7ea3be4bc
Resolve merge conflict lint error ( #46162 )
2022-03-03 08:13:26 -05:00
idafurjes
fa7323e6d5
Provisioning: Fix plugin provisioning storing SecureJsonData ( #46149 )
...
* Provisioning: Fix plugin provisioning storing SecureJsonData
* Fix tests and rename service to pluginSettings
2022-03-03 11:57:33 +01:00
Serge Zaitsev
a231c6861c
Chore: Remove bus.Dispatch from provisioning services ( #44989 )
...
* make getordbyname a method
* remove one dispatch from plugins provisioner
* remove bus from the plugins provisioner, skip test for now
* remove bus from datasource provisioning
* resolve tests in notifier provisioning
* remove bus from the dashboards provisioning service
* fix missing struct field
* fix getorgbyid method calls
* pass org store into dashboard provisioner
* fix test function prototype
* fix tests
* attempt to fix tests after the rebase
* fix integration test
* avoid using transaction
* remove comments
2022-02-23 11:12:37 +01:00
idafurjes
30aa24a183
Chore: Implement OpenTelemtry in Grafana ( #42674 )
...
* Separate Tracer interface to TracerService and Tracer
* Fix lint
* Fix:Make it possible to start spans for both opentracing and opentelemetry in ds proxy
* Add span methods, use span interface for rest of tracing
* Fix logs in tracing
* Fix tests that are related to tracing
* Fix resourcepermissions test
* Fix some tests
* Fix more tests
* Add TracingService to wire cli runner
* Remove GlobalTracer from bus
* Renaming test function
* Remove GlobalTracer from TSDB
* Replace GlobalTracer in api
* Adjust tests to the InitializeForTests func
* Remove GlobalTracer from services
* Remove GlobalTracer
* Remove bus.NewTest
* Remove Tracer interface
* Add InitializeForBus
* Simplify tests
* Clean up tests
* Rename TracerService to Tracer
* Update pkg/middleware/request_tracing.go
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
* Initialize tracer before passing it to SQLStore initialization in commands
* Remove tests for opentracing
* Set span attributes correctly, remove unnecessary trace initiliazation form test
* Add tracer instance to newSQLStore
* Fix changes due to rebase
* Add modified tracing middleware test
* Fix opentracing implementation tags
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2022-01-20 11:10:12 +01:00
idafurjes
8e6d6af744
Rename DispatchCtx to Dispatch ( #43563 )
2021-12-28 17:36:22 +01:00
idafurjes
7936c4c522
Rename AddHandlerCtx to AddHandler ( #43557 )
2021-12-28 16:08:07 +01:00
idafurjes
b8852ef6a3
Chore: Remove context.TODO() ( #43409 )
...
* Remove context.TODO() from services
* Fix live test
* Remove context.TODO
2021-12-22 11:02:42 +01:00
idafurjes
c80e7764d8
Chore: Remove Dispatch and AddHandler ( #42603 )
...
* Remove Dispatch
* Remove context.TODO()
* Remove AddHandler and Dispatch
2021-12-02 18:08:59 +01:00
idafurjes
e6123bc3ef
Replace AddHandler with AddHandlerCtx in tests ( #42585 )
2021-12-01 15:43:31 +01:00
Will Browne
2e3e7a7e55
Plugins: Plugin Store API returns DTO model ( #41340 )
...
* toying around
* fix refs
* remove unused fields
* go further
* add context
* ensure streaming handler is set
2021-11-17 12:04:22 +01:00
Will Browne
b80fbe03f0
Plugins: Refactor Plugin Management ( #40477 )
...
* add core plugin flow
* add instrumentation
* move func
* remove cruft
* support external backend plugins
* refactor + clean up
* remove comments
* refactor loader
* simplify core plugin path arg
* cleanup loggers
* move signature validator to plugins package
* fix sig packaging
* cleanup plugin model
* remove unnecessary plugin field
* add start+stop for pm
* fix failures
* add decommissioned state
* export fields just to get things flowing
* fix comments
* set static routes
* make image loading idempotent
* merge with backend plugin manager
* re-use funcs
* reorder imports + remove unnecessary interface
* add some TODOs + remove unused func
* remove unused instrumentation func
* simplify client usage
* remove import alias
* re-use backendplugin.Plugin interface
* re order funcs
* improve var name
* fix log statements
* refactor data model
* add logic for dupe check during loading
* cleanup state setting
* refactor loader
* cleanup manager interface
* add rendering flow
* refactor loading + init
* add renderer support
* fix renderer plugin
* reformat imports
* track errors
* fix plugin signature inheritance
* name param in interface
* update func comment
* fix func arg name
* introduce class concept
* remove func
* fix external plugin check
* apply changes from pm-experiment
* fix core plugins
* fix imports
* rename interface
* comment API interface
* add support for testdata plugin
* enable alerting + use correct core plugin contracts
* slim manager API
* fix param name
* fix filter
* support static routes
* fix rendering
* tidy rendering
* get tests compiling
* fix install+uninstall
* start finder test
* add finder test coverage
* start loader tests
* add test for core plugins
* load core + bundled test
* add test for nested plugin loading
* add test files
* clean interface + fix registering some core plugins
* refactoring
* reformat and create sub packages
* simplify core plugin init
* fix ctx cancel scenario
* migrate initializer
* remove Init() funcs
* add test starter
* new logger
* flesh out initializer tests
* refactoring
* remove unused svc
* refactor rendering flow
* fixup loader tests
* add enabled helper func
* fix logger name
* fix data fetchers
* fix case where plugin dir doesn't exist
* improve coverage + move dupe checking to loader
* remove noisy debug logs
* register core plugins automagically
* add support for renderer in catalog
* make private func + fix req validation
* use interface
* re-add check for renderer in catalog
* tidy up from moving to auto reg core plugins
* core plugin registrar
* guards
* copy over core plugins for test infra
* all tests green
* renames
* propagate new interfaces
* kill old manager
* get compiling
* tidy up
* update naming
* refactor manager test + cleanup
* add more cases to finder test
* migrate validator to field
* more coverage
* refactor dupe checking
* add test for plugin class
* add coverage for initializer
* split out rendering
* move
* fixup tests
* fix uss test
* fix frontend settings
* fix grafanads test
* add check when checking sig errors
* fix enabled map
* fixup
* allow manual setup of CM
* rename to cloud-monitoring
* remove TODO
* add installer interface for testing
* loader interface returns
* tests passing
* refactor + add more coverage
* support 'stackdriver'
* fix frontend settings loading
* improve naming based on package name
* small tidy
* refactor test
* fix renderer start
* make cloud-monitoring plugin ID clearer
* add plugin update test
* add integration tests
* don't break all if sig can't be calculated
* add root URL check test
* add more signature verification tests
* update DTO name
* update enabled plugins comment
* update comments
* fix linter
* revert fe naming change
* fix errors endpoint
* reset error code field name
* re-order test to help verify
* assert -> require
* pm check
* add missing entry + re-order
* re-check
* dump icon log
* verify manager contents first
* reformat
* apply PR feedback
* apply style changes
* fix one vs all loading err
* improve log output
* only start when no signature error
* move log
* rework plugin update check
* fix test
* fix multi loading from cfg.PluginSettings
* improve log output #2
* add error abstraction to capture errors without registering a plugin
* add debug log
* add unsigned warning
* e2e test attempt
* fix logger
* set home path
* prevent panic
* alternate
* ugh.. fix home path
* return renderer even if not started
* make renderer plugin managed
* add fallback renderer icon, update renderer badge + prevent changes when renderer is installed
* fix icon loading
* rollback renderer changes
* use correct field
* remove unneccessary block
* remove newline
* remove unused func
* fix bundled plugins base + module fields
* remove unused field since refactor
* add authorizer abstraction
* loader only returns plugins expected to run
* fix multi log output
2021-11-01 10:53:33 +01:00
Arve Knudsen
a2eda798e7
PluginManager: Make remaining plugin state non-global ( #32094 )
...
* PluginDashboards: Use plugin manager interface
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* PluginManager: Make panels non-global
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* PluginManager: Make apps non-global
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* PluginManager: Make static routes non-global
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* PluginManager: Make pluginTypes non-global
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-03-18 13:53:01 +01:00
Arve Knudsen
87c3a2b790
PluginManager: Make Plugins, Renderer and DataSources non-global ( #31866 )
...
* PluginManager: Make Plugins and DataSources non-global
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix integration tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Replace outdated command
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* DashboardService: Ensure it gets constructed with necessary parameters
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix build
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* DashboardService: Ensure it gets constructed with necessary parameters
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove dead code
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove FocusConvey
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Remove dead code
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Undo interface changes
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Backend: Move tsdbifaces.RequestHandler to plugins.DataRequestHandler
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Rename to DataSourceCount
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Consolidate dashboard interfaces into one
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix test
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Fix dashboard integration tests
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-03-17 16:06:10 +01:00
Arve Knudsen
b79e61656a
Introduce TSDB service ( #31520 )
...
* Introduce TSDB service
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
2021-03-08 07:02:49 +01:00
Arve Knudsen
f326b79cc1
Security: Add gosec G304 auditing annotations ( #29578 )
...
* Security: Add gosec G304 auditing annotations
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* Add gosec annotations
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* Add gosec annotations
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* add G304 auditing comment
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* Add gosec annotations
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* space
Signed-off-by: bergquist <carl.bergquist@gmail.com>
* Add gosec annotations
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: bergquist <carl.bergquist@gmail.com>
2020-12-03 22:13:06 +01:00
Arve Knudsen
9593d57914
Chore: Enable errorlint linter ( #29227 )
...
* Enable errorlint linter
* Handle wrapped errors
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2020-11-19 14:47:17 +01:00
Alexander Zobnin
4f9123ebe2
Provisioning: always pin app to the sidebar when enabled ( #29084 )
2020-11-17 09:45:40 +03:00
Marcus Efraimsson
cc95754e0d
Provisioning: Adds support for enabling app plugins ( #25649 )
...
Adds support for enabling app plugins using provisioning.
Ref #11409
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2020-06-22 17:49:13 +02:00