diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-09-18 11:40:46 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-09-18 11:40:46 +1200 |
commit | 2608adeff46f1286deff11a5320cee5647f6d41b (patch) | |
tree | a16014c04c755ec701b3237b0cccc7d8cc406960 /web/app/store | |
parent | d5ca160059220a07c71c95cc85696e0d66bf9c6e (diff) | |
download | trackermap-web-2608adeff46f1286deff11a5320cee5647f6d41b.tar.gz trackermap-web-2608adeff46f1286deff11a5320cee5647f6d41b.tar.bz2 trackermap-web-2608adeff46f1286deff11a5320cee5647f6d41b.zip |
Move web interface from main repo
Diffstat (limited to 'web/app/store')
26 files changed, 776 insertions, 0 deletions
diff --git a/web/app/store/AllDevices.js b/web/app/store/AllDevices.js new file mode 100644 index 00000000..3f51926e --- /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 00000000..35209967 --- /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 00000000..8ce0cc2f --- /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 00000000..9e9cb791 --- /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 00000000..2019582e --- /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 00000000..48405db6 --- /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 00000000..c3c37331 --- /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 00000000..2805d52f --- /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 00000000..2698933f --- /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 00000000..68c76bef --- /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 00000000..a0b01ae6 --- /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 00000000..8740b25d --- /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 00000000..027c96be --- /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 00000000..c656bdcb --- /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 00000000..4c26ad45 --- /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 00000000..04cd9b86 --- /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 00000000..8675983e --- /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 00000000..27bc1fd5 --- /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 00000000..1759ffde --- /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 00000000..ab6da94c --- /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 00000000..7c9a4fca --- /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 00000000..e0d86aa4 --- /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 00000000..09ef61db --- /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 00000000..296f5863 --- /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 00000000..e0326382 --- /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 00000000..53a49ff8 --- /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 + } + } +}); |