mirror of
https://github.com/owntracks/frontend.git
synced 2026-02-23 21:43:49 +00:00
Compare commits
9 Commits
v2.0.0-bet
...
v2.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
220bda6ef3 | ||
|
|
6209c806a2 | ||
|
|
c85e6fedf2 | ||
|
|
edff370dc8 | ||
|
|
69edbc6ce4 | ||
|
|
76f1d4980c | ||
|
|
39fd7727f4 | ||
|
|
418a2fe808 | ||
|
|
f0c4ba43cb |
6
.travis.yml
Normal file
6
.travis.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 10
|
||||
cache: yarn
|
||||
script:
|
||||
- yarn test
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user