From 2608adeff46f1286deff11a5320cee5647f6d41b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 18 Sep 2016 11:40:46 +1200 Subject: Move web interface from main repo --- web/app/store/AllDevices.js | 28 ++++++++++++++++++++++ web/app/store/AllGeofences.js | 28 ++++++++++++++++++++++ web/app/store/AllGroups.js | 28 ++++++++++++++++++++++ web/app/store/AllNotifications.js | 30 +++++++++++++++++++++++ web/app/store/Attributes.js | 24 +++++++++++++++++++ web/app/store/CommandTypes.js | 50 +++++++++++++++++++++++++++++++++++++++ web/app/store/Devices.js | 28 ++++++++++++++++++++++ web/app/store/DistanceUnits.js | 39 ++++++++++++++++++++++++++++++ web/app/store/Events.js | 25 ++++++++++++++++++++ web/app/store/GeofenceTypes.js | 28 ++++++++++++++++++++++ web/app/store/Geofences.js | 28 ++++++++++++++++++++++ web/app/store/Groups.js | 28 ++++++++++++++++++++++ web/app/store/Languages.js | 33 ++++++++++++++++++++++++++ web/app/store/LatestPositions.js | 20 ++++++++++++++++ web/app/store/MapTypes.js | 34 ++++++++++++++++++++++++++ web/app/store/Notifications.js | 25 ++++++++++++++++++++ web/app/store/Positions.js | 25 ++++++++++++++++++++ web/app/store/ReportEventTypes.js | 25 ++++++++++++++++++++ web/app/store/ReportEvents.js | 28 ++++++++++++++++++++++ web/app/store/ReportRoute.js | 28 ++++++++++++++++++++++ web/app/store/ReportSummary.js | 29 +++++++++++++++++++++++ web/app/store/ReportTrips.js | 29 +++++++++++++++++++++++ web/app/store/ReportTypes.js | 34 ++++++++++++++++++++++++++ web/app/store/SpeedUnits.js | 43 +++++++++++++++++++++++++++++++++ web/app/store/TimeUnits.js | 31 ++++++++++++++++++++++++ web/app/store/Users.js | 28 ++++++++++++++++++++++ 26 files changed, 776 insertions(+) create mode 100644 web/app/store/AllDevices.js create mode 100644 web/app/store/AllGeofences.js create mode 100644 web/app/store/AllGroups.js create mode 100644 web/app/store/AllNotifications.js create mode 100644 web/app/store/Attributes.js create mode 100644 web/app/store/CommandTypes.js create mode 100644 web/app/store/Devices.js create mode 100644 web/app/store/DistanceUnits.js create mode 100644 web/app/store/Events.js create mode 100644 web/app/store/GeofenceTypes.js create mode 100644 web/app/store/Geofences.js create mode 100644 web/app/store/Groups.js create mode 100644 web/app/store/Languages.js create mode 100644 web/app/store/LatestPositions.js create mode 100644 web/app/store/MapTypes.js create mode 100644 web/app/store/Notifications.js create mode 100644 web/app/store/Positions.js create mode 100644 web/app/store/ReportEventTypes.js create mode 100644 web/app/store/ReportEvents.js create mode 100644 web/app/store/ReportRoute.js create mode 100644 web/app/store/ReportSummary.js create mode 100644 web/app/store/ReportTrips.js create mode 100644 web/app/store/ReportTypes.js create mode 100644 web/app/store/SpeedUnits.js create mode 100644 web/app/store/TimeUnits.js create mode 100644 web/app/store/Users.js (limited to 'web/app/store') diff --git a/web/app/store/AllDevices.js b/web/app/store/AllDevices.js new file mode 100644 index 0000000..3f51926 --- /dev/null +++ b/web/app/store/AllDevices.js @@ -0,0 +1,28 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.AllDevices', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Device', + + proxy: { + type: 'rest', + url: 'api/devices', + extraParams: { + all: true + } + } +}); diff --git a/web/app/store/AllGeofences.js b/web/app/store/AllGeofences.js new file mode 100644 index 0000000..3520996 --- /dev/null +++ b/web/app/store/AllGeofences.js @@ -0,0 +1,28 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.AllGeofences', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Geofence', + + proxy: { + type: 'rest', + url: 'api/geofences', + extraParams: { + all: true + } + } +}); diff --git a/web/app/store/AllGroups.js b/web/app/store/AllGroups.js new file mode 100644 index 0000000..8ce0cc2 --- /dev/null +++ b/web/app/store/AllGroups.js @@ -0,0 +1,28 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.AllGroups', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Group', + + proxy: { + type: 'rest', + url: 'api/groups', + extraParams: { + all: true + } + } +}); diff --git a/web/app/store/AllNotifications.js b/web/app/store/AllNotifications.js new file mode 100644 index 0000000..9e9cb79 --- /dev/null +++ b/web/app/store/AllNotifications.js @@ -0,0 +1,30 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.AllNotifications', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Notification', + + proxy: { + type: 'rest', + url: 'api/users/notifications', + extraParams: { + all: true + } + }, + sortOnLoad: true, + sorters: { property: 'type', direction : 'ASC' } +}); diff --git a/web/app/store/Attributes.js b/web/app/store/Attributes.js new file mode 100644 index 0000000..2019582 --- /dev/null +++ b/web/app/store/Attributes.js @@ -0,0 +1,24 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.Attributes', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Attribute', + + sorters: [{ + property: 'priority' + }] +}); diff --git a/web/app/store/CommandTypes.js b/web/app/store/CommandTypes.js new file mode 100644 index 0000000..48405db --- /dev/null +++ b/web/app/store/CommandTypes.js @@ -0,0 +1,50 @@ +/* + * Copyright 2016 Gabor Somogyi (gabor.g.somogyi@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.CommandTypes', { + extend: 'Ext.data.Store', + fields: ['type', 'name'], + + listeners: { + 'beforeload' : function (store) { + var proxy; + proxy = store.getProxy(); + proxy.setUrl('api/commandtypes?deviceId' + proxy.extraParams.deviceId); + } + }, + + proxy: { + type: 'rest', + url: '', + reader: { + type: 'json', + getData: function (data) { + Ext.each(data, function (entry) { + var nameKey, name; + entry.name = entry.type; + if (typeof entry.type !== 'undefined') { + nameKey = 'command' + entry.type.charAt(0).toUpperCase() + entry.type.slice(1); + name = Strings[nameKey]; + if (typeof name !== 'undefined') { + entry.name = name; + } + } + }); + return data; + } + } + } +}); diff --git a/web/app/store/Devices.js b/web/app/store/Devices.js new file mode 100644 index 0000000..c3c3733 --- /dev/null +++ b/web/app/store/Devices.js @@ -0,0 +1,28 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.Devices', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Device', + + proxy: { + type: 'rest', + url: 'api/devices', + writer: { + writeAllFields: true + } + } +}); diff --git a/web/app/store/DistanceUnits.js b/web/app/store/DistanceUnits.js new file mode 100644 index 0000000..2805d52 --- /dev/null +++ b/web/app/store/DistanceUnits.js @@ -0,0 +1,39 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +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 + }], + + formatValue: function (value, unit) { + var model; + if (!unit) { + unit = 'km'; + } + model = this.findRecord('key', unit); + return (value * model.get('factor')).toFixed(2) + ' ' + model.get('name'); + } +}); diff --git a/web/app/store/Events.js b/web/app/store/Events.js new file mode 100644 index 0000000..2698933 --- /dev/null +++ b/web/app/store/Events.js @@ -0,0 +1,25 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.Events', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Event', + + proxy: { + type: 'rest', + url: 'api/events' + } +}); diff --git a/web/app/store/GeofenceTypes.js b/web/app/store/GeofenceTypes.js new file mode 100644 index 0000000..68c76be --- /dev/null +++ b/web/app/store/GeofenceTypes.js @@ -0,0 +1,28 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.GeofenceTypes', { + extend: 'Ext.data.Store', + fields: ['key', 'name'], + + data: [{ + key: 'Polygon', + name: Strings.mapShapePolygon + }, { + key: 'Circle', + name: Strings.mapShapeCircle + }] +}); diff --git a/web/app/store/Geofences.js b/web/app/store/Geofences.js new file mode 100644 index 0000000..a0b01ae --- /dev/null +++ b/web/app/store/Geofences.js @@ -0,0 +1,28 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.Geofences', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Geofence', + + proxy: { + type: 'rest', + url: 'api/geofences', + writer: { + writeAllFields: true + } + } +}); diff --git a/web/app/store/Groups.js b/web/app/store/Groups.js new file mode 100644 index 0000000..8740b25 --- /dev/null +++ b/web/app/store/Groups.js @@ -0,0 +1,28 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.Groups', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Group', + + proxy: { + type: 'rest', + url: 'api/groups', + writer: { + writeAllFields: true + } + } +}); diff --git a/web/app/store/Languages.js b/web/app/store/Languages.js new file mode 100644 index 0000000..027c96b --- /dev/null +++ b/web/app/store/Languages.js @@ -0,0 +1,33 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +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; + })() +}); diff --git a/web/app/store/LatestPositions.js b/web/app/store/LatestPositions.js new file mode 100644 index 0000000..c656bdc --- /dev/null +++ b/web/app/store/LatestPositions.js @@ -0,0 +1,20 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.LatestPositions', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Position' +}); diff --git a/web/app/store/MapTypes.js b/web/app/store/MapTypes.js new file mode 100644 index 0000000..4c26ad4 --- /dev/null +++ b/web/app/store/MapTypes.js @@ -0,0 +1,34 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.MapTypes', { + extend: 'Ext.data.Store', + fields: ['key', 'name'], + + data: [{ + key: 'osm', + name: Strings.mapOsm + }, { + key: 'bingRoad', + name: Strings.mapBingRoad + }, { + key: 'bingAerial', + name: Strings.mapBingAerial + }, { + key: 'custom', + name: Strings.mapCustom + }] +}); diff --git a/web/app/store/Notifications.js b/web/app/store/Notifications.js new file mode 100644 index 0000000..04cd9b8 --- /dev/null +++ b/web/app/store/Notifications.js @@ -0,0 +1,25 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.Notifications', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Notification', + + proxy: { + type: 'rest', + url: 'api/users/notifications' + } +}); diff --git a/web/app/store/Positions.js b/web/app/store/Positions.js new file mode 100644 index 0000000..8675983 --- /dev/null +++ b/web/app/store/Positions.js @@ -0,0 +1,25 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.Positions', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Position', + + proxy: { + type: 'rest', + url: 'api/positions' + } +}); diff --git a/web/app/store/ReportEventTypes.js b/web/app/store/ReportEventTypes.js new file mode 100644 index 0000000..27bc1fd --- /dev/null +++ b/web/app/store/ReportEventTypes.js @@ -0,0 +1,25 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2016 Andrey Kunitsyn (abyss@fox5.ru) + * + * 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. + */ + +Ext.define('Traccar.store.ReportEventTypes', { + extend: 'Ext.data.Store', + fields: ['type', 'name'], + + statics: { + allEvents: '%' + } +}); diff --git a/web/app/store/ReportEvents.js b/web/app/store/ReportEvents.js new file mode 100644 index 0000000..1759ffd --- /dev/null +++ b/web/app/store/ReportEvents.js @@ -0,0 +1,28 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.ReportEvents', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Event', + + proxy: { + type: 'rest', + url: 'api/reports/events', + headers: { + 'Accept': 'application/json' + } + } +}); diff --git a/web/app/store/ReportRoute.js b/web/app/store/ReportRoute.js new file mode 100644 index 0000000..ab6da94 --- /dev/null +++ b/web/app/store/ReportRoute.js @@ -0,0 +1,28 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.ReportRoute', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Position', + + proxy: { + type: 'rest', + url: 'api/reports/route', + headers: { + 'Accept': 'application/json' + } + } +}); diff --git a/web/app/store/ReportSummary.js b/web/app/store/ReportSummary.js new file mode 100644 index 0000000..7c9a4fc --- /dev/null +++ b/web/app/store/ReportSummary.js @@ -0,0 +1,29 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2016 Andrey Kunitsyn (abyss@fox5.ru) + * + * 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. + */ + +Ext.define('Traccar.store.ReportSummary', { + extend: 'Ext.data.Store', + model: 'Traccar.model.ReportSummary', + + proxy: { + type: 'rest', + url: 'api/reports/summary', + headers: { + 'Accept': 'application/json' + } + } +}); diff --git a/web/app/store/ReportTrips.js b/web/app/store/ReportTrips.js new file mode 100644 index 0000000..e0d86aa --- /dev/null +++ b/web/app/store/ReportTrips.js @@ -0,0 +1,29 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2016 Andrey Kunitsyn (abyss@fox5.ru) + * + * 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. + */ + +Ext.define('Traccar.store.ReportTrips', { + extend: 'Ext.data.Store', + model: 'Traccar.model.ReportTrip', + + proxy: { + type: 'rest', + url: 'api/reports/trips', + headers: { + 'Accept': 'application/json' + } + } +}); diff --git a/web/app/store/ReportTypes.js b/web/app/store/ReportTypes.js new file mode 100644 index 0000000..09ef61d --- /dev/null +++ b/web/app/store/ReportTypes.js @@ -0,0 +1,34 @@ +/* + * Copyright 2016 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.ReportTypes', { + extend: 'Ext.data.Store', + fields: ['key', 'name'], + + data: [{ + key: 'route', + name: Strings.reportRoute + }, { + key: 'events', + name: Strings.reportEvents + }, { + key: 'trips', + name: Strings.reportTrips + }, { + key: 'summary', + name: Strings.reportSummary + }] +}); diff --git a/web/app/store/SpeedUnits.js b/web/app/store/SpeedUnits.js new file mode 100644 index 0000000..296f586 --- /dev/null +++ b/web/app/store/SpeedUnits.js @@ -0,0 +1,43 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.SpeedUnits', { + extend: 'Ext.data.Store', + fields: ['key', 'name', 'factor'], + + data: [{ + key: 'kn', + name: Strings.sharedKn, + factor: 1 + }, { + key: 'kmh', + name: Strings.sharedKmh, + factor: 1.852 + }, { + key: 'mph', + name: Strings.sharedMph, + factor: 1.15078 + }], + + formatValue: function (value, unit) { + var model; + if (!unit) { + unit = 'kn'; + } + model = this.findRecord('key', unit); + return (value * model.get('factor')).toFixed(1) + ' ' + model.get('name'); + } +}); diff --git a/web/app/store/TimeUnits.js b/web/app/store/TimeUnits.js new file mode 100644 index 0000000..e032638 --- /dev/null +++ b/web/app/store/TimeUnits.js @@ -0,0 +1,31 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.TimeUnits', { + extend: 'Ext.data.Store', + fields: ['name', 'factor'], + + data: [{ + name: Strings.sharedSecond, + factor: 1 + }, { + name: Strings.sharedMinute, + factor: 60 + }, { + name: Strings.sharedHour, + factor: 3600 + }] +}); diff --git a/web/app/store/Users.js b/web/app/store/Users.js new file mode 100644 index 0000000..53a49ff --- /dev/null +++ b/web/app/store/Users.js @@ -0,0 +1,28 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * 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. + */ + +Ext.define('Traccar.store.Users', { + extend: 'Ext.data.Store', + model: 'Traccar.model.User', + + proxy: { + type: 'rest', + url: 'api/users', + writer: { + writeAllFields: true + } + } +}); -- cgit v1.2.3