diff --git a/api/api.go b/api/api.go
index ac66de1..dc88ad5 100644
--- a/api/api.go
+++ b/api/api.go
@@ -14,6 +14,7 @@ type Datapoint struct {
}
var defaultPeriod = 7
+var defaultLimit = 10
// log fatal errors
func checkError(err error) {
diff --git a/api/browsers.go b/api/browsers.go
index 4fe9315..1cfb5d8 100644
--- a/api/browsers.go
+++ b/api/browsers.go
@@ -30,10 +30,10 @@ var GetBrowsersHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Re
WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL ? DAY) AND browser_name IS NOT NULL
GROUP BY browser_name
ORDER BY count DESC
- LIMIT 10`)
+ LIMIT ?`)
checkError(err)
defer stmt.Close()
- rows, err := stmt.Query(period)
+ rows, err := stmt.Query(period, defaultLimit)
checkError(err)
defer rows.Close()
diff --git a/api/countries.go b/api/countries.go
index 4ca90ad..93582b2 100644
--- a/api/countries.go
+++ b/api/countries.go
@@ -30,10 +30,10 @@ var GetCountriesHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.R
WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL ? DAY) AND country IS NOT NULL
GROUP BY country
ORDER BY count DESC
- LIMIT 10`)
+ LIMIT ?`)
checkError(err)
defer stmt.Close()
- rows, err := stmt.Query(period)
+ rows, err := stmt.Query(period, defaultLimit)
checkError(err)
defer rows.Close()
diff --git a/api/languages.go b/api/languages.go
index 4f5185c..89d33d7 100644
--- a/api/languages.go
+++ b/api/languages.go
@@ -27,11 +27,12 @@ var GetLanguagesHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.R
FROM visits
WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL ? DAY)
GROUP BY browser_language
- ORDER BY count DESC`)
+ ORDER BY count DESC
+ LIMIT ?`)
checkError(err)
defer stmt.Close()
- rows, err := stmt.Query(period)
+ rows, err := stmt.Query(period, defaultLimit)
checkError(err)
defer rows.Close()
diff --git a/api/pageviews.go b/api/pageviews.go
index 48ac5fc..a3bbe92 100644
--- a/api/pageviews.go
+++ b/api/pageviews.go
@@ -18,11 +18,12 @@ var GetPageviewsHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.R
FROM visits
WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL ? DAY)
GROUP BY path
- ORDER BY pageviews DESC`)
+ ORDER BY pageviews DESC
+ LIMIT ?`)
checkError(err)
defer stmt.Close()
- rows, err := stmt.Query(period)
+ rows, err := stmt.Query(period, defaultLimit)
checkError(err)
defer rows.Close()
diff --git a/api/screen-resolutions.go b/api/screen-resolutions.go
index 54d2194..91513b0 100644
--- a/api/screen-resolutions.go
+++ b/api/screen-resolutions.go
@@ -29,10 +29,11 @@ var GetScreenResolutionsHandler = http.HandlerFunc(func(w http.ResponseWriter, r
FROM visits
WHERE timestamp >= DATE_SUB(CURRENT_TIMESTAMP, INTERVAL ? DAY)
GROUP BY screen_resolution
- ORDER BY count DESC`)
+ ORDER BY count DESC
+ LIMIT ?`)
checkError(err)
defer stmt.Close()
- rows, err := stmt.Query(period)
+ rows, err := stmt.Query(period, defaultLimit)
checkError(err)
defer rows.Close()
diff --git a/assets/js/components/HeaderBar.js b/assets/js/components/HeaderBar.js
new file mode 100644
index 0000000..861f458
--- /dev/null
+++ b/assets/js/components/HeaderBar.js
@@ -0,0 +1,22 @@
+'use strict'
+
+import { h, render, Component } from 'preact';
+import LogoutButton from '../components/LogoutButton.js';
+
+class HeaderBar extends Component {
+ render() {
+ const rightContent = this.props.showLogout ? Ana open web analytics
+