aboutsummaryrefslogtreecommitdiff
path: root/web/DeviceView.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-05-02 12:07:37 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-05-02 12:07:37 +1200
commit44da47950bdd75be57714158fd8a6d59c94460b5 (patch)
treea4041015bd6eea68e07246290cb0e0d1c4f1c5ac /web/DeviceView.js
parentf6d9014c9a05cce42678515d941af52c1c2584a5 (diff)
downloadtrackermap-server-44da47950bdd75be57714158fd8a6d59c94460b5.tar.gz
trackermap-server-44da47950bdd75be57714158fd8a6d59c94460b5.tar.bz2
trackermap-server-44da47950bdd75be57714158fd8a6d59c94460b5.zip
Add create device dialog
Diffstat (limited to 'web/DeviceView.js')
-rw-r--r--web/DeviceView.js38
1 files changed, 25 insertions, 13 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'
}, {