Add number of tokens to the service accounts view (#44919)

* feat: add serviceaccountDTO

* WIP

* feat: listing number of tokens for a given service account

* nit: removed fmt

* Update pkg/services/serviceaccounts/database/database.go

* Update public/app/features/serviceaccounts/ServiceAccountsListPage.tsx

* fixes

* align DTOProfile data to the frontend

* reviewed myself fixes

* fix: tests fix
This commit is contained in:
Eric Leijonmarck
2022-02-08 14:31:34 +01:00
committed by GitHub
parent 788f77b7da
commit 79340c087f
12 changed files with 99 additions and 49 deletions

View File

@@ -1,6 +1,10 @@
package serviceaccounts
import "github.com/grafana/grafana/pkg/services/accesscontrol"
import (
"time"
"github.com/grafana/grafana/pkg/services/accesscontrol"
)
var (
ScopeAll = "serviceaccounts:*"
@@ -22,3 +26,23 @@ type CreateServiceaccountForm struct {
OrgID int64 `json:"-"`
Name string `json:"name" binding:"Required"`
}
type ServiceAccountDTO struct {
Id int64 `json:"id"`
Name string `json:"name"`
Login string `json:"login"`
OrgId int64 `json:"orgId"`
Tokens int64 `json:"tokens"`
}
type ServiceAccountProfileDTO struct {
Id int64 `json:"id"`
Name string `json:"name"`
Login string `json:"login"`
OrgId int64 `json:"orgId"`
IsDisabled bool `json:"isDisabled"`
UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"createdAt"`
AvatarUrl string `json:"avatarUrl"`
AccessControl map[string]bool `json:"accessControl,omitempty"`
}