Skip to content

Commit

Permalink
Merge branch 'master' into modern
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Mar 23, 2020
2 parents 990d485 + f5165c8 commit ba9cc86
Show file tree
Hide file tree
Showing 128 changed files with 5,052 additions and 5,091 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# [Traccar Web Interface](https://www.traccar.org)
[![Build Status](https://travis-ci.org/tananaev/traccar-web.svg?branch=master)](https://travis-ci.org/tananaev/traccar-web)
[![Build Status](https://travis-ci.org/traccar/traccar-web.svg?branch=master)](https://travis-ci.org/traccar/traccar-web)

## Overview

Traccar is open source server for various GPS tracking devices. This repository contains web interface for the Traccar platform. For back-end checkout [main Traccar repository](https://github.com/tananaev/traccar).

Icons are generously provided by [Font Awesome](http://fontawesome.io/) and [Icons8](https://icons8.com/). We are also using [BrowserStack](https://www.browserstack.com/) to test compatibility with various platforms and browser versions.

## New version under construction

A new version is being developed https://github.com/traccar/traccar-web/tree/modern/modern

You can read about why write a new client here https://github.com/traccar/traccar-web/issues/592

## Team

- Anton Tananaev ([[email protected]](mailto:[email protected]))
Expand Down
17 changes: 16 additions & 1 deletion web/app/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Ext.define('Traccar.Application', {

requires: [
'Traccar.Style',
'Traccar.AttributeFormatter'
'Traccar.AttributeFormatter',
'Traccar.view.TouchFix62'
],

models: [
Expand Down Expand Up @@ -51,6 +52,7 @@ Ext.define('Traccar.Application', {
'Devices',
'AllGroups',
'AllDevices',
'AlarmTypes',
'Positions',
'LatestPositions',
'EventPositions',
Expand Down Expand Up @@ -148,6 +150,19 @@ Ext.define('Traccar.Application', {
}
},

updateNotificationToken: function (token) {
var attributes = Ext.clone(this.user.get('attributes'));
if (!attributes.notificationTokens || attributes.notificationTokens.indexOf(token) < 0) {
if (!attributes.notificationTokens) {
attributes.notificationTokens = token;
} else {
attributes.notificationTokens += ',' + token;
}
this.user.set('attributes', attributes);
this.user.save();
}
},

setUser: function (data) {
var reader = Ext.create('Ext.data.reader.Json', {
model: 'Traccar.model.User'
Expand Down
9 changes: 4 additions & 5 deletions web/app/GeofenceConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Ext.define('Traccar.GeofenceConverter', {
resolutionAtEquator = mapView.getResolution();
pointResolution = ol.proj.getPointResolution(projection, resolutionAtEquator, center);
resolutionFactor = resolutionAtEquator / pointResolution;
radius = Number(coordinates[2]) / ol.proj.METERS_PER_UNIT.m * resolutionFactor;
radius = Number(coordinates[2]) / ol.proj.Units.METERS_PER_UNIT.m * resolutionFactor;
geometry = new ol.geom.Circle(center, radius);
}
}
Expand All @@ -68,15 +68,14 @@ Ext.define('Traccar.GeofenceConverter', {
},

geometryToWkt: function (projection, geometry) {
var result, i, center, radius, edgeCoordinate, earthSphere, groundRadius, points;
var result, i, center, radius, edgeCoordinate, groundRadius, points;
if (geometry instanceof ol.geom.Circle) {
center = geometry.getCenter();
radius = geometry.getRadius();
edgeCoordinate = [center[0] + radius, center[1]];
center = ol.proj.transform(center, projection, 'EPSG:4326');
earthSphere = new ol.Sphere(6378137);
groundRadius = earthSphere.haversineDistance(center,
ol.proj.transform(edgeCoordinate, projection, 'EPSG:4326'));
groundRadius = ol.sphere.getDistance(
center, ol.proj.transform(edgeCoordinate, projection, 'EPSG:4326'), 6378137);
result = 'CIRCLE (';
result += center[1] + ' ' + center[0] + ', ';
result += groundRadius.toFixed(1) + ')';
Expand Down
3 changes: 3 additions & 0 deletions web/app/Style.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ Ext.define('Traccar.Style', {
mapGeofenceWidth: 5,
mapGeofenceRadius: 9,

mapAnimateMarkerDuration: 2000,
mapAnimateMarkerTimeout: 40,

coordinatePrecision: 6,
numberPrecision: 2,

Expand Down
8 changes: 8 additions & 0 deletions web/app/controller/Root.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ Ext.define('Traccar.controller.Root', {

loadApp: function () {
var attribution, eventId;

if (window.webkit && window.webkit.messageHandlers.appInterface) {
window.webkit.messageHandlers.appInterface.postMessage('login');
}
if (window.appInterface) {
window.appInterface.postMessage('login');
}

Ext.getStore('Groups').load();
Ext.getStore('Drivers').load();
Ext.getStore('Geofences').load();
Expand Down
4 changes: 4 additions & 0 deletions web/app/model/ReportStop.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Ext.define('Traccar.model.ReportStop', {
name: 'startTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'startOdometer',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('distance')
}, {
name: 'address',
type: 'string'
Expand Down
8 changes: 8 additions & 0 deletions web/app/model/ReportSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ Ext.define('Traccar.model.ReportSummary', {
name: 'distance',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('distance')
}, {
name: 'startOdometer',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('distance')
}, {
name: 'endOdometer',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('distance')
}, {
name: 'engineHours',
type: 'int'
Expand Down
8 changes: 8 additions & 0 deletions web/app/model/ReportTrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ Ext.define('Traccar.model.ReportTrip', {
name: 'distance',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('distance')
}, {
name: 'startOdometer',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('distance')
}, {
name: 'endOdometer',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('distance')
}, {
name: 'duration',
type: 'int'
Expand Down
34 changes: 34 additions & 0 deletions web/app/store/AlarmTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2018 Anton Tananaev ([email protected])
* Copyright 2018 Andrey Kunitsyn ([email protected])
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Ext.define('Traccar.store.AlarmTypes', {
extend: 'Ext.data.Store',
fields: ['key', 'name'],

data: (function () {
var key, items = [];
for (key in Strings) {
if (Strings.hasOwnProperty(key) && key.lastIndexOf('alarm', 0) === 0) {
items.push({
key: key.charAt(5).toLowerCase() + key.slice(6),
name: Strings[key]
});
}
}
return items;
})()
});
2 changes: 1 addition & 1 deletion web/app/store/AllMaintenances.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Ext.define('Traccar.store.AllMaintenances', {

proxy: {
type: 'rest',
url: 'api/maintenances',
url: 'api/maintenance',
extraParams: {
all: true
}
Expand Down
4 changes: 2 additions & 2 deletions web/app/store/CommonUserAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ Ext.define('Traccar.store.CommonUserAttributes', {
name: Strings.attributeUiDisableCalendars,
valueType: 'boolean'
}, {
key: 'ui.disableMaintenances',
name: Strings.attributeUiDisableMaintenances,
key: 'ui.disableMaintenance',
name: Strings.attributeUiDisableMaintenance,
valueType: 'boolean'
}, {
key: 'ui.hidePositionAttributes',
Expand Down
9 changes: 8 additions & 1 deletion web/app/store/KnownCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Ext.define('Traccar.store.KnownCommands', {
}, {
type: 'setTimezone',
parameters: [{
key: 'timezoneName',
key: 'timezone',
name: Strings.commandTimezone,
valueType: 'string',
dataType: 'timezone'
Expand All @@ -55,6 +55,13 @@ Ext.define('Traccar.store.KnownCommands', {
name: Strings.commandMessage,
valueType: 'string'
}]
}, {
type: 'message',
parameters: [{
key: 'message',
name: Strings.commandMessage,
valueType: 'string'
}]
}, {
type: 'sendUssd',
parameters: [{
Expand Down
2 changes: 1 addition & 1 deletion web/app/store/Maintenances.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Ext.define('Traccar.store.Maintenances', {

proxy: {
type: 'rest',
url: 'api/maintenances',
url: 'api/maintenance',
writer: {
writeAllFields: true
}
Expand Down
3 changes: 3 additions & 0 deletions web/app/store/MapTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ Ext.define('Traccar.store.MapTypes', {
}, {
key: 'custom',
name: Strings.mapCustom
}, {
key: 'customArcgis',
name: Strings.mapCustomArcgis
}]
});
2 changes: 1 addition & 1 deletion web/app/view/DeviceMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Ext.define('Traccar.view.DeviceMenu', {
handler: 'onCommandsClick',
reference: 'menuCommandsButton'
}, {
text: Strings.sharedMaintenances,
text: Strings.sharedMaintenance,
glyph: 'xf0ad@FontAwesome',
handler: 'onMaintenancesClick',
reference: 'menuMaintenancesButton'
Expand Down
4 changes: 2 additions & 2 deletions web/app/view/DeviceMenuController.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Ext.define('Traccar.view.DeviceMenuController', {
this.lookupReference('menuDeviceAccumulatorsButton').setHidden(
!Traccar.app.getUser().get('administrator') && Traccar.app.getUser().get('userLimit') === 0 || Traccar.app.getVehicleFeaturesDisabled());
this.lookupReference('menuMaintenancesButton').setHidden(
Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenances'));
Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableMaintenance'));
},

onGeofencesClick: function () {
Expand Down Expand Up @@ -110,7 +110,7 @@ Ext.define('Traccar.view.DeviceMenuController', {

onMaintenancesClick: function () {
Ext.create('Traccar.view.BaseWindow', {
title: Strings.sharedMaintenances,
title: Strings.sharedMaintenance,
items: {
xtype: 'linkMaintenancesView',
baseObjectName: 'deviceId',
Expand Down
15 changes: 13 additions & 2 deletions web/app/view/EventsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ Ext.define('Traccar.view.EventsController', {
listen: {
controller: {
'*': {
deselectevent: 'deselectEvent'
selectdevice: 'deselectEvent',
selectreport: 'deselectEvent'
},
'map': {
deselectfeature: 'deselectFeature'
}
},
store: {
Expand Down Expand Up @@ -79,7 +83,14 @@ Ext.define('Traccar.view.EventsController', {
Traccar.app.showEvents(false);
},

deselectEvent: function () {

deselectEvent: function (object) {
if (object) {
this.deselectFeature();
}
},

deselectFeature: function () {
this.getView().getSelectionModel().deselectAll();
},

Expand Down
5 changes: 5 additions & 0 deletions web/app/view/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ Ext.define('Traccar.view.Report', {
reference: 'exportButton',
disabled: true,
handler: 'onReportClick'
}, {
text: Strings.reportEmail,
reference: 'emailButton',
disabled: true,
handler: 'onReportClick'
}, {
text: Strings.reportClear,
handler: 'onClearClick'
Expand Down
Loading

0 comments on commit ba9cc86

Please sign in to comment.