add field description for the API
Signed-off-by: zhu733756 <talonzhu@yunify.com>
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
curl -d '{"grafanaDashboardUrl":"https://grafana.com/api/dashboards/7362/revisions/5/download"}' -H "Content-Type: application/json" localhost:9090/kapis/monitoring.kubesphere.io/v1alpha3/clusterdashboard/test1/template
|
curl -d '{"grafanaDashboardUrl":"https://grafana.com/api/dashboards/7362/revisions/5/download", "description":"this is a test dashboard."}' -H "Content-Type: application/json" localhost:9090/kapis/monitoring.kubesphere.io/v1alpha3/clusterdashboard/test1/template
|
||||||
@@ -383,6 +383,8 @@ func (h handler) handleGrafanaDashboardImport(req *restful.Request, resp *restfu
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
annotation := map[string]string{"kubesphere.io/description": entity.Description}
|
||||||
|
|
||||||
dashboard := monitoringdashboardv1alpha2.ClusterDashboard{
|
dashboard := monitoringdashboardv1alpha2.ClusterDashboard{
|
||||||
TypeMeta: v1.TypeMeta{
|
TypeMeta: v1.TypeMeta{
|
||||||
APIVersion: convertedDashboard.APIVersion,
|
APIVersion: convertedDashboard.APIVersion,
|
||||||
@@ -390,6 +392,7 @@ func (h handler) handleGrafanaDashboardImport(req *restful.Request, resp *restfu
|
|||||||
},
|
},
|
||||||
ObjectMeta: v1.ObjectMeta{
|
ObjectMeta: v1.ObjectMeta{
|
||||||
Name: convertedDashboard.Metadata["name"],
|
Name: convertedDashboard.Metadata["name"],
|
||||||
|
Annotations: annotation,
|
||||||
},
|
},
|
||||||
Spec: *convertedDashboard.Spec,
|
Spec: *convertedDashboard.Spec,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ type MetricData struct {
|
|||||||
type DashboardEntity struct {
|
type DashboardEntity struct {
|
||||||
GrafanaDashboardUrl string `json:"grafanaDashboardUrl,omitempty"`
|
GrafanaDashboardUrl string `json:"grafanaDashboardUrl,omitempty"`
|
||||||
GrafanaDashboardContent string `json:"grafanaDashboardContent,omitempty"`
|
GrafanaDashboardContent string `json:"grafanaDashboardContent,omitempty"`
|
||||||
|
Description string `json:"description,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// The first element is the timestamp, the second is the metric value.
|
// The first element is the timestamp, the second is the metric value.
|
||||||
|
|||||||
Reference in New Issue
Block a user