From a5d36c62facad98c409b9fcd4f8b92c3d47601ab Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Tue, 12 Sep 2017 17:39:43 +0500 Subject: Implement Saved Commands --- web/app/view/permissions/Calendars.js | 38 +++++++++++++ web/app/view/permissions/ComputedAttributes.js | 51 +++++++++++++++++ web/app/view/permissions/DeviceAttributes.js | 51 ----------------- web/app/view/permissions/DeviceDrivers.js | 44 --------------- web/app/view/permissions/DeviceGeofences.js | 37 ------------- web/app/view/permissions/Devices.js | 77 ++++++++++++++++++++++++++ web/app/view/permissions/Drivers.js | 44 +++++++++++++++ web/app/view/permissions/Geofences.js | 37 +++++++++++++ web/app/view/permissions/GroupAttributes.js | 49 ---------------- web/app/view/permissions/GroupDrivers.js | 44 --------------- web/app/view/permissions/GroupGeofences.js | 37 ------------- web/app/view/permissions/Groups.js | 50 +++++++++++++++++ web/app/view/permissions/SavedCommands.js | 55 ++++++++++++++++++ web/app/view/permissions/UserAttributes.js | 51 ----------------- web/app/view/permissions/UserCalendars.js | 38 ------------- web/app/view/permissions/UserDevices.js | 77 -------------------------- web/app/view/permissions/UserDrivers.js | 44 --------------- web/app/view/permissions/UserGeofences.js | 37 ------------- web/app/view/permissions/UserGroups.js | 50 ----------------- web/app/view/permissions/UserUsers.js | 32 ----------- web/app/view/permissions/Users.js | 32 +++++++++++ 21 files changed, 384 insertions(+), 591 deletions(-) create mode 100644 web/app/view/permissions/Calendars.js create mode 100644 web/app/view/permissions/ComputedAttributes.js delete mode 100644 web/app/view/permissions/DeviceAttributes.js delete mode 100644 web/app/view/permissions/DeviceDrivers.js delete mode 100644 web/app/view/permissions/DeviceGeofences.js create mode 100644 web/app/view/permissions/Devices.js create mode 100644 web/app/view/permissions/Drivers.js create mode 100644 web/app/view/permissions/Geofences.js delete mode 100644 web/app/view/permissions/GroupAttributes.js delete mode 100644 web/app/view/permissions/GroupDrivers.js delete mode 100644 web/app/view/permissions/GroupGeofences.js create mode 100644 web/app/view/permissions/Groups.js create mode 100644 web/app/view/permissions/SavedCommands.js delete mode 100644 web/app/view/permissions/UserAttributes.js delete mode 100644 web/app/view/permissions/UserCalendars.js delete mode 100644 web/app/view/permissions/UserDevices.js delete mode 100644 web/app/view/permissions/UserDrivers.js delete mode 100644 web/app/view/permissions/UserGeofences.js delete mode 100644 web/app/view/permissions/UserGroups.js delete mode 100644 web/app/view/permissions/UserUsers.js create mode 100644 web/app/view/permissions/Users.js (limited to 'web/app/view/permissions') diff --git a/web/app/view/permissions/Calendars.js b/web/app/view/permissions/Calendars.js new file mode 100644 index 0000000..ff2796b --- /dev/null +++ b/web/app/view/permissions/Calendars.js @@ -0,0 +1,38 @@ +/* + * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 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 . + */ + +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, + dataIndex: 'name', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' + }] + } +}); diff --git a/web/app/view/permissions/ComputedAttributes.js b/web/app/view/permissions/ComputedAttributes.js new file mode 100644 index 0000000..800717c --- /dev/null +++ b/web/app/view/permissions/ComputedAttributes.js @@ -0,0 +1,51 @@ +/* + * 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 . + */ + +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, + dataIndex: 'description', + flex: 1, + 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/DeviceAttributes.js b/web/app/view/permissions/DeviceAttributes.js deleted file mode 100644 index c7755f0..0000000 --- a/web/app/view/permissions/DeviceAttributes.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 . - */ - -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, - 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/DeviceDrivers.js b/web/app/view/permissions/DeviceDrivers.js deleted file mode 100644 index d3aa20b..0000000 --- a/web/app/view/permissions/DeviceDrivers.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 . - */ - -Ext.define('Traccar.view.permissions.DeviceDrivers', { - extend: 'Traccar.view.permissions.Base', - xtype: 'deviceDriversView', - - requires: [ - 'Ext.grid.filters.Filters' - ], - - plugins: 'gridfilters', - - columns: { - items: [{ - text: Strings.sharedName, - dataIndex: 'name', - flex: 1, - minWidth: Traccar.Style.columnWidthNormal, - filter: 'string' - }, { - text: Strings.deviceIdentifier, - dataIndex: 'uniqueId', - flex: 1, - minWidth: Traccar.Style.columnWidthNormal, - filter: 'string' - }] - } -}); diff --git a/web/app/view/permissions/DeviceGeofences.js b/web/app/view/permissions/DeviceGeofences.js deleted file mode 100644 index c16bced..0000000 --- a/web/app/view/permissions/DeviceGeofences.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@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 . - */ - -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, - filter: 'string' - }] - } -}); diff --git a/web/app/view/permissions/Devices.js b/web/app/view/permissions/Devices.js new file mode 100644 index 0000000..4cadafe --- /dev/null +++ b/web/app/view/permissions/Devices.js @@ -0,0 +1,77 @@ +/* + * Copyright 2015 - 2017 Anton Tananaev (anton@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 . + */ + +Ext.define('Traccar.view.permissions.Devices', { + extend: 'Traccar.view.permissions.Base', + xtype: 'linkDevicesView', + + requires: [ + 'Ext.grid.filters.Filters', + 'Traccar.AttributeFormatter' + ], + + plugins: 'gridfilters', + + columns: { + items: [{ + text: Strings.sharedName, + dataIndex: 'name', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' + }, { + text: Strings.deviceIdentifier, + dataIndex: 'uniqueId', + flex: 1, + 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/Drivers.js b/web/app/view/permissions/Drivers.js new file mode 100644 index 0000000..f0ea289 --- /dev/null +++ b/web/app/view/permissions/Drivers.js @@ -0,0 +1,44 @@ +/* + * 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 . + */ + +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, + dataIndex: 'name', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' + }, { + text: Strings.deviceIdentifier, + dataIndex: 'uniqueId', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' + }] + } +}); diff --git a/web/app/view/permissions/Geofences.js b/web/app/view/permissions/Geofences.js new file mode 100644 index 0000000..84135d3 --- /dev/null +++ b/web/app/view/permissions/Geofences.js @@ -0,0 +1,37 @@ +/* + * Copyright 2016 - 2017 Anton Tananaev (anton@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 . + */ + +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, + dataIndex: 'name', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' + }] + } +}); diff --git a/web/app/view/permissions/GroupAttributes.js b/web/app/view/permissions/GroupAttributes.js deleted file mode 100644 index 4db8b24..0000000 --- a/web/app/view/permissions/GroupAttributes.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 . - */ - -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, - 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/GroupDrivers.js b/web/app/view/permissions/GroupDrivers.js deleted file mode 100644 index 61aa10a..0000000 --- a/web/app/view/permissions/GroupDrivers.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 . - */ - -Ext.define('Traccar.view.permissions.GroupDrivers', { - extend: 'Traccar.view.permissions.Base', - xtype: 'groupDriversView', - - requires: [ - 'Ext.grid.filters.Filters' - ], - - plugins: 'gridfilters', - - columns: { - items: [{ - text: Strings.sharedName, - dataIndex: 'name', - flex: 1, - minWidth: Traccar.Style.columnWidthNormal, - filter: 'string' - }, { - text: Strings.deviceIdentifier, - dataIndex: 'uniqueId', - flex: 1, - minWidth: Traccar.Style.columnWidthNormal, - filter: 'string' - }] - } -}); diff --git a/web/app/view/permissions/GroupGeofences.js b/web/app/view/permissions/GroupGeofences.js deleted file mode 100644 index f365e35..0000000 --- a/web/app/view/permissions/GroupGeofences.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@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 . - */ - -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, - filter: 'string' - }] - } -}); diff --git a/web/app/view/permissions/Groups.js b/web/app/view/permissions/Groups.js new file mode 100644 index 0000000..d3cad98 --- /dev/null +++ b/web/app/view/permissions/Groups.js @@ -0,0 +1,50 @@ +/* + * Copyright 2016 - 2017 Anton Tananaev (anton@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 . + */ + +Ext.define('Traccar.view.permissions.Groups', { + extend: 'Traccar.view.permissions.Base', + xtype: 'linkGroupsView', + + requires: [ + 'Ext.grid.filters.Filters', + 'Traccar.AttributeFormatter' + ], + + plugins: 'gridfilters', + + columns: { + items: [{ + text: Strings.sharedName, + dataIndex: 'name', + flex: 1, + 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/SavedCommands.js b/web/app/view/permissions/SavedCommands.js new file mode 100644 index 0000000..1c7ab77 --- /dev/null +++ b/web/app/view/permissions/SavedCommands.js @@ -0,0 +1,55 @@ +/* + * 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 . + */ + +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, + dataIndex: 'description', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' + }, { + text: Strings.sharedType, + dataIndex: 'name', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + filter: { + type: 'list', + idField: 'name', + labelField: 'name', + store: 'AllCommandTypes' + } + }, { + text: Strings.notificationSms, + dataIndex: 'textChannel', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + filter: 'boolean' + }] + } +}); diff --git a/web/app/view/permissions/UserAttributes.js b/web/app/view/permissions/UserAttributes.js deleted file mode 100644 index a0a385e..0000000 --- a/web/app/view/permissions/UserAttributes.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 . - */ - -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, - 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 deleted file mode 100644 index 54ecfc2..0000000 --- a/web/app/view/permissions/UserCalendars.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org) - * Copyright 2016 - 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 . - */ - -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, - filter: 'string' - }] - } -}); diff --git a/web/app/view/permissions/UserDevices.js b/web/app/view/permissions/UserDevices.js deleted file mode 100644 index a9bb65b..0000000 --- a/web/app/view/permissions/UserDevices.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2015 - 2017 Anton Tananaev (anton@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 . - */ - -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, - filter: 'string' - }, { - text: Strings.deviceIdentifier, - dataIndex: 'uniqueId', - flex: 1, - 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/UserDrivers.js b/web/app/view/permissions/UserDrivers.js deleted file mode 100644 index 8f88ddd..0000000 --- a/web/app/view/permissions/UserDrivers.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 . - */ - -Ext.define('Traccar.view.permissions.UserDrivers', { - extend: 'Traccar.view.permissions.Base', - xtype: 'userDriversView', - - requires: [ - 'Ext.grid.filters.Filters' - ], - - plugins: 'gridfilters', - - columns: { - items: [{ - text: Strings.sharedName, - dataIndex: 'name', - flex: 1, - minWidth: Traccar.Style.columnWidthNormal, - filter: 'string' - }, { - text: Strings.deviceIdentifier, - dataIndex: 'uniqueId', - flex: 1, - minWidth: Traccar.Style.columnWidthNormal, - filter: 'string' - }] - } -}); diff --git a/web/app/view/permissions/UserGeofences.js b/web/app/view/permissions/UserGeofences.js deleted file mode 100644 index 436a2a6..0000000 --- a/web/app/view/permissions/UserGeofences.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@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 . - */ - -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, - filter: 'string' - }] - } -}); diff --git a/web/app/view/permissions/UserGroups.js b/web/app/view/permissions/UserGroups.js deleted file mode 100644 index bc24201..0000000 --- a/web/app/view/permissions/UserGroups.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2016 - 2017 Anton Tananaev (anton@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 . - */ - -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, - 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 deleted file mode 100644 index c5980c2..0000000 --- a/web/app/view/permissions/UserUsers.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 . - */ - -Ext.define('Traccar.view.permissions.UserUsers', { - extend: 'Traccar.view.permissions.Base', - xtype: 'userUsersView', - - columns: { - items: [{ - text: Strings.sharedName, - dataIndex: 'name', - flex: 1, - minWidth: Traccar.Style.columnWidthNormal, - filter: 'string' - }] - } -}); diff --git a/web/app/view/permissions/Users.js b/web/app/view/permissions/Users.js new file mode 100644 index 0000000..66cf5d6 --- /dev/null +++ b/web/app/view/permissions/Users.js @@ -0,0 +1,32 @@ +/* + * 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 . + */ + +Ext.define('Traccar.view.permissions.Users', { + extend: 'Traccar.view.permissions.Base', + xtype: 'linkUsersView', + + columns: { + items: [{ + text: Strings.sharedName, + dataIndex: 'name', + flex: 1, + minWidth: Traccar.Style.columnWidthNormal, + filter: 'string' + }] + } +}); -- cgit v1.2.3 From be47d612285d484e2d0a2aa43174fb8e36acd816 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Thu, 14 Sep 2017 09:38:14 +0500 Subject: Improve command type formatting --- web/app/AttributeFormatter.js | 7 +++++++ web/app/model/Command.js | 8 -------- web/app/model/KnownCommand.js | 3 +-- web/app/view/dialog/BaseEditController.js | 2 +- web/app/view/dialog/SendCommand.js | 2 +- web/app/view/dialog/SendCommandController.js | 9 ++++++--- web/app/view/edit/DevicesController.js | 1 - web/app/view/edit/SavedCommands.js | 7 ++++--- web/app/view/permissions/SavedCommands.js | 7 ++++--- web/l10n/en.json | 2 +- 10 files changed, 25 insertions(+), 23 deletions(-) (limited to 'web/app/view/permissions') diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 8a9e3dc..289aff9 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -130,6 +130,11 @@ Ext.define('Traccar.AttributeFormatter', { return null; }, + commandTypeFormatter: function (value) { + var name = Strings['command' + value.charAt(0).toUpperCase() + value.slice(1)]; + return name ? name : value; + }, + defaultFormatter: function (value) { if (typeof value === 'number') { return Number(value.toFixed(Traccar.Style.numberPrecision)); @@ -175,6 +180,8 @@ Ext.define('Traccar.AttributeFormatter', { return this.volumeFormatter; case 'driverUniqueId': return this.driverUniqueIdFormatter; + case 'commandType': + return this.commandTypeFormatter; default: return this.defaultFormatter; } diff --git a/web/app/model/Command.js b/web/app/model/Command.js index aa3dad1..f64d2a4 100644 --- a/web/app/model/Command.js +++ b/web/app/model/Command.js @@ -31,14 +31,6 @@ Ext.define('Traccar.model.Command', { }, { name: 'type', type: 'string' - }, { - name: 'name', - convert: function (v, rec) { - var name = Strings['command' + rec.get('type').charAt(0).toUpperCase() + rec.get('type').slice(1)]; - return name ? name : rec.get('type'); - }, - depends: ['type'], - persist: false }, { name: 'textChannel', type: 'boolean' diff --git a/web/app/model/KnownCommand.js b/web/app/model/KnownCommand.js index 0821302..06610e3 100644 --- a/web/app/model/KnownCommand.js +++ b/web/app/model/KnownCommand.js @@ -25,8 +25,7 @@ Ext.define('Traccar.model.KnownCommand', { }, { name: 'name', convert: function (v, rec) { - var name = Strings['command' + rec.get('type').charAt(0).toUpperCase() + rec.get('type').slice(1)]; - return name ? name : rec.get('type'); + return Traccar.AttributeFormatter.getFormatter('commandType')(rec.get('type')); }, depends: ['type'] }, { diff --git a/web/app/view/dialog/BaseEditController.js b/web/app/view/dialog/BaseEditController.js index f58b6cb..91379e2 100644 --- a/web/app/view/dialog/BaseEditController.js +++ b/web/app/view/dialog/BaseEditController.js @@ -43,7 +43,7 @@ Ext.define('Traccar.view.dialog.BaseEditController', { } else { record.save(); } - button.up('window').close(); + this.closeView(); }, showAttributesView: function (button) { diff --git a/web/app/view/dialog/SendCommand.js b/web/app/view/dialog/SendCommand.js index 0bb7d61..f4224be 100644 --- a/web/app/view/dialog/SendCommand.js +++ b/web/app/view/dialog/SendCommand.js @@ -29,7 +29,7 @@ Ext.define('Traccar.view.dialog.SendCommand', { items: [{ xtype: 'combobox', reference: 'commandsComboBox', - fieldLabel: Strings.sharedSavedCommand, + fieldLabel: Strings.deviceCommand, displayField: 'description', valueField: 'id', store: 'DeviceCommands', diff --git a/web/app/view/dialog/SendCommandController.js b/web/app/view/dialog/SendCommandController.js index 3bd2ad4..0e9442a 100644 --- a/web/app/view/dialog/SendCommandController.js +++ b/web/app/view/dialog/SendCommandController.js @@ -36,9 +36,7 @@ Ext.define('Traccar.view.dialog.SendCommandController', { Ext.Ajax.request({ scope: this, url: 'api/commands/send', - jsonData: record.getData({ - persist: true - }), + jsonData: record.getData(), callback: this.onSendResult }); }, @@ -89,5 +87,10 @@ Ext.define('Traccar.view.dialog.SendCommandController', { } else { Traccar.app.showError(response); } + }, + + closeView: function () { + this.lookupReference('commandsComboBox').getStore().removeAll(); + this.callParent(arguments); } }); diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 43bab22..915f724 100644 --- a/web/app/view/edit/DevicesController.js +++ b/web/app/view/edit/DevicesController.js @@ -126,7 +126,6 @@ Ext.define('Traccar.view.edit.DevicesController', { commandsStore = dialog.lookupReference('commandsComboBox').getStore(); commandsStore.getProxy().setExtraParam('deviceId', deviceId); - commandsStore.removeAll(); if (!Traccar.app.getPreference('limitCommands', false)) { commandsStore.add({ id: 0, diff --git a/web/app/view/edit/SavedCommands.js b/web/app/view/edit/SavedCommands.js index 8f1f6b3..869fbf9 100644 --- a/web/app/view/edit/SavedCommands.js +++ b/web/app/view/edit/SavedCommands.js @@ -50,13 +50,14 @@ Ext.define('Traccar.view.edit.SavedCommands', { filter: 'string' }, { text: Strings.sharedType, - dataIndex: 'name', + dataIndex: 'type', filter: { type: 'list', - idField: 'name', + idField: 'type', labelField: 'name', store: 'AllCommandTypes' - } + }, + renderer: Traccar.AttributeFormatter.getFormatter('commandType') }, { text: Strings.notificationSms, dataIndex: 'textChannel', diff --git a/web/app/view/permissions/SavedCommands.js b/web/app/view/permissions/SavedCommands.js index 1c7ab77..106fad5 100644 --- a/web/app/view/permissions/SavedCommands.js +++ b/web/app/view/permissions/SavedCommands.js @@ -35,15 +35,16 @@ Ext.define('Traccar.view.permissions.SavedCommands', { filter: 'string' }, { text: Strings.sharedType, - dataIndex: 'name', + dataIndex: 'type', flex: 1, minWidth: Traccar.Style.columnWidthNormal, filter: { type: 'list', - idField: 'name', + idField: 'type', labelField: 'name', store: 'AllCommandTypes' - } + }, + renderer: Traccar.AttributeFormatter.getFormatter('commandType') }, { text: Strings.notificationSms, dataIndex: 'textChannel', diff --git a/web/l10n/en.json b/web/l10n/en.json index de0cb7e..aeb20dd 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -71,7 +71,7 @@ "sharedInfoTitle": "Info", "sharedSavedCommand": "Saved Command", "sharedSavedCommands": "Saved Commands", - "sharedNew": "New ...", + "sharedNew": "New…", "attributeSpeedLimit": "Speed Limit", "attributeReportIgnoreOdometer": "Report: Ignore Odometer", "attributeMaintenanceStart": "Maintenance: Start", -- cgit v1.2.3