diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-02 12:07:37 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-05-02 12:07:37 +1200 |
commit | 44da47950bdd75be57714158fd8a6d59c94460b5 (patch) | |
tree | a4041015bd6eea68e07246290cb0e0d1c4f1c5ac | |
parent | f6d9014c9a05cce42678515d941af52c1c2584a5 (diff) | |
download | trackermap-server-44da47950bdd75be57714158fd8a6d59c94460b5.tar.gz trackermap-server-44da47950bdd75be57714158fd8a6d59c94460b5.tar.bz2 trackermap-server-44da47950bdd75be57714158fd8a6d59c94460b5.zip |
Add create device dialog
-rw-r--r-- | web/DeviceView.js | 38 | ||||
-rw-r--r-- | web/Strings.js | 7 |
2 files changed, 31 insertions, 14 deletions
diff --git a/web/DeviceView.js b/web/DeviceView.js index c64a6031f..80e75cb2c 100644 --- a/web/DeviceView.js +++ b/web/DeviceView.js @@ -16,6 +16,7 @@ Ext.define('DeviceView', { extend: 'Ext.grid.Panel', + requires: [ 'DeviceDialog' ], xtype: 'device-view', title: Strings.device_title, @@ -23,24 +24,35 @@ Ext.define('DeviceView', { tbar: [{ text:'Add', handler: function() { - - var device = { - name: "AjaxTest", - uniqueId: "UniqueId" - }; - - Ext.Ajax.request({ - url: '/api/device/add', - jsonData: Ext.encode(device), - success: function() { - alert("success"); + var panel = this.up('panel'); + Ext.create('DeviceDialog', { + onUpdate: function() { + panel.store.reload(); } - }); + }).show(); } }, { text:'Edit' }, { - text:'Remove' + text:'Remove', + handler: function() { + Ext.Msg.show({ + title: Strings.device_dialog, + message: 'Remove device?', + buttons: Ext.Msg.YESNO, + buttonText: { + yes: Strings.dialog_delete, + no: Strings.dialog_cancel + }, + fn: function(btn) { + if (btn === 'yes') { + console.log('Yes pressed'); + } else if (btn === 'no') { + console.log('No pressed'); + } + } + }); + } }, { xtype: 'tbfill' }, { diff --git a/web/Strings.js b/web/Strings.js index b46c162a9..9c89f7fa0 100644 --- a/web/Strings.js +++ b/web/Strings.js @@ -24,12 +24,17 @@ Ext.define('Strings', { login_login: 'Login', login_failed: 'Incorrect email address or password.', + device_dialog: 'Device', device_title: 'Devices', device_name: 'Name', device_identifier: 'Identifier', report_title: 'Reports', - + + dialog_create: 'Create', + dialog_update: 'Update', + dialog_delete: 'Delete', + dialog_cancel: 'Cancel', map_title: 'Map' }); |