updating dashboard dependency version and resolve conflicts

Signed-off-by: junotx <junotx@126.com>
This commit is contained in:
junotx
2021-03-16 10:21:26 +08:00
parent 0c1f994695
commit a8b9211416
131 changed files with 75 additions and 21648 deletions

View File

@@ -18,6 +18,7 @@ package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/json"
"kubesphere.io/monitoring-dashboard/api/v1alpha1/panels"
)
@@ -49,12 +50,60 @@ type Time struct {
// Supported panel type
type Panel struct {
// It can only be one of the following three types
// The panel row
Row panels.Row `json:",inline"`
Row *panels.Row `json:",inline"`
// The panel graph
Graph panels.Graph `json:",inline"`
Graph *panels.Graph `json:",inline"`
// The panel singlestat
SingleStat panels.SingleStat `json:",inline"`
SingleStat *panels.SingleStat `json:",inline"`
}
type PanelType string
const (
PanelRow PanelType = "row"
PanelGraph PanelType = "graph"
PanelSingleStat PanelType = "singlestat"
)
func (p *Panel) UnmarshalJSON(data []byte) error {
if len(data) == 0 {
return nil
}
var t struct{ Type PanelType }
err := json.Unmarshal(data, &t)
if err != nil {
return err
}
switch t.Type {
case PanelRow:
p.Row = &panels.Row{}
return json.Unmarshal(data, p.Row)
case PanelGraph:
p.Graph = &panels.Graph{}
return json.Unmarshal(data, p.Graph)
case PanelSingleStat:
p.SingleStat = &panels.SingleStat{}
return json.Unmarshal(data, p.SingleStat)
}
return json.Unmarshal(data, p)
}
func (p *Panel) MarshalJSON() (data []byte, err error) {
switch {
case p.Row != nil:
return json.Marshal(p.Row)
case p.Graph != nil:
return json.Marshal(p.Graph)
case p.SingleStat != nil:
return json.Marshal(p.SingleStat)
}
return json.Marshal(p)
}
// Templating defines a variable, which can be used as a placeholder in query

View File

@@ -22,6 +22,7 @@ package v1alpha1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
"kubesphere.io/monitoring-dashboard/api/v1alpha1/panels"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@@ -171,9 +172,21 @@ func (in *DashboardSpec) DeepCopy() *DashboardSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Panel) DeepCopyInto(out *Panel) {
*out = *in
out.Row = in.Row
in.Graph.DeepCopyInto(&out.Graph)
in.SingleStat.DeepCopyInto(&out.SingleStat)
if in.Row != nil {
in, out := &in.Row, &out.Row
*out = new(panels.Row)
**out = **in
}
if in.Graph != nil {
in, out := &in.Graph, &out.Graph
*out = new(panels.Graph)
(*in).DeepCopyInto(*out)
}
if in.SingleStat != nil {
in, out := &in.SingleStat, &out.SingleStat
*out = new(panels.SingleStat)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Panel.