本文整理汇总了Golang中github.com/outbrain/orchestrator/Godeps/_workspace/src/github.com/martini-contrib/render.Render类的典型用法代码示例。如果您正苦于以下问题:Golang Render类的具体用法?Golang Render怎么用?Golang Render使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Render类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: SetHostAttribute
// SetHostAttribute is a utility method that allows per-host key-value store.
func (this *HttpAgentsAPI) SetHostAttribute(params martini.Params, r render.Render, req *http.Request) {
err := attributes.SetHostAttributes(params["host"], params["attrVame"], params["attrValue"])
if err != nil {
r.JSON(200, &APIResponse{Code: ERROR, Message: fmt.Sprintf("%+v", err)})
return
}
r.JSON(200, (err == nil))
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:11,代码来源:agents_api.go
示例2: Seeds
func (this *HttpWeb) Seeds(params martini.Params, r render.Render, req *http.Request, user auth.User) {
r.HTML(200, "templates/seeds", map[string]interface{}{
"agentsHttpActive": config.Config.ServeAgentsHttp,
"title": "seeds",
"activePage": "agents",
"authorizedForAction": isAuthorizedForAction(req, user),
"userId": getUserId(req, user),
"autoshow_problems": false,
})
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:10,代码来源:web.go
示例3: GetHostAttributeByAttributeName
// GetHostAttributeByAttributeName returns a host attribute
func (this *HttpAgentsAPI) GetHostAttributeByAttributeName(params martini.Params, r render.Render, req *http.Request) {
output, err := attributes.GetHostAttributesByAttribute(params["attr"], req.URL.Query().Get("valueMatch"))
if err != nil {
r.JSON(200, &APIResponse{Code: ERROR, Message: fmt.Sprintf("%+v", err)})
return
}
r.JSON(200, output)
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:12,代码来源:agents_api.go
示例4: ClusterByAlias
func (this *HttpWeb) ClusterByAlias(params martini.Params, r render.Render, req *http.Request, user auth.User) {
clusterName, err := inst.GetClusterByAlias(params["clusterAlias"])
// Willing to accept the case of multiple clusters; we just present one
if clusterName == "" && err != nil {
r.JSON(200, &APIResponse{Code: ERROR, Message: fmt.Sprintf("%+v", err)})
return
}
params["clusterName"] = clusterName
this.Cluster(params, r, req, user)
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:11,代码来源:web.go
示例5: ClustersAnalysis
func (this *HttpWeb) ClustersAnalysis(params martini.Params, r render.Render, req *http.Request, user auth.User) {
r.HTML(200, "templates/clusters_analysis", map[string]interface{}{
"agentsHttpActive": config.Config.ServeAgentsHttp,
"title": "clusters",
"activePage": "cluster",
"autoshow_problems": false,
"authorizedForAction": isAuthorizedForAction(req, user),
"userId": getUserId(req, user),
"removeTextFromHostnameDisplay": config.Config.RemoveTextFromHostnameDisplay,
})
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:11,代码来源:web.go
示例6: Cluster
func (this *HttpWeb) Cluster(params martini.Params, r render.Render, req *http.Request, user auth.User) {
r.HTML(200, "templates/cluster", map[string]interface{}{
"agentsHttpActive": config.Config.ServeAgentsHttp,
"title": "cluster",
"activePage": "cluster",
"clusterName": params["clusterName"],
"autoshow_problems": true,
"contextMenuVisible": true,
"pseudoGTIDModeEnabled": (config.Config.PseudoGTIDPattern != ""),
"authorizedForAction": isAuthorizedForAction(req, user),
"userId": getUserId(req, user),
"removeTextFromHostnameDisplay": config.Config.RemoveTextFromHostnameDisplay,
"compactDisplay": req.URL.Query().Get("compact"),
})
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:15,代码来源:web.go
示例7: Search
func (this *HttpWeb) Search(params martini.Params, r render.Render, req *http.Request, user auth.User) {
searchString := params["searchString"]
if searchString == "" {
searchString = req.URL.Query().Get("s")
}
r.HTML(200, "templates/search", map[string]interface{}{
"agentsHttpActive": config.Config.ServeAgentsHttp,
"title": "search",
"activePage": "search",
"searchString": searchString,
"authorizedForAction": isAuthorizedForAction(req, user),
"userId": getUserId(req, user),
"autoshow_problems": false,
})
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:15,代码来源:web.go
示例8: LongQueries
func (this *HttpWeb) LongQueries(params martini.Params, r render.Render, req *http.Request, user auth.User) {
filter := params["filter"]
if filter == "" {
filter = req.URL.Query().Get("filter")
}
r.HTML(200, "templates/long_queries", map[string]interface{}{
"agentsHttpActive": config.Config.ServeAgentsHttp,
"title": "long queries",
"activePage": "queries",
"authorizedForAction": isAuthorizedForAction(req, user),
"userId": getUserId(req, user),
"autoshow_problems": false,
"filter": filter,
})
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:16,代码来源:web.go
示例9: Audit
func (this *HttpWeb) Audit(params martini.Params, r render.Render, req *http.Request, user auth.User) {
page, err := strconv.Atoi(params["page"])
if err != nil {
page = 0
}
r.HTML(200, "templates/audit", map[string]interface{}{
"agentsHttpActive": config.Config.ServeAgentsHttp,
"title": "audit",
"activePage": "audit",
"authorizedForAction": isAuthorizedForAction(req, user),
"userId": getUserId(req, user),
"autoshow_problems": false,
"page": page,
"auditHostname": params["host"],
"auditPort": params["port"],
})
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:18,代码来源:web.go
示例10: AgentsInstances
// AgentsInstances provides list of assumed MySQL instances (host:port)
func (this *HttpAgentsAPI) AgentsInstances(params martini.Params, r render.Render, req *http.Request) string {
agents, err := agent.ReadAgents()
hostnames := []string{}
for _, agent := range agents {
hostnames = append(hostnames, fmt.Sprintf("%s:%d", agent.Hostname, agent.MySQLPort))
}
if err != nil {
r.JSON(200, &APIResponse{Code: ERROR, Message: fmt.Sprintf("%+v", err)})
return ""
}
if req.URL.Query().Get("format") == "txt" {
return strings.Join(hostnames, "\n")
} else {
r.JSON(200, hostnames)
}
return ""
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:20,代码来源:agents_api.go
示例11: AuditFailureDetection
func (this *HttpWeb) AuditFailureDetection(params martini.Params, r render.Render, req *http.Request, user auth.User) {
page, err := strconv.Atoi(params["page"])
if err != nil {
page = 0
}
detectionId, err := strconv.ParseInt(params["id"], 10, 0)
if err != nil {
detectionId = 0
}
r.HTML(200, "templates/audit_failure_detection", map[string]interface{}{
"agentsHttpActive": config.Config.ServeAgentsHttp,
"title": "audit-failure-detection",
"activePage": "audit",
"authorizedForAction": isAuthorizedForAction(req, user),
"userId": getUserId(req, user),
"autoshow_problems": false,
"page": page,
"detectionId": detectionId,
})
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:21,代码来源:web.go
示例12: SubmitAgent
// SubmitAgent registeres an agent. It is initiated by an agent to register itself.
func (this *HttpAgentsAPI) SubmitAgent(params martini.Params, r render.Render) {
port, err := strconv.Atoi(params["port"])
if err != nil {
r.JSON(200, &APIResponse{Code: ERROR, Message: err.Error()})
return
}
output, err := agent.SubmitAgent(params["host"], port, params["token"])
if err != nil {
r.JSON(200, &APIResponse{Code: ERROR, Message: err.Error()})
return
}
r.JSON(200, output)
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:15,代码来源:agents_api.go
示例13: ClusterByInstance
func (this *HttpWeb) ClusterByInstance(params martini.Params, r render.Render, req *http.Request, user auth.User) {
instanceKey, err := this.getInstanceKey(params["host"], params["port"])
if err != nil {
r.JSON(200, &APIResponse{Code: ERROR, Message: err.Error()})
return
}
instance, found, err := inst.ReadInstance(&instanceKey)
if (!found) || (err != nil) {
r.JSON(200, &APIResponse{Code: ERROR, Message: fmt.Sprintf("Cannot read instance: %+v", instanceKey)})
return
}
// Willing to accept the case of multiple clusters; we just present one
if instance.ClusterName == "" && err != nil {
r.JSON(200, &APIResponse{Code: ERROR, Message: fmt.Sprintf("%+v", err)})
return
}
params["clusterName"] = instance.ClusterName
this.Cluster(params, r, req, user)
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:21,代码来源:web.go
示例14: AgentPing
func (this *HttpAgentsAPI) AgentPing(params martini.Params, r render.Render, req *http.Request) {
r.JSON(200, "OK")
}
开发者ID:rlowe,项目名称:orchestrator,代码行数:3,代码来源:agents_api.go
注:本文中的github.com/outbrain/orchestrator/Godeps/_workspace/src/github.com/martini-contrib/render.Render类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论