]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: close #3504: Add datacenter notes
authorDominic Jäger <d.jaeger@proxmox.com>
Wed, 22 Sep 2021 10:42:18 +0000 (12:42 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 9 Nov 2021 17:33:47 +0000 (18:33 +0100)
Like notes for nodes.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
www/manager6/dc/Config.js
www/manager6/panel/NotesView.js

index 934952d9a39a21c00462865a0881688f30c24aac..eb4c780531ae36f195143930f25d88059eedf569 100644 (file)
@@ -27,6 +27,12 @@ Ext.define('PVE.dc.Config', {
                iconCls: 'fa fa-book',
                itemId: 'summary',
            },
+           {
+               xtype: 'pveNotesView',
+               title: gettext('Notes'),
+               iconCls: 'fa fa-sticky-note-o',
+               itemId: 'notes',
+           },
            {
                title: gettext('Cluster'),
                xtype: 'pveClusterAdministration',
index b281f8926f87361c648d28a918aa7b67e1276c37..7c8299d081074f9d0bdf8acb86c4b02fb20ee671 100644 (file)
@@ -6,6 +6,7 @@ Ext.define('PVE.panel.NotesView', {
     bodyPadding: 10,
     scrollable: true,
     animCollapse: false,
+    maxLength: 64 * 1024,
 
     tbar: {
        itemId: 'tbar',
@@ -79,37 +80,38 @@ Ext.define('PVE.panel.NotesView', {
     }],
 
     initComponent: function() {
-       var me = this;
+       const me = this;
+       const type = me.pveSelNode.data.type;
 
-       var nodename = me.pveSelNode.data.node;
-       if (!nodename) {
-           throw "no node name specified";
-       }
+       if (me.pveSelNode.data.id === 'root') {
+           me.url = '/api2/extjs/cluster/options';
+       } else {
+           const nodename = me.pveSelNode.data.node;
+           if (!nodename) {
+               throw "no node name specified";
+           }
 
-       let type = me.pveSelNode.data.type;
-       if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
-           throw 'invalid type specified';
-       }
+           if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
+               throw 'invalid type specified';
+           }
 
-       var vmid = me.pveSelNode.data.vmid;
-       if (!vmid && type !== 'node') {
-           throw "no VM ID specified";
-       }
+           const vmid = me.pveSelNode.data.vmid;
+           if (!vmid && type !== 'node') {
+               throw "no VM ID specified";
+           }
 
-       me.url = `/api2/extjs/nodes/${nodename}/`;
+           me.url = `/api2/extjs/nodes/${nodename}/`;
 
-       // add the type specific path if qemu/lxc and set the backend's maxLen
-       if (type === 'qemu' || type === 'lxc') {
-           me.url += `${type}/${vmid}/`;
-           me.maxLength = 8 * 1024;
-       } else {
-           me.maxLength = 64 * 1024;
+           // add the type specific path if qemu/lxc and set the backend's maxLen
+           if (type === 'qemu' || type === 'lxc') {
+               me.url += `${type}/${vmid}/`;
+               me.maxLength = 8 * 1024;
+           }
+           me.url += 'config';
        }
 
-       me.url += 'config';
-
        me.callParent();
-       if (type === 'node') {
+       if (type === 'node' || type === '') { // '' is for datacenter
            me.down('#tbar').setVisible(true);
        } else if (me.pveSelNode.data.template !== 1) {
            me.setCollapsible(true);