Storage: simplify retrieving the file names from the response frame (#51805)

* add util method for storage list frame

* use go:embed

* remove enum
This commit is contained in:
Artur Wierzbicki
2022-07-07 10:47:05 +04:00
committed by GitHub
parent 4f931afe29
commit 052132be46
8 changed files with 267 additions and 23 deletions

View File

@@ -6,7 +6,6 @@ import (
"fmt"
"strings"
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana/pkg/infra/filestorage"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/models"
@@ -34,7 +33,7 @@ type StorageService interface {
registry.BackgroundService
// List folder contents
List(ctx context.Context, user *models.SignedInUser, path string) (*data.Frame, error)
List(ctx context.Context, user *models.SignedInUser, path string) (*StorageListFrame, error)
// Read raw file contents out of the store
Read(ctx context.Context, user *models.SignedInUser, path string) (*filestorage.File, error)
@@ -114,7 +113,7 @@ func getOrgId(user *models.SignedInUser) int64 {
return user.OrgId
}
func (s *standardStorageService) List(ctx context.Context, user *models.SignedInUser, path string) (*data.Frame, error) {
func (s *standardStorageService) List(ctx context.Context, user *models.SignedInUser, path string) (*StorageListFrame, error) {
// apply access control here
return s.tree.ListFolder(ctx, getOrgId(user), path)
}