Chore: Remove library panel thema (#112154)
This commit is contained in:
@@ -688,7 +688,6 @@
|
||||
/packages/grafana-schema/src/**/grafanapyroscope @grafana/observability-traces-and-profiling
|
||||
/packages/grafana-schema/src/**/heatmap @grafana/dataviz-squad
|
||||
/packages/grafana-schema/src/**/histogram @grafana/dataviz-squad
|
||||
/packages/grafana-schema/src/**/librarypanel @grafana/sharing-squad
|
||||
/packages/grafana-schema/src/**/logs @grafana/observability-logs
|
||||
/packages/grafana-schema/src/**/logsnew @grafana/observability-logs
|
||||
/packages/grafana-schema/src/**/loki @grafana/oss-big-tent @grafana/observability-logs
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
package kind
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
name: "LibraryPanel"
|
||||
maturity: "experimental"
|
||||
description: "A standalone panel"
|
||||
|
||||
lineage: schemas: [{
|
||||
version: [0, 0]
|
||||
schema: {
|
||||
spec: {
|
||||
// Folder UID
|
||||
folderUid?: string @grafanamaturity(ToMetadata="sys")
|
||||
|
||||
// Library element UID
|
||||
uid: string
|
||||
|
||||
// Panel name (also saved in the model)
|
||||
name: string & strings.MinRunes(1)
|
||||
|
||||
// Panel description
|
||||
description?: string
|
||||
|
||||
// The panel type (from inside the model)
|
||||
type: string & strings.MinRunes(1)
|
||||
|
||||
// Dashboard version when this was saved (zero if unknown)
|
||||
schemaVersion?: uint16
|
||||
|
||||
// panel version, incremented each time the dashboard is updated.
|
||||
version: int64 @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
// TODO: should be the same panel schema defined in dashboard
|
||||
// Typescript: Omit<Panel, 'gridPos' | 'id' | 'libraryPanel'>;
|
||||
model: {...}
|
||||
|
||||
// Object storage metadata
|
||||
meta?: #LibraryElementDTOMeta @grafanamaturity(ToMetadata="sys")
|
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type")
|
||||
|
||||
#LibraryElementDTOMetaUser: {
|
||||
id: int64
|
||||
name: string
|
||||
avatarUrl: string
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
|
||||
#LibraryElementDTOMeta: {
|
||||
folderName: string
|
||||
folderUid: string @grafanamaturity(ToMetadata="sys")
|
||||
connectedDashboards: int64
|
||||
|
||||
created: string & time.Time
|
||||
updated: string & time.Time
|
||||
|
||||
createdBy: #LibraryElementDTOMetaUser @grafanamaturity(ToMetadata="sys")
|
||||
updatedBy: #LibraryElementDTOMetaUser @grafanamaturity(ToMetadata="sys")
|
||||
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
|
||||
}
|
||||
}]
|
||||
@@ -104,20 +104,3 @@ export {
|
||||
defaultFieldConfig,
|
||||
defaultRowPanel
|
||||
} from './veneer/dashboard.types';
|
||||
|
||||
// Raw generated types from LibraryPanel kind.
|
||||
export type {
|
||||
LibraryElementDTOMetaUser,
|
||||
LibraryElementDTOMeta
|
||||
} from './raw/librarypanel/x/librarypanel_types.gen';
|
||||
|
||||
// The following exported declarations correspond to types in the librarypanel@0.0 kind's
|
||||
// schema with attribute @grafana(TSVeneer="type").
|
||||
//
|
||||
// The handwritten file for these type and default veneers is expected to be at
|
||||
// packages/grafana-schema/src/veneer/librarypanel.types.ts.
|
||||
// This re-export declaration enforces that the handwritten veneer file exists,
|
||||
// and exports all the symbols in the list.
|
||||
//
|
||||
// TODO generate code such that tsc enforces type compatibility between raw and veneer decls
|
||||
export type { LibraryPanel } from './veneer/librarypanel.types';
|
||||
|
||||
@@ -4,4 +4,5 @@
|
||||
* @packageDocumentation
|
||||
*/
|
||||
export * from './veneer/common.types';
|
||||
export * from './veneer/librarypanel.types';
|
||||
export * from './index.gen';
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// kinds/gen.go
|
||||
// Using jennies:
|
||||
// TSTypesJenny
|
||||
// LatestMajorsOrXJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
export interface LibraryElementDTOMetaUser {
|
||||
avatarUrl: string;
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface LibraryElementDTOMeta {
|
||||
connectedDashboards: number;
|
||||
created: string;
|
||||
createdBy: LibraryElementDTOMetaUser;
|
||||
folderName: string;
|
||||
folderUid: string;
|
||||
updated: string;
|
||||
updatedBy: LibraryElementDTOMetaUser;
|
||||
}
|
||||
|
||||
export interface LibraryPanel {
|
||||
/**
|
||||
* Panel description
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Folder UID
|
||||
*/
|
||||
folderUid?: string;
|
||||
/**
|
||||
* Object storage metadata
|
||||
*/
|
||||
meta?: LibraryElementDTOMeta;
|
||||
/**
|
||||
* TODO: should be the same panel schema defined in dashboard
|
||||
* Typescript: Omit<Panel, 'gridPos' | 'id' | 'libraryPanel'>;
|
||||
*/
|
||||
model: Record<string, unknown>;
|
||||
/**
|
||||
* Panel name (also saved in the model)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Dashboard version when this was saved (zero if unknown)
|
||||
*/
|
||||
schemaVersion?: number;
|
||||
/**
|
||||
* The panel type (from inside the model)
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* Library element UID
|
||||
*/
|
||||
uid: string;
|
||||
/**
|
||||
* panel version, incremented each time the dashboard is updated.
|
||||
*/
|
||||
version: number;
|
||||
}
|
||||
@@ -1,7 +1,55 @@
|
||||
import * as raw from '../raw/librarypanel/x/librarypanel_types.gen';
|
||||
|
||||
import { Panel } from './dashboard.types';
|
||||
|
||||
export interface LibraryPanel extends raw.LibraryPanel {
|
||||
export interface LibraryElementDTOMetaUser {
|
||||
avatarUrl: string;
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface LibraryElementDTOMeta {
|
||||
connectedDashboards: number;
|
||||
created: string;
|
||||
createdBy: LibraryElementDTOMetaUser;
|
||||
folderName: string;
|
||||
folderUid: string;
|
||||
updated: string;
|
||||
updatedBy: LibraryElementDTOMetaUser;
|
||||
}
|
||||
|
||||
export interface LibraryPanel {
|
||||
/**
|
||||
* Panel description
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
* Folder UID
|
||||
*/
|
||||
folderUid?: string;
|
||||
/**
|
||||
* Object storage metadata
|
||||
*/
|
||||
meta?: LibraryElementDTOMeta;
|
||||
|
||||
// The panel
|
||||
model: Omit<Panel, 'gridPos' | 'id' | 'libraryPanel'>;
|
||||
/**
|
||||
* Panel name (also saved in the model)
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Dashboard version when this was saved (zero if unknown)
|
||||
*/
|
||||
schemaVersion?: number;
|
||||
/**
|
||||
* The panel type (from inside the model)
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* Library element UID
|
||||
*/
|
||||
uid: string;
|
||||
/**
|
||||
* panel version, incremented each time the dashboard is updated.
|
||||
*/
|
||||
version: number;
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// kinds/gen.go
|
||||
// Using jennies:
|
||||
// K8ResourcesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
package librarypanel
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/grafana/grafana/pkg/kinds"
|
||||
)
|
||||
|
||||
// Resource is the kubernetes style representation of LibraryPanel. (TODO be better)
|
||||
type K8sResource = kinds.GrafanaResource[Spec, Status]
|
||||
|
||||
// NewResource creates a new instance of the resource with a given name (UID)
|
||||
func NewK8sResource(name string, s *Spec) K8sResource {
|
||||
return K8sResource{
|
||||
TypeMeta: v1.TypeMeta{
|
||||
Kind: "LibraryPanel",
|
||||
APIVersion: "v0-0-alpha",
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: name,
|
||||
Annotations: make(map[string]string),
|
||||
Labels: make(map[string]string),
|
||||
},
|
||||
Spec: s,
|
||||
}
|
||||
}
|
||||
|
||||
// Resource is the wire representation of LibraryPanel.
|
||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||
type Resource struct {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// kinds/gen.go
|
||||
// Using jennies:
|
||||
// K8ResourcesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
package librarypanel
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Metadata defines model for Metadata.
|
||||
type Metadata struct {
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreationTimestamp time.Time `json:"creationTimestamp"`
|
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
|
||||
|
||||
// extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
|
||||
ExtraFields map[string]any `json:"extraFields"`
|
||||
Finalizers []string `json:"finalizers"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
ResourceVersion string `json:"resourceVersion"`
|
||||
Uid string `json:"uid"`
|
||||
UpdateTimestamp time.Time `json:"updateTimestamp"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
}
|
||||
|
||||
// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
|
||||
// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
|
||||
// As it is also intended to be generic enough to function with any API Server.
|
||||
type KubeObjectMetadata struct {
|
||||
CreationTimestamp time.Time `json:"creationTimestamp"`
|
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
|
||||
Finalizers []string `json:"finalizers"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
ResourceVersion string `json:"resourceVersion"`
|
||||
Uid string `json:"uid"`
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// kinds/gen.go
|
||||
// Using jennies:
|
||||
// GoResourceTypes
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package librarypanel
|
||||
|
||||
import (
|
||||
time "time"
|
||||
)
|
||||
|
||||
type Spec struct {
|
||||
// Folder UID
|
||||
FolderUid *string `json:"folderUid,omitempty"`
|
||||
// Library element UID
|
||||
Uid string `json:"uid"`
|
||||
// Panel name (also saved in the model)
|
||||
Name string `json:"name"`
|
||||
// Panel description
|
||||
Description *string `json:"description,omitempty"`
|
||||
// The panel type (from inside the model)
|
||||
Type string `json:"type"`
|
||||
// Dashboard version when this was saved (zero if unknown)
|
||||
SchemaVersion *uint16 `json:"schemaVersion,omitempty"`
|
||||
// panel version, incremented each time the dashboard is updated.
|
||||
Version int64 `json:"version"`
|
||||
// TODO: should be the same panel schema defined in dashboard
|
||||
// Typescript: Omit<Panel, 'gridPos' | 'id' | 'libraryPanel'>;
|
||||
Model map[string]any `json:"model"`
|
||||
// Object storage metadata
|
||||
Meta *LibraryElementDTOMeta `json:"meta,omitempty"`
|
||||
}
|
||||
|
||||
// NewSpec creates a new Spec object.
|
||||
func NewSpec() *Spec {
|
||||
return &Spec{
|
||||
Model: map[string]any{},
|
||||
}
|
||||
}
|
||||
|
||||
type LibraryElementDTOMeta struct {
|
||||
FolderName string `json:"folderName"`
|
||||
FolderUid string `json:"folderUid"`
|
||||
ConnectedDashboards int64 `json:"connectedDashboards"`
|
||||
Created time.Time `json:"created"`
|
||||
Updated time.Time `json:"updated"`
|
||||
CreatedBy LibraryElementDTOMetaUser `json:"createdBy"`
|
||||
UpdatedBy LibraryElementDTOMetaUser `json:"updatedBy"`
|
||||
}
|
||||
|
||||
// NewLibraryElementDTOMeta creates a new LibraryElementDTOMeta object.
|
||||
func NewLibraryElementDTOMeta() *LibraryElementDTOMeta {
|
||||
return &LibraryElementDTOMeta{
|
||||
CreatedBy: *NewLibraryElementDTOMetaUser(),
|
||||
UpdatedBy: *NewLibraryElementDTOMetaUser(),
|
||||
}
|
||||
}
|
||||
|
||||
type LibraryElementDTOMetaUser struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
AvatarUrl string `json:"avatarUrl"`
|
||||
}
|
||||
|
||||
// NewLibraryElementDTOMetaUser creates a new LibraryElementDTOMetaUser object.
|
||||
func NewLibraryElementDTOMetaUser() *LibraryElementDTOMetaUser {
|
||||
return &LibraryElementDTOMetaUser{}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// kinds/gen.go
|
||||
// Using jennies:
|
||||
// K8ResourcesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
package librarypanel
|
||||
|
||||
// Defines values for OperatorStateState.
|
||||
const (
|
||||
OperatorStateStateFailed OperatorStateState = "failed"
|
||||
OperatorStateStateInProgress OperatorStateState = "in_progress"
|
||||
OperatorStateStateSuccess OperatorStateState = "success"
|
||||
)
|
||||
|
||||
// Defines values for StatusOperatorStateState.
|
||||
const (
|
||||
StatusOperatorStateStateFailed StatusOperatorStateState = "failed"
|
||||
StatusOperatorStateStateInProgress StatusOperatorStateState = "in_progress"
|
||||
StatusOperatorStateStateSuccess StatusOperatorStateState = "success"
|
||||
)
|
||||
|
||||
// OperatorState defines model for OperatorState.
|
||||
type OperatorState struct {
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"`
|
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]any `json:"details,omitempty"`
|
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"`
|
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State OperatorStateState `json:"state"`
|
||||
}
|
||||
|
||||
// OperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
type OperatorStateState string
|
||||
|
||||
// Status defines model for Status.
|
||||
type Status struct {
|
||||
// additionalFields is reserved for future use
|
||||
AdditionalFields map[string]any `json:"additionalFields,omitempty"`
|
||||
|
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
OperatorStates map[string]StatusOperatorState `json:"operatorStates,omitempty"`
|
||||
}
|
||||
|
||||
// StatusOperatorState defines model for status.#OperatorState.
|
||||
type StatusOperatorState struct {
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"`
|
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]any `json:"details,omitempty"`
|
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"`
|
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State StatusOperatorStateState `json:"state"`
|
||||
}
|
||||
|
||||
// StatusOperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
type StatusOperatorStateState string
|
||||
@@ -1,43 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// kinds/gen.go
|
||||
// Using jennies:
|
||||
// K8ResourcesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
package publicdashboard
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/grafana/grafana/pkg/kinds"
|
||||
)
|
||||
|
||||
// Resource is the kubernetes style representation of PublicDashboard. (TODO be better)
|
||||
type K8sResource = kinds.GrafanaResource[Spec, Status]
|
||||
|
||||
// NewResource creates a new instance of the resource with a given name (UID)
|
||||
func NewK8sResource(name string, s *Spec) K8sResource {
|
||||
return K8sResource{
|
||||
TypeMeta: v1.TypeMeta{
|
||||
Kind: "PublicDashboard",
|
||||
APIVersion: "v0-0-alpha",
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: name,
|
||||
Annotations: make(map[string]string),
|
||||
Labels: make(map[string]string),
|
||||
},
|
||||
Spec: s,
|
||||
}
|
||||
}
|
||||
|
||||
// Resource is the wire representation of PublicDashboard.
|
||||
// It currently will soon be merged into the k8s flavor (TODO be better)
|
||||
type Resource struct {
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Spec Spec `json:"spec"`
|
||||
Status Status `json:"status"`
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// kinds/gen.go
|
||||
// Using jennies:
|
||||
// K8ResourcesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
package publicdashboard
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Metadata defines model for Metadata.
|
||||
type Metadata struct {
|
||||
CreatedBy string `json:"createdBy"`
|
||||
CreationTimestamp time.Time `json:"creationTimestamp"`
|
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
|
||||
|
||||
// extraFields is reserved for any fields that are pulled from the API server metadata but do not have concrete fields in the CUE metadata
|
||||
ExtraFields map[string]any `json:"extraFields"`
|
||||
Finalizers []string `json:"finalizers"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
ResourceVersion string `json:"resourceVersion"`
|
||||
Uid string `json:"uid"`
|
||||
UpdateTimestamp time.Time `json:"updateTimestamp"`
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
}
|
||||
|
||||
// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
|
||||
// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
|
||||
// As it is also intended to be generic enough to function with any API Server.
|
||||
type KubeObjectMetadata struct {
|
||||
CreationTimestamp time.Time `json:"creationTimestamp"`
|
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"`
|
||||
Finalizers []string `json:"finalizers"`
|
||||
Labels map[string]string `json:"labels"`
|
||||
ResourceVersion string `json:"resourceVersion"`
|
||||
Uid string `json:"uid"`
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// kinds/gen.go
|
||||
// Using jennies:
|
||||
// GoResourceTypes
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
|
||||
package publicdashboard
|
||||
|
||||
type Spec struct {
|
||||
// Unique public dashboard identifier
|
||||
Uid string `json:"uid"`
|
||||
// Dashboard unique identifier referenced by this public dashboard
|
||||
DashboardUid string `json:"dashboardUid"`
|
||||
// Unique public access token
|
||||
AccessToken *string `json:"accessToken,omitempty"`
|
||||
// Flag that indicates if the public dashboard is enabled
|
||||
IsEnabled bool `json:"isEnabled"`
|
||||
// Flag that indicates if annotations are enabled
|
||||
AnnotationsEnabled bool `json:"annotationsEnabled"`
|
||||
// Flag that indicates if the time range picker is enabled
|
||||
TimeSelectionEnabled bool `json:"timeSelectionEnabled"`
|
||||
}
|
||||
|
||||
// NewSpec creates a new Spec object.
|
||||
func NewSpec() *Spec {
|
||||
return &Spec{}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// kinds/gen.go
|
||||
// Using jennies:
|
||||
// K8ResourcesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
package publicdashboard
|
||||
|
||||
// Defines values for OperatorStateState.
|
||||
const (
|
||||
OperatorStateStateFailed OperatorStateState = "failed"
|
||||
OperatorStateStateInProgress OperatorStateState = "in_progress"
|
||||
OperatorStateStateSuccess OperatorStateState = "success"
|
||||
)
|
||||
|
||||
// Defines values for StatusOperatorStateState.
|
||||
const (
|
||||
StatusOperatorStateStateFailed StatusOperatorStateState = "failed"
|
||||
StatusOperatorStateStateInProgress StatusOperatorStateState = "in_progress"
|
||||
StatusOperatorStateStateSuccess StatusOperatorStateState = "success"
|
||||
)
|
||||
|
||||
// OperatorState defines model for OperatorState.
|
||||
type OperatorState struct {
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"`
|
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]any `json:"details,omitempty"`
|
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"`
|
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State OperatorStateState `json:"state"`
|
||||
}
|
||||
|
||||
// OperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
type OperatorStateState string
|
||||
|
||||
// Status defines model for Status.
|
||||
type Status struct {
|
||||
// additionalFields is reserved for future use
|
||||
AdditionalFields map[string]any `json:"additionalFields,omitempty"`
|
||||
|
||||
// operatorStates is a map of operator ID to operator state evaluations.
|
||||
// Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
OperatorStates map[string]StatusOperatorState `json:"operatorStates,omitempty"`
|
||||
}
|
||||
|
||||
// StatusOperatorState defines model for status.#OperatorState.
|
||||
type StatusOperatorState struct {
|
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"`
|
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]any `json:"details,omitempty"`
|
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"`
|
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State StatusOperatorStateState `json:"state"`
|
||||
}
|
||||
|
||||
// StatusOperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
type StatusOperatorStateState string
|
||||
@@ -39,15 +39,6 @@ func GetCoreKinds() ([]CoreKind, error) {
|
||||
CueFile: dashboardCue,
|
||||
})
|
||||
|
||||
librarypanelCue, err := loadCueFile(ctx, filepath.Join(root, "./kinds/librarypanel/librarypanel_kind.cue"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
kinds = append(kinds, CoreKind{
|
||||
Name: "librarypanel",
|
||||
CueFile: librarypanelCue,
|
||||
})
|
||||
|
||||
return kinds, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,18 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/dynamic"
|
||||
|
||||
dashboardV0 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/api/dtos"
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
"github.com/grafana/grafana/pkg/api/routing"
|
||||
"github.com/grafana/grafana/pkg/apimachinery/utils"
|
||||
"github.com/grafana/grafana/pkg/infra/metrics"
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
grafanaapiserver "github.com/grafana/grafana/pkg/services/apiserver"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
@@ -28,11 +33,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/errhttp"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
k8serrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/dynamic"
|
||||
)
|
||||
|
||||
func (l *LibraryElementService) registerAPIEndpoints() {
|
||||
@@ -340,7 +340,7 @@ func (l *LibraryElementService) getConnectionsHandler(c *contextmodel.ReqContext
|
||||
ConnectionID: dashboard.ID, // nolint:staticcheck
|
||||
ConnectionUID: dashboard.UID,
|
||||
// returns the creation information of the library element, not the connection
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: element.Meta.CreatedBy.Id,
|
||||
Name: element.Meta.CreatedBy.Name,
|
||||
AvatarUrl: element.Meta.CreatedBy.AvatarUrl,
|
||||
@@ -713,7 +713,7 @@ func (lk8s *libraryElementsK8sHandler) unstructuredToLegacyLibraryPanelDTO(c *co
|
||||
}
|
||||
for _, user := range users {
|
||||
if user.UID == createdBy {
|
||||
dto.Meta.CreatedBy = librarypanel.LibraryElementDTOMetaUser{
|
||||
dto.Meta.CreatedBy = model.LibraryElementDTOMetaUser{
|
||||
Id: user.ID,
|
||||
Name: user.Login,
|
||||
AvatarUrl: dtos.GetGravatarUrl(lk8s.cfg, user.Email),
|
||||
@@ -721,7 +721,7 @@ func (lk8s *libraryElementsK8sHandler) unstructuredToLegacyLibraryPanelDTO(c *co
|
||||
}
|
||||
// not else because /api returns the same user for updated if it was never updated
|
||||
if user.UID == updatedBy {
|
||||
dto.Meta.UpdatedBy = librarypanel.LibraryElementDTOMetaUser{
|
||||
dto.Meta.UpdatedBy = model.LibraryElementDTOMetaUser{
|
||||
Id: user.ID,
|
||||
Name: user.Login,
|
||||
AvatarUrl: dtos.GetGravatarUrl(lk8s.cfg, user.Email),
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity"
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/infra/metrics"
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
@@ -200,12 +199,12 @@ func (l *LibraryElementService) createLibraryElement(c context.Context, signedIn
|
||||
ConnectedDashboards: 0,
|
||||
Created: element.Created,
|
||||
Updated: element.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: element.CreatedBy,
|
||||
Name: signedInUser.GetLogin(),
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, signedInUser.GetEmail()),
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: element.UpdatedBy,
|
||||
Name: signedInUser.GetLogin(),
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, signedInUser.GetEmail()),
|
||||
@@ -363,12 +362,12 @@ func (l *LibraryElementService) getLibraryElements(c context.Context, store db.D
|
||||
ConnectedDashboards: libraryElement.ConnectedDashboards,
|
||||
Created: libraryElement.Created,
|
||||
Updated: libraryElement.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: libraryElement.CreatedBy,
|
||||
Name: libraryElement.CreatedByName,
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, libraryElement.CreatedByEmail),
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: libraryElement.UpdatedBy,
|
||||
Name: libraryElement.UpdatedByName,
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, libraryElement.UpdatedByEmail),
|
||||
@@ -509,12 +508,12 @@ func (l *LibraryElementService) getAllLibraryElements(c context.Context, signedI
|
||||
ConnectedDashboards: element.ConnectedDashboards,
|
||||
Created: element.Created,
|
||||
Updated: element.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: element.CreatedBy,
|
||||
Name: element.CreatedByName,
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, element.CreatedByEmail),
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: element.UpdatedBy,
|
||||
Name: element.UpdatedByName,
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, element.UpdatedByEmail),
|
||||
@@ -670,12 +669,12 @@ func (l *LibraryElementService) patchLibraryElement(c context.Context, signedInU
|
||||
ConnectedDashboards: elementInDB.ConnectedDashboards,
|
||||
Created: libraryElement.Created,
|
||||
Updated: libraryElement.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: elementInDB.CreatedBy,
|
||||
Name: elementInDB.CreatedByName,
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, elementInDB.CreatedByEmail),
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: libraryElement.UpdatedBy,
|
||||
Name: signedInUser.GetLogin(),
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, signedInUser.GetEmail()),
|
||||
@@ -761,12 +760,12 @@ func (l *LibraryElementService) getElementsForDashboardID(c context.Context, das
|
||||
ConnectedDashboards: element.ConnectedDashboards,
|
||||
Created: element.Created,
|
||||
Updated: element.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: element.CreatedBy,
|
||||
Name: element.CreatedByName,
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, element.CreatedByEmail),
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: element.UpdatedBy,
|
||||
Name: element.UpdatedByName,
|
||||
AvatarUrl: dtos.GetGravatarUrl(l.Cfg, element.UpdatedByEmail),
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements/model"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
@@ -51,12 +50,12 @@ func TestIntegration_CreateLibraryElement(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: sc.initialResult.Result.Meta.Created,
|
||||
Updated: sc.initialResult.Result.Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: "signed_in_user",
|
||||
AvatarUrl: "/avatar/37524e1eb8b3e32850b57db0a19af93b",
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: "signed_in_user",
|
||||
AvatarUrl: "/avatar/37524e1eb8b3e32850b57db0a19af93b",
|
||||
@@ -102,12 +101,12 @@ func TestIntegration_CreateLibraryElement(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Meta.Created,
|
||||
Updated: result.Result.Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: "signed_in_user",
|
||||
AvatarUrl: "/avatar/37524e1eb8b3e32850b57db0a19af93b",
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: "signed_in_user",
|
||||
AvatarUrl: "/avatar/37524e1eb8b3e32850b57db0a19af93b",
|
||||
@@ -181,12 +180,12 @@ func TestIntegration_CreateLibraryElement(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Meta.Created,
|
||||
Updated: result.Result.Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: "signed_in_user",
|
||||
AvatarUrl: "/avatar/37524e1eb8b3e32850b57db0a19af93b",
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: "signed_in_user",
|
||||
AvatarUrl: "/avatar/37524e1eb8b3e32850b57db0a19af93b",
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
"github.com/grafana/grafana/pkg/services/folder"
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements/model"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
@@ -84,12 +83,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -120,12 +119,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[1].Meta.Created,
|
||||
Updated: result.Result.Elements[1].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -187,12 +186,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -223,12 +222,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[1].Meta.Created,
|
||||
Updated: result.Result.Elements[1].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -312,12 +311,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -348,12 +347,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[1].Meta.Created,
|
||||
Updated: result.Result.Elements[1].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -462,12 +461,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -562,12 +561,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -598,12 +597,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[1].Meta.Created,
|
||||
Updated: result.Result.Elements[1].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -665,12 +664,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -732,12 +731,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -800,12 +799,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -878,12 +877,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -954,12 +953,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -990,12 +989,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[1].Meta.Created,
|
||||
Updated: result.Result.Elements[1].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -1059,12 +1058,12 @@ func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: result.Result.Elements[0].Meta.Created,
|
||||
Updated: result.Result.Elements[0].Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||
"github.com/grafana/grafana/pkg/services/folder"
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements/model"
|
||||
@@ -61,12 +60,12 @@ func TestIntegration_GetLibraryElement(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: res.Result.Meta.Created,
|
||||
Updated: res.Result.Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
@@ -161,12 +160,12 @@ func TestIntegration_GetLibraryElement(t *testing.T) {
|
||||
ConnectedDashboards: 1,
|
||||
Created: res.Result.Meta.Created,
|
||||
Updated: res.Result.Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
|
||||
@@ -3,14 +3,12 @@ package libraryelements
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
"github.com/grafana/grafana/pkg/services/folder"
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements/model"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/folder"
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements/model"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
@@ -83,12 +81,12 @@ func TestIntegration_PatchLibraryElement(t *testing.T) {
|
||||
ConnectedDashboards: 0,
|
||||
Created: sc.initialResult.Result.Meta.Created,
|
||||
Updated: result.Result.Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: "signed_in_user",
|
||||
AvatarUrl: "/avatar/37524e1eb8b3e32850b57db0a19af93b",
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol/acimpl"
|
||||
acmock "github.com/grafana/grafana/pkg/services/accesscontrol/mock"
|
||||
@@ -118,7 +117,7 @@ func TestIntegration_GetLibraryPanelConnections(t *testing.T) {
|
||||
ElementID: 1,
|
||||
ConnectionID: 1,
|
||||
Created: res.Result[0].Created,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
)
|
||||
|
||||
type LibraryConnectionKind int
|
||||
@@ -99,8 +97,8 @@ type LibraryElementDTOMeta struct {
|
||||
Created time.Time `json:"created"`
|
||||
Updated time.Time `json:"updated"`
|
||||
|
||||
CreatedBy librarypanel.LibraryElementDTOMetaUser `json:"createdBy"`
|
||||
UpdatedBy librarypanel.LibraryElementDTOMetaUser `json:"updatedBy"`
|
||||
CreatedBy LibraryElementDTOMetaUser `json:"createdBy"`
|
||||
UpdatedBy LibraryElementDTOMetaUser `json:"updatedBy"`
|
||||
}
|
||||
|
||||
// libraryElementConnection is the model for library element connections.
|
||||
@@ -126,16 +124,22 @@ type LibraryElementConnectionWithMeta struct {
|
||||
CreatedByEmail string
|
||||
}
|
||||
|
||||
type LibraryElementDTOMetaUser struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
AvatarUrl string `json:"avatarUrl"`
|
||||
}
|
||||
|
||||
// LibraryElementConnectionDTO is the frontend DTO for element connections.
|
||||
type LibraryElementConnectionDTO struct {
|
||||
// Deprecated: this field will be removed in the future
|
||||
ID int64 `json:"id"`
|
||||
Kind int64 `json:"kind"`
|
||||
ElementID int64 `json:"elementId"`
|
||||
ConnectionID int64 `json:"connectionId"`
|
||||
ConnectionUID string `json:"connectionUid"`
|
||||
Created time.Time `json:"created"`
|
||||
CreatedBy librarypanel.LibraryElementDTOMetaUser `json:"createdBy"`
|
||||
ID int64 `json:"id"`
|
||||
Kind int64 `json:"kind"`
|
||||
ElementID int64 `json:"elementId"`
|
||||
ConnectionID int64 `json:"connectionId"`
|
||||
ConnectionUID string `json:"connectionUid"`
|
||||
Created time.Time `json:"created"`
|
||||
CreatedBy LibraryElementDTOMetaUser `json:"createdBy"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol/actest"
|
||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
@@ -656,12 +655,12 @@ func toLibraryElement(t *testing.T, res model.LibraryElementDTO) libraryElement
|
||||
ConnectedDashboards: res.Meta.ConnectedDashboards,
|
||||
Created: res.Meta.Created,
|
||||
Updated: res.Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: res.Meta.CreatedBy.Id,
|
||||
Name: res.Meta.CreatedBy.Name,
|
||||
AvatarUrl: res.Meta.CreatedBy.AvatarUrl,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: res.Meta.UpdatedBy.Id,
|
||||
Name: res.Meta.UpdatedBy.Name,
|
||||
AvatarUrl: res.Meta.UpdatedBy.AvatarUrl,
|
||||
@@ -694,12 +693,12 @@ func getExpected(t *testing.T, res model.LibraryElementDTO, UID string, name str
|
||||
ConnectedDashboards: 0,
|
||||
Created: res.Meta.Created,
|
||||
Updated: res.Meta.Updated,
|
||||
CreatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
CreatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
},
|
||||
UpdatedBy: librarypanel.LibraryElementDTOMetaUser{
|
||||
UpdatedBy: model.LibraryElementDTOMetaUser{
|
||||
Id: 1,
|
||||
Name: userInDbName,
|
||||
AvatarUrl: userInDbAvatar,
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
VizPanel,
|
||||
isSceneObject,
|
||||
} from '@grafana/scenes';
|
||||
import { Panel } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { Panel } from '@grafana/schema';
|
||||
import { OptionFilter } from 'app/features/dashboard/components/PanelEditor/OptionsPaneOptions';
|
||||
import { getLastUsedDatasourceFromStorage } from 'app/features/dashboard/utils/dashboard';
|
||||
import { saveLibPanel } from 'app/features/library-panels/state/api';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SceneTimeRange, VizPanel } from '@grafana/scenes';
|
||||
import { LibraryPanel } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { LibraryPanel } from '@grafana/schema';
|
||||
|
||||
import { activateFullSceneTree } from '../utils/test-utils';
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { GrafanaTheme2 } from '@grafana/data';
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
import { reportInteraction } from '@grafana/runtime';
|
||||
import { SceneVariable, SceneVariableState } from '@grafana/scenes';
|
||||
import { Dashboard } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { Dashboard } from '@grafana/schema';
|
||||
import { CollapsableSection, Icon, Spinner, Stack, Tooltip, useStyles2 } from '@grafana/ui';
|
||||
|
||||
import { VariableUsagesButton } from '../../variables/VariableUsagesButton';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { AsyncState } from 'react-use/lib/useAsync';
|
||||
|
||||
import { selectors as e2eSelectors } from '@grafana/e2e-selectors';
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
import { Dashboard } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { Dashboard } from '@grafana/schema';
|
||||
import { Spec as DashboardV2Spec } from '@grafana/schema/dist/esm/schema/dashboard/v2';
|
||||
import { Alert, Label, RadioButtonGroup, Stack, Switch } from '@grafana/ui';
|
||||
import { DashboardJson } from 'app/features/manage-dashboards/types';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { config } from '@grafana/runtime';
|
||||
import { SceneTimeRange } from '@grafana/scenes';
|
||||
import { Dashboard } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { Dashboard } from '@grafana/schema';
|
||||
import {
|
||||
Spec as DashboardV2Spec,
|
||||
defaultQueryGroupKind,
|
||||
|
||||
@@ -7,7 +7,7 @@ import AutoSizer from 'react-virtualized-auto-sizer';
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
import { config } from '@grafana/runtime';
|
||||
import { SceneComponentProps, SceneObjectBase } from '@grafana/scenes';
|
||||
import { Dashboard } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { Dashboard } from '@grafana/schema';
|
||||
import { Spec as DashboardV2Spec } from '@grafana/schema/dist/esm/schema/dashboard/v2';
|
||||
import { Button, ClipboardButton, CodeEditor, Field, Modal, Stack, Switch } from '@grafana/ui';
|
||||
import { ObjectMeta } from 'app/features/apiserver/types';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { t } from '@grafana/i18n';
|
||||
import { SceneComponentProps, SceneObjectBase, SceneObjectRef, VizPanel } from '@grafana/scenes';
|
||||
import { LibraryPanel } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { LibraryPanel } from '@grafana/schema';
|
||||
import { ShareLibraryPanel } from 'app/features/dashboard/components/ShareModal/ShareLibraryPanel';
|
||||
import { shareDashboardType } from 'app/features/dashboard/components/ShareModal/utils';
|
||||
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||
|
||||
@@ -5,7 +5,7 @@ import { selectors as e2eSelectors } from '@grafana/e2e-selectors';
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
import { getBackendSrv } from '@grafana/runtime';
|
||||
import { SceneComponentProps, sceneGraph, SceneObjectBase, SceneObjectRef, VizPanel } from '@grafana/scenes';
|
||||
import { Dashboard } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { Dashboard } from '@grafana/schema';
|
||||
import { Button, ClipboardButton, Field, Input, Modal, RadioButtonGroup, Stack } from '@grafana/ui';
|
||||
import { notifyApp } from 'app/core/actions';
|
||||
import { createSuccessNotification } from 'app/core/copy/appNotification';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { NavModelItem } from '@grafana/data';
|
||||
import { LibraryPanel } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { LibraryPanel } from '@grafana/schema';
|
||||
import { DashboardModel } from 'app/features/dashboard/state/DashboardModel';
|
||||
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { useAsync, useDebounce } from 'react-use';
|
||||
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
import { FetchError, isFetchError } from '@grafana/runtime';
|
||||
import { LibraryPanel } from '@grafana/schema/dist/esm/index.gen';
|
||||
import { LibraryPanel } from '@grafana/schema';
|
||||
import { Button, Field, Input, Modal, Stack } from '@grafana/ui';
|
||||
import { FolderPicker } from 'app/core/components/Select/FolderPicker';
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { AnyAction } from '@reduxjs/toolkit';
|
||||
import { Dispatch } from 'react';
|
||||
|
||||
import { LibraryPanel } from '@grafana/schema';
|
||||
import { LibraryElementDTOMetaUser } from '@grafana/schema/src/raw/librarypanel/x/librarypanel_types.gen';
|
||||
import { LibraryPanel, LibraryElementDTOMetaUser } from '@grafana/schema';
|
||||
|
||||
import { PanelModel } from '../dashboard/state/PanelModel';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user