diff --git a/.eslintrc.js b/.eslintrc.js index 8c8cf57..6482350 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,6 +7,12 @@ module.exports = { rules: { "no-console": process.env.NODE_ENV === "production" ? "error" : "warn", "no-debugger": process.env.NODE_ENV === "production" ? "error" : "warn", + "max-len": [ + "error", + { + ignoreUrls: true, + }, + ], "prettier/prettier": [ "error", { diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..70ff051 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +liberapay: owntracks.org diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fc4c49..3777c01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,36 +1,68 @@ -# 2.0.0-beta.6 (2019-12-14) +# Changelog -- Fix heatmap - the upgrade of `vue2-leaflet` from 2.2.1 to 2.3.0 added an `activated` attribute to layers causing the heatmap to not show +## 2.0.0-beta.10 (2020-02-07) -# 2.0.0-beta.5 (2019-12-14) +- Add "distance travelled" feature + +## 2.0.0-beta.9 (2020-02-06) + +- Support locale with language and region part (`en-GB`) +- Update docs (screenshot, changelog improvements, typo fix) +- Add funding information + +## 2.0.0-beta.8 (2020-01-26) + +- Add friendly device name and face images to location history popups +- Add missing `alt`/`title` to device face image +- Fix all JSDoc `@return` directives to `@returns` +- Use computed prop for device name in location popup +- Enable ESLint `max-len` rule + +## 2.0.0-beta.7 (2020-01-24) + +This release doesn't really affect end-users but greatly improves the development experience. + +- Add `jsconfig.json` +- Set `no-console`/`no-debugger` to `"warn"` in dev mode +- Linting and formatting: + - Separate npm scripts for linting and formatting + - Lint/format Markdown files + - Run lint on Travis CI +- Upgrade dependencies + +## 2.0.0-beta.6 (2019-12-14) + +- Fix heatmap - the upgrade of `vue2-leaflet` from 2.2.1 to 2.3.0 added an `activated` attribute to layers causing the heatmap to not show ([#18](https://github.com/owntracks/frontend/issues/18)) + +## 2.0.0-beta.5 (2019-12-14) - Add Leaflet popup close button background color transition - Add `$config` Vue instance property -- Improve accessibility +- Improve accessibility ([#9](https://github.com/owntracks/frontend/issues/9)) - Use configured locale for timestamp formatting - Upgrade dependencies -# 2.0.0-beta.4 (2019-12-14) +## 2.0.0-beta.4 (2019-12-14) -- Add support for time selection +- Add support for time selection ([#10](https://github.com/owntracks/frontend/issues/10)) - New date/time picker component is properly translated/localised and keyboard accessible - Config options are now `startDateTime`/`endDateTime` and format of URL parameters changed - Changed default start/end date and time to use local timezone - Fix missing translation of "[date] to [date]" - Update i18n development notes in `README.md` -# 2.0.0-beta.3 (2019-12-13) +## 2.0.0-beta.3 (2019-12-13) - Add i18 support (currently English and German, `locale` config option) - Add custom checkbox focus style -- Fix layer dropdown issues +- Fix layer dropdown issues ([#1](https://github.com/owntracks/frontend/issues/1)) - Fix checkbox style issues - Fix hover/focus inconsistencies - Fix Docker image labels - `README.md` enhancements - Upgrade dependencies -# 2.0.0-beta.2 (2019-11-02) +## 2.0.0-beta.2 (2019-11-02) - Add `onLocationChange.reloadHistory` config option - Add Travis CI config @@ -39,7 +71,7 @@ - Fix table of content links in config documentation - Upgrade dependencies -# 2.0.0-beta.1 (2019-10-26) +## 2.0.0-beta.1 (2019-10-26) - Convert codebase to Node.js based development workflow, including: - Package management using yarn @@ -55,22 +87,22 @@ - Custom checkbox styles - Switch from Font Awesome 4 to Feather Icons - Application now uses Vuex and Vue Router -- Add URL query parameters to load and preserve application state: `lat`, `lng`, `zoom`, `start`, `end`, `user`, `device` and `layers`. -- Add a loading indicator. -- Add 'download data' modal, currently supporting formatted and minified JSON. -- Add a verbose mode. -- Add CORS proxy script toeasily use a production instance of the OwnTracks recorder in development. -- Add unit tests for util and API functions. +- Add URL query parameters to load and preserve application state: `lat`, `lng`, `zoom`, `start`, `end`, `user`, `device` and `layers` +- Add a loading indicator +- Add 'download data' modal, currently supporting formatted and minified JSON +- Add a verbose mode +- Add CORS proxy script to easily use a production instance of the OwnTracks recorder in development +- Add unit tests for util and API functions - Add documentation for all public funtions -- Add documentation for all configuration options. -- Add more configuration options, including setting the API base URL ([#4](https://github.com/owntracks/frontend/issues/4)) and hiding the `ping/ping` location ([#12](https://github.com/owntracks/frontend/issues/12)). +- Add documentation for all configuration options +- Add more configuration options, including setting the API base URL ([#4](https://github.com/owntracks/frontend/issues/4)) and hiding the `ping/ping` location ([#12](https://github.com/owntracks/frontend/issues/12)) -# 1.1.0 (2019-10-26) +## 1.1.0 (2019-10-26) -- Add support for Docker. [#7](https://github.com/owntracks/frontend/pull/7), [@sharkoz](https://github.com/sharkoz) -- Move project to the OwnTracks organisation on GitHub. [#8](https://github.com/owntracks/frontend/pull/8), [@jpmens](https://github.com/jpmens) -- Enable compression in nginx configuration used in Docker image. [#11](https://github.com/owntracks/frontend/pull/11), [@sharkoz](https://github.com/sharkoz) +- Add support for Docker ([#7](https://github.com/owntracks/frontend/pull/7), [@sharkoz](https://github.com/sharkoz)) +- Move project to the OwnTracks organisation on GitHub ([#8](https://github.com/owntracks/frontend/pull/8), [@jpmens](https://github.com/jpmens)) +- Enable compression in nginx configuration used in Docker image ([#11](https://github.com/owntracks/frontend/pull/11), [@sharkoz](https://github.com/sharkoz)) -# 1.0.0 (2019-06-18) +## 1.0.0 (2019-06-18) - Initial release diff --git a/docker/Dockerfile b/docker/Dockerfile index d5ccc8e..67af989 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,7 +6,7 @@ COPY . ./ RUN yarn build FROM nginx:1.17-alpine -LABEL version="2.0.0-beta.6" +LABEL version="2.0.0-beta.10" LABEL description="OwnTracks UI" LABEL maintainer="Linus Groh " ENV LISTEN_PORT=80 \ diff --git a/docs/config.md b/docs/config.md index 18502e3..d06fa14 100644 --- a/docs/config.md +++ b/docs/config.md @@ -29,9 +29,6 @@ window.owntracks.config = {}; - [`locale`](#locale) - `map` - [`attribution`](#mapattribution) - - `center` - - [`lat`](#mapcenterlat) - - [`lng`](#mapcenterlng) - [`circle`](#mapcircle) - [`circleMarker`](#mapcirclemarker) - `controls` @@ -59,12 +56,12 @@ window.owntracks.config = {}; - [`maxZoom`](#mapmaxzoom) - [`polyline`](#mappolyline) - [`url`](#mapurl) - - [`zoom`](#mapzoom) - `onLocationChange` - [`reloadHistory`](#onlocationchangereloadhistory) - [`primaryColor`](#primarycolor) - [`selectedDevice`](#selecteddevice) - [`selectedUser`](#selecteduser) +- [`showDistanceTravelled`](#showdistancetravelled) - [`startDateTime`](#startdatetime) - [`verbose`](#verbose) @@ -123,7 +120,16 @@ Remove the `ping/ping` location from the fetched data. This is useful when using ### `locale` -The language to use for the user interface. Available: `de` (German), `en` (English). +The locale to use for the user interface, this affects the language and date/time +formats. + +Available languages: + +- `de` (German) +- `en` (English) +- `es` (Spanish) + +You can use formats like `en-GB`, `en-US`, `de-DE`. - Type: [`String`] - Default: `"en"` @@ -144,20 +150,6 @@ Attribution for map tiles. }; ``` -### `map.center.lat` - -Initial map center latitude. - -- Type: [`Number`] -- Default: `0` - -### `map.center.lng` - -Initial map center longitude. - -- Type: [`Number`] -- Default: `0` - ### `map.circle` Location accuracy indicator configuation. `color` and `fillColor` default to @@ -368,13 +360,6 @@ and [this Wikipedia article](https://en.wikipedia.org/wiki/Tiled_web_map). }; ``` -### `map.zoom` - -Initial map zoom level. - -- Type: [`Number`] -- Default: `19` - ### `onLocationChange.reloadHistory` Whether to reload the location history (of selected date range) or not when a location @@ -400,7 +385,7 @@ Primary color for the user interface (navigation bar and various map elements). ### `selectedDevice` Initial selected device. All devices will be shown by default if `null`. Will be ignored -if [`selectedUser`](#selectedUser) is `null`; +if [`selectedUser`](#selectedUser) is `null`. Only data for the selected user/device will be fetched, so you can use this to limit the amount of data fetched after page load. @@ -433,6 +418,16 @@ amount of data fetched after page load. }; ``` +### `showDistanceTravelled` + +Whether to calculate and show the travelled distance of the last fetched data in the +header bar. `maxPointDistance` is being takein into account, if a distance between two +subsequent points is greater than `maxPointDistance`, it will not contibute to the +calculated travelled distance. + +- Type: [`Boolean`] +- Default: `true` + ### `startDateTime` Initial start date and time (browser timezone) for fetched data. diff --git a/docs/images/owntracks-ui.png b/docs/images/owntracks-ui.png index 0d279af..3b2e2b0 100644 Binary files a/docs/images/owntracks-ui.png and b/docs/images/owntracks-ui.png differ diff --git a/package.json b/package.json index d297199..1416edd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "owntracks-ui", - "version": "2.0.0-beta.6", + "version": "2.0.0-beta.10", "author": { "name": "Linus Groh", "email": "mail@linusgroh.de" @@ -26,29 +26,29 @@ "vue": "^2.6.11", "vue-ctk-date-time-picker": "^2.4.0", "vue-feather-icons": "^5.0.0", - "vue-i18n": "^8.15.3", - "vue-js-modal": "^1.3.31", + "vue-i18n": "^8.15.4", + "vue-js-modal": "^1.3.33", "vue-outside-events": "^1.1.3", - "vue-router": "^3.1.5", - "vue2-leaflet": "^2.4.2", + "vue-router": "^3.1.6", + "vue2-leaflet": "^2.5.2", "vuex": "^3.1.2" }, "devDependencies": { - "@vue/cli-plugin-babel": "^4.1.2", - "@vue/cli-plugin-eslint": "^4.1.2", - "@vue/cli-plugin-unit-jest": "^4.1.2", - "@vue/cli-service": "^4.1.2", + "@vue/cli-plugin-babel": "^4.2.3", + "@vue/cli-plugin-eslint": "^4.2.3", + "@vue/cli-plugin-unit-jest": "^4.2.3", + "@vue/cli-service": "^4.2.3", "@vue/eslint-config-prettier": "^6.0.0", "@vue/test-utils": "1.0.0-beta.31", "babel-core": "7.0.0-bridge.0", - "babel-eslint": "^10.0.3", + "babel-eslint": "^10.1.0", "babel-jest": "^25.1.0", "cors-anywhere": "^0.4.1", "eslint": "^6.8.0", "eslint-plugin-prettier": "^3.1.2", - "eslint-plugin-vue": "^6.1.2", + "eslint-plugin-vue": "^6.2.1", "jest-fetch-mock": "^3.0.1", - "lint-staged": "^10.0.2", + "lint-staged": "^10.0.8", "moment-locales-webpack-plugin": "^1.1.2", "node-sass": "^4.13.1", "sass-loader": "^8.0.2", diff --git a/src/api.js b/src/api.js index da26688..2dc6f72 100644 --- a/src/api.js +++ b/src/api.js @@ -12,7 +12,7 @@ import { getApiUrl } from "@/util"; * * @param {String} path API resource path * @param {Object} [params] Query parameters - * @return {Promise} Promise returned by the fetch function + * @returns {Promise} Promise returned by the fetch function */ const fetchApi = (path, params = {}) => { const url = getApiUrl(path); @@ -24,7 +24,7 @@ const fetchApi = (path, params = {}) => { /** * Get the recorder's version. * - * @return {String} Version + * @returns {String} Version */ export const getVersion = async () => { const response = await fetchApi("/api/0/version"); @@ -36,7 +36,7 @@ export const getVersion = async () => { /** * Get all users. * - * @return {Array.} Array of usernames + * @returns {Array.} Array of usernames */ export const getUsers = async () => { const response = await fetchApi("/api/0/list"); @@ -49,7 +49,8 @@ export const getUsers = async () => { * Get all devices for the provided users. * * @param {Array.} users Array of usernames - * @return {Object.>} Object mapping each username to an array of device names + * @returns {Object.>} + * Object mapping each username to an array of device names */ export const getDevices = async users => { const devices = {}; @@ -69,7 +70,7 @@ export const getDevices = async users => { * * @param {User} [user] Get last locations of all devices from this user * @param {Device} [device] Get last location of specific device - * @return {Array.} Array of last location objects + * @returns {Array.} Array of last location objects */ export const getLastLocations = async (user, device) => { const params = {}; @@ -91,7 +92,7 @@ export const getLastLocations = async (user, device) => { * @param {Device} device Device name * @param {String} start Start date and time in UTC * @param {String} end End date and time in UTC - * @return {LocationHistory} Array of location history objects + * @returns {LocationHistory} Array of location history objects */ export const getUserDeviceLocationHistory = async ( user, @@ -113,10 +114,12 @@ export const getUserDeviceLocationHistory = async ( /** * Get the location history of multiple devices. * - * @param {Object.>} devices Devices of which the history should be fetched + * @param {Object.>} devices + * Devices of which the history should be fetched * @param {String} start Start date and time in UTC * @param {String} end End date and time in UTC - * @return {Object.>} Array of location history objects + * @returns {Object.>} + * Array of location history objects */ export const getLocationHistory = async (devices, start, end) => { const locationHistory = {}; @@ -139,7 +142,8 @@ export const getLocationHistory = async (devices, start, end) => { }; /** - * Connect to the WebSocket API, reconnect when necessary and handle received messages. + * Connect to the WebSocket API, reconnect when necessary and handle received + * messages. * * @param {webSocketLocationCallback} [callback] Callback for location messages */ diff --git a/src/components/AppHeader.vue b/src/components/AppHeader.vue index 571badf..760c822 100644 --- a/src/components/AppHeader.vue +++ b/src/components/AppHeader.vue @@ -98,6 +98,13 @@