Commit Graph

149 Commits

Author SHA1 Message Date
linoman
13f4382214
Auth: Implement requester interface in access control module (#74289)
* Implement requester interface in the access control module
2023-09-06 11:16:10 +02:00
Ryan McKinley
025b2f3011
Chore: use any rather than interface{} (#74066) 2023-08-30 18:46:47 +03:00
linoman
1b8e9b51b2
Replace signed in user for identity.requester (#74048)
* Make identity.Requester available at Context

* Clean pkg/services/guardian/guardian.go

* Clean guardian provider and guardian AC

* Clean pkg/api/team.go

* Clean ctxhandler, datasources, plugin and live

* Clean dashboards and guardian

* Implement NewUserDisplayDTOFromRequester

* Change status code numbers for http constants

* Upgrade signature of ngalert services

* log parsing errors instead of throwing error
2023-08-30 16:51:18 +02:00
Jo
a307582212
Revert "Replace signed in user for identity.requester (#73750)" (#73962)
This reverts commit 9b9c9e83dc.
2023-08-28 21:05:59 +02:00
linoman
9b9c9e83dc
Replace signed in user for identity.requester (#73750)
* Make identity.Requester available at Context

* Clean pkg/services/guardian/guardian.go

* Clean guardian provider and guardian AC

* Clean pkg/api/team.go

* Clean ctxhandler, datasources, plugin and live

* Question: what to do with the UserDisplayDTO?

* Clean dashboards and guardian

* Remove identity.Requester from ReqContext

* Implement NewUserDisplayDTOFromRequester

* Fix tests

* Change status code numbers for http constants

* Upgrade signature of ngalert services

* log parsing errors instead of throwing error

* Fix tests and add logs

* linting
2023-08-28 12:04:36 -05:00
Karl Persson
31df4db1d3
Dashboards+Folder: remove unused function MakeUserAdmin (#73635)
* Dashboards+Folder: remove unused function MakeUserAdmin

* Remove dead branch
2023-08-23 12:54:06 +02:00
Marcus Efraimsson
040b7d2571
Chore: Add errutils helpers (#73577)
Add helpers for the errutil package in favor of errutil.NewBase.
2023-08-22 12:52:24 +02:00
Sofia Papagiannaki
1869da1d86
Nested folders: Fetch multiple folders from dashboard folder store (#72464) 2023-08-01 11:04:44 +03:00
Serge Zaitsev
7767ab6f43
Chore: Add folder data migration, fix unique index (#72602)
* add folder data migration, fix unique index

* fix unique index

* pass a fake store in tests

* pass store into other providers in tests

* and now with alerting!
2023-08-01 09:36:37 +02:00
Sofia Papagiannaki
1f742fcf93
Guardian: Split dashboard and folder guardian implementation (#69722)
* Split dashboard and folder guardian implementations

* Replace guardian constructors

* Simplify tests

* Add tests

* Apply suggestion from code review

Differentiate errors for dashboard and folders

* Remove tests for general folder

* Add tests for general scope
2023-07-25 15:31:12 +03:00
Arati R
20ffbbc41e
NestedFolders: Add library panels counting and deletion to folder registry (#69149)
* Expose library element service's folder service
* Register library panels, add count implementation
* Expand folder counts test
* Update registry deletion method interface
* Allow getting library elements from any folder
* Add test for library panel deletion
* Add test for library panel counting
2023-07-25 13:05:53 +02:00
Ieva
a65cb4d808
RBAC: remove simple RBAC disabled checks (#71137)
* remove simple RBAC disabled checks

* fixing tests

* remove old AC tests
2023-07-10 15:14:21 +03:00
Sofia Papagiannaki
22147c6230
NestedFolders: Do not perform guardian checks for subfolders (#69769)
Nested folders: Do not perform guardian checks for subfolders

Permissions are inherited so if the parent has access then
the subfolder has access too
2023-07-07 21:26:01 +03:00
Andreas Deininger
95b1f3c875
Fixing typos (#70487) 2023-06-22 09:43:38 +01:00
Arati R
6cb1a5e368
Nested folders: Add alert rule counts and deletion to folder registry (#67259)
* Let alert rule service implement registry service
* Add count method to RuleStore interface
* Add implementation for deletion of alert rules
* Rename uid to folderUID in registry methods
* Check forceDeleteRule value for registry deletion
* Register alerting store with folder service
* Move folder test functions to separate package
* Add testing for alert rule counting, deletion
* Remove redundant count method
* Fix deleteChildrenInFolder signature
* Update pkg/services/ngalert/store/alert_rule.go
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* Add tests for nested folder deletion
* Refactor TestIntegrationNestedFolderService
* Add rules store as parameter for alertng provider

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-06-02 16:38:02 +02:00
Eng Zer Jun
7f7b03d794
Chore: Avoid unnecessary byte/string conversions (#69001)
Avoid unnecessary byte/string conversion

We can use alternative functions/methods to avoid unnecessary
byte/string conversion calls.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-05-26 10:08:50 +00:00
Sofia Papagiannaki
14fb4ff779
API: Add deprecation notice for updating folder UID (#68543)
* API: Add deprecation notice for updating folder UID
2023-05-16 18:28:18 +03:00
Sofia Papagiannaki
d458292b66
Nested folders: Allow renaming a folder multiple times (#68379)
Return folder version in response that is required for updating
the entry in the dashboard table.
2023-05-16 16:41:14 +03:00
Sofia Papagiannaki
d883404f50
Nested folders: Fix missing URL from folder responses (#68082)
* Nested folders: Set URL in folder responses always

* Apply suggestions from code review

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
2023-05-10 16:20:16 +03:00
Ieva
e51b92991d
Folders: return an error when listing folders if permission guardian returns an error (#68109)
return an error when listing folders if perm gaurdian returns an error
2023-05-10 14:05:53 +01:00
Arati R
a5206a1cda
Nested folders: Provide count of all descendant dashboards and folders (#67184)
* Add a method for getting descendant folders
* Include dashboard count for descendant folders
* Return subfolder count
* Replace references to children with descendants
* Update openapi specs
* Add test for descendant counts
* Add logging to GetDescendantCounts
2023-04-27 17:00:09 +02:00
Sofia Papagiannaki
893bf08dcf
Nested folders: Fix API response ordering when fetching subfolders (#67258)
* Nested folders: Fix ordering when getting subfolders

* Update endpoint swagger description

* Modify test
2023-04-27 17:24:47 +03:00
Eric Leijonmarck
b93f26f29d
RBAC: Update TestIntegrationFolderService remove RBAC setting (#67052)
* remove the RBAC configuration setting

* add back tests
2023-04-25 11:10:00 +01:00
Sofia Papagiannaki
7dbcd5ecd0
NestedFolders: Return full folder hierarchy in Folder response (#66835)
* Delete redundant struct

* Include parent folders in DTO

* Add test

* Update swagger
2023-04-25 11:22:20 +03:00
Arati R
fd434cab58
NestedFolders: Add API endpoint for descendant count in a folder (#66550)
* Add CountInFolder to RegistryService interface
* Add folder children counts api route
* Update fake GetFolderChildrenCounts
* Add test for getting folder children counts
* Add validation to folder children counts handler
* Update openapi specs
* Update pkg/services/folder/folderimpl/folder.go
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-04-24 15:57:28 +02:00
Sofia Papagiannaki
24696d593b
Nested folders: Fix error response codes (#66943)
* Nested folders: Fix error response codes

Fix error handling
2023-04-20 17:47:51 +03:00
Arati R
cab3ba519a
NestedFolders: Add folder service registry with dashboard service implementation (#65033)
* Delete folders, dashboards with registry service
Co-authored-by: Serge Zaitsev <hello@zserge.com>
* Update signature of ProvideDashboardServiceImpl
* Regenerate mockery file
* Add test for DeleteInFolder
* Add test for DeleteDashboardsInFolder
* Delete child dashboard associations via registry
* Add validation of folder uid and org id

---------

Co-authored-by: Serge Zaitsev <hello@zserge.com>
2023-04-14 11:17:23 +02:00
Sofia Papagiannaki
a270188f0c
Nested folders: Fix moving folder under root (#65684)
* Nested folders: Fix moving folder under root

* Add store test for not empty parent after update

* Modify folder and document store update implementation

Move folder only if NewParentUID is not nil

* Apply suggestion from code review
2023-04-03 21:24:36 +03:00
Sofia Papagiannaki
c65cd5833a
Nested folders: Fix move (#65526)
* Nested Folders: Fix move response

Fix JSON tags to be consistent with the GET endpoint

* Add API test for moving to root folder

* Allow move to root folder

* Fix failure message

* Update OpenAPI specification
2023-03-30 11:46:11 +03:00
Ieva
7860ca6c3d
RBAC: protect folder creation and moving (#64636)
* protect moving folders to a subfolder and creating folders in a subfolder

* folder update endpoint isn't used for folder parent update

* lint

* move permission check logic to services, fix tests

* linting
2023-03-20 11:04:22 +00:00
Sofia Papagiannaki
4ee0be6fdf
Chore: Add function for detecting if the SQL driver supported CTEs (#64441)
* Add interface method for detecting if the SQL driver supported CTEs

* Update nested folder store to call RecursiveQueriesAreSupported()
2023-03-20 10:27:08 +02:00
ying-jeanne
6974f4340b
NestedFolders: Fix nested folder deletion (#63572)
---------

Co-authored-by: suntala <arati.rana@grafana.com>
Co-authored-by: ying-jeanne <ying-jeanne@users.noreply.github.com>
Co-authored-by: jeanne0731 <jeanne0731@users.noreply.github.com>
2023-03-15 09:51:37 +01:00
Ieva
a52999a886
Access Control: revert to using folder store from the scope resolvers (#64132)
* revert to using folder store from the resolvers

* fixing tests after revert

* api test fixes

---------

Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2023-03-03 10:56:33 -05:00
Kristin Laemmert
bb798e24f3
chore(services): replace dependencies on dashboard store with dashboard service (#63937)
* chore(services): replace dependencies on dashboard store with dashboard service

This continues the backend service/store split by replacing dashboard store dependencies with service dependencies. the folder service remains the single exception for now; otherwise we'd have a dependency cycle between the folder and dashboard services. I have some ideas for that, but I'll take care of all the easy parts first.

While doing this, I identified and removed a number of unused arguments from the following functions:

NewFolderNameScopeResolver
NewFolderIDScopeResolver
NewFolderUIDScopeResolver
NewDashboardIDScopeResolver
NewDashboardUIDScopeResolver
resolveDashboardScope

I have a small enterprise PR to support this commit.

* lingering fmt
2023-03-02 08:09:57 -05:00
Ryan McKinley
22aa09d392
DashboardStore: Provide an interface directly rather than pointer receiver (#63910) 2023-03-01 07:52:16 -08:00
Ieva
4570131fe5
Folders: simplify guardian permissions checks (#63183)
simplify code
2023-02-09 07:19:08 -05:00
Sofia Papagiannaki
225c8dbba7
Chore: Fix fetching the General folder when nested folders is set and improve error handling (#62951)
* Nested folders: Modify Get() not to fail fetching the General folder

* Add test
2023-02-08 17:16:53 +02:00
Ieva
078639abcd
RBAC: add folder UID scope resolver (#62695)
* add folder uid scope resolver

* undo guardian change, move it to a separate PR

* fix test + linting
2023-02-07 16:27:20 +00:00
Ryan McKinley
b1e58eb47e
Chore: Replace short UID generation with more standard UUIDs (#62731) 2023-02-06 20:44:37 -05:00
Sofia Papagiannaki
ee2878f189
Chore: Fix logging message in folder service (#62939) 2023-02-06 13:11:32 +02:00
Josh Hunt
4d268cbcdb
NestedFolders: use guardian.NewByUID to check folder permissions (#62864) 2023-02-06 10:14:22 +00:00
Sofia Papagiannaki
4eaff63eda
SQLStore: Fix folder migration for MySQL < 5.7 (#62521)
* Nested folders: Do not skip integration tests

* SQLStore: Fix folder migration

It reduces the length of the title column to be equal with the respective
dashboard column.
2023-02-02 16:21:25 +02:00
Sofia Papagiannaki
adaf82ffb7
Nested Folder: Fix for SQLite not to overwrite the parent on restarts (#62709)
Nested Folder: Fix for SQLite not to overwrite the arent on restarts
2023-02-02 12:06:51 +02:00
Sofia Papagiannaki
f143b0a5b2
Chore: Move folder store interface, implementation and test under pkg/services/folder (#62586)
* Chore: Move folder store into folder service package

* Split folder and dashboard store implementations
2023-02-01 15:43:21 +02:00
Ieva
ee3d742c7d
RBAC: inherit folder permissions when resolving managed permissions (#62244)
* add nested folder scope inheritance to managed permission services

* add a more specific erorr

* remove circular dependencies

* use errutil for returning erorr

* fix tests

* fix tests

* define a new error in ac package
2023-01-30 14:19:42 +00: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
e8b8a9e276
chore: move dashboard_acl models into dashboard service (#62151) 2023-01-26 08:46:30 -05:00
Sofia Papagiannaki
cd27562c76
Access control: Modify dashboard/folder resolvers so that return also the inherited scopes (#62025)
* Access Control: Add folder service dependency to the dashboard/folder resolvers

* Expose the function fetching parents to folder interface

* Add generic prepend utility

* Modify dashboard resolvers to return inherited scopes
2023-01-26 10:21:10 +02:00
Kristin Laemmert
7c27c866f6
chore: update folder model (json tags) to match previous model (#62117)
chore: update folder model to match previous model
2023-01-25 10:04:08 -05:00
idafurjes
b54b80f473
Chore: Remove Result from dashboard models (#61997)
* Chore: Remove Result from dashboard models

* Fix lint tests

* Fix dashboard service tests

* Fix API tests

* Remove commented out code

* Chore: Merge main - cleanup
2023-01-25 10:36:26 +01:00
idafurjes
421976e919
Chore: Remove folders from models pkg (#61853) 2023-01-25 09:14:32 +01:00
Sofia Papagiannaki
c7a7ebd3e0
Chore: Drop search service dependency from folder service (#61789)
* Chore: Drop search service dependency from folder service
2023-01-23 14:09:09 +02:00
idafurjes
68445a7c77
Chore: Remove dashboard ACL from models (#61749)
* Remove dashboard ACL from models

* Remove unused comment
2023-01-20 14:58:47 +01:00
Sofia Papagiannaki
c104cc7020
Chore: Split folder store and dashboard store interfaces (#61655)
* update folder store mock

* Split folder store and dashboard store interfaces
2023-01-19 18:38:07 +02:00
Sofia Papagiannaki
b80c9bb974
Chore: Drop dashboard service dependency from folder service (#61614)
* Chore: Drop dashboard dependency from folder service
2023-01-18 17:47:59 +02:00
idafurjes
b573b19ca3
Chore: Remove dashboards from models pkg (#61578)
* Copy dashboard models to dashboard pkg

* Use some models from current pkg instead of models

* Adjust api pkg

* Adjust pkg services

* Fix lint

* Chore: Remove dashboards models

* Remove dashboards from models pkg

* Fix lint in tests

* Fix lint in tests 2

* Fix for import in auth

* Remove newline

* Revert unused fix
2023-01-18 13:52:41 +01:00
Sofia Papagiannaki
f25d5199c5
Chore: Fix folder service tests (#61659)
* Chore: Fix folder service tests
2023-01-18 12:22:23 +02:00
idafurjes
7c2522c477
Chore: Move dashboard models to dashboard pkg (#61458)
* Copy dashboard models to dashboard pkg

* Use some models from current pkg instead of models

* Adjust api pkg

* Adjust pkg services

* Fix lint
2023-01-16 16:33:55 +01:00
Sofia Papagiannaki
e2ed42c2a3
Nested folders: Do not expose the sequential ID from the folder store (#60702)
* Nested folders: Do not expose the sequential ID from the folder store
2023-01-06 16:04:17 +02:00
Sofia Papagiannaki
4df78cebc2
Nested Folders: Unify folder services (#60390)
* Nested Folders: Unify folder services
2022-12-20 17:38:09 +02:00
Sofia Papagiannaki
55b014974d
Nested folders: Refactor folder update (#60323)
* Nested folders: Refactor folder update

* Apply suggestions from code review
2022-12-20 15:00:33 +02:00
Sofia Papagiannaki
b1ef5ab320
Nested Folders: Support listing nested folder children (#58566)
* Nested Folders: Support listing nested folder children

* Filter out subfolders with no permissions

* Apply suggestion from code review
2022-12-19 10:52:04 +02:00
Sofia Papagiannaki
11d8bcbea9
Guardian: Introduce additional constructors (#59577)
* Guardian: Use dashboard UID instead of ID

* Apply suggestions from code review

Introduce several guardian constructors and each time use
the most appropriate one.
2022-12-15 16:34:17 +02:00
ying-jeanne
b059296cb0
[nested folder]Add circular reference detection in create nested folder (#60163)
* add circulic reference detection in create neste folder

* redeclare mock

* add log for getHeight when depassing limit
2022-12-14 11:07:55 -05:00
ying-jeanne
1131bac5da
[Nested Folder] Block move operation that could introduce more than 8 level of depth,… (#59832)
* block move operation that could introduce more than 8 level of depth, forbid circular reference

* move getHeight to store, mock store in service

* fix linter
2022-12-08 08:49:17 -05:00
Sofia Papagiannaki
798a8ceb9c
Nested folders: Fix delete (#59627)
* Fix deleting subfolder

It used to fail with beause of missing signed in user

* Add logging

* fixup

* Fail request if deleting nested folder has failed

Before we only used to log the error

* Fix failing test

During failed nested folder creation
call the dashboard store deletion instead of the service one.
2022-12-01 05:27:40 -05:00
Ryan McKinley
5b71a16acf
Slugify: Replace gosimple/slug with a simple function (#59517) 2022-11-30 11:12:56 -05:00
Sofia Papagiannaki
933879a347
Chore: Delete accidentally committed test database (#59238) 2022-11-29 10:33:43 +02:00
Sofia Papagiannaki
8ab7ca45cd
Nested folder: Fix for PostgreSQL (#59405)
* Nested Folders: Fix PostgreSQL LastInsertId failure

* Fix children sorting

* Fix store tests
2022-11-28 17:48:44 +02:00
Sofia Papagiannaki
f5c41ea497
Nested Folders: More API fixes (#59316)
* Nested Folder: Fix create, use camel case for JSON properties

* Fix get parents if the folder does not exist

* Add store test for get parents
2022-11-24 13:28:53 -05:00
Sofia Papagiannaki
8e6d343981
Nested Folders: Some API fixes (#59298)
* Nested Folders: Fix API responses

* Fix panic during deletions

* Add test
2022-11-24 08:59:47 -05:00
Sofia Papagiannaki
ad96b240fc
Nested Folder: Enforce maximum nested folder depth (#59213)
* Nested Folder: Enforce maximum nested folder depth

* Cleanup

* Fix logging
2022-11-23 09:44:45 -05:00
Sofia Papagiannaki
0af96936be
Nested Folders: Do not refer to the configuration for checking for the flag (#59197)
* Nested Folders: Do not refer to the configuration for checking for the flag

Use always features.IsEnabled() instead

* Depend on the interface instead
2022-11-23 06:16:00 -05:00
Sofia Papagiannaki
02b6b09121
Nested Folders: Set user in the API level (#59148) 2022-11-23 11:13:47 +02:00
Sofia Papagiannaki
9926931d40
Nested Folder: Include URL into the GET response (#59099) 2022-11-22 07:04:09 -05:00
Sofia Papagiannaki
93b4b9154e
Chore: Restore folder properties (#58743)
* Chore: Fix folder URL

* Restore more folder properties

* Fixup
2022-11-15 12:58:12 +02:00
Sofia Papagiannaki
9855e74b92
Chore: Refactor quota service (#58643)
Chore: Refactor quota service (#57586)

* Chore: refactore quota service

* Apply suggestions from code review
2022-11-14 21:08:10 +02:00
ying-jeanne
69b5a9c752
Chore: [Nested Folder] Add db migration at service start time (#58590)
* add db migration at service start time

* make changes for the 3 db

* revert migrator

* fix feature toggle check

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
2022-11-12 09:51:46 -05:00
idafurjes
080ea88af7
Nested Folders: Support getting of nested folder in folder service wh… (#58597)
* Nested Folders: Support getting of nested folder in folder service when feature flag is set

* Fix lint

* Fix some tests

* Fix ngalert test

* ngalert fix

* Fix API tests

* Fix some tests and lint

* Fix lint 2

* Fix library elements and panels

* Add access control to get folder

* Cleanup and minor test change
2022-11-11 14:28:24 +01:00
ying-jeanne
b13b58ebf8
Add move endpoint into folder service (#58575)
* add move endpoint

* change signatures
2022-11-10 09:06:52 -05:00
idafurjes
30f0d66983
Folder: Add implementation for Update for nested folder (#58479)
* Add implementation for Update nested folder

* Remove parent uid from Update

* Fix update
2022-11-10 14:28:55 +01:00
Sofia Papagiannaki
bf5a08e039
API: Support creating a nested folder (#58508)
* API: Support nested folder creation

* Update swagger

* fixup

* Update pkg/api/dtos/folder.go

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>

* Fix some tests

* create legacy folder url from title and uid

Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>
Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
2022-11-10 04:41:03 -05:00
ying-jeanne
accb4dea55
[Nested Folder] Delete folder methode (#58444)
* transfer DeleteFolder changes from larger PR

* finish some thingies

* add the simplest delete logics

* some intermedia steps

* fix tests

* add test

* fix some comments

Co-authored-by: yangkb09 <yangkb09@gmail.com>
2022-11-10 03:42:32 -05:00
Sofia Papagiannaki
4d2be7a277
Nested Folders: Use recursive query if the driver supports it (#58178)
* Nested Folders: Try first recursive query and fallback if it's not supported

* Apply suggestion from code review

Fix error msgID
2022-11-08 14:53:05 -05:00
Kristin Laemmert
a255c32e1a
nested folders: support creation of nested folders in folder service when feature flag is set (#58364)
* nested folders: support creation of nested folders in folder service when feature flag is set
2022-11-08 08:59:55 -05:00
idafurjes
af2f51f196
Folder: Add folder service implementation (#58182)
* Folder: Add folder service implementation

* Add Move

* Add tests

* Add new servie method and adjust Update, Delete and Move

* Remove contains

* GetTree return children of depth one
2022-11-08 11:33:13 +01:00
Sofia Papagiannaki
96cdf77995
Revert "Chore: Refactor quota service (#57586)" (#58394)
This reverts commit 326ea86a57.
2022-11-08 11:52:07 +02:00
Sofia Papagiannaki
326ea86a57
Chore: Refactor quota service (#57586)
* Chore: refactore quota service

* Apply suggestions from code review
2022-11-08 10:25:34 +02:00
Dan Cech
9ea6a43089
Build: clean up and document integration test convention (#58170)
* clean up and document integration test convention

* clarify integration test conventions

* clean up integration tests that don't follow convention

* mark testIntegration* functions as helpers to avoid confusion
2022-11-04 10:14:21 -04:00
Sofia Papagiannaki
d131733f55
Nested Folder: Modify store Update() (#58183)
* Nested Folder: Modify store Update()

* fixup
2022-11-04 10:04:24 +01:00
Sofia Papagiannaki
5c973e58bd
Nested Folders: Add tests for store methods (#57662)
* Nested Folders: Add store tests

* Fix parent order

* Fix update

* skip tests!

* Export test helpers for now
2022-11-03 14:21:41 +01:00
Kristin Laemmert
706b301285
feat(nested folders): add CountDashboardsInFolder (#57847)
* feat(nested folders): add CountDashboardsInFolder

This commit adds a new method to the Dashboard service and stores: CountDashboardsInFolder. The command struct takes a folderUID, but the store implementation still depends on the parent folder ID. This is temporary; eventually we will replace all references to FolderIDs (associated with Dashboards) with folder UIDs.

There are some unfortunate additional test changes that were necessary after generating the service & store mocks; it looks like that hasn't been generated since the last change(s).

* more test updates
* don't forget the service test
* that didn't end up used, so bye for now
* agree to disagree with the linter
2022-11-02 09:15:50 -04:00
idafurjes
d7bee33398
Add implementation for Create and GetParents of foder store (#57829)
* Add Move implementation

* Remove Move from store

* Add Create and GetParents implementation for folder store
2022-10-28 20:07:25 +02:00
idafurjes
6b483a8dca
Add implementation for folder store methods (#57700)
* Add implementation for folder store methods

* Add Move implementation

* Add back comment and fix query

* Remove Move from store

* Adjust GetChildren

* Fix errutil error declaration and usage

* Add org id to get children query
2022-10-28 15:35:49 +02:00
Kristin Laemmert
6a6fdbc1f9
chore: updates to the new folder model (#57776) 2022-10-28 08:23:39 -04:00
Kristin Laemmert
6c982e5b71
some file moving and struct renaming (#57686) 2022-10-26 11:52:01 -04:00
Kristin Laemmert
b346ae0310
feat: add new Folder table migration & define nested folder interfaces (#56882)
* feat: add new Folder table migration

Add a new folder table to support the Nested Folders feature.

https://github.com/grafana/grafana/issues/56880

* register nested folders feature flag (unused)

* feat: nested folder service (experiment)

This commit adds a NestedFolderSvc interface and stubbed out implementation as an alternative to the existing folder service. This is an experimental feature to try out different methods for backwards compatibility and parallelization, so that Grafana can continue to store folders in the existing (non-nested) manner while also using the new nested folder service.

Eventually the new service will (hopefully) become _the_ service, at which point the legacy service can be deprecated (or remain, with the new service methods replacing the original. whatever makes sense at the time).


* nested folders: don't run the new migration

This commit removes the nested folder migration from the list of active migrations so we can merge this branch and continue development without impacting Grafana instances built off main.
2022-10-26 10:15:14 -04:00
ying-jeanne
ed98d7bc27
Chore: remove busmock (#57170) 2022-10-18 13:31:56 +00:00
Serge Zaitsev
53baecd71f
Chore: Move folder service into a separate package (#56591)
* Chore: move folder service interface into a separate package

* copy implementation into a standalone package

* move implementation and tests to the new folder package

* remove leftovers from wire

* add test doubles for folder service

* fix tests in library panels/elements

* fix provideservice in ngalert
2022-10-10 21:47:53 +02:00