aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/DeviceView.js38
-rw-r--r--web/Strings.js7
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'
});