9 Commits

Author SHA1 Message Date
Linus Groh
220bda6ef3 Release 2.0.0-beta.2 2019-11-02 18:17:48 +00:00
Linus Groh
6209c806a2 Upgrade dependencies 2019-11-02 17:30:13 +00:00
Linus Groh
c85e6fedf2 Fix timezone issues in tests 2019-11-02 17:25:17 +00:00
Linus Groh
edff370dc8 Enable Travis CI 2019-11-02 16:54:59 +00:00
Linus Groh
69edbc6ce4 Fix typo 2019-11-02 16:34:11 +00:00
Linus Groh
76f1d4980c Add onLocationChange.reloadHistory config option 2019-11-01 22:37:51 +00:00
Linus Groh
39fd7727f4 Upgrade dependencies 2019-10-27 12:34:01 +00:00
Linus Groh
418a2fe808 Fix ESLint errors 2019-10-27 12:28:29 +00:00
Linus Groh
f0c4ba43cb Fix config TOC links 2019-10-26 22:52:42 +01:00
10 changed files with 800 additions and 1322 deletions

6
.travis.yml Normal file
View File

@@ -0,0 +1,6 @@
language: node_js
node_js:
- 10
cache: yarn
script:
- yarn test

View File

@@ -1,3 +1,12 @@
# 2.0.0-beta.1 (2019-11-02)
- Add `onLocationChange.reloadHistory` config option
- Add Travis CI config
- Fix timezone issues in tests
- Fix ESLint errors in production mode
- Fix table of content links in config documentation
- Upgrade dependencies
# 2.0.0-beta.1 (2019-10-26)
- Convert codebase to Node.js based development workflow, including:

View File

@@ -1,5 +1,5 @@
FROM node:10 as build
LABEL version="2.0.0-beta.1"
LABEL version="2.0.0-beta.2"
LABEL description="OwnTracks UI"
LABEL maintainer="Linus Groh <mail@linusgroh.de>"
WORKDIR /usr/src/app

View File

