[v3.2] Add grafana dashboard importing API (#11)

* Add API to import grafana templates to kubesphere dashboard
* Merge and fix the latest codes from kubesphere #2501

Signed-off-by: zhu733756 <talonzhu@yunify.com>
This commit is contained in:
zhu733756
2021-08-16 11:41:29 +08:00
committed by zhu733756
parent 9df6df5544
commit 242ceb54f6
217 changed files with 119028 additions and 96 deletions

View File

@@ -5,15 +5,15 @@ package panels
// Graph visualizes range query results into a linear graph
type Graph struct {
// Name of the graph panel
Title string `json:"title,omitempty"`
//Title string `json:"title,omitempty"`
// Must be `graph`
Type string `json:"type"`
//Type string `json:"type"`
// Panel ID
Id int64 `json:"id,omitempty"`
//Id int64 `json:"id,omitempty"`
// Panel description
Description string `json:"description,omitempty"`
// A collection of queries
Targets []Target `json:"targets,omitempty"`
//Targets []Target `json:"targets,omitempty"`
// Display as a bar chart
Bars bool `json:"bars,omitempty"`
// Set series color

View File

@@ -5,9 +5,9 @@ package panels
// Row groups relevant charts
type Row struct {
// Name of the row panel
Title string `json:"title,omitempty"`
//Title string `json:"title,omitempty"`
// Must be `row`
Type string `json:"type"`
//Type string `json:"type"`
// Panel ID
Id int64 `json:"id,omitempty"`
//Id int64 `json:"id,omitempty"`
}

View File

@@ -5,15 +5,15 @@ package panels
// SingleStat shows instant query result
type SingleStat struct {
// Name of the signlestat panel
Title string `json:"title,omitempty"`
//Title string `json:"title,omitempty"`
// Must be `singlestat`
Type string `json:"type"`
//Type string `json:"type"`
// Panel ID
Id int64 `json:"id,omitempty"`
//Id int64 `json:"id,omitempty"`
// A collection of queries
Targets []Target `json:"targets,omitempty"`
//Targets []Target `json:"targets,omitempty"`
// Limit the decimal numbers
Decimals int64 `json:"decimals,omitempty"`
Decimals *int64 `json:"decimals,omitempty"`
// Display unit
Format string `json:"format,omitempty"`
}

View File

@@ -25,11 +25,6 @@ import ()
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Graph) DeepCopyInto(out *Graph) {
*out = *in
if in.Targets != nil {
in, out := &in.Targets, &out.Targets
*out = make([]Target, len(*in))
copy(*out, *in)
}
if in.Colors != nil {
in, out := &in.Colors, &out.Colors
*out = make([]string, len(*in))
@@ -70,10 +65,10 @@ func (in *Row) DeepCopy() *Row {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SingleStat) DeepCopyInto(out *SingleStat) {
*out = *in
if in.Targets != nil {
in, out := &in.Targets, &out.Targets
*out = make([]Target, len(*in))
copy(*out, *in)
if in.Decimals != nil {
in, out := &in.Decimals, &out.Decimals
*out = new(int64)
**out = **in
}
}