initial commit

parents
VITE_APP_VERSION=$npm_package_version
{
"extends": "airbnb",
"env": {
"browser": true
},
"parserOptions": {
"ecmaVersion": 2020
},
"overrides": [{
"files": ["*.jsx", "*.js"]
}],
"plugins": [
"react"
],
"ignorePatterns": ["legacy/", "build/", "switcher.js", "theme.js"],
"rules": {
"max-len": [0],
"no-shadow": [0],
"no-return-assign": [0],
"no-param-reassign": [0],
"no-prototype-builtins": [0],
"object-curly-newline": [1, {
"ObjectExpression": { "minProperties": 8, "multiline": true, "consistent": true },
"ObjectPattern": { "minProperties": 8, "multiline": true, "consistent": true },
"ImportDeclaration": { "minProperties": 4, "multiline": true, "consistent": true },
"ExportDeclaration": { "minProperties": 4, "multiline": true, "consistent": true }
}],
"import/no-unresolved": [1, {
"ignore": ["\\.svg", "virtual:"]
}],
"react/function-component-definition": [1, {
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}],
"react/jsx-props-no-spreading": [0],
"jsx-a11y/anchor-is-valid": [0],
"jsx-a11y/label-has-associated-control": [0],
"react/prop-types": [0]
}
}
# Contributing to Traccar
Please make sure you read this guide before commenting on any issue or creating a new issue or pull request.
Before asking anything, please search for an answer in:
- [Traccar documentation](https://www.traccar.org/documentation/)
- [Traccar forums](https://www.traccar.org/forums/)
- Relevant repositories (see below)
- [Google Search](https://www.google.com/)
GitHub issues should be used ONLY for feature requests, code discussions and bug reports. For general discussions please use [Traccar forums](https://www.traccar.org/forums/).
There are multiple Traccar projects. If you create a new issue you MUST do it in the relevant repository:
- [Traccar Server](https://github.com/tananaev/traccar/issues)
- [Traccar Web Interface](https://github.com/tananaev/traccar-web/issues)
- [Traccar Client for Android](https://github.com/tananaev/traccar-client-android/issues)
- [Traccar Client for iOS](https://github.com/tananaev/traccar-client-ios/issues)
- [Traccar Manager for Android](https://github.com/tananaev/traccar-manager-android/issues)
- [Traccar Manager for iOS](https://github.com/tananaev/traccar-manager-ios/issues)
If you are not sure where your issue belongs to, please use Traccar Server main repository.
If you want to discuss something that applies to both Android and iOS apps, please use Android repository.
## Bug Reports
Before creating a bug report make sure that you have tested latest official release with default configuration.
Only create a bug report issue if you are confident that there is a problem in Traccar software.
Provide as much details as possible, including log fragments, operating system and hardware information.
## Feature Requests
Before creating a feature request make sure that the feature or modification that you are requesting is not yet implemented.
Search reposiroty to ensure that there is no existing issues for your request. If there is, add a new comment on that issue.
Provide as much details as possible, including use case for your feature and any benefits that you can think of.
## Pull Requests
If you want to contribute some code to Traccar, it is recommended to discuss your solution with maintainers before starting any work.
Any code that you want to contribute must be of high quality and follow existing code patterns and styles.
custom: https://www.traccar.org/donate/
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
name: Legacy App Lint
on:
push:
branches:
- master
paths:
- legacy/**
pull_request:
branches:
- master
paths:
- legacy/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: legacy/package-lock.json
- run: npm ci --ignore-scripts
working-directory: legacy
- run: npm run lint
working-directory: legacy
name: Modern App Lint
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm run lint
name: Update Translations
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: pip install transifex-python six
- name: Update translations
env:
TRANSIFEX_TOKEN: ${{ secrets.TRANSIFEX_TOKEN }}
run: ./tools/translate.py -t "$TRANSIFEX_TOKEN"
- name: Commit changes
run: |
git config --global user.name 'Traccar Bot'
git config --global user.email 'support@traccar.org'
git commit -am "Update localization files"
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
node_modules
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/legacy/web/lib
/legacy/web/app.min.js
legacy-peer-deps=true
{
"version": "0.2.0",
"configurations": [
{
"name": "npm start",
"request": "launch",
"runtimeArgs": ["start"],
"runtimeExecutable": "npm",
"type": "node"
},
{
"name": "npm run build",
"request": "launch",
"runtimeArgs": ["run", "build"],
"runtimeExecutable": "npm",
"type": "node"
}
]
}
This diff is collapsed. Click to expand it.
# [Traccar Web Interface](https://www.traccar.org)
## 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).
The modern app uses React, Material UI and MapLibre. For more information on how to build it please check the [web app documentation](https://www.traccar.org/build-web-app/).
## Team
- Anton Tananaev ([anton@traccar.org](mailto:anton@traccar.org))
- Andrey Kunitsyn ([andrey@traccar.org](mailto:andrey@traccar.org))
## License
Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="${colorPrimary}" />
<meta name="description" content="${description}" />
<link rel="icon" href="/SafeFetch.png" />
<link rel="apple-touch-icon" href="/SafeFetch.png" sizes="180x180" />
<link rel="manifest" href="/manifest.webmanifest" />
<link rel="stylesheet" href="/styles.css">
<title>SafeFetch Dashboard</title>
<script>
var START_CLICKED=false;
document.addEventListener("DOMContentLoaded",
function () {
});
function hasItemWithKeyAndValue(arr, key, value) {
return arr.some(item => item[key] === value);
}
</script>
<style>
.loader {
position: fixed; top: calc(50% - 25px); left: calc(50% - 25px);
width: 50px; aspect-ratio: 1; box-sizing: content-box; animation: ll 1s infinite linear;
border-radius: 50%; border: 8px solid lightgray; border-right-color: black;
}
@keyframes ll {to{transform: rotate(1turn)}}
</style>
</head>
<body>
<noscript>Enable JavaScript to use <a href="https://www.traccar.org/">Traccar GPS Tracking System</a>.</noscript>
<div id="root" class="root"></div>
<div class="loader"></div>
<script type="module" src="/src/index.jsx" onerror="alert('Loading error.')"></script>
</body>
</html>
web/simple/app.js
web/app.min.js
web/load.js
web/lib
{
"root": true,
"extends": "eslint:all",
"env": {
"browser": true
},
"globals": {
"Ext": false,
"ol": false,
"Traccar": false,
"Strings": false,
"Locale": false,
"proj4": false
},
"rules": {
"strict": "off",
"max-lines": ["error", 1000],
"max-len": ["error", 180],
"max-statements": ["error", 35],
"max-params": ["error", 5],
"indent": ["error", 4, {
"SwitchCase": 1
}],
"quotes": ["error", "single"],
"padded-blocks": ["error", "never"],
"dot-location": ["error", "property"],
"wrap-iife": ["error", "inside"],
"dot-notation": "off",
"array-bracket-newline": "off",
"array-element-newline": "off",
"sort-keys": "off",
"sort-vars": "off",
"no-magic-numbers": "off",
"no-mixed-operators": "off",
"prefer-template": "off",
"newline-per-chained-call": "off",
"object-shorthand": "off",
"func-names": "off",
"init-declarations": "off",
"no-var": "off",
"id-length": "off",
"no-undefined": "off",
"object-curly-newline": "off",
"prefer-destructuring": "off",
"no-plusplus": "off",
"no-param-reassign": "off",
"no-ternary": "off",
"multiline-ternary": "off",
"one-var-declaration-per-line": "off",
"no-shadow": "off",
"no-else-return": "off",
"consistent-this": "off",
"quote-props": "off",
"no-negated-condition": "off",
"prefer-arrow-callback": "off",
"no-prototype-builtins": "off",
"no-multi-assign": "off",
"no-bitwise": "off",
"prefer-rest-params": "off",
"function-paren-newline": "off"
}
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "traccar-web",
"dependencies": {
"extjs-gpl": "^6.2.0",
"ol": "^6.12.0",
"ol-layerswitcher": "^3.8.3",
"openlayers-dist": "^6.12.0",
"proj4": "^2.7.5"
},
"devDependencies": {
"eslint": "^4.4.1"
},
"scripts": {
"postinstall": "/bin/bash -c 'mkdir -p web/lib/{ol,ol-layerswitcher,proj4,extjs} && cp node_modules/openlayers-dist/{ol.js,ol.css} web/lib/ol/ && cp node_modules/ol-layerswitcher/dist/{ol-layerswitcher.js,ol-layerswitcher.css} web/lib/ol-layerswitcher/ && cp node_modules/proj4/dist/proj4.js web/lib/proj4/ && cp node_modules/extjs-gpl/build/ext-all.js web/lib/extjs/ && mkdir -p web/lib/extjs/classic && cp -r node_modules/extjs-gpl/build/classic/locale web/lib/extjs/classic/locale && cp -r node_modules/extjs-gpl/build/classic/theme-triton web/lib/extjs/classic/theme-triton && mkdir -p web/lib/extjs/packages/charts && cp -r node_modules/extjs-gpl/build/packages/charts/classic web/lib/extjs/packages/charts/classic'",
"build": "sencha compile --classpath=web/app.js,web/app,node_modules/extjs-gpl/packages/core/src,node_modules/extjs-gpl/packages/core/overrides,node_modules/extjs-gpl/classic/classic/src,node_modules/extjs-gpl/classic/classic/overrides exclude -all and include -recursive -file web/app.js and exclude -namespace=Ext and concatenate -closure web/app.min.js",
"lint": "./node_modules/.bin/eslint web/."
}
}
.view-color-green {
background-color: rgba(77, 250, 144, 0.3);
}
.view-color-yellow {
background-color: rgba(250, 190, 77, 0.3);
}
.view-color-red {
background-color: rgba(255, 84, 104, 0.3);
}
.view-item-disabled {
opacity: 0.5;
}
.toolbar-header-style {
background-color: #5fa2dd !important;
}
body.x-border-layout-ct, div.x-border-layout-ct {
background-color: #bbbbbb !important;
}
.x-fieldset {
overflow: visible !important; /* workaround for Safari issue */
}
#update {
position: absolute;
width: 100%;
top: 20px;
font-weight: bold;
text-align: center;
}
#attribution {
position: absolute;
bottom: 10px;
right: 15px;
font-size: x-small;
}
#spinner:before {
content: '';
box-sizing: border-box;
position: absolute;
top: 50%;
left: 50%;
width: 60px;
height: 60px;
margin-top: -30px;
margin-left: -30px;
border-radius: 50%;
border-top: 6px solid #5fa2dd;
border-right: 6px solid transparent;
animation: spinner .6s linear infinite;
}
@keyframes spinner {
to {
transform: rotate(360deg);
}
}
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.application({
name: 'Traccar',
extend: 'Traccar.Application'
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.Application', {
extend: 'Ext.app.Application',
name: 'Traccar',
requires: [
'Traccar.Style',
'Traccar.AttributeFormatter',
'Traccar.view.TouchFix62'
],
models: [
'Server',
'User',
'Group',
'Device',
'Position',
'Attribute',
'Command',
'Event',
'Geofence',
'Notification',
'ReportSummary',
'ReportTrip',
'ReportStop',
'Calendar',
'KnownAttribute',
'Driver',
'KnownCommand',
'KnownNotification',
'Maintenance'
],
stores: [
'Groups',
'Devices',
'AllGroups',
'AllDevices',
'AlarmTypes',
'Positions',
'LatestPositions',
'EventPositions',
'Users',
'Attributes',
'MapTypes',
'DistanceUnits',
'SpeedUnits',
'CoordinateFormats',
'CommandTypes',
'TimeUnits',
'Languages',
'Events',
'Geofences',
'AllGeofences',
'Notifications',
'AllNotifications',
'GeofenceTypes',
'ReportRoute',
'ReportEvents',
'ReportTrips',
'ReportStops',
'ReportSummary',
'ReportTypes',
'ReportEventTypes',
'ReportChartTypes',
'ReportPeriods',
'Statistics',
'DeviceImages',
'Calendars',
'AllCalendars',
'AllTimezones',
'VisibleDevices',
'DeviceStatuses',
'CommonDeviceAttributes',
'DeviceAttributes',
'GeofenceAttributes',
'GroupAttributes',
'ServerAttributes',
'CommonUserAttributes',
'UserAttributes',
'ComputedAttributes',
'AllComputedAttributes',
'PositionAttributes',
'AttributeValueTypes',
'Drivers',
'AllDrivers',
'KnownCommands',
'VolumeUnits',
'AllCommandTypes',
'Commands',
'AllCommands',
'DeviceCommands',
'AllNotificationTypes',
'Maintenances',
'AllMaintenances',
'MaintenanceTypes',
'HoursUnits',
'AllNotificators'
],
controllers: [
'Root'
],
isMobile: function () {
return window.matchMedia && window.matchMedia('(max-width: 768px)').matches;
},
getVehicleFeaturesDisabled: function () {
return this.getBooleanAttributePreference('ui.disableVehicleFeatures');
},
getEventString: function (eventType) {
var key = 'event' + eventType.charAt(0).toUpperCase() + eventType.slice(1);
return Strings[key] || key;
},
getNotificatorString: function (eventType) {
var key = 'notificator' + eventType.charAt(0).toUpperCase() + eventType.slice(1);
return Strings[key] || key;
},
showReports: function (show) {
var rootPanel = Ext.getCmp('rootPanel');
if (rootPanel) {
rootPanel.setActiveItem(show ? 1 : 0);
}
},
showEvents: function (show) {
var rootPanel = Ext.getCmp('rootPanel');
if (rootPanel) {
rootPanel.setActiveItem(show ? 2 : 0);
}
},
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'
});
this.user = reader.readRecords(data).getRecords()[0];
},
getUser: function () {
return this.user;
},
setServer: function (data) {
var reader = Ext.create('Ext.data.reader.Json', {
model: 'Traccar.model.Server'
});
this.server = reader.readRecords(data).getRecords()[0];
},
getServer: function () {
return this.server;
},
getPreference: function (key, defaultValue) {
if (this.getServer().get('forceSettings')) {
return this.getServer().get(key) || this.getUser().get(key) || defaultValue;
} else {
return this.getUser().get(key) || this.getServer().get(key) || defaultValue;
}
},
getAttributePreference: function (key, defaultValue) {
if (this.getServer().get('forceSettings')) {
return this.getServer().get('attributes')[key] || this.getUser().get('attributes')[key] || defaultValue;
} else {
return this.getUser().get('attributes')[key] || this.getServer().get('attributes')[key] || defaultValue;
}
},
getBooleanAttributePreference: function (key) {
return this.getAttributePreference(key, false).toString() === 'true';
},
getReportColor: function (deviceId) {
var index, reportColor, device = Ext.getStore('Devices').getById(deviceId);
if (device) {
reportColor = device.get('attributes')['web.reportColor'];
}
if (reportColor) {
return reportColor;
} else {
index = 0;
if (deviceId !== undefined) {
index = deviceId % Traccar.Style.mapRouteColor.length;
}
return Traccar.Style.mapRouteColor[index];
}
},
showError: function (error) {
if (Ext.isString(error)) {
Ext.Msg.alert(Strings.errorTitle, error);
} else if (error.responseText) {
Ext.Msg.alert(Strings.errorTitle, Strings.errorGeneral +
'<br><br><textarea readonly rows="5" style="resize: none; width: 100%;">' +
error.responseText + '</textarea>');
} else if (error.statusText) {
Ext.Msg.alert(Strings.errorTitle, error.statusText);
} else {
Ext.Msg.alert(Strings.errorTitle, Strings.errorConnection);
}
},
showToast: function (message, title) {
Ext.toast({
html: message,
title: title,
width: Traccar.Style.toastWidth,
align: 'br'
});
}
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.DeviceImages', {
singleton: true,
getImageSvg: function (color, zoom, angle, category) {
var i, info, svg, width, height, rotateTransform, scaleTransform, fill;
info = Ext.getStore('DeviceImages').findRecord('key', category || 'default', 0, false, false, true);
svg = Ext.clone(info.get('svg'));
if (!svg) {
svg = this.cloneDocument(info.get('svg'));
}
width = parseFloat(svg.documentElement.getAttribute('width'));
height = parseFloat(svg.documentElement.getAttribute('height'));
fill = info.get('fillId');
if (!Ext.isArray(fill)) {
fill = [fill];
}
for (i = 0; i < fill.length; i++) {
svg.getElementById(fill[i]).style.fill = color;
}
rotateTransform = 'rotate(' + angle + ' ' + width / 2 + ' ' + height / 2 + ')';
svg.getElementById(info.get('rotateId')).setAttribute('transform', rotateTransform);
if (zoom) {
width *= Traccar.Style.mapScaleSelected;
height *= Traccar.Style.mapScaleSelected;
scaleTransform = 'scale(' + Traccar.Style.mapScaleSelected + ') ';
} else {
width *= Traccar.Style.mapScaleNormal;
height *= Traccar.Style.mapScaleNormal;
scaleTransform = 'scale(' + Traccar.Style.mapScaleNormal + ') ';
}
if (info.get('scaleId') !== info.get('rotateId')) {
svg.getElementById(info.get('scaleId')).setAttribute('transform', scaleTransform);
} else {
svg.getElementById(info.get('scaleId')).setAttribute('transform', scaleTransform + ' ' + rotateTransform);
}
svg.documentElement.setAttribute('width', width);
svg.documentElement.setAttribute('height', height);
svg.documentElement.setAttribute('viewBox', '0 0 ' + width + ' ' + height);
return svg;
},
formatSrc: function (svg) {
return 'data:image/svg+xml;charset=utf-8,' +
encodeURIComponent(new XMLSerializer().serializeToString(svg.documentElement));
},
cloneDocument: function (svgDocument) {
var newDocument, newNode;
newDocument = svgDocument.implementation.createDocument(svgDocument.namespaceURI, null, null);
newNode = newDocument.importNode(svgDocument.documentElement, true);
newDocument.appendChild(newNode);
return newDocument;
},
getImageIcon: function (color, zoom, angle, category) {
var image, svg, width, height;
svg = this.getImageSvg(color, zoom, angle, category);
width = parseFloat(svg.documentElement.getAttribute('width'));
height = parseFloat(svg.documentElement.getAttribute('height'));
image = new ol.style.Icon({
imgSize: [width, height],
src: this.formatSrc(svg)
});
image.fill = color;
image.zoom = zoom;
image.angle = angle;
image.category = category;
return image;
}
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* 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.GeofenceConverter', {
singleton: true,
wktToGeometry: function (mapView, wkt) {
var geometry, projection, resolutionAtEquator, pointResolution, resolutionFactor,
points = [], center, radius, content, i, lat, lon, coordinates;
if (wkt.lastIndexOf('POLYGON', 0) === 0) {
content = wkt.match(/\([^()]+\)/);
if (content !== null) {
coordinates = content[0].match(/-?\d+\.?\d*/g);
if (coordinates !== null) {
projection = mapView.getProjection();
for (i = 0; i < coordinates.length; i += 2) {
lat = Number(coordinates[i]);
lon = Number(coordinates[i + 1]);
points.push(ol.proj.transform([lon, lat], 'EPSG:4326', projection));
}
geometry = new ol.geom.Polygon([points]);
}
}
} else if (wkt.lastIndexOf('CIRCLE', 0) === 0) {
content = wkt.match(/\([^()]+\)/);
if (content !== null) {
coordinates = content[0].match(/-?\d+\.?\d*/g);
if (coordinates !== null) {
projection = mapView.getProjection();
center = ol.proj.transform([Number(coordinates[1]), Number(coordinates[0])], 'EPSG:4326', projection);
resolutionAtEquator = mapView.getResolution();
pointResolution = ol.proj.getPointResolution(projection, resolutionAtEquator, center);
resolutionFactor = resolutionAtEquator / pointResolution;
radius = Number(coordinates[2]) / ol.proj.Units.METERS_PER_UNIT.m * resolutionFactor;
geometry = new ol.geom.Circle(center, radius);
}
}
} else if (wkt.lastIndexOf('LINESTRING', 0) === 0) {
content = wkt.match(/\([^()]+\)/);
if (content !== null) {
coordinates = content[0].match(/-?\d+\.?\d*/g);
if (coordinates !== null) {
projection = mapView.getProjection();
for (i = 0; i < coordinates.length; i += 2) {
lat = Number(coordinates[i]);
lon = Number(coordinates[i + 1]);
points.push(ol.proj.transform([lon, lat], 'EPSG:4326', projection));
}
geometry = new ol.geom.LineString(points);
}
}
}
return geometry;
},
geometryToWkt: function (projection, geometry) {
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');
groundRadius = ol.sphere.getDistance(
center, ol.proj.transform(edgeCoordinate, projection, 'EPSG:4326'), 6378137);
result = 'CIRCLE (';
result += center[1] + ' ' + center[0] + ', ';
result += groundRadius.toFixed(1) + ')';
} else if (geometry instanceof ol.geom.Polygon) {
geometry.transform(projection, 'EPSG:4326');
points = geometry.getCoordinates();
result = 'POLYGON((';
for (i = 0; i < points[0].length; i += 1) {
result += points[0][i][1] + ' ' + points[0][i][0] + ', ';
}
result = result.substring(0, result.length - 2) + '))';
} else if (geometry instanceof ol.geom.LineString) {
geometry.transform(projection, 'EPSG:4326');
points = geometry.getCoordinates();
result = 'LINESTRING (';
for (i = 0; i < points.length; i += 1) {
result += points[i][1] + ' ' + points[i][0] + ', ';
}
result = result.substring(0, result.length - 2) + ')';
}
return result;
}
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.Style', {
singleton: true,
refreshPeriod: 60 * 1000,
reconnectTimeout: 60 * 1000,
reportTimeout: 120 * 1000,
normalPadding: 10,
windowWidth: 800,
windowHeight: 600,
formFieldWidth: 275,
dateTimeFormat24: 'Y-m-d H:i:s',
dateTimeFormat12: 'Y-m-d g:i:s a',
timeFormat24: 'H:i',
timeFormat12: 'g:i a',
dateFormat: 'Y-m-d',
weekStartDay: 1,
deviceWidth: 400,
toastWidth: 300,
reportHeight: 250,
columnWidthNormal: 100,
mapDefaultLat: 48.8567,
mapDefaultLon: 2.3508,
mapDefaultZoom: 4,
mapRouteColor: [
'#F06292',
'#BA68C8',
'#4DD0E1',
'#4DB6AC',
'#FF8A65',
'#A1887F'
],
mapRouteWidth: 5,
mapTextColor: 'rgba(50, 50, 50, 1.0)',
mapTextStrokeColor: 'rgba(255, 255, 255, 1.0)',
mapTextStrokeWidth: 2,
mapTextOffset: 2,
mapTextFont: 'bold 12px sans-serif',
mapColorOnline: 'rgba(77, 250, 144, 1.0)',
mapColorUnknown: 'rgba(250, 190, 77, 1.0)',
mapColorOffline: 'rgba(255, 162, 173, 1.0)',
mapScaleNormal: 1,
mapScaleSelected: 1.5,
mapMaxZoom: 18,
mapDelay: 500,
mapAccuracyColor: 'rgba(96, 96, 96, 1.0)',
mapGeofenceTextColor: 'rgba(14, 88, 141, 1.0)',
mapGeofenceColor: 'rgba(21, 127, 204, 1.0)',
mapGeofenceOverlayOpacity: 0.2,
mapGeofenceWidth: 5,
mapGeofenceRadius: 9,
mapAnimateMarkerDuration: 2000,
mapAnimateMarkerTimeout: 40,
coordinatePrecision: 6,
numberPrecision: 2,
reportGridStyle: 'borderTop: 1px solid lightgray',
chartPadding: '20 40 10 10',
chartMarkerRadius: 3,
chartMarkerHighlightScaling: 1.5
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.model.Attribute', {
extend: 'Ext.data.Model',
fields: [{
name: 'priority',
type: 'int'
}, {
name: 'name',
type: 'string'
}, {
name: 'value'
}, {
name: 'attribute',
type: 'string'
}]
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.Calendar', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'name',
type: 'string'
}, {
name: 'data'
}, {
name: 'attributes'
}]
});
/*
* Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
*
* 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.model.Command', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'description',
type: 'string'
}, {
name: 'deviceId',
type: 'int'
}, {
name: 'type',
type: 'string'
}, {
name: 'textChannel',
type: 'boolean'
}, {
name: 'attributes'
}]
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.ComputedAttribute', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'description',
type: 'string'
}, {
name: 'type',
type: 'string'
}, {
name: 'attribute',
type: 'string'
}, {
name: 'expression',
type: 'string'
}]
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.model.Device', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'name',
type: 'string'
}, {
name: 'uniqueId',
type: 'string'
}, {
name: 'phone',
type: 'string',
allowNull: true
}, {
name: 'model',
type: 'string',
allowNull: true
}, {
name: 'contact',
type: 'string',
allowNull: true
}, {
name: 'category',
type: 'string',
allowNull: true
}, {
name: 'status',
type: 'string',
allowNull: true
}, {
name: 'lastUpdate',
type: 'date',
dateFormat: 'c'
}, {
name: 'groupId',
type: 'int'
}, {
name: 'disabled',
type: 'boolean'
}, {
name: 'attributes'
}]
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.Driver', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'name',
type: 'string'
}, {
name: 'uniqueId',
type: 'string'
}, {
name: 'attributes'
}]
});
/*
* Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.Event', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'type',
type: 'string'
}, {
name: 'eventTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'deviceId',
type: 'int'
}, {
name: 'positionId',
type: 'int'
}, {
name: 'geofenceId',
type: 'int'
}, {
name: 'maintenanceId',
type: 'int'
}, {
name: 'text',
convert: function (v, rec) {
var text, alarmKey, geofence, maintenance;
if (rec.get('type') === 'commandResult') {
text = Strings.eventCommandResult + ': ' + rec.get('attributes')['result'];
} else if (rec.get('type') === 'alarm') {
alarmKey = rec.get('attributes')['alarm'];
alarmKey = 'alarm' + alarmKey.charAt(0).toUpperCase() + alarmKey.slice(1);
text = Strings[alarmKey] || alarmKey;
} else if (rec.get('type') === 'textMessage') {
text = Strings.eventTextMessage + ': ' + rec.get('attributes')['message'];
} else if (rec.get('type') === 'driverChanged') {
text = Strings.eventDriverChanged + ': ' +
Traccar.AttributeFormatter.driverUniqueIdFormatter(rec.get('attributes')['driverUniqueId']);
} else {
text = Traccar.app.getEventString(rec.get('type'));
}
if (rec.get('geofenceId')) {
geofence = Ext.getStore('Geofences').getById(rec.get('geofenceId'));
if (geofence) {
text += ' "' + geofence.get('name') + '"';
}
}
if (rec.get('maintenanceId')) {
maintenance = Ext.getStore('Maintenances').getById(rec.get('maintenanceId'));
if (maintenance) {
text += ' "' + maintenance.get('name') + '"';
}
}
return text;
},
depends: ['type', 'attributes', 'geofenceId', 'maintenanceId']
}, {
name: 'attributes'
}]
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* 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.model.Geofence', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'name',
type: 'string'
}, {
name: 'description',
type: 'string'
}, {
name: 'area',
type: 'string'
}, {
name: 'calendarId',
type: 'int'
}, {
name: 'attributes'
}]
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* 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.model.Group', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'name',
type: 'string'
}, {
name: 'groupId',
type: 'int'
}, {
name: 'attributes'
}]
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.KnownAttribute', {
extend: 'Ext.data.Model',
idProperty: 'key',
fields: [{
name: 'key',
type: 'string'
}, {
name: 'name',
type: 'string'
}, {
name: 'valueType',
type: 'string'
}, {
name: 'dataType',
type: 'string'
}]
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.KnownCommand', {
extend: 'Ext.data.Model',
idProperty: 'type',
fields: [{
name: 'type',
type: 'string'
}, {
name: 'name',
convert: function (v, rec) {
return Traccar.AttributeFormatter.getFormatter('commandType')(rec.get('type'));
},
depends: ['type']
}, {
name: 'parameters'
}]
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.KnownNotification', {
extend: 'Ext.data.Model',
idProperty: 'type',
fields: [{
name: 'type',
type: 'string'
}, {
name: 'name',
convert: function (v, rec) {
return Traccar.app.getEventString(rec.get('type'));
},
depends: ['type']
}]
});
/*
* Copyright 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.KnownNotificator', {
extend: 'Ext.data.Model',
idProperty: 'type',
fields: [{
name: 'type',
type: 'string'
}, {
name: 'name',
convert: function (v, rec) {
return Traccar.app.getNotificatorString(rec.get('type'));
},
depends: ['type']
}]
});
/*
* Copyright 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.Maintenance', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'name',
type: 'string'
}, {
name: 'type',
type: 'string'
}, {
name: 'start',
type: 'float'
}, {
name: 'period',
type: 'float'
}, {
name: 'attributes'
}]
});
/*
* Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
*
* 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.model.Notification', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'type',
type: 'string'
}, {
name: 'always',
type: 'bool'
}, {
name: 'attributes'
}, {
name: 'notificators',
type: 'string'
}, {
name: 'calendarId',
type: 'int'
}]
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.model.Position', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'protocol',
type: 'string'
}, {
name: 'deviceId',
type: 'int'
}, {
name: 'serverTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'deviceTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'fixTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'valid',
type: 'boolean'
}, {
name: 'accuracy',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('accuracy')
}, {
name: 'latitude',
type: 'float'
}, {
name: 'longitude',
type: 'float'
}, {
name: 'altitude',
type: 'float'
}, {
name: 'speed',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('speed')
}, {
name: 'course',
type: 'float'
}, {
name: 'address',
type: 'string'
}, {
name: 'attributes'
}]
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.ReportStop', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'deviceId',
type: 'int'
}, {
name: 'deviceName',
type: 'string'
}, {
name: 'duration',
type: 'int'
}, {
name: 'startTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'startOdometer',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('distance')
}, {
name: 'address',
type: 'string'
}, {
name: 'endTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'engineHours',
type: 'int'
}, {
name: 'positionId',
type: 'int'
}, {
name: 'spentFuel',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('spentFuel')
}]
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.ReportSummary', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'deviceId',
type: 'int'
}, {
name: 'deviceName',
type: 'string'
}, {
name: 'startTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'maxSpeed',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('speed')
}, {
name: 'averageSpeed',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('speed')
}, {
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'
}, {
name: 'spentFuel',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('spentFuel')
}]
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.model.ReportTrip', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'deviceId',
type: 'int'
}, {
name: 'deviceName',
type: 'string'
}, {
name: 'maxSpeed',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('speed')
}, {
name: 'averageSpeed',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('speed')
}, {
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'
}, {
name: 'startTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'startAddress',
type: 'string'
}, {
name: 'endTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'endAddress',
type: 'string'
}, {
name: 'spentFuel',
type: 'float',
convert: Traccar.AttributeFormatter.getConverter('spentFuel')
}, {
name: 'driverUniqueId',
type: 'string'
}, {
name: 'driverName',
type: 'string'
}]
});
/*
* Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
*
* 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.model.Server', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'registration',
type: 'boolean'
}, {
name: 'readonly',
type: 'boolean'
}, {
name: 'deviceReadonly',
type: 'boolean'
}, {
name: 'limitCommands',
type: 'boolean'
}, {
name: 'disableReports',
type: 'boolean'
}, {
name: 'map',
type: 'string'
}, {
name: 'bingKey',
type: 'string'
}, {
name: 'mapUrl',
type: 'string'
}, {
name: 'latitude',
type: 'float'
}, {
name: 'longitude',
type: 'float'
}, {
name: 'zoom',
type: 'int'
}, {
name: 'forceSettings',
type: 'boolean'
}, {
name: 'coordinateFormat',
type: 'string'
}, {
name: 'poiLayer',
type: 'string'
}, {
name: 'announcement',
type: 'string'
}, {
name: 'attributes'
}],
proxy: {
type: 'ajax',
url: 'api/server',
actionMethods: {
update: 'PUT'
},
writer: {
type: 'json',
writeAllFields: true
}
}
});
/*
* Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
*
* 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.model.Statistics', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'captureTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'activeUsers',
type: 'int'
}, {
name: 'activeDevices',
type: 'int'
}, {
name: 'requests',
type: 'int'
}, {
name: 'messagesReceived',
type: 'int'
}, {
name: 'messagesStored',
type: 'int'
}, {
name: 'mailSent',
type: 'int'
}, {
name: 'smsSent',
type: 'int'
}, {
name: 'geocoderRequests',
type: 'int'
}, {
name: 'geolocationRequests',
type: 'int'
}, {
name: 'attributes'
}]
});
/*
* Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
*
* 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.model.User', {
extend: 'Ext.data.Model',
identifier: 'negative',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'name',
type: 'string'
}, {
name: 'login',
type: 'string'
}, {
name: 'email',
type: 'string'
}, {
name: 'password',
type: 'string'
}, {
name: 'phone',
type: 'string'
}, {
name: 'readonly',
type: 'boolean'
}, {
name: 'administrator',
type: 'boolean'
}, {
name: 'map',
type: 'string'
}, {
name: 'latitude',
type: 'float'
}, {
name: 'longitude',
type: 'float'
}, {
name: 'zoom',
type: 'int'
}, {
name: 'coordinateFormat',
type: 'string'
}, {
name: 'disabled',
type: 'boolean'
}, {
name: 'expirationTime',
type: 'date',
dateFormat: 'c'
}, {
name: 'deviceLimit',
type: 'int'
}, {
name: 'userLimit',
type: 'int'
}, {
name: 'deviceReadonly',
type: 'boolean'
}, {
name: 'limitCommands',
type: 'boolean'
}, {
name: 'disableReports',
type: 'boolean'
}, {
name: 'poiLayer',
type: 'string'
}, {
name: 'attributes'
}],
proxy: {
type: 'rest',
url: 'api/users',
writer: {
type: 'json',
writeAllFields: true
}
}
});
/*
* Copyright 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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;
})()
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.AllCalendars', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Calendar',
proxy: {
type: 'rest',
url: 'api/calendars',
extraParams: {
all: true
}
}
});
/*
* Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.AllCommandTypes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownCommand',
proxy: {
type: 'rest',
url: 'api/commands/types',
listeners: {
exception: function (proxy, response) {
Traccar.app.showError(response);
}
}
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.AllCommands', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Command',
proxy: {
type: 'rest',
url: 'api/commands',
extraParams: {
all: true
}
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.AllComputedAttributes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.ComputedAttribute',
proxy: {
type: 'rest',
url: 'api/attributes/computed',
extraParams: {
all: true
}
}
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.AllDevices', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Device',
proxy: {
type: 'rest',
url: 'api/devices',
extraParams: {
all: true
}
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.AllDrivers', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Driver',
proxy: {
type: 'rest',
url: 'api/drivers',
extraParams: {
all: true
}
}
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* 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.AllGeofences', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Geofence',
proxy: {
type: 'rest',
url: 'api/geofences',
extraParams: {
all: true
}
}
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* 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.AllGroups', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Group',
proxy: {
type: 'rest',
url: 'api/groups',
extraParams: {
all: true
}
}
});
/*
* Copyright 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.AllMaintenances', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Maintenance',
proxy: {
type: 'rest',
url: 'api/maintenance',
extraParams: {
all: true
}
}
});
/*
* Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.AllNotificationTypes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownNotification',
proxy: {
type: 'rest',
url: 'api/notifications/types',
listeners: {
exception: function (proxy, response) {
Traccar.app.showError(response);
}
}
}
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.AllNotifications', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Notification',
proxy: {
type: 'rest',
url: 'api/notifications',
extraParams: {
all: true
}
}
});
/*
* Copyright 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.AllNotificators', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownNotificator',
proxy: {
type: 'rest',
url: 'api/notifications/notificators',
listeners: {
exception: function (proxy, response) {
Traccar.app.showError(response);
}
}
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.AttributeValueTypes', {
extend: 'Ext.data.Store',
fields: ['id', 'name'],
proxy: 'memory',
data: [{
id: 'string',
name: Strings.sharedTypeString
}, {
id: 'number',
name: Strings.sharedTypeNumber
}, {
id: 'boolean',
name: Strings.sharedTypeBoolean
}]
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.Attributes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Attribute',
sorters: [{
property: 'priority'
}]
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.Calendars', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Calendar',
proxy: {
type: 'rest',
url: 'api/calendars',
writer: {
writeAllFields: true
}
}
});
/*
* Copyright 2016 Gabor Somogyi (gabor.g.somogyi@gmail.com)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.CommandTypes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownCommand',
proxy: {
type: 'rest',
url: 'api/commands/types',
listeners: {
'exception': function (proxy, response) {
Traccar.app.showError(response);
}
}
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.Commands', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Command',
proxy: {
type: 'rest',
url: 'api/commands',
writer: {
writeAllFields: true
}
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.CommonDeviceAttributes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownAttribute',
data: [{
key: 'speedLimit',
name: Strings.attributeSpeedLimit,
valueType: 'number',
dataType: 'speed'
}, {
key: 'report.ignoreOdometer',
name: Strings.attributeReportIgnoreOdometer,
valueType: 'boolean'
}]
});
/*
* Copyright 2017 - 2022 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.CommonUserAttributes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownAttribute',
data: [{
key: 'web.liveRouteLength',
name: Strings.attributeWebLiveRouteLength,
valueType: 'number',
allowDecimals: false
}, {
key: 'web.selectZoom',
name: Strings.attributeWebSelectZoom,
valueType: 'number',
allowDecimals: false,
minValue: Traccar.Style.mapDefaultZoom,
maxValue: Traccar.Style.mapMaxZoom
}, {
key: 'web.maxZoom',
name: Strings.attributeWebMaxZoom,
valueType: 'number',
allowDecimals: false,
minValue: Traccar.Style.mapDefaultZoom,
maxValue: Traccar.Style.mapMaxZoom
}, {
key: 'ui.disableEvents',
name: Strings.attributeUiDisableEvents,
valueType: 'boolean'
}, {
key: 'ui.disableVehicleFeatures',
name: Strings.attributeUiDisableVehicleFeatures,
valueType: 'boolean'
}, {
key: 'ui.disableDrivers',
name: Strings.attributeUiDisableDrivers,
valueType: 'boolean'
}, {
key: 'ui.disableComputedAttributes',
name: Strings.attributeUiDisableComputedAttributes,
valueType: 'boolean'
}, {
key: 'ui.disableCalendars',
name: Strings.attributeUiDisableCalendars,
valueType: 'boolean'
}, {
key: 'ui.disableMaintenance',
name: Strings.attributeUiDisableMaintenance,
valueType: 'boolean'
}, {
key: 'ui.hidePositionAttributes',
name: Strings.attributeUiHidePositionAttributes,
valueType: 'string'
}, {
key: 'distanceUnit',
name: Strings.settingsDistanceUnit,
valueType: 'string',
dataType: 'distanceUnit'
}, {
key: 'speedUnit',
name: Strings.settingsSpeedUnit,
valueType: 'string',
dataType: 'speedUnit'
}, {
key: 'volumeUnit',
name: Strings.settingsVolumeUnit,
valueType: 'string',
dataType: 'volumeUnit'
}, {
key: 'timezone',
name: Strings.sharedTimezone,
valueType: 'string',
dataType: 'timezone'
}]
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.ComputedAttributes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.ComputedAttribute',
proxy: {
type: 'rest',
url: 'api/attributes/computed',
writer: {
writeAllFields: true
}
}
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* 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.CoordinateFormats', {
extend: 'Ext.data.Store',
fields: ['key', 'name'],
data: [{
key: 'dd',
name: Strings.sharedDecimalDegrees
}, {
key: 'ddm',
name: Strings.sharedDegreesDecimalMinutes
}, {
key: 'dms',
name: Strings.sharedDegreesMinutesSeconds
}],
formatValue: function (key, value, unit) {
var hemisphere, degrees, minutes, seconds;
if (key === 'latitude') {
hemisphere = value >= 0 ? 'N' : 'S';
} else {
hemisphere = value >= 0 ? 'E' : 'W';
}
switch (unit) {
case 'ddm':
value = Math.abs(value);
degrees = Math.floor(value);
minutes = (value - degrees) * 60;
return degrees + '° ' + minutes.toFixed(Traccar.Style.coordinatePrecision) + '\' ' + hemisphere;
case 'dms':
value = Math.abs(value);
degrees = Math.floor(value);
minutes = Math.floor((value - degrees) * 60);
seconds = Math.round((value - degrees - minutes / 60) * 3600);
return degrees + '° ' + minutes + '\' ' + seconds + '" ' + hemisphere;
default:
return value.toFixed(Traccar.Style.coordinatePrecision) + '°';
}
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.DeviceAttributes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownAttribute',
data: [{
key: 'web.reportColor',
name: Strings.attributeWebReportColor,
valueType: 'color'
}, {
key: 'devicePassword',
name: Strings.attributeDevicePassword,
valueType: 'string'
}, {
key: 'processing.copyAttributes',
name: Strings.attributeProcessingCopyAttributes,
valueType: 'string'
}, {
key: 'decoder.timezone',
name: Strings.sharedTimezone,
valueType: 'string',
dataType: 'timezone'
}, {
key: 'deviceInactivityStart',
name: Strings.attributeDeviceInactivityStart,
valueType: 'number',
allowDecimals: false,
minValue: 1
}, {
key: 'deviceInactivityPeriod',
name: Strings.attributeDeviceInactivityPeriod,
valueType: 'number',
allowDecimals: false,
minValue: 1
}]
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.DeviceCommands', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Command',
proxy: {
type: 'rest',
url: 'api/commands/send',
listeners: {
'exception': function (proxy, response) {
Traccar.app.showError(response);
}
}
}
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.DeviceImages', {
extend: 'Ext.data.Store',
fields: ['key', 'name', 'svg', 'fillId', 'rotateId', 'scaleId'],
data: (function () {
var i, key, data = [];
for (i = 0; i < window.Images.length; i++) {
key = window.Images[i];
data.push({
key: key,
name: Strings['category' + key.charAt(0).toUpperCase() + key.slice(1)],
svg: document.getElementById(key + 'Svg').contentDocument,
fillId: key === 'arrow' ? 'arrow' : 'background',
rotateId: key === 'arrow' ? 'arrow' : 'background',
scaleId: key === 'arrow' ? 'arrow' : 'layer1'
});
}
return data;
})()
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.DeviceStatuses', {
extend: 'Ext.data.Store',
fields: ['id', 'name', 'color'],
data: [{
id: 'online',
name: Strings.deviceStatusOnline,
color: 'view-color-green'
}, {
id: 'offline',
name: Strings.deviceStatusOffline,
color: 'view-color-red'
}, {
id: 'unknown',
name: Strings.deviceStatusUnknown,
color: 'view-color-yellow'
}]
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.Devices', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Device',
proxy: {
type: 'rest',
url: 'api/devices',
writer: {
writeAllFields: true
}
}
});
/*
* Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
*
* 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.DistanceUnits', {
extend: 'Ext.data.Store',
fields: ['key', 'name', 'factor'],
data: [{
key: 'km',
name: Strings.sharedKm,
factor: 0.001
}, {
key: 'mi',
name: Strings.sharedMi,
factor: 0.000621371
}, {
key: 'nmi',
name: Strings.sharedNmi,
factor: 0.000539957
}],
convertValue: function (value, unit, back) {
var model;
if (!unit) {
unit = 'km';
}
model = this.findRecord('key', unit);
return back ? value / model.get('factor') : value * model.get('factor');
},
formatValue: function (value, unit, convert) {
var model;
if (!unit) {
unit = 'km';
}
model = this.findRecord('key', unit);
return (convert ? this.convertValue(value, unit) : value).toFixed(2) + ' ' + model.get('name');
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.Drivers', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Driver',
proxy: {
type: 'rest',
url: 'api/drivers',
writer: {
writeAllFields: true
}
}
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.EventPositions', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Position',
trackRemoved: false,
proxy: {
type: 'rest',
url: 'api/positions',
headers: {
'Accept': 'application/json'
}
}
});
/*
* Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.Events', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Event',
trackRemoved: false,
proxy: {
type: 'rest',
url: 'api/events'
}
});
/*
* Copyright 2017 - 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2017 - 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.GeofenceAttributes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownAttribute',
proxy: 'memory',
data: [{
key: 'color',
name: Strings.attributeColor,
valueType: 'color'
}, {
key: 'speedLimit',
name: Strings.attributeSpeedLimit,
valueType: 'number',
dataType: 'speed'
}, {
key: 'polylineDistance',
name: Strings.attributePolylineDistance,
valueType: 'number',
dataType: 'distance'
}]
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* 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.GeofenceTypes', {
extend: 'Ext.data.Store',
fields: ['key', 'name'],
data: [{
key: 'Polygon',
name: Strings.mapShapePolygon
}, {
key: 'Circle',
name: Strings.mapShapeCircle
}, {
key: 'LineString',
name: Strings.mapShapePolyline
}]
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* 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.Geofences', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Geofence',
proxy: {
type: 'rest',
url: 'api/geofences',
writer: {
writeAllFields: true
}
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.GroupAttributes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownAttribute',
data: [{
key: 'processing.copyAttributes',
name: Strings.attributeProcessingCopyAttributes,
valueType: 'string'
}, {
key: 'decoder.timezone',
name: Strings.sharedTimezone,
valueType: 'string',
dataType: 'timezone'
}]
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
*
* 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.Groups', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Group',
proxy: {
type: 'rest',
url: 'api/groups',
writer: {
writeAllFields: true
}
}
});
/*
* Copyright 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.HoursUnits', {
extend: 'Ext.data.Store',
fields: ['key', 'name', 'fullName'],
data: [{
key: 'h',
name: Strings.sharedHourAbbreviation,
fullName: Strings.sharedHour
}],
convertValue: function (value, unit, back) {
return back ? value * 3600000 : value / 3600000;
},
formatValue: function (value, unit, convert) {
var hours, minutes;
if (convert) {
hours = Math.floor(value / 3600000);
minutes = Math.floor(value % 3600000 / 60000);
} else {
hours = Math.floor(value);
minutes = Math.floor(value % 1 * 60);
}
return hours + ' ' + Strings.sharedHourAbbreviation + ' ' + minutes + ' ' + Strings.sharedMinuteAbbreviation;
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.KnownCommands', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownCommand',
data: [{
type: 'custom',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'positionPeriodic',
parameters: [{
key: 'frequency',
name: Strings.commandFrequency,
valueType: 'number',
allowDecimals: false,
minValue: 0,
dataType: 'frequency'
}]
}, {
type: 'setTimezone',
parameters: [{
key: 'timezone',
name: Strings.commandTimezone,
valueType: 'string',
dataType: 'timezone'
}]
}, {
type: 'sendSms',
parameters: [{
key: 'phone',
name: Strings.commandPhone,
valueType: 'string'
}, {
key: 'message',
name: Strings.commandMessage,
valueType: 'string'
}]
}, {
type: 'message',
parameters: [{
key: 'message',
name: Strings.commandMessage,
valueType: 'string'
}]
}, {
type: 'sendUssd',
parameters: [{
key: 'phone',
name: Strings.commandPhone,
valueType: 'string'
}]
}, {
type: 'sosNumber',
parameters: [{
key: 'index',
name: Strings.commandIndex,
valueType: 'number',
allowDecimals: false,
minValue: 0
}, {
key: 'phone',
name: Strings.commandPhone,
valueType: 'string'
}]
}, {
type: 'silenceTime',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'setPhonebook',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'voiceMessage',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'outputControl',
parameters: [{
key: 'index',
name: Strings.commandIndex,
valueType: 'number',
allowDecimals: false,
minValue: 0
}, {
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'voiceMonitoring',
parameters: [{
key: 'enable',
name: Strings.commandEnable,
valueType: 'boolean'
}]
}, {
type: 'setAgps',
parameters: [{
key: 'enable',
name: Strings.commandEnable,
valueType: 'boolean'
}]
}, {
type: 'setIndicator',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'configuration',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'setConnection',
parameters: [{
key: 'server',
name: Strings.commandServer,
valueType: 'string'
}, {
key: 'port',
name: Strings.commandPort,
valueType: 'number',
allowDecimals: false,
minValue: 1,
maxValue: 65535
}]
}, {
type: 'setOdometer',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'modePowerSaving',
parameters: [{
key: 'enable',
name: Strings.commandEnable,
valueType: 'boolean'
}]
}, {
type: 'modeDeepSleep',
parameters: [{
key: 'enable',
name: Strings.commandEnable,
valueType: 'boolean'
}]
}, {
type: 'alarmGeofence',
parameters: [{
key: 'radius',
name: Strings.commandRadius,
valueType: 'number',
allowDecimals: false,
minValue: 0
}]
}, {
type: 'alarmBattery',
parameters: [{
key: 'enable',
name: Strings.commandEnable,
valueType: 'boolean'
}]
}, {
type: 'alarmSos',
parameters: [{
key: 'enable',
name: Strings.commandEnable,
valueType: 'boolean'
}]
}, {
type: 'alarmRemove',
parameters: [{
key: 'enable',
name: Strings.commandEnable,
valueType: 'boolean'
}]
}, {
type: 'alarmClock',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'alarmSpeed',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}, {
type: 'alarmFall',
parameters: [{
key: 'enable',
name: Strings.commandEnable,
valueType: 'boolean'
}]
}, {
type: 'alarmVibration',
parameters: [{
key: 'data',
name: Strings.commandData,
valueType: 'string'
}]
}]
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.Languages', {
extend: 'Ext.data.Store',
fields: ['code', 'name'],
data: (function () {
var code, data = [];
for (code in Locale.languages) {
if (Locale.languages.hasOwnProperty(code)) {
data.push({
code: code,
name: Locale.languages[code].name
});
}
}
return data;
})()
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.LatestPositions', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Position'
});
/*
* Copyright 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.MaintenanceTypes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownAttribute'
});
/*
* Copyright 2018 Anton Tananaev (anton@traccar.org)
* Copyright 2018 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.Maintenances', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Maintenance',
proxy: {
type: 'rest',
url: 'api/maintenance',
writer: {
writeAllFields: true
}
}
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.MapTypes', {
extend: 'Ext.data.Store',
fields: ['key', 'name'],
data: [{
key: 'locationIqStreets',
name: Strings.mapLocationIqStreets
}, {
key: 'osm',
name: Strings.mapOsm
}, {
key: 'carto',
name: Strings.mapCarto
}, {
key: 'autoNavi',
name: Strings.mapAutoNavi
}, {
key: 'bingRoad',
name: Strings.mapBingRoad
}, {
key: 'bingAerial',
name: Strings.mapBingAerial
}, {
key: 'bingHybrid',
name: Strings.mapBingHybrid
}, {
key: 'yandexMap',
name: Strings.mapYandexMap
}, {
key: 'yandexSat',
name: Strings.mapYandexSat
}, {
key: 'custom',
name: Strings.mapCustom
}, {
key: 'customArcgis',
name: Strings.mapCustomArcgis
}]
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.Notifications', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Notification',
proxy: {
type: 'rest',
url: 'api/notifications',
writer: {
writeAllFields: true
}
}
});
/*
* Copyright 2017 Anton Tananaev (anton@traccar.org)
* Copyright 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.PositionAttributes', {
extend: 'Ext.data.Store',
model: 'Traccar.model.KnownAttribute',
proxy: 'memory',
data: [{
key: 'raw',
name: Strings.positionRaw,
valueType: 'string'
}, {
key: 'index',
name: Strings.positionIndex,
valueType: 'number'
}, {
key: 'hdop',
name: Strings.positionHdop,
valueType: 'number'
}, {
key: 'vdop',
name: Strings.positionVdop,
valueType: 'number'
}, {
key: 'pdop',
name: Strings.positionPdop,
valueType: 'number'
}, {
key: 'sat',
name: Strings.positionSat,
valueType: 'number'
}, {
key: 'satVisible',
name: Strings.positionSatVisible,
valueType: 'number'
}, {
key: 'rssi',
name: Strings.positionRssi,
valueType: 'number'
}, {
key: 'gps',
name: Strings.positionGps,
valueType: 'number'
}, {
key: 'roaming',
name: Strings.positionRoaming,
valueType: 'boolean'
}, {
key: 'event',
name: Strings.positionEvent,
valueType: 'string'
}, {
key: 'alarm',
name: Strings.positionAlarm,
valueType: 'string'
}, {
key: 'status',
name: Strings.positionStatus,
valueType: 'string'
}, {
key: 'odometer',
name: Strings.positionOdometer,
valueType: 'number',
dataType: 'distance'
}, {
key: 'serviceOdometer',
name: Strings.positionServiceOdometer,
valueType: 'number',
dataType: 'distance'
}, {
key: 'tripOdometer',
name: Strings.positionTripOdometer,
valueType: 'number',
dataType: 'distance'
}, {
key: 'hours',
name: Strings.positionHours,
valueType: 'number',
dataType: 'hours'
}, {
key: 'steps',
name: Strings.positionSteps,
valueType: 'number'
}, {
key: 'input',
name: Strings.positionInput,
valueType: 'string'
}, {
key: 'output',
name: Strings.positionOutput,
valueType: 'string'
}, {
key: 'power',
name: Strings.positionPower,
valueType: 'number',
dataType: 'voltage'
}, {
key: 'battery',
name: Strings.positionBattery,
valueType: 'number',
dataType: 'voltage'
}, {
key: 'batteryLevel',
name: Strings.positionBatteryLevel,
valueType: 'number',
dataType: 'percentage'
}, {
key: 'fuel',
name: Strings.positionFuel,
valueType: 'number',
dataType: 'volume'
}, {
key: 'fuelConsumption',
name: Strings.positionFuelConsumption,
valueType: 'number',
dataType: 'consumption'
}, {
key: 'versionFw',
name: Strings.positionVersionFw,
valueType: 'string'
}, {
key: 'versionHw',
name: Strings.positionVersionHw,
valueType: 'string'
}, {
key: 'type',
name: Strings.sharedType,
valueType: 'string'
}, {
key: 'ignition',
name: Strings.positionIgnition,
valueType: 'boolean'
}, {
key: 'flags',
name: Strings.positionFlags,
valueType: 'string'
}, {
key: 'charge',
name: Strings.positionCharge,
valueType: 'boolean'
}, {
key: 'ip',
name: Strings.positionIp,
valueType: 'string'
}, {
key: 'archive',
name: Strings.positionArchive,
valueType: 'boolean'
}, {
key: 'distance',
name: Strings.positionDistance,
valueType: 'number',
dataType: 'distance'
}, {
key: 'totalDistance',
name: Strings.deviceTotalDistance,
valueType: 'number',
dataType: 'distance'
}, {
key: 'rpm',
name: Strings.positionRpm,
valueType: 'number'
}, {
key: 'vin',
name: Strings.positionVin,
valueType: 'string'
}, {
key: 'approximate',
name: Strings.positionApproximate,
valueType: 'boolean'
}, {
key: 'throttle',
name: Strings.positionThrottle,
valueType: 'number'
}, {
key: 'motion',
name: Strings.positionMotion,
valueType: 'boolean'
}, {
key: 'armed',
name: Strings.positionArmed,
valueType: 'number'
}, {
key: 'geofence',
name: Strings.sharedGeofence,
valueType: 'string'
}, {
key: 'acceleration',
name: Strings.positionAcceleration,
valueType: 'number'
}, {
key: 'deviceTemp',
name: Strings.positionDeviceTemp,
valueType: 'number',
dataType: 'temperature'
}, {
key: 'operator',
name: Strings.positionOperator,
valueType: 'string'
}, {
key: 'command',
name: Strings.deviceCommand,
valueType: 'string'
}, {
key: 'blocked',
name: Strings.positionBlocked,
valueType: 'boolean'
}, {
key: 'dtcs',
name: Strings.positionDtcs,
valueType: 'string'
}, {
key: 'obdSpeed',
name: Strings.positionObdSpeed,
valueType: 'number',
dataType: 'speed'
}, {
key: 'obdOdometer',
name: Strings.positionObdOdometer,
valueType: 'number',
dataType: 'distance'
}, {
key: 'result',
name: Strings.eventCommandResult,
valueType: 'string'
}, {
key: 'driverUniqueId',
name: Strings.positionDriverUniqueId,
valueType: 'string',
dataType: 'driverUniqueId'
}],
getAttributeName: function (key, capitalize) {
var model = this.getById(key);
if (model) {
return model.get('name');
} else if (capitalize) {
return key.replace(/^./, function (match) {
return match.toUpperCase();
});
} else {
return key;
}
},
getAttributeDataType: function (key) {
var model = this.getById(key);
if (model && model.get('dataType')) {
return model.get('dataType');
} else {
return null;
}
}
});
/*
* Copyright 2015 Anton Tananaev (anton@traccar.org)
*
* 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.Positions', {
extend: 'Ext.data.Store',
model: 'Traccar.model.Position',
proxy: {
type: 'rest',
url: 'api/positions',
headers: {
'Accept': 'application/json'
}
}
});
/*
* Copyright 2016 Anton Tananaev (anton@traccar.org)
* Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
*
* 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.ReportChartTypes', {
extend: 'Ext.data.Store',
fields: ['key', 'name'],
data: [{
key: 'speed',
name: Strings.positionSpeed
}, {
key: 'accuracy',
name: Strings.positionAccuracy
}, {
key: 'altitude',
name: Strings.positionAltitude
}]
});
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment