2020-10-25 21:27:28 +08:00
|
|
|
package clusterutils
|
2020-09-06 16:19:34 +08:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
|
|
|
|
"github.com/iwind/TeaGo/actions"
|
2020-10-25 21:27:28 +08:00
|
|
|
"net/http"
|
2020-09-06 16:19:34 +08:00
|
|
|
)
|
|
|
|
|
|
2020-10-25 21:27:28 +08:00
|
|
|
type ClustersHelper struct {
|
2020-09-06 16:19:34 +08:00
|
|
|
}
|
|
|
|
|
|
2020-10-25 21:27:28 +08:00
|
|
|
func NewClustersHelper() *ClustersHelper {
|
|
|
|
|
return &ClustersHelper{}
|
2020-09-06 16:19:34 +08:00
|
|
|
}
|
|
|
|
|
|
2020-10-25 21:27:28 +08:00
|
|
|
func (this *ClustersHelper) BeforeAction(action *actions.ActionObject) {
|
|
|
|
|
if action.Request.Method != http.MethodGet {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-06 16:19:34 +08:00
|
|
|
action.Data["teaMenu"] = "clusters"
|
|
|
|
|
|
|
|
|
|
selectedTabbar, _ := action.Data["mainTab"]
|
|
|
|
|
|
|
|
|
|
tabbar := actionutils.NewTabbar()
|
|
|
|
|
tabbar.Add("集群", "", "/clusters", "", selectedTabbar == "cluster")
|
2020-10-25 21:27:28 +08:00
|
|
|
tabbar.Add("SSH认证", "", "/clusters/grants", "", selectedTabbar == "grant")
|
2020-09-06 16:19:34 +08:00
|
|
|
actionutils.SetTabbar(action, tabbar)
|
|
|
|
|
}
|