diff options
author | Abyss777 <abyss@fox5.ru> | 2017-10-17 17:02:47 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-10-17 17:02:47 +0500 |
commit | 41a18fef939d249ae5ed9ac4ae35c0a4e5ed8770 (patch) | |
tree | e405165239075265962fee36ec3d2289f3d98b1a /web | |
parent | 531f9d5c556e9795b32099587bfa84f3b74017c4 (diff) | |
download | trackermap-web-41a18fef939d249ae5ed9ac4ae35c0a4e5ed8770.tar.gz trackermap-web-41a18fef939d249ae5ed9ac4ae35c0a4e5ed8770.tar.bz2 trackermap-web-41a18fef939d249ae5ed9ac4ae35c0a4e5ed8770.zip |
Implement base Grid Panel class with common configs
Diffstat (limited to 'web')
24 files changed, 52 insertions, 88 deletions
diff --git a/web/app/view/Events.js b/web/app/view/Events.js index ca1f3ea5..3f4b5757 100644 --- a/web/app/view/Events.js +++ b/web/app/view/Events.js @@ -17,7 +17,7 @@ */ Ext.define('Traccar.view.Events', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'eventsView', requires: [ diff --git a/web/app/view/GridPanel.js b/web/app/view/GridPanel.js new file mode 100644 index 00000000..848af081 --- /dev/null +++ b/web/app/view/GridPanel.js @@ -0,0 +1,34 @@ +/* + * 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.view.GridPanel', { + extend: 'Ext.grid.Panel', + xtype: 'customGridPanel', + + requires: [ + 'Ext.grid.filters.Filters' + ], + + plugins: 'gridfilters', + + viewConfig: { + enableTextSelection: true, + getRowClass: function () { + return this.enableTextSelection ? 'x-selectable' : ''; + } + } +}); diff --git a/web/app/view/Report.js b/web/app/view/Report.js index 1289e6b2..f77cfca6 100644 --- a/web/app/view/Report.js +++ b/web/app/view/Report.js @@ -20,7 +20,8 @@ Ext.define('Traccar.view.Report', { xtype: 'reportView', requires: [ - 'Traccar.view.ReportController' + 'Traccar.view.ReportController', + 'Traccar.view.GridPanel' ], controller: 'report', @@ -70,7 +71,7 @@ Ext.define('Traccar.view.Report', { layout: 'card', items: [{ - xtype: 'grid', + xtype: 'customGridPanel', itemId: 'grid', listeners: { selectionchange: 'onSelectionChange' diff --git a/web/app/view/State.js b/web/app/view/State.js index d161251c..690c097f 100644 --- a/web/app/view/State.js +++ b/web/app/view/State.js @@ -16,7 +16,7 @@ */ Ext.define('Traccar.view.State', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'stateView', requires: [ diff --git a/web/app/view/Statistics.js b/web/app/view/Statistics.js index 55e4d507..f033e03a 100644 --- a/web/app/view/Statistics.js +++ b/web/app/view/Statistics.js @@ -15,7 +15,7 @@ */ Ext.define('Traccar.view.Statistics', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'statisticsView', requires: [ diff --git a/web/app/view/edit/Attributes.js b/web/app/view/edit/Attributes.js index 2dd06be2..cb07eda1 100644 --- a/web/app/view/edit/Attributes.js +++ b/web/app/view/edit/Attributes.js @@ -16,17 +16,14 @@ */ Ext.define('Traccar.view.edit.Attributes', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'attributesView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.view.edit.AttributesController', 'Traccar.view.edit.Toolbar' ], - plugins: 'gridfilters', - controller: 'attributes', tbar: { diff --git a/web/app/view/edit/Calendars.js b/web/app/view/edit/Calendars.js index 1c4a2ece..23f20e25 100644 --- a/web/app/view/edit/Calendars.js +++ b/web/app/view/edit/Calendars.js @@ -17,17 +17,14 @@ */ Ext.define('Traccar.view.edit.Calendars', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'calendarsView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.view.edit.CalendarsController', 'Traccar.view.edit.Toolbar' ], - plugins: 'gridfilters', - controller: 'calendars', store: 'Calendars', diff --git a/web/app/view/edit/ComputedAttributes.js b/web/app/view/edit/ComputedAttributes.js index 5d344988..9f0b9396 100644 --- a/web/app/view/edit/ComputedAttributes.js +++ b/web/app/view/edit/ComputedAttributes.js @@ -17,17 +17,14 @@ */ Ext.define('Traccar.view.edit.ComputedAttributes', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'computedAttributesView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.view.edit.ComputedAttributesController', 'Traccar.view.edit.Toolbar' ], - plugins: 'gridfilters', - controller: 'computedAttributes', store: 'ComputedAttributes', diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js index d2ba0f3d..39550b6c 100644 --- a/web/app/view/edit/Devices.js +++ b/web/app/view/edit/Devices.js @@ -16,11 +16,10 @@ */ Ext.define('Traccar.view.edit.Devices', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'devicesView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.AttributeFormatter', 'Traccar.view.edit.DevicesController', 'Traccar.view.ArrayListFilter', @@ -29,8 +28,6 @@ Ext.define('Traccar.view.edit.Devices', { controller: 'devices', - plugins: 'gridfilters', - store: 'VisibleDevices', stateful: true, @@ -82,6 +79,7 @@ Ext.define('Traccar.view.edit.Devices', { }, viewConfig: { + enableTextSelection: true, getRowClass: function (record) { var status = record.get('status'); if (status) { diff --git a/web/app/view/edit/Drivers.js b/web/app/view/edit/Drivers.js index 59d8d2c4..9aac8cd6 100644 --- a/web/app/view/edit/Drivers.js +++ b/web/app/view/edit/Drivers.js @@ -17,17 +17,14 @@ */ Ext.define('Traccar.view.edit.Drivers', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'driversView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.view.edit.DriversController', 'Traccar.view.edit.Toolbar' ], - plugins: 'gridfilters', - controller: 'drivers', store: 'Drivers', diff --git a/web/app/view/edit/Geofences.js b/web/app/view/edit/Geofences.js index 51fa7686..9c564bc3 100644 --- a/web/app/view/edit/Geofences.js +++ b/web/app/view/edit/Geofences.js @@ -16,17 +16,14 @@ */ Ext.define('Traccar.view.edit.Geofences', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'geofencesView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.view.edit.GeofencesController', 'Traccar.view.edit.Toolbar' ], - plugins: 'gridfilters', - controller: 'geofences', store: 'Geofences', diff --git a/web/app/view/edit/Groups.js b/web/app/view/edit/Groups.js index 691df8ae..0808201d 100644 --- a/web/app/view/edit/Groups.js +++ b/web/app/view/edit/Groups.js @@ -16,18 +16,15 @@ */ Ext.define('Traccar.view.edit.Groups', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'groupsView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.AttributeFormatter', 'Traccar.view.edit.GroupsController', 'Traccar.view.edit.Toolbar' ], - plugins: 'gridfilters', - controller: 'groups', store: 'Groups', diff --git a/web/app/view/edit/Notifications.js b/web/app/view/edit/Notifications.js index 8bbdb711..e17100a4 100644 --- a/web/app/view/edit/Notifications.js +++ b/web/app/view/edit/Notifications.js @@ -17,17 +17,14 @@ */ Ext.define('Traccar.view.edit.Notifications', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'notificationsView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.view.edit.NotificationsController', 'Traccar.view.edit.Toolbar' ], - plugins: 'gridfilters', - controller: 'notifications', store: 'Notifications', diff --git a/web/app/view/edit/SavedCommands.js b/web/app/view/edit/SavedCommands.js index b0cf89d0..794e95e4 100644 --- a/web/app/view/edit/SavedCommands.js +++ b/web/app/view/edit/SavedCommands.js @@ -17,17 +17,14 @@ */ Ext.define('Traccar.view.edit.SavedCommands', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'savedCommandsView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.view.edit.SavedCommandsController', 'Traccar.view.edit.Toolbar' ], - plugins: 'gridfilters', - controller: 'savedCommands', store: 'Commands', diff --git a/web/app/view/edit/Users.js b/web/app/view/edit/Users.js index d98d49ce..fd371990 100644 --- a/web/app/view/edit/Users.js +++ b/web/app/view/edit/Users.js @@ -17,11 +17,10 @@ */ Ext.define('Traccar.view.edit.Users', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', xtype: 'usersView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.view.edit.UsersController', 'Traccar.view.edit.Toolbar' ], @@ -29,8 +28,6 @@ Ext.define('Traccar.view.edit.Users', { controller: 'users', store: 'Users', - plugins: 'gridfilters', - tbar: { xtype: 'editToolbar', scrollable: true, diff --git a/web/app/view/permissions/Base.js b/web/app/view/permissions/Base.js index 2b07d84c..57017531 100644 --- a/web/app/view/permissions/Base.js +++ b/web/app/view/permissions/Base.js @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ Ext.define('Traccar.view.permissions.Base', { - extend: 'Ext.grid.Panel', + extend: 'Traccar.view.GridPanel', requires: [ 'Traccar.view.permissions.BaseController' diff --git a/web/app/view/permissions/Calendars.js b/web/app/view/permissions/Calendars.js index ff2796bb..3d08efca 100644 --- a/web/app/view/permissions/Calendars.js +++ b/web/app/view/permissions/Calendars.js @@ -20,12 +20,6 @@ Ext.define('Traccar.view.permissions.Calendars', { extend: 'Traccar.view.permissions.Base', xtype: 'linkCalendarsView', - requires: [ - 'Ext.grid.filters.Filters' - ], - - plugins: 'gridfilters', - columns: { items: [{ text: Strings.sharedName, diff --git a/web/app/view/permissions/ComputedAttributes.js b/web/app/view/permissions/ComputedAttributes.js index 800717ce..19af72ad 100644 --- a/web/app/view/permissions/ComputedAttributes.js +++ b/web/app/view/permissions/ComputedAttributes.js @@ -20,12 +20,6 @@ Ext.define('Traccar.view.permissions.ComputedAttributes', { extend: 'Traccar.view.permissions.Base', xtype: 'linkComputedAttributesView', - requires: [ - 'Ext.grid.filters.Filters' - ], - - plugins: 'gridfilters', - columns: { items: [{ text: Strings.sharedDescription, diff --git a/web/app/view/permissions/Devices.js b/web/app/view/permissions/Devices.js index 4cadafe4..d120eacb 100644 --- a/web/app/view/permissions/Devices.js +++ b/web/app/view/permissions/Devices.js @@ -20,12 +20,9 @@ Ext.define('Traccar.view.permissions.Devices', { xtype: 'linkDevicesView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.AttributeFormatter' ], - plugins: 'gridfilters', - columns: { items: [{ text: Strings.sharedName, diff --git a/web/app/view/permissions/Drivers.js b/web/app/view/permissions/Drivers.js index f0ea2890..33cf2f76 100644 --- a/web/app/view/permissions/Drivers.js +++ b/web/app/view/permissions/Drivers.js @@ -20,12 +20,6 @@ Ext.define('Traccar.view.permissions.Drivers', { extend: 'Traccar.view.permissions.Base', xtype: 'linkDriversView', - requires: [ - 'Ext.grid.filters.Filters' - ], - - plugins: 'gridfilters', - columns: { items: [{ text: Strings.sharedName, diff --git a/web/app/view/permissions/Geofences.js b/web/app/view/permissions/Geofences.js index 84135d3b..efdf18da 100644 --- a/web/app/view/permissions/Geofences.js +++ b/web/app/view/permissions/Geofences.js @@ -19,12 +19,6 @@ Ext.define('Traccar.view.permissions.Geofences', { extend: 'Traccar.view.permissions.Base', xtype: 'linkGeofencesView', - requires: [ - 'Ext.grid.filters.Filters' - ], - - plugins: 'gridfilters', - columns: { items: [{ text: Strings.sharedName, diff --git a/web/app/view/permissions/Groups.js b/web/app/view/permissions/Groups.js index d3cad98e..91a639c0 100644 --- a/web/app/view/permissions/Groups.js +++ b/web/app/view/permissions/Groups.js @@ -20,12 +20,9 @@ Ext.define('Traccar.view.permissions.Groups', { xtype: 'linkGroupsView', requires: [ - 'Ext.grid.filters.Filters', 'Traccar.AttributeFormatter' ], - plugins: 'gridfilters', - columns: { items: [{ text: Strings.sharedName, diff --git a/web/app/view/permissions/Notifications.js b/web/app/view/permissions/Notifications.js index 6538e67d..9386d6d6 100644 --- a/web/app/view/permissions/Notifications.js +++ b/web/app/view/permissions/Notifications.js @@ -20,12 +20,6 @@ Ext.define('Traccar.view.permissions.Notifications', { extend: 'Traccar.view.permissions.Base', xtype: 'linkNotificationsView', - requires: [ - 'Ext.grid.filters.Filters' - ], - - plugins: 'gridfilters', - columns: { items: [{ text: Strings.notificationType, diff --git a/web/app/view/permissions/SavedCommands.js b/web/app/view/permissions/SavedCommands.js index 106fad52..52b759bb 100644 --- a/web/app/view/permissions/SavedCommands.js +++ b/web/app/view/permissions/SavedCommands.js @@ -20,12 +20,6 @@ Ext.define('Traccar.view.permissions.SavedCommands', { extend: 'Traccar.view.permissions.Base', xtype: 'linkSavedCommandsView', - requires: [ - 'Ext.grid.filters.Filters' - ], - - plugins: 'gridfilters', - columns: { items: [{ text: Strings.sharedDescription, |