]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/panel/NotesView.js
network reload: check if recent enough PVE ifupdown2 version is present
[pve-manager.git] / www / manager6 / panel / NotesView.js
CommitLineData
b49fb084
DM
1Ext.define('PVE.panel.NotesView', {
2 extend: 'Ext.panel.Panel',
ade55c15 3 xtype: 'pveNotesView',
b49fb084 4
6f68dcbe 5 title: gettext("Notes"),
6f68dcbe
EK
6 bodyStyle: 'white-space:pre',
7 bodyPadding: 10,
8 scrollable: true,
9
9db54b1f
DC
10 tbar: {
11 itemId: 'tbar',
12 hidden: true,
13 items: [
14 {
15 text: gettext('Edit'),
16 handler: function() {
17 var me = this.up('panel');
18 me.run_editor();
19 }
20 }
21 ]
22 },
23
24 run_editor: function() {
25 var me = this;
26 var win = Ext.create('PVE.window.NotesEdit', {
27 pveSelNode: me.pveSelNode,
28 url: me.url
29 });
30 win.show();
31 win.on('destroy', me.load, me);
32 },
33
b49fb084
DM
34 load: function() {
35 var me = this;
9db54b1f 36
e7ade592 37 Proxmox.Utils.API2Request({
b49fb084
DM
38 url: me.url,
39 waitMsgTarget: me,
40 failure: function(response, opts) {
41 me.update(gettext('Error') + " " + response.htmlStatus);
42 },
43 success: function(response, opts) {
44 var data = response.result.data.description || '';
45 me.update(Ext.htmlEncode(data));
46 }
47 });
48 },
49
9db54b1f
DC
50 listeners: {
51 render: function(c) {
52 var me = this;
53 me.getEl().on('dblclick', me.run_editor, me);
54 }
55 },
56
57 tools: [{
58 type: 'gear',
59 handler: function() {
02eb40cf 60 var me = this.up('panel');
9db54b1f
DC
61 me.run_editor();
62 }
63 }],
64
b49fb084
DM
65 initComponent : function() {
66 var me = this;
67
68 var nodename = me.pveSelNode.data.node;
69 if (!nodename) {
70 throw "no node name specified";
71 }
72
9db54b1f
DC
73 var type = me.pveSelNode.data.type;
74 if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
75 throw 'invalid type specified';
76 }
77
b49fb084 78 var vmid = me.pveSelNode.data.vmid;
9db54b1f 79 if (!vmid && type !== 'node') {
b49fb084
DM
80 throw "no VM ID specified";
81 }
82
9db54b1f 83 me.url = '/api2/extjs/nodes/' + nodename + '/';
b49fb084 84
9db54b1f
DC
85 // add the type specific path if qemu/lxc
86 if (type === 'qemu' || type === 'lxc') {
87 me.url += type + '/' + vmid + '/';
b49fb084
DM
88 }
89
9db54b1f 90 me.url += 'config';
b49fb084
DM
91
92 me.callParent();
9db54b1f
DC
93 if (type === 'node') {
94 me.down('#tbar').setVisible(true);
95 }
abbf0eb7 96 me.load();
b49fb084
DM
97 }
98});