[pve-devel] [PATCH manager 17/17] fix #1358: add clustername to datacenter element in tree
Dominik Csapak
d.csapak at proxmox.com
Wed Jul 19 15:45:29 CEST 2017
this is useful when having more than one cluster, but all with
the same/similar node naming scheme
we need to pass this information via the /version api call
and get it in the gui
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
PVE/API2.pm | 6 ++++++
www/manager6/Workspace.js | 4 ++++
www/manager6/tree/ResourceTree.js | 8 ++++++++
3 files changed, 18 insertions(+)
diff --git a/PVE/API2.pm b/PVE/API2.pm
index 329b6b79..1b715448 100644
--- a/PVE/API2.pm
+++ b/PVE/API2.pm
@@ -185,6 +185,12 @@ __PACKAGE__->register_method ({
$res->{$k} = $vi->{$k};
}
+ # get clustername
+ my $clusterinfo = PVE::Cluster::get_clinfo();
+ if ($clusterinfo->{cluster}) {
+ $res->{clustername} = $clusterinfo->{cluster}->{name} if $clusterinfo->{cluster}->{name};
+ }
+
# get storage formats, including custom plugins
my $storages = {};
my $storagetypes = PVE::Storage::Plugin->lookup_types();
diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 1f64b3ff..4dd99acf 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -159,6 +159,10 @@ Ext.define('PVE.StdWorkspace', {
if (data.storagetypes) {
PVE.Utils.setStorageFormats(data.storagetypes);
}
+
+ if (data.clustername) {
+ me.down('pveResourceTree').setClusterName(data.clustername);
+ }
}
});
}
diff --git a/www/manager6/tree/ResourceTree.js b/www/manager6/tree/ResourceTree.js
index b928f95d..361458af 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -39,6 +39,14 @@ Ext.define('PVE.tree.ResourceTree', {
useArrows: true,
+ setClusterName: function(clustername) {
+ var me = this;
+ var rootnode = me.store.getRootNode();
+ rootnode.set('text', gettext('Datacenter') + ' (' + clustername + ')',
+ { dirty: false });
+
+ },
+
// private
nodeSortFn: function(node1, node2) {
var n1 = node1.data;
--
2.11.0
More information about the pve-devel
mailing list