diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-19 23:45:00 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-19 23:45:00 +1200 |
commit | 5a6044faac45b377efabe363655ec21790bd955b (patch) | |
tree | e5d60feb3a6d17775c4b63379920d9ff88aaa379 /web/app | |
parent | f3ce72afbd49ccde94178158147de7b378128a55 (diff) | |
parent | 56a5de3dc50e438884c5636c11f31e48bf19a15e (diff) | |
download | etbsa-traccar-web-5a6044faac45b377efabe363655ec21790bd955b.tar.gz etbsa-traccar-web-5a6044faac45b377efabe363655ec21790bd955b.tar.bz2 etbsa-traccar-web-5a6044faac45b377efabe363655ec21790bd955b.zip |
Merge pull request #507 from Abyss777/column_filters
Column filters to most windows
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/AttributeFormatter.js | 14 | ||||
-rw-r--r-- | web/app/view/edit/Attributes.js | 4 | ||||
-rw-r--r-- | web/app/view/edit/Calendars.js | 6 | ||||
-rw-r--r-- | web/app/view/edit/ComputedAttributes.js | 16 | ||||
-rw-r--r-- | web/app/view/edit/Devices.js | 8 | ||||
-rw-r--r-- | web/app/view/edit/Geofences.js | 9 | ||||
-rw-r--r-- | web/app/view/edit/Groups.js | 17 | ||||
-rw-r--r-- | web/app/view/edit/Users.js | 18 | ||||
-rw-r--r-- | web/app/view/edit/UsersController.js | 1 | ||||
-rw-r--r-- | web/app/view/permissions/DeviceAttributes.js | 14 | ||||
-rw-r--r-- | web/app/view/permissions/DeviceGeofences.js | 9 | ||||
-rw-r--r-- | web/app/view/permissions/GroupAttributes.js | 12 | ||||
-rw-r--r-- | web/app/view/permissions/GroupGeofences.js | 9 | ||||
-rw-r--r-- | web/app/view/permissions/UserAttributes.js | 14 | ||||
-rw-r--r-- | web/app/view/permissions/UserCalendars.js | 9 | ||||
-rw-r--r-- | web/app/view/permissions/UserDevices.js | 46 | ||||
-rw-r--r-- | web/app/view/permissions/UserGeofences.js | 9 | ||||
-rw-r--r-- | web/app/view/permissions/UserGroups.js | 22 | ||||
-rw-r--r-- | web/app/view/permissions/UserUsers.js | 3 |
19 files changed, 211 insertions, 29 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index aecbd8a..0c38567 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -62,6 +62,18 @@ Ext.define('Traccar.AttributeFormatter', { return Ext.getStore('Devices').getById(value).get('name'); }, + groupIdFormatter: function (value) { + var group, store; + if (value !== 0) { + store = Ext.getStore('AllGroups'); + if (store.getTotalCount() === 0) { + store = Ext.getStore('Groups'); + } + group = store.getById(value); + return group ? group.get('name') : value; + } + }, + lastUpdateFormatter: function (value) { var seconds, interval; @@ -113,6 +125,8 @@ Ext.define('Traccar.AttributeFormatter', { return this.durationFormatter; } else if (key === 'deviceId') { return this.deviceIdFormatter; + } else if (key === 'groupId') { + return this.groupIdFormatter; } else if (key === 'lastUpdate') { return this.lastUpdateFormatter; } else { diff --git a/web/app/view/edit/Attributes.js b/web/app/view/edit/Attributes.js index 66d8bb1..84cadea 100644 --- a/web/app/view/edit/Attributes.js +++ b/web/app/view/edit/Attributes.js @@ -20,10 +20,13 @@ Ext.define('Traccar.view.edit.Attributes', { xtype: 'attributesView', requires: [ + 'Ext.grid.filters.Filters', 'Traccar.view.edit.AttributesController', 'Traccar.view.edit.Toolbar' ], + plugins: 'gridfilters', + controller: 'attributes', tbar: { @@ -42,6 +45,7 @@ Ext.define('Traccar.view.edit.Attributes', { items: [{ text: Strings.sharedName, dataIndex: 'name', + filter: 'string', renderer: function (value, metaData) { var attribute; if (this.attributesStore) { diff --git a/web/app/view/edit/Calendars.js b/web/app/view/edit/Calendars.js index 92ffa06..1c4a2ec 100644 --- a/web/app/view/edit/Calendars.js +++ b/web/app/view/edit/Calendars.js @@ -21,10 +21,13 @@ Ext.define('Traccar.view.edit.Calendars', { xtype: 'calendarsView', requires: [ + 'Ext.grid.filters.Filters', 'Traccar.view.edit.CalendarsController', 'Traccar.view.edit.Toolbar' ], + plugins: 'gridfilters', + controller: 'calendars', store: 'Calendars', @@ -43,7 +46,8 @@ Ext.define('Traccar.view.edit.Calendars', { }, items: [{ text: Strings.sharedName, - dataIndex: 'name' + dataIndex: 'name', + filter: 'string' }] } }); diff --git a/web/app/view/edit/ComputedAttributes.js b/web/app/view/edit/ComputedAttributes.js index b4699e8..5d34498 100644 --- a/web/app/view/edit/ComputedAttributes.js +++ b/web/app/view/edit/ComputedAttributes.js @@ -21,10 +21,13 @@ Ext.define('Traccar.view.edit.ComputedAttributes', { xtype: 'computedAttributesView', requires: [ + 'Ext.grid.filters.Filters', 'Traccar.view.edit.ComputedAttributesController', 'Traccar.view.edit.Toolbar' ], + plugins: 'gridfilters', + controller: 'computedAttributes', store: 'ComputedAttributes', @@ -43,10 +46,16 @@ Ext.define('Traccar.view.edit.ComputedAttributes', { }, items: [{ text: Strings.sharedDescription, - dataIndex: 'description' + dataIndex: 'description', + filter: 'string' }, { text: Strings.sharedAttribute, dataIndex: 'attribute', + filter: { + type: 'list', + labelField: 'name', + store: 'PositionAttributes' + }, renderer: function (value) { return Ext.getStore('PositionAttributes').getAttributeName(value); } @@ -56,6 +65,11 @@ Ext.define('Traccar.view.edit.ComputedAttributes', { }, { text: Strings.sharedType, dataIndex: 'type', + filter: { + type: 'list', + labelField: 'name', + store: 'AttributeValueTypes' + }, renderer: function (value) { var type = Ext.getStore('AttributeValueTypes').getById(value); if (type) { diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js index 196df73..267a38b 100644 --- a/web/app/view/edit/Devices.js +++ b/web/app/view/edit/Devices.js @@ -139,13 +139,7 @@ Ext.define('Traccar.view.edit.Devices', { labelField: 'name', store: 'Groups' }, - renderer: function (value) { - var group; - if (value !== 0) { - group = Ext.getStore('Groups').getById(value); - return group ? group.get('name') : value; - } - } + renderer: Traccar.AttributeFormatter.getFormatter('groupId') }, { text: Strings.deviceStatus, dataIndex: 'status', diff --git a/web/app/view/edit/Geofences.js b/web/app/view/edit/Geofences.js index 8ca9c31..51fa768 100644 --- a/web/app/view/edit/Geofences.js +++ b/web/app/view/edit/Geofences.js @@ -20,10 +20,13 @@ Ext.define('Traccar.view.edit.Geofences', { xtype: 'geofencesView', requires: [ + 'Ext.grid.filters.Filters', 'Traccar.view.edit.GeofencesController', 'Traccar.view.edit.Toolbar' ], + plugins: 'gridfilters', + controller: 'geofences', store: 'Geofences', @@ -42,10 +45,12 @@ Ext.define('Traccar.view.edit.Geofences', { }, items: [{ text: Strings.sharedName, - dataIndex: 'name' + dataIndex: 'name', + filter: 'string' }, { text: Strings.sharedDescription, - dataIndex: 'description' + dataIndex: 'description', + filter: 'string' }] } }); diff --git a/web/app/view/edit/Groups.js b/web/app/view/edit/Groups.js index 88bbd7b..d4d0830 100644 --- a/web/app/view/edit/Groups.js +++ b/web/app/view/edit/Groups.js @@ -20,10 +20,14 @@ Ext.define('Traccar.view.edit.Groups', { xtype: 'groupsView', requires: [ + 'Ext.grid.filters.Filters', + 'Traccar.AttributeFormatter', 'Traccar.view.edit.GroupsController', 'Traccar.view.edit.Toolbar' ], + plugins: 'gridfilters', + controller: 'groups', store: 'Groups', @@ -59,7 +63,18 @@ Ext.define('Traccar.view.edit.Groups', { }, items: [{ text: Strings.sharedName, - dataIndex: 'name' + dataIndex: 'name', + filter: 'string' + }, { + text: Strings.groupDialog, + dataIndex: 'groupId', + hidden: true, + filter: { + type: 'list', + labelField: 'name', + store: 'AllGroups' + }, + renderer: Traccar.AttributeFormatter.getFormatter('groupId') }] } }); diff --git a/web/app/view/edit/Users.js b/web/app/view/edit/Users.js index 4356b16..0aafb3d 100644 --- a/web/app/view/edit/Users.js +++ b/web/app/view/edit/Users.js @@ -96,30 +96,36 @@ Ext.define('Traccar.view.edit.Users', { }, items: [{ text: Strings.sharedName, - dataIndex: 'name' + dataIndex: 'name', + filter: 'string' }, { text: Strings.userEmail, dataIndex: 'email', filter: 'string' }, { text: Strings.userAdmin, - dataIndex: 'admin' + dataIndex: 'admin', + filter: 'boolean' }, { text: Strings.serverReadonly, dataIndex: 'readonly', - hidden: true + hidden: true, + filter: 'boolean' }, { text: Strings.userDeviceReadonly, dataIndex: 'deviceReadonly', - hidden: true + hidden: true, + filter: 'boolean' }, { text: Strings.userDisabled, - dataIndex: 'disabled' + dataIndex: 'disabled', + filter: 'boolean' }, { text: Strings.userExpirationTime, dataIndex: 'expirationTime', hidden: true, - renderer: Traccar.AttributeFormatter.getFormatter('expirationTime') + renderer: Traccar.AttributeFormatter.getFormatter('expirationTime'), + filter: 'date' }] } }); diff --git a/web/app/view/edit/UsersController.js b/web/app/view/edit/UsersController.js index fe69d40..c064403 100644 --- a/web/app/view/edit/UsersController.js +++ b/web/app/view/edit/UsersController.js @@ -67,6 +67,7 @@ Ext.define('Traccar.view.edit.UsersController', { onDevicesClick: function () { var user = this.getView().getSelectionModel().getSelection()[0]; + Ext.getStore('AllGroups').load(); Ext.create('Traccar.view.BaseWindow', { title: Strings.deviceTitle, items: { diff --git a/web/app/view/permissions/DeviceAttributes.js b/web/app/view/permissions/DeviceAttributes.js index 2ce0763..c7755f0 100644 --- a/web/app/view/permissions/DeviceAttributes.js +++ b/web/app/view/permissions/DeviceAttributes.js @@ -20,17 +20,29 @@ Ext.define('Traccar.view.permissions.DeviceAttributes', { extend: 'Traccar.view.permissions.Base', xtype: 'deviceAttributesView', + requires: [ + 'Ext.grid.filters.Filters' + ], + + plugins: 'gridfilters', + columns: { items: [{ text: Strings.sharedDescription, dataIndex: 'description', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' }, { text: Strings.sharedAttribute, dataIndex: 'attribute', flex: 1, minWidth: Traccar.Style.columnWidthNormal, + filter: { + type: 'list', + labelField: 'name', + store: 'PositionAttributes' + }, renderer: function (value) { return Ext.getStore('PositionAttributes').getAttributeName(value); } diff --git a/web/app/view/permissions/DeviceGeofences.js b/web/app/view/permissions/DeviceGeofences.js index 7905b49..c16bced 100644 --- a/web/app/view/permissions/DeviceGeofences.js +++ b/web/app/view/permissions/DeviceGeofences.js @@ -19,12 +19,19 @@ Ext.define('Traccar.view.permissions.DeviceGeofences', { extend: 'Traccar.view.permissions.Base', xtype: 'deviceGeofencesView', + requires: [ + 'Ext.grid.filters.Filters' + ], + + plugins: 'gridfilters', + columns: { items: [{ text: Strings.sharedName, dataIndex: 'name', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' }] } }); diff --git a/web/app/view/permissions/GroupAttributes.js b/web/app/view/permissions/GroupAttributes.js index 44089da..4db8b24 100644 --- a/web/app/view/permissions/GroupAttributes.js +++ b/web/app/view/permissions/GroupAttributes.js @@ -20,17 +20,27 @@ Ext.define('Traccar.view.permissions.GroupAttributes', { extend: 'Traccar.view.permissions.Base', xtype: 'groupAttributesView', + requires: [ + 'Ext.grid.filters.Filters' + ], + columns: { items: [{ text: Strings.sharedDescription, dataIndex: 'description', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' }, { text: Strings.sharedAttribute, dataIndex: 'attribute', flex: 1, minWidth: Traccar.Style.columnWidthNormal, + filter: { + type: 'list', + labelField: 'name', + store: 'PositionAttributes' + }, renderer: function (value) { return Ext.getStore('PositionAttributes').getAttributeName(value); } diff --git a/web/app/view/permissions/GroupGeofences.js b/web/app/view/permissions/GroupGeofences.js index 84cec3c..f365e35 100644 --- a/web/app/view/permissions/GroupGeofences.js +++ b/web/app/view/permissions/GroupGeofences.js @@ -19,12 +19,19 @@ Ext.define('Traccar.view.permissions.GroupGeofences', { extend: 'Traccar.view.permissions.Base', xtype: 'groupGeofencesView', + requires: [ + 'Ext.grid.filters.Filters' + ], + + plugins: 'gridfilters', + columns: { items: [{ text: Strings.sharedName, dataIndex: 'name', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' }] } }); diff --git a/web/app/view/permissions/UserAttributes.js b/web/app/view/permissions/UserAttributes.js index 7bca622..a0a385e 100644 --- a/web/app/view/permissions/UserAttributes.js +++ b/web/app/view/permissions/UserAttributes.js @@ -20,17 +20,29 @@ Ext.define('Traccar.view.permissions.UserAttributes', { extend: 'Traccar.view.permissions.Base', xtype: 'userAttributesView', + requires: [ + 'Ext.grid.filters.Filters' + ], + + plugins: 'gridfilters', + columns: { items: [{ text: Strings.sharedDescription, dataIndex: 'description', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' }, { text: Strings.sharedAttribute, dataIndex: 'attribute', flex: 1, minWidth: Traccar.Style.columnWidthNormal, + filter: { + type: 'list', + labelField: 'name', + store: 'PositionAttributes' + }, renderer: function (value) { return Ext.getStore('PositionAttributes').getAttributeName(value); } diff --git a/web/app/view/permissions/UserCalendars.js b/web/app/view/permissions/UserCalendars.js index f45f777..54ecfc2 100644 --- a/web/app/view/permissions/UserCalendars.js +++ b/web/app/view/permissions/UserCalendars.js @@ -20,12 +20,19 @@ Ext.define('Traccar.view.permissions.UserCalendars', { extend: 'Traccar.view.permissions.Base', xtype: 'userCalendarsView', + requires: [ + 'Ext.grid.filters.Filters' + ], + + plugins: 'gridfilters', + columns: { items: [{ text: Strings.sharedName, dataIndex: 'name', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' }] } }); diff --git a/web/app/view/permissions/UserDevices.js b/web/app/view/permissions/UserDevices.js index dd6f43d..a9bb65b 100644 --- a/web/app/view/permissions/UserDevices.js +++ b/web/app/view/permissions/UserDevices.js @@ -19,17 +19,59 @@ Ext.define('Traccar.view.permissions.UserDevices', { extend: 'Traccar.view.permissions.Base', xtype: 'userDevicesView', + requires: [ + 'Ext.grid.filters.Filters', + 'Traccar.AttributeFormatter' + ], + + plugins: 'gridfilters', + columns: { items: [{ text: Strings.sharedName, dataIndex: 'name', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' }, { text: Strings.deviceIdentifier, dataIndex: 'uniqueId', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' + }, { + text: Strings.sharedPhone, + dataIndex: 'phone', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + hidden: true, + filter: 'string' + }, { + text: Strings.deviceModel, + dataIndex: 'model', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + hidden: true, + filter: 'string' + }, { + text: Strings.deviceContact, + dataIndex: 'contact', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + hidden: true, + filter: 'string' + }, { + text: Strings.groupDialog, + dataIndex: 'groupId', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + hidden: true, + filter: { + type: 'list', + labelField: 'name', + store: 'AllGroups' + }, + renderer: Traccar.AttributeFormatter.getFormatter('groupId') }] } }); diff --git a/web/app/view/permissions/UserGeofences.js b/web/app/view/permissions/UserGeofences.js index 49b94ff..436a2a6 100644 --- a/web/app/view/permissions/UserGeofences.js +++ b/web/app/view/permissions/UserGeofences.js @@ -19,12 +19,19 @@ Ext.define('Traccar.view.permissions.UserGeofences', { extend: 'Traccar.view.permissions.Base', xtype: 'userGeofencesView', + requires: [ + 'Ext.grid.filters.Filters' + ], + + plugins: 'gridfilters', + columns: { items: [{ text: Strings.sharedName, dataIndex: 'name', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' }] } }); diff --git a/web/app/view/permissions/UserGroups.js b/web/app/view/permissions/UserGroups.js index 0c23713..bc24201 100644 --- a/web/app/view/permissions/UserGroups.js +++ b/web/app/view/permissions/UserGroups.js @@ -19,12 +19,32 @@ Ext.define('Traccar.view.permissions.UserGroups', { extend: 'Traccar.view.permissions.Base', xtype: 'userGroupsView', + requires: [ + 'Ext.grid.filters.Filters', + 'Traccar.AttributeFormatter' + ], + + plugins: 'gridfilters', + columns: { items: [{ text: Strings.sharedName, dataIndex: 'name', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' + }, { + text: Strings.groupDialog, + dataIndex: 'groupId', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + hidden: true, + filter: { + type: 'list', + labelField: 'name', + store: 'AllGroups' + }, + renderer: Traccar.AttributeFormatter.getFormatter('groupId') }] } }); diff --git a/web/app/view/permissions/UserUsers.js b/web/app/view/permissions/UserUsers.js index abef700..c5980c2 100644 --- a/web/app/view/permissions/UserUsers.js +++ b/web/app/view/permissions/UserUsers.js @@ -25,7 +25,8 @@ Ext.define('Traccar.view.permissions.UserUsers', { text: Strings.sharedName, dataIndex: 'name', flex: 1, - minWidth: Traccar.Style.columnWidthNormal + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' }] } }); |