Skip to content

Commit

Permalink
Add report panel toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed May 18, 2015
1 parent b512fa1 commit caab568
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 11 deletions.
6 changes: 4 additions & 2 deletions web/app/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ Ext.define('Traccar.Application', {

models: [
'User',
'Device'
'Device',
'Position'
],

stores: [
'Devices'
'Devices',
'Positions'
],

controllers: [
Expand Down
14 changes: 14 additions & 0 deletions web/app/Resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ var strings = {
device_remove: 'Remove device?',

report_title: 'Reports',
report_device: 'Device',
report_from: 'From',
report_to: 'To',
report_show: 'Show',
report_clear: 'Clear',
report_time: 'Time',
report_valid: 'Valid',
report_latitude: 'Latitude',
report_longitude: 'Longitude',
report_altitude: 'Altitude',
report_speed: 'Speed',
report_course: 'Course',
report_address: 'Address',

dialog_save: 'Save',
dialog_delete: 'Delete',
Expand All @@ -50,6 +63,7 @@ var styles = {
device_width: 350,

report_height: 250,
report_time: 100,

map_center: [ -0.1275, 51.507222 ],
map_zoom: 6,
Expand Down
37 changes: 37 additions & 0 deletions web/app/model/Position.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2015 Anton Tananaev ([email protected])
*
* 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.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' },
{ name: 'deviceTime', type: 'date' },
{ name: 'fixTime', type: 'date' },
{ name: 'valid', type: 'boolean' },
{ name: 'latitude', type: 'float' },
{ name: 'longitude', type: 'float' },
{ name: 'altitude', type: 'float' },
{ name: 'speed', type: 'float' },
{ name: 'course', type: 'float' },
{ name: 'address', type: 'string' },
{ name: 'other', type: 'string' }
]
});
8 changes: 4 additions & 4 deletions web/app/store/Devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Ext.define('Traccar.store.Devices', {
proxy: {
type: 'ajax',
api: {
create : '/api/device/add',
read : '/api/device/get',
update : '/api/device/update',
destroy : '/api/device/remove'
create: '/api/device/add',
read: '/api/device/get',
update: '/api/device/update',
destroy: '/api/device/remove'
},
reader: {
type: 'json',
Expand Down
29 changes: 29 additions & 0 deletions web/app/store/Positions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2015 Anton Tananaev ([email protected])
*
* 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: 'ajax',
url: '/api/position/get',
reader: {
type: 'json',
rootProperty: 'data'
}
}
});
3 changes: 1 addition & 2 deletions web/app/view/device/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Ext.define('Traccar.view.device.Device', {
],

controller: 'device',
store: 'Devices',

title: strings.device_title,
selType: 'rowmodel',
Expand Down Expand Up @@ -50,8 +51,6 @@ Ext.define('Traccar.view.device.Device', {
handler: 'onLogoutClick'
}],

store: 'Devices',

listeners: {
selectionchange: 'onSelectionChange'
},
Expand Down
47 changes: 44 additions & 3 deletions web/app/view/report/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,56 @@ Ext.define('Traccar.view.report.Report', {
extend: 'Ext.grid.Panel',
xtype: 'report-view',

requires: [
'Traccar.view.report.ReportController'
],

controller: 'report',
store: 'Positions',

title: strings.report_title,

tbar: [{
text:'Do Something'
xtype: 'tbtext',
html: strings.report_device
}, {
xtype: 'combobox',
store: 'Devices',
valueField: 'id',
displayField: 'name',
typeAhead: true,
queryMode: 'local'
}, '-', {
xtype: 'tbtext',
html: strings.report_from
}, {
xtype: 'datefield'
}, {
xtype: 'timefield',
maxWidth: styles.report_time
}, '-', {
xtype: 'tbtext',
html: strings.report_to
}, {
xtype: 'datefield'
}, {
xtype: 'timefield',
maxWidth: styles.report_time
}, '-', {
text: strings.report_show
}, {
text: strings.report_clear
}],

columns: [
{ text: "Column1", dataIndex: 'c1', flex: 1 },
{ text: "Column2", dataIndex: 'c2', flex: 1 }
{ text: strings.report_time, dataIndex: 'fixTime', flex: 1 },
{ text: strings.report_valid, dataIndex: 'valid', flex: 1 },
{ text: strings.report_latitude, dataIndex: 'latitude', flex: 1 },
{ text: strings.report_longitude, dataIndex: 'longitude', flex: 1 },
{ text: strings.report_altitude, dataIndex: 'altitude', flex: 1 },
{ text: strings.report_speed, dataIndex: 'speed', flex: 1 },
{ text: strings.report_course, dataIndex: 'course', flex: 1 },
{ text: strings.report_address, dataIndex: 'address', flex: 1 }
]

});
24 changes: 24 additions & 0 deletions web/app/view/report/ReportController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2015 Anton Tananaev ([email protected])
*
* 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.view.report.ReportController', {
extend: 'Ext.app.ViewController',
alias: 'controller.report',

onSelectionChange: function(selected) {
}

});

0 comments on commit caab568

Please sign in to comment.