[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

@@ -20,6 +20,8 @@ package v1alpha3
import (
"net/http"
monitoringdashboardv1alpha2 "kubesphere.io/monitoring-dashboard/api/v1alpha2"
openpitrixoptions "kubesphere.io/kubesphere/pkg/simple/client/openpitrix"
"kubesphere.io/kubesphere/pkg/client/clientset/versioned"
@@ -504,6 +506,14 @@ func AddToContainer(c *restful.Container, k8sClient kubernetes.Interface, monito
Returns(http.StatusOK, respOK, monitoring.Metric{})).
Produces(restful.MIME_JSON)
ws.Route(ws.POST("/dashboard/template").
To(h.handleGrafanaDashboardImport).
Doc("Convert Grafana templates to KubeSphere dashboards.").
Metadata(restfulspec.KeyOpenAPITags, []string{constants.DashboardTag}).
Writes(monitoringdashboardv1alpha2.ClusterDashboard{}).
Returns(http.StatusOK, respOK, monitoringdashboardv1alpha2.ClusterDashboard{})).
Produces(restful.MIME_JSON)
c.Add(ws)
return nil
}