[pve-devel] [PATCH manager 19/49] create some models

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jan 23 11:05:36 CET 2018


From: Dominik Csapak <d.csapak at proxmox.com>

we want to use the getId method of some records, but for this
we need that the records are defined as an instance of a model,
so we create some and use them

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/data/PVEProxy.js        |  1 +
 www/manager6/dc/SecurityGroups.js    | 10 ++++++++--
 www/manager6/grid/FirewallAliases.js | 10 ++++++++--
 www/manager6/panel/IPSet.js          |  9 +++++++--
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/www/manager6/data/PVEProxy.js b/www/manager6/data/PVEProxy.js
index a3b0b721..f8f918ff 100644
--- a/www/manager6/data/PVEProxy.js
+++ b/www/manager6/data/PVEProxy.js
@@ -53,6 +53,7 @@ Ext.define('PVE.RestProxy', {
 		      }
 		  }
 		],
+	idProperty: 'realm',
 	proxy: {
 	    type: 'pve',
 	    url: "/api2/json/access/domains"
diff --git a/www/manager6/dc/SecurityGroups.js b/www/manager6/dc/SecurityGroups.js
index 8022ae32..0872eb0a 100644
--- a/www/manager6/dc/SecurityGroups.js
+++ b/www/manager6/dc/SecurityGroups.js
@@ -1,3 +1,10 @@
+Ext.define('pve-security-groups', {
+    extend: 'Ext.data.Model',
+
+    fields: [ 'group', 'comment', 'digest' ],
+    idProperty: 'group'
+});
+
 Ext.define('PVE.SecurityGroupEdit', {
     extend: 'PVE.window.Edit',
 
@@ -86,12 +93,11 @@ Ext.define('PVE.SecurityGroupList', {
 	}
 
 	var store = new Ext.data.Store({
-	    fields: [ 'group', 'comment', 'digest' ],
+	    model: 'pve-security-groups',
 	    proxy: {
 		type: 'pve',
 		url: '/api2/json' + me.base_url
 	    },
-	    idProperty: 'group',
 	    sorters: {
 		property: 'group',
 		order: 'DESC'
diff --git a/www/manager6/grid/FirewallAliases.js b/www/manager6/grid/FirewallAliases.js
index e963ea1e..af20a665 100644
--- a/www/manager6/grid/FirewallAliases.js
+++ b/www/manager6/grid/FirewallAliases.js
@@ -64,6 +64,13 @@ Ext.define('PVE.FirewallAliasEdit', {
     }
 });
 
+Ext.define('pve-fw-aliases', {
+    extend: 'Ext.data.Model',
+
+    fields: [ 'name', 'cidr', 'comment', 'digest' ],
+    idProperty: 'name'
+});
+
 Ext.define('PVE.FirewallAliases', {
     extend: 'Ext.grid.Panel',
     alias: ['widget.pveFirewallAliases'],
@@ -86,12 +93,11 @@ Ext.define('PVE.FirewallAliases', {
 	}
 
 	var store = new Ext.data.Store({
-	    fields: [ 'name', 'cidr', 'comment', 'digest' ],
+	    model: 'pve-fw-aliases',
 	    proxy: {
 		type: 'pve',
 		url: "/api2/json" + me.base_url
 	    },
-	    idProperty: 'name',
 	    sorters: {
 		property: 'name',
 		order: 'DESC'
diff --git a/www/manager6/panel/IPSet.js b/www/manager6/panel/IPSet.js
index 8be6a6d4..4ae23a57 100644
--- a/www/manager6/panel/IPSet.js
+++ b/www/manager6/panel/IPSet.js
@@ -1,3 +1,9 @@
+Ext.define('pve-fw-ipsets', {
+    extend: 'Ext.data.Model',
+    fields: [ 'name', 'comment', 'digest' ],
+    idProperty: 'name'
+});
+
 Ext.define('PVE.IPSetList', {
     extend: 'Ext.grid.Panel',
     alias: 'widget.pveIPSetList',
@@ -26,12 +32,11 @@ Ext.define('PVE.IPSetList', {
 	}
 
 	var store = new Ext.data.Store({
-	    fields: [ 'name', 'comment', 'digest' ],
+	    model: 'pve-fw-ipsets',
 	    proxy: {
 		type: 'pve',
 		url: "/api2/json" + me.base_url
 	    },
-	    idProperty: 'name',
 	    sorters: {
 		property: 'name',
 		order: 'DESC'
-- 
2.14.2





More information about the pve-devel mailing list