@@ -23,46 +23,48 @@ window.owntracks.config = {};
## Options
- `api`
- [`baseUrl`](#api.baseUrl)
- [`endDate`](#endDate)
- [`ignorePingLocation`](#ignorePingLocation)
- [`baseUrl`](#apibaseurl)
- [`endDate`](#enddate)
- [`ignorePingLocation`](#ignorepinglocation)
- `map`
- [`attribution`](#map.attribution)
- [`attribution`](#mapattribution)
- `center`
- [`lat`](#map.center.lat)
- [`lng`](#map.center.lng)
- [`circle`](#map.circle)
- [`circleMarker`](#map.circleMarker)
- [`lat`](#mapcenterlat)
- [`lng`](#mapcenterlng)
- [`circle`](#mapcircle)
- [`circleMarker`](#mapcirclemarker)
- `controls`
- `scale`
- [`display`](#map.controls.scale.display)
- [`imperial`](#map.controls.scale.imperial)
- [`maxWidth`](#map.controls.scale.maxWidth)
- [`metric`](#map.controls.scale.metric)
- [`position`](#map.controls.scale.position)
- [`display`](#mapcontrolsscaledisplay)
- [`imperial`](#mapcontrolsscaleimperial)
- [`maxWidth`](#mapcontrolsscalemaxwidth)
- [`metric`](#mapcontrolsscalemetric)
- [`position`](#mapcontrolsscaleposition)
- `zoom`
- [`display`](#map.controls.zoom.display)
- [`position`](#map.controls.zoom.position)
- [`display`](#mapcontrolszoomdisplay)
- [`position`](#mapcontrolszoomposition)
- `heatmap`
- [`blur`](#map.heatmap.blur)
- [`gradient`](#map.heatmap.gradient)
- [`max`](#map.heatmap.max)
- [`radius`](#map.heatmap.radius)
- [`blur`](#mapheatmapblur)
- [`gradient`](#mapheatmapgradient)
- [`max`](#mapheatmapmax)
- [`radius`](#mapheatmapradius)
- `layers`
- [`heatmap`](#map.layers.heatmap)
- [`last`](#map.layers.last)
- [`line`](#map.layers.line)
- [`points`](#map.layers.points)
- [`maxNativeZoom`](#map.maxNativeZoom)
- [`maxPointDistance`](#map.maxPointDistance)
- [`maxZoom`](#map.maxZoom)
- [`polyline`](#map.polyline)
- [`url`](#map.url)
- [`zoom`](#map.zoom)
- [`primaryColor`](#primaryColor)
- [`selectedDevice`](#selectedDevice)
- [`selectedUser`](#selectedUser)
- [`startDate`](#startDate)
- [`heatmap`](#maplayersheatmap)
- [`last`](#maplayerslast)
- [`line`](#maplayersline)
- [`points`](#maplayerspoints)
- [`maxNativeZoom`](#mapmaxnativezoom)
- [`maxPointDistance`](#mapmaxpointdistance)
- [`maxZoom`](#mapmaxzoom)
- [`polyline`](#mappolyline)
- [`url`](#mapurl)
- [`zoom`](#mapzoom)
- `onLocationChange`
- [`reloadHistory`](#onlocationchangereloadhistory)
- [`primaryColor`](#primarycolor)
- [`selectedDevice`](#selecteddevice)
- [`selectedUser`](#selecteduser)
- [`startDate`](#startdate)
- [`verbose`](#verbose)
### `api.baseUrl`
@@ -364,6 +366,14 @@ 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
update is received.
- Type: [`Boolean`]
- Default: `false`
### `primaryColor`
Primary color for the user interface (navigation bar and various map elements).

View File

@@ -1,6 +1,6 @@
{
"name": "owntracks-ui",
"version": "2.0.0-beta.1",
"version": "2.0.0-beta.2",
"author": {
"name": "Linus Groh",
"email": "mail@linusgroh.de"
@@ -14,8 +14,8 @@
},
"dependencies": {
"clipboard-copy": "^3.1.0",
"core-js": "^3.3.2",
"deepmerge": "^4.2.1",
"core-js": "^3.3.6",
"deepmerge": "^4.2.2",
"leaflet": "^1.5.1",
"leaflet.heat": "^0.2.0",
"vue": "^2.6.6",

View File

@@ -65,6 +65,9 @@ const DEFAULT_CONFIG = {
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
zoom: 19,
},
onLocationChange: {
reloadHistory: false,
},
primaryColor: "#3f51b5",
selectedDevice: null,
selectedUser: null,

View File

@@ -6,11 +6,13 @@ export const logLevels = {
ERROR: "ERROR",
};
/* eslint-disable no-console */
const logFunctions = {
[logLevels.INFO]: console.info,
[logLevels.WARNING]: console.warn,
[logLevels.ERROR]: console.error,
};
/* eslint-enable no-console */
const logColors = {
[logLevels.INFO]: "#0d66ba",

View File

@@ -75,14 +75,17 @@ const reloadData = async ({ dispatch }) => {
/**
* Connect to WebSocket to receive live location updates. When an update is
* received, reload last locations and location history.
* received, reload last locations and location history depending on config.
*/
const connectWebsocket = async ({ dispatch }) => {
api.connectWebsocket(async () => {
// Reloading the complete location history is necessary because the
// last locations do lack some of the detailed information.
// TODO: make this optional via config.
await dispatch("reloadData");
// TODO: keep cards from HTTP API response in the Vuex store so we
// can use the data from the WebSocket location update (which does
// not contain card information) and don't have to poll the API.
await dispatch("getLastLocations");
if (config.onLocationChange.reloadHistory) {
await dispatch("getLocationHistory");
}
});
};

View File

@@ -144,14 +144,14 @@ describe("API", () => {
const locationHistory = await api.getUserDeviceLocationHistory(
"foo",
"phone",
new Date(1970, 1, 1),
new Date(1970, 12, 31)
new Date(Date.UTC(1970, 0, 1)),
new Date(Date.UTC(1970, 11, 31))
);
expect(locationHistory).toEqual(response.data);
expect(fetch.mock.calls.length).toEqual(1);
expect(fetch.mock.calls[0][0].href).toEqual(
"http://localhost/api/0/locations?from=1970-01-31T00%3A00%3A00&to=1971-01-30T23%3A59%3A59&user=foo&device=phone&format=json"
"http://localhost/api/0/locations?from=1970-01-01T00%3A00%3A00&to=1970-12-31T23%3A59%3A59&user=foo&device=phone&format=json"
);
});
@@ -194,8 +194,8 @@ describe("API", () => {
const locationHistory = await api.getLocationHistory(
{ foo: ["phone", "tablet"], bar: ["laptop"] },
new Date(1970, 1, 1),
new Date(1970, 12, 31)
new Date(Date.UTC(1970, 0, 1)),
new Date(Date.UTC(1970, 11, 31))
);
expect(locationHistory).toEqual({
foo: {
@@ -207,13 +207,13 @@ describe("API", () => {
expect(fetch.mock.calls.length).toEqual(3);
expect(fetch.mock.calls[0][0].href).toEqual(
"http://localhost/api/0/locations?from=1970-01-31T00%3A00%3A00&to=1971-01-30T23%3A59%3A59&user=foo&device=phone&format=json"
"http://localhost/api/0/locations?from=1970-01-01T00%3A00%3A00&to=1970-12-31T23%3A59%3A59&user=foo&device=phone&format=json"
);
expect(fetch.mock.calls[1][0].href).toEqual(
"http://localhost/api/0/locations?from=1970-01-31T00%3A00%3A00&to=1971-01-30T23%3A59%3A59&user=foo&device=tablet&format=json"
"http://localhost/api/0/locations?from=1970-01-01T00%3A00%3A00&to=1970-12-31T23%3A59%3A59&user=foo&device=tablet&format=json"
);
expect(fetch.mock.calls[2][0].href).toEqual(
"http://localhost/api/0/locations?from=1970-01-31T00%3A00%3A00&to=1971-01-30T23%3A59%3A59&user=bar&device=laptop&format=json"
"http://localhost/api/0/locations?from=1970-01-01T00%3A00%3A00&to=1970-12-31T23%3A59%3A59&user=bar&device=laptop&format=json"
);
});
});

1989
yarn.lock

File diff suppressed because it is too large Load Diff