LibraryPanels: removes feature toggle (#33839)

* WIP: intial structure

* Refactor: adds create library element endpoint

* Feature: adds delete library element

* wip

* Refactor: adds get api

* Refactor: adds get all api

* Refactor: adds patch api

* Refactor: changes to library_element_connection

* Refactor: add get connections api

* wip: in the middle of refactor

* wip

* Refactor: consolidating both api:s

* Refactor: points front end to library elements api

* Tests: Fixes broken test

* LibraryPanels: removes feature toggle

* Fix: fixes delete library elements in folder and adds tests

* Tests: fixes snapshot

* Refactor: adds service interfaces so they can be easily mocked

* Refactor: changes order of tabs in manage folder

* Refactor: fixes so link does not cover whole card

* Refactor: fixes index string name

* Update pkg/services/libraryelements/libraryelements.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/services/libraryelements/libraryelements_permissions_test.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/services/libraryelements/database.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: changes after PR comments

* Update libraryelements.go

* Update libraryelements.go

* Chore: updates after PR comments

* Chore: trying to fix build error

* Refactor: fixed stupid mistake

* Update libraryelements.go

* Chore: tries to fix build errors

* Refactor: trying to fix MySQL key length

* Update libraryelements.go

* Update pkg/services/libraryelements/libraryelements.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/services/librarypanels/librarypanels.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Refactor: changes after PR comments

* Refactor: changes after PR comments

* Tests: fixes tests

* Refactor: renames connections to connectedDashboards

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Hugo Häggmark
2021-05-12 08:48:17 +02:00
committed by GitHub
parent f61328af2d
commit 69d9f427e1
25 changed files with 477 additions and 441 deletions

View File

@ -121,27 +121,6 @@ type libraryElementsSearchResult struct {
PerPage int `json:"perPage"`
}
func overrideLibraryElementServiceInRegistry(cfg *setting.Cfg) LibraryElementService {
l := LibraryElementService{
SQLStore: nil,
Cfg: cfg,
}
overrideServiceFunc := func(d registry.Descriptor) (*registry.Descriptor, bool) {
descriptor := registry.Descriptor{
Name: "LibraryElementService",
Instance: &l,
InitPriority: 0,
}
return &descriptor, true
}
registry.RegisterOverride(overrideServiceFunc)
return l
}
func getCreatePanelCommand(folderID int64, name string) CreateLibraryElementCommand {
command := getCreateCommandWithModel(folderID, name, Panel, []byte(`
{
@ -294,17 +273,11 @@ func testScenario(t *testing.T, desc string, fn func(t *testing.T, sc scenarioCo
}
orgID := int64(1)
role := models.ROLE_ADMIN
cfg := setting.NewCfg()
// Everything in this service is behind the feature toggle "panelLibrary"
cfg.FeatureToggles = map[string]bool{"panelLibrary": true}
// Because the LibraryElementService is behind a feature toggle, we need to override the service in the registry
// with a Cfg that contains the feature toggle so migrations are run properly
service := overrideLibraryElementServiceInRegistry(cfg)
// We need to assign SQLStore after the override and migrations are done
sqlStore := sqlstore.InitTestDB(t)
service.SQLStore = sqlStore
service := LibraryElementService{
Cfg: setting.NewCfg(),
SQLStore: sqlStore,
}
user := models.SignedInUser{
UserId: 1,