[pve-devel] [RFC widget-toolkit 7/7] APT repositories: show list of warnings

Fabian Ebner f.ebner at proxmox.com
Wed Jan 20 11:01:43 CET 2021


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/node/APTRepositories.js | 88 +++++++++++++++++++++++++++++++++++--
 1 file changed, 85 insertions(+), 3 deletions(-)

diff --git a/src/node/APTRepositories.js b/src/node/APTRepositories.js
index 5982306..2c46af5 100644
--- a/src/node/APTRepositories.js
+++ b/src/node/APTRepositories.js
@@ -1,3 +1,25 @@
+Ext.define('Proxmox.node.APTRepositories', {
+    extend: 'Ext.container.Container',
+    xtype: 'proxmoxNodeAPTRepositories',
+
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    items: [
+	{
+	    xtype: 'proxmoxNodeAPTRepositoriesMain',
+	    cbind: {
+		nodename: '{nodename}',
+	    },
+	},
+	{
+	    xtype: 'proxmoxNodeAPTRepositoriesWarnings',
+	    cbind: {
+		nodename: '{nodename}',
+	    },
+	},
+    ],
+});
+
 Ext.define('apt-repolist', {
     extend: 'Ext.data.Model',
     fields: [
@@ -27,10 +49,9 @@ Ext.define('apt-repolist', {
     ],
 });
 
-Ext.define('Proxmox.node.APTRepositories', {
+Ext.define('Proxmox.node.APTRepositoriesMain', {
     extend: 'Ext.grid.GridPanel',
-
-    xtype: 'proxmoxNodeAPTRepositories',
+    xtype: 'proxmoxNodeAPTRepositoriesMain',
 
     sortableColumns: false,
 
@@ -129,3 +150,64 @@ Ext.define('Proxmox.node.APTRepositories', {
 	me.callParent();
     },
 });
+
+Ext.define('apt-repolist-warnings', {
+    extend: 'Ext.data.Model',
+    fields: [
+	{
+	    name: "location",
+	    convert: function(value, record) {
+		let path = record.data.path;
+		if (value || !path) {
+		    return value;
+		}
+		let number = record.data.number || '';
+		return path + ':' + number;
+	    },
+	},
+	'message',
+    ],
+});
+
+Ext.define('Proxmox.node.APTRepositoriesWarnings', {
+    extend: 'Ext.grid.GridPanel',
+    xtype: 'proxmoxNodeAPTRepositoriesWarnings',
+
+    columns: [
+	{
+	    header: "Warning",
+	    dataIndex: "message",
+	    flex: 1,
+	},
+	{
+	    header: "Location",
+	    dataIndex: "location",
+	    flex: 1,
+	},
+    ],
+
+    initComponent: function() {
+	let me = this;
+
+	if (!me.nodename) {
+	    throw "no node name specified";
+	}
+
+	let store = Ext.create('Ext.data.Store', {
+	    model: 'apt-repolist-warnings',
+	    proxy: {
+		type: 'proxmox',
+		url: "/api2/json/nodes/" + me.nodename + "/apt/repositoriescheck",
+	    },
+	});
+
+	Ext.apply(me, {
+	    store: store,
+	});
+
+	Proxmox.Utils.monStoreErrors(me, store, true);
+	store.load();
+
+	me.callParent();
+    },
+});
-- 
2.20.1






More information about the pve-devel mailing list