[pve-devel] [PATCH manager 1/8] move dcNodeView into its own file
Dominik Csapak
d.csapak at proxmox.com
Fri Oct 28 13:11:41 CEST 2016
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/dc/NodeView.js | 110 ++++++++++++++++++++++++++++++++++++++++++++
www/manager6/dc/Summary.js | 110 --------------------------------------------
3 files changed, 111 insertions(+), 110 deletions(-)
create mode 100644 www/manager6/dc/NodeView.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 06fbd45..28e31bd 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -203,6 +203,7 @@ JSSRC= \
dc/Support.js \
dc/SecurityGroups.js \
dc/Config.js \
+ dc/NodeView.js \
Workspace.js
lint: ${JSSRC}
diff --git a/www/manager6/dc/NodeView.js b/www/manager6/dc/NodeView.js
new file mode 100644
index 0000000..eb9fb27
--- /dev/null
+++ b/www/manager6/dc/NodeView.js
@@ -0,0 +1,110 @@
+Ext.define('PVE.dc.NodeView', {
+ extend: 'Ext.grid.GridPanel',
+
+ alias: ['widget.pveDcNodeView'],
+
+ initComponent : function() {
+ var me = this;
+
+ var rstore = Ext.create('PVE.data.UpdateStore', {
+ interval: 3000,
+ storeid: 'pve-dc-nodes',
+ model: 'pve-dc-nodes',
+ proxy: {
+ type: 'pve',
+ url: "/api2/json/cluster/status"
+ },
+ filters: {
+ property: 'type',
+ value : 'node'
+ }
+ });
+
+ var store = Ext.create('PVE.data.DiffStore', { rstore: rstore });
+
+ var noClusterText = gettext("Standalone node - no cluster defined");
+ var status = Ext.create('Ext.Component', {
+ padding: 2,
+ html: ' ',
+ dock: 'bottom'
+ });
+
+ Ext.apply(me, {
+ store: store,
+ stateful: false,
+ bbar: [ status ],
+ columns: [
+ {
+ header: gettext('Name'),
+ width: 200,
+ sortable: true,
+ dataIndex: 'name'
+ },
+ {
+ header: 'ID',
+ width: 50,
+ sortable: true,
+ dataIndex: 'nodeid'
+ },
+ {
+ header: gettext('Online'),
+ width: 100,
+ sortable: true,
+ dataIndex: 'online',
+ renderer: PVE.Utils.format_boolean
+ },
+ {
+ header: gettext('Support'),
+ width: 100,
+ sortable: true,
+ dataIndex: 'level',
+ renderer: PVE.Utils.render_support_level
+ },
+ {
+ header: gettext('Server Address'),
+ flex: 1,
+ sortable: true,
+ dataIndex: 'ip'
+ }
+ ],
+ listeners: {
+ show: rstore.startUpdate,
+ destroy: rstore.stopUpdate
+ }
+ });
+
+ me.callParent();
+
+ me.mon(rstore, 'load', function(s, records, success) {
+ if (!success) {
+ return;
+ }
+
+ var cluster_rec = rstore.getById('cluster');
+
+ if (!cluster_rec) {
+ status.update(noClusterText);
+ return;
+ }
+
+ var cluster_data = cluster_rec.getData();
+ if (!cluster_data) {
+ status.update(noClusterText);
+ return;
+ }
+ var text = gettext("Cluster") + ": " + cluster_data.name + ", " +
+ gettext("Quorate") + ": " + PVE.Utils.format_boolean(cluster_data.quorate);
+ status.update(text);
+ });
+
+ }
+}, function() {
+
+ Ext.define('pve-dc-nodes', {
+ extend: 'Ext.data.Model',
+ fields: [ 'id', 'type', 'name', 'nodeid', 'ip', 'level', 'local', 'online'],
+ idProperty: 'id'
+ });
+
+});
+
diff --git a/www/manager6/dc/Summary.js b/www/manager6/dc/Summary.js
index 11d6ba0..961f092 100644
--- a/www/manager6/dc/Summary.js
+++ b/www/manager6/dc/Summary.js
@@ -1,113 +1,3 @@
-Ext.define('PVE.dc.NodeView', {
- extend: 'Ext.grid.GridPanel',
-
- alias: ['widget.pveDcNodeView'],
-
- initComponent : function() {
- var me = this;
-
- var rstore = Ext.create('PVE.data.UpdateStore', {
- interval: 3000,
- storeid: 'pve-dc-nodes',
- model: 'pve-dc-nodes',
- proxy: {
- type: 'pve',
- url: "/api2/json/cluster/status"
- },
- filters: {
- property: 'type',
- value : 'node'
- }
- });
-
- var store = Ext.create('PVE.data.DiffStore', { rstore: rstore });
-
- var noClusterText = gettext("Standalone node - no cluster defined");
- var status = Ext.create('Ext.Component', {
- padding: 2,
- html: ' ',
- dock: 'bottom'
- });
-
- Ext.apply(me, {
- store: store,
- stateful: false,
- bbar: [ status ],
- columns: [
- {
- header: gettext('Name'),
- width: 200,
- sortable: true,
- dataIndex: 'name'
- },
- {
- header: 'ID',
- width: 50,
- sortable: true,
- dataIndex: 'nodeid'
- },
- {
- header: gettext('Online'),
- width: 100,
- sortable: true,
- dataIndex: 'online',
- renderer: PVE.Utils.format_boolean
- },
- {
- header: gettext('Support'),
- width: 100,
- sortable: true,
- dataIndex: 'level',
- renderer: PVE.Utils.render_support_level
- },
- {
- header: gettext('Server Address'),
- flex: 1,
- sortable: true,
- dataIndex: 'ip'
- }
- ],
- listeners: {
- show: rstore.startUpdate,
- destroy: rstore.stopUpdate
- }
- });
-
- me.callParent();
-
- me.mon(rstore, 'load', function(s, records, success) {
- if (!success) {
- return;
- }
-
- var cluster_rec = rstore.getById('cluster');
-
- if (!cluster_rec) {
- status.update(noClusterText);
- return;
- }
-
- var cluster_data = cluster_rec.getData();
- if (!cluster_data) {
- status.update(noClusterText);
- return;
- }
- var text = gettext("Cluster") + ": " + cluster_data.name + ", " +
- gettext("Quorate") + ": " + PVE.Utils.format_boolean(cluster_data.quorate);
- status.update(text);
- });
-
- }
-}, function() {
-
- Ext.define('pve-dc-nodes', {
- extend: 'Ext.data.Model',
- fields: [ 'id', 'type', 'name', 'nodeid', 'ip', 'level', 'local', 'online'],
- idProperty: 'id'
- });
-
-});
-
Ext.define('PVE.dc.Summary', {
extend: 'Ext.panel.Panel',
--
2.1.4
More information about the pve-devel
mailing list