From adc26166f46fc76b134d6455846dc73d838f92a6 Mon Sep 17 00:00:00 2001 From: Azareal Date: Sat, 18 May 2019 16:50:43 +1000 Subject: [PATCH] Add a route exclusion flag to the analytics routes pane. Improve the styling for chart legends and fix some broken ones. Rename analyticsRowsToNameMap to analyticsRowsToRefMap. --- routes/panel/analytics.go | 20 ++++++++++++++++++-- themes/cosora/public/main.css | 2 +- themes/cosora/public/panel.css | 8 ++++++-- themes/nox/public/panel.css | 3 +++ themes/shadow/public/main.css | 19 +++++++------------ themes/shadow/public/panel.css | 4 ++++ themes/tempra_simple/public/main.css | 11 +++++------ themes/tempra_simple/public/panel.css | 4 ++++ 8 files changed, 48 insertions(+), 23 deletions(-) diff --git a/routes/panel/analytics.go b/routes/panel/analytics.go index 7dc1bbd6..b54d2757 100644 --- a/routes/panel/analytics.go +++ b/routes/panel/analytics.go @@ -608,7 +608,7 @@ func AnalyticsActiveMemory(w http.ResponseWriter, r *http.Request, user c.User) return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage, "panel_analytics_right", "analytics", "panel_analytics_active_memory", pi}) } -func analyticsRowsToNameMap(rows *sql.Rows) (map[string]int, error) { +func analyticsRowsToRefMap(rows *sql.Rows) (map[string]int, error) { nameMap := make(map[string]int) defer rows.Close() for rows.Next() { @@ -812,10 +812,23 @@ func AnalyticsRoutes(w http.ResponseWriter, r *http.Request, user c.User) c.Rout } ovList := analyticsVMapToOVList(vMap) + ex := strings.Split(r.FormValue("ex"), ",") + var inEx = func(name string) bool { + for _, e := range ex { + if e == name { + return true + } + } + return false + } + var vList [][]int64 var legendList []string var i int for _, ovitem := range ovList { + if inEx(ovitem.name) { + continue + } var viewList []int64 for _, value := range revLabelList { viewList = append(viewList, ovitem.viewMap[value]) @@ -833,6 +846,9 @@ func AnalyticsRoutes(w http.ResponseWriter, r *http.Request, user c.User) c.Rout // TODO: Sort this slice var routeItems []c.PanelAnalyticsRoutesItem for route, count := range routeMap { + if inEx(route) { + continue + } routeItems = append(routeItems, c.PanelAnalyticsRoutesItem{ Route: route, Count: count, @@ -1051,7 +1067,7 @@ func AnalyticsReferrers(w http.ResponseWriter, r *http.Request, user c.User) c.R if err != nil && err != sql.ErrNoRows { return c.InternalError(err, w, r) } - refMap, err := analyticsRowsToNameMap(rows) + refMap, err := analyticsRowsToRefMap(rows) if err != nil { return c.InternalError(err, w, r) } diff --git a/themes/cosora/public/main.css b/themes/cosora/public/main.css index 45dbce8f..dcabd4df 100644 --- a/themes/cosora/public/main.css +++ b/themes/cosora/public/main.css @@ -161,7 +161,7 @@ li { margin-right: 3px; } -ul { +#main_menu { display: flex; list-style-type: none; padding: 0px; diff --git a/themes/cosora/public/panel.css b/themes/cosora/public/panel.css index 3bd98d30..763d7bcf 100644 --- a/themes/cosora/public/panel.css +++ b/themes/cosora/public/panel.css @@ -314,10 +314,10 @@ .ct-series-a .ct-bar, .ct-series-a .ct-line, .ct-series-a .ct-point, .ct-series-a .ct-slice-donut { stroke: hsl(359,98%,53%) !important; } -.ct-point { +.ct-series-a.ct-point { stroke: hsl(359,98%,23%) !important; } -.ct-point:hover { +.ct-series-a.ct-point:hover { stroke: hsl(359,98%,30%) !important; } /*.ct-chart-line { @@ -344,6 +344,10 @@ transform: translate(-100%) rotate(-45deg); white-space: nowrap; }*/ +.ct-legend { + margin-top: 0px; + margin-bottom: 0px; +} .analytics .colstack_head select { margin-top: -5px; } diff --git a/themes/nox/public/panel.css b/themes/nox/public/panel.css index 4e84b114..24f8013b 100644 --- a/themes/nox/public/panel.css +++ b/themes/nox/public/panel.css @@ -203,6 +203,9 @@ button, .formbutton, .panel_right_button:not(.has_inner_button), #panel_users .p .colstack_graph_holder .ct-grid { stroke: rgb(125,125,125); } +.ct-legend { + margin-left: 0px; +} #panel_setting .formlabel { display: none; diff --git a/themes/shadow/public/main.css b/themes/shadow/public/main.css index c9e192a4..8f7b306e 100644 --- a/themes/shadow/public/main.css +++ b/themes/shadow/public/main.css @@ -39,7 +39,7 @@ body { padding-bottom: 5px; } -ul { +#main_menu { list-style-type: none; background-color: var(--main-block-color); border-bottom: 1px solid var(--main-background-color); @@ -49,28 +49,26 @@ ul { height: 41px; } -li { +.menu_left, .menu_right li { float: left; height: 29.5px; padding-top: 12px; margin: 0; } - .menu_left { margin-right: 10px; } - .menu_right { float: right; } -#menu_overview { +#main_menu #menu_overview { margin-right: 13px; margin-left: 10px; font-size: 16px; } -.menu_left:not(#menu_overview) { +#main_menu .menu_left:not(#menu_overview) { font-size: 15px; padding-top: 13px; } @@ -78,12 +76,10 @@ li { .alert_bell { float: right; } - .menu_alerts { float: right; padding-top: 14px; } - .alert_counter { background-color: rgb(200,0,0); border-radius: 2px; @@ -93,7 +89,6 @@ li { position: relative; top: -1px; } - .alert_aftercounter { float: right; margin-right: 4px; @@ -1045,7 +1040,7 @@ blockquote:first-child { } @media(max-width: 830px) { - ul { + #main_menu { padding-left: 10px; padding-right: 0px; height: 35px; @@ -1125,7 +1120,7 @@ blockquote:first-child { } @media(min-width: 400px) { - ul { + #main_menu { height: 40px; } #menu_overview { @@ -1204,7 +1199,7 @@ blockquote:first-child { } @media(max-width: 324px) { - ul { + #main_menu { padding-left: 5px; } } diff --git a/themes/shadow/public/panel.css b/themes/shadow/public/panel.css index d972beb1..84162aeb 100644 --- a/themes/shadow/public/panel.css +++ b/themes/shadow/public/panel.css @@ -129,6 +129,10 @@ .ct-series-a .ct-bar, .ct-series-a .ct-line, .ct-series-a .ct-point, .ct-series-a .ct-slice-donut { stroke: hsl(359,98%,43%) !important; } +.ct-legend { + margin-top: 0px; + margin-bottom: 0px; +} .spamSelector + .timeRangeSelector { margin-left: 8px; } diff --git a/themes/tempra_simple/public/main.css b/themes/tempra_simple/public/main.css index 8f3d9c74..68189dfd 100644 --- a/themes/tempra_simple/public/main.css +++ b/themes/tempra_simple/public/main.css @@ -12,7 +12,7 @@ body { /* Patch for Edge, until they fix emojis in arial x.x */ @supports (-ms-ime-align:auto) { .user_content { font-family: Segoe UI Emoji, arial; } } -ul { +#main_menu { padding-left: 0px; padding-right: 0px; height: 36px; @@ -21,16 +21,17 @@ ul { background-color: rgb(252,252,252); margin-bottom: 12px; } -li { +.menu_left, .menu_right { height: 35px; padding-left: 10px; padding-top: 8px; padding-bottom: 8px; + padding-right: 10px; background: white; border-bottom: 1px solid hsl(0, 0%, 80%); } -li:hover { background: rgb(252,252,252); } -li a { +.menu_left:hover, .menu_right:hover { background: rgb(252,252,252); } +.menu_left a, .menu_right a { text-decoration: none; color: black; font-size: 17px; @@ -38,12 +39,10 @@ li a { .menu_left { float: left; border-right: 1px solid hsl(0, 0%, 80%); - padding-right: 10px; } .menu_right { float: right; border-left: 1px solid hsl(0, 0%, 80%); - padding-right: 10px; } #menu_overview { background: none; diff --git a/themes/tempra_simple/public/panel.css b/themes/tempra_simple/public/panel.css index ae981722..9d7974a3 100644 --- a/themes/tempra_simple/public/panel.css +++ b/themes/tempra_simple/public/panel.css @@ -173,6 +173,10 @@ background-color: white; border: 1px solid hsl(0,0%,85%); } +.ct-legend { + margin-top: 0px; + margin-bottom: 0px; +} .spamSelector + .timeRangeSelector { margin-left: 8px; }