package service import ( "fmt" "go-admin/app/observe/service/dto" "go-admin/utils" ) type WeaveScope struct { // service.Service utils.OtService } const menuString = ` [ { "hide_if_empty":false, "name":"容器/部署", "options":[ { "defaultValue":"application", "id":"system", "options":[ { "label":"All", "value":"all" }, { "label":"System containers", "value":"system" }, { "label":"Application containers", "value":"application" } ] }, { "defaultValue":"running", "id":"stopped", "options":[ { "label":"Stopped containers", "value":"stopped" }, { "label":"Running containers", "value":"running" }, { "label":"Both", "value":"both" } ] }, { "defaultValue":"hide", "id":"pseudo", "options":[ { "label":"显示非容器化", "value":"show" }, { "label":"隐藏非容器化", "value":"hide" } ] } ], "rank":2, "stats":{ "edge_count":22, "filtered_nodes":1, "node_count":300, "nonpseudo_node_count":297 }, "sub_topologies":[ { "hide_if_empty":false, "name":"by DNS name", "options":[ { "defaultValue":"application", "id":"system", "options":[ { "label":"All", "value":"all" }, { "label":"System containers", "value":"system" }, { "label":"Application containers", "value":"application" } ] }, { "defaultValue":"running", "id":"stopped", "options":[ { "label":"Stopped containers", "value":"stopped" }, { "label":"Running containers", "value":"running" }, { "label":"Both", "value":"both" } ] }, { "defaultValue":"hide", "id":"pseudo", "options":[ { "label":"Show uncontained", "value":"show" }, { "label":"Hide uncontained", "value":"hide" } ] } ], "rank":0, "stats":{ "edge_count":20, "filtered_nodes":1, "node_count":252, "nonpseudo_node_count":249 }, "url":"/api/topology/containers-by-hostname" }, { "hide_if_empty":false, "name":"by image", "options":[ { "defaultValue":"application", "id":"system", "options":[ { "label":"All", "value":"all" }, { "label":"System containers", "value":"system" }, { "label":"Application containers", "value":"application" } ] }, { "defaultValue":"running", "id":"stopped", "options":[ { "label":"Stopped containers", "value":"stopped" }, { "label":"Running containers", "value":"running" }, { "label":"Both", "value":"both" } ] }, { "defaultValue":"hide", "id":"pseudo", "options":[ { "label":"Show uncontained", "value":"show" }, { "label":"Hide uncontained", "value":"hide" } ] } ], "rank":0, "stats":{ "edge_count":22, "filtered_nodes":1, "node_count":34, "nonpseudo_node_count":31 }, "url":"/api/topology/containers-by-image" } ], "url":"/api/topology/containers" }, { "hide_if_empty":false, "name":"服务拓扑", "options":null, "rank":4, "stats":{ "edge_count":3, "filtered_nodes":0, "node_count":3, "nonpseudo_node_count":1 }, "sub_topologies":[ { "hide_if_empty":false, "name":"Weave Net", "options":null, "rank":0, "stats":{ "edge_count":0, "filtered_nodes":0, "node_count":1, "nonpseudo_node_count":1 }, "url":"/api/topology/weave" } ], "url":"/api/v1/ws/topology/services/ws?t=5s&app_alias=%s" }, { "hide_if_empty":true, "name":"Pods", "options":[ { "defaultValue":"hide", "id":"snapshot", "options":[ { "label":"Show snapshots", "value":"show" }, { "label":"Hide snapshots", "value":"hide" } ] }, { "defaultValue":"hide", "id":"storage", "options":[ { "label":"Show storage", "value":"show" }, { "label":"Hide storage", "value":"hide" } ] }, { "defaultValue":"hide", "id":"pseudo", "options":[ { "label":"Show unmanaged", "value":"show" }, { "label":"Hide unmanaged", "value":"hide" } ] } ], "rank":3, "stats":{ "edge_count":0, "filtered_nodes":0, "node_count":0, "nonpseudo_node_count":0 }, "sub_topologies":[ { "hide_if_empty":true, "name":"Controllers", "options":[ { "defaultValue":"hide", "id":"pseudo", "options":[ { "label":"Show unmanaged", "value":"show" }, { "label":"Hide unmanaged", "value":"hide" } ] } ], "rank":0, "stats":{ "edge_count":0, "filtered_nodes":0, "node_count":0, "nonpseudo_node_count":0 }, "url":"/api/topology/kube-controllers/%s" }, { "hide_if_empty":true, "name":"Services", "options":[ { "defaultValue":"hide", "id":"pseudo", "options":[ { "label":"Show unmanaged", "value":"show" }, { "label":"Hide unmanaged", "value":"hide" } ] } ], "rank":0, "stats":{ "edge_count":0, "filtered_nodes":0, "node_count":0, "nonpseudo_node_count":0 }, "url":"/api/topology/services" } ], "url":"/api/topology/pods" }, { "hide_if_empty":true, "name":"进程", "options":[ { "defaultValue":"hide", "id":"unconnected", "options":[ { "label":"显示未连接", "value":"show" }, { "label":"隐藏未连接", "value":"hide" } ] } ], "rank":1, "stats":{ "edge_count":24, "filtered_nodes":0, "node_count":316, "nonpseudo_node_count":314 }, "url":"/api/topology/processes" }, { "hide_if_empty":true, "name":"Services", "options":[ { "defaultValue":"hide", "id":"pseudo", "options":[ { "label":"Show unmanaged", "value":"show" }, { "label":"Hide unmanaged", "value":"hide" } ] } ], "rank":3, "stats":{ "edge_count":0, "filtered_nodes":0, "node_count":0, "nonpseudo_node_count":0 }, "url":"/api/topology/swarm-services" }, { "hide_if_empty":true, "name":"Tasks", "options":[ { "defaultValue":"hide", "id":"pseudo", "options":[ { "label":"Show unmanaged", "value":"show" }, { "label":"Hide unmanaged", "value":"hide" } ] } ], "rank":3, "stats":{ "edge_count":0, "filtered_nodes":0, "node_count":0, "nonpseudo_node_count":0 }, "sub_topologies":[ { "hide_if_empty":true, "name":"Services", "options":[ { "defaultValue":"hide", "id":"pseudo", "options":[ { "label":"Show unmanaged", "value":"show" }, { "label":"Hide unmanaged", "value":"hide" } ] } ], "rank":0, "stats":{ "edge_count":0, "filtered_nodes":0, "node_count":0, "nonpseudo_node_count":0 }, "url":"/api/topology/ecs-services" } ], "url":"/api/topology/ecs-tasks" } ] ` const menuStringServiceOnly = ` [ { "hide_if_empty":false, "name":"服务拓扑", "options":null, "rank":4, "stats":{ "edge_count":19, "filtered_nodes":0, "node_count":16, "nonpseudo_node_count":16 }, "sub_topologies":[], "url":"/api/v1/ws/topology/services" } ] ` // GetPage 获取UrlMapping列表 func (e *WeaveScope) GetMenu(req *dto.ScopeMenuResp) string { return fmt.Sprintf(menuStringServiceOnly) // req.AppAlias, req.Live, // req.AppAlias, req.Live, } //"url":"/api/v1/ws/topology/services/ws?system=application&t=5s&app_alias=%s&start_time=%v&end_time=%v&live=%v" // "url":"/api/v1/ss/topology/services/ws?system=application&t=5s&app_alias=%s&live=%v"