aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-10-08 18:53:12 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-10-08 18:53:12 +1300
commit401ee249a4c7b0de5eeaf32d1cbee4fd0d82a7a8 (patch)
treefcc70bbaa11e4e0b683134496007bdafc1110598 /web/app/view
parent4966403aab46912dd29b8385b6050e95c47c295f (diff)
downloadtrackermap-web-401ee249a4c7b0de5eeaf32d1cbee4fd0d82a7a8.tar.gz
trackermap-web-401ee249a4c7b0de5eeaf32d1cbee4fd0d82a7a8.tar.bz2
trackermap-web-401ee249a4c7b0de5eeaf32d1cbee4fd0d82a7a8.zip
Implement statistics report view
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/SettingsMenu.js5
-rw-r--r--web/app/view/SettingsMenuController.js12
-rw-r--r--web/app/view/Statistics.js78
-rw-r--r--web/app/view/StatisticsController.js29
4 files changed, 124 insertions, 0 deletions
diff --git a/web/app/view/SettingsMenu.js b/web/app/view/SettingsMenu.js
index e1f6bf21..c494572f 100644
--- a/web/app/view/SettingsMenu.js
+++ b/web/app/view/SettingsMenu.js
@@ -62,6 +62,11 @@ Ext.define('Traccar.view.SettingsMenu', {
handler: 'onAttributeAliasesClick',
reference: 'settingsAttributeAliasesButton'
}, {
+ hidden: true,
+ text: Strings.statisticsTitle,
+ handler: 'onStatisticsClick',
+ reference: 'settingsStatisticsButton'
+ }, {
text: Strings.loginLogout,
handler: 'onLogoutClick'
}]
diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js
index eee0097b..9d547c55 100644
--- a/web/app/view/SettingsMenuController.js
+++ b/web/app/view/SettingsMenuController.js
@@ -28,6 +28,7 @@ Ext.define('Traccar.view.SettingsMenuController', {
'Traccar.view.Geofences',
'Traccar.view.Notifications',
'Traccar.view.AttributeAliases',
+ 'Traccar.view.Statistics',
'Traccar.view.BaseWindow'
],
@@ -38,6 +39,7 @@ Ext.define('Traccar.view.SettingsMenuController', {
if (admin) {
this.lookupReference('settingsServerButton').setHidden(false);
this.lookupReference('settingsUsersButton').setHidden(false);
+ this.lookupReference('settingsStatisticsButton').setHidden(false);
}
if (admin || !readonly) {
this.lookupReference('settingsGroupsButton').setHidden(false);
@@ -110,6 +112,16 @@ Ext.define('Traccar.view.SettingsMenuController', {
}).show();
},
+ onStatisticsClick: function () {
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.statisticsTitle,
+ modal: false,
+ items: {
+ xtype: 'statisticsView'
+ }
+ }).show();
+ },
+
onLogoutClick: function () {
Ext.create('Traccar.view.LoginController').logout();
}
diff --git a/web/app/view/Statistics.js b/web/app/view/Statistics.js
new file mode 100644
index 00000000..78195949
--- /dev/null
+++ b/web/app/view/Statistics.js
@@ -0,0 +1,78 @@
+/*
+ * 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.view.Statistics', {
+ extend: 'Ext.grid.Panel',
+ xtype: 'statisticsView',
+
+ requires: [
+ 'Traccar.view.StatisticsController'
+ ],
+
+ controller: 'statistics',
+ store: 'Statistics',
+
+ tbar: [{
+ xtype: 'tbtext',
+ html: Strings.reportFrom
+ }, {
+ xtype: 'datefield',
+ reference: 'fromDateField',
+ startDay: Traccar.Style.weekStartDay,
+ format: Traccar.Style.dateFormat,
+ value: new Date(new Date().getTime() - 24 * 60 * 60 * 1000)
+ }, '-', {
+ xtype: 'tbtext',
+ html: Strings.reportTo
+ }, {
+ xtype: 'datefield',
+ reference: 'toDateField',
+ startDay: Traccar.Style.weekStartDay,
+ format: Traccar.Style.dateFormat,
+ value: new Date()
+ }, '-', {
+ text: Strings.reportShow,
+ handler: 'onShowClick'
+ }],
+
+ columns: [{
+ text: Strings.statisticsCaptureTime,
+ dataIndex: 'captureTime',
+ flex: 1,
+ xtype: 'datecolumn',
+ renderer: Traccar.AttributeFormatter.defaultFormatter()
+ }, {
+ text: Strings.statisticsActiveUsers,
+ dataIndex: 'activeUsers',
+ flex: 1
+ }, {
+ text: Strings.statisticsActiveDevices,
+ dataIndex: 'activeDevices',
+ flex: 1
+ }, {
+ text: Strings.statisticsRequests,
+ dataIndex: 'requests',
+ flex: 1
+ }, {
+ text: Strings.statisticsMessagesReceived,
+ dataIndex: 'messagesReceived',
+ flex: 1
+ }, {
+ text: Strings.statisticsMessagesStored,
+ dataIndex: 'messagesStored',
+ flex: 1
+ }]
+});
diff --git a/web/app/view/StatisticsController.js b/web/app/view/StatisticsController.js
new file mode 100644
index 00000000..339d8e95
--- /dev/null
+++ b/web/app/view/StatisticsController.js
@@ -0,0 +1,29 @@
+/*
+ * 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.view.StatisticsController', {
+ extend: 'Ext.app.ViewController',
+ alias: 'controller.statistics',
+
+ onShowClick: function () {
+ Ext.getStore('Statistics').load({
+ params: {
+ from: this.lookupReference('fromDateField').getValue().toISOString(),
+ to: this.lookupReference('toDateField').getValue().toISOString()
+ }
+ });
+ }
+});