[pmg-devel] [PATCH v2 gui] add certificates and acme view

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Mar 12 16:24:07 CET 2021


Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
Changes to v1:
* removed superfluous `border: 0`
* removed initComponent and commented-out help reference (to be filled
  by the user atm)

 js/Certificates.js   | 96 ++++++++++++++++++++++++++++++++++++++++++++
 js/Makefile          |  1 +
 js/NavigationTree.js |  6 +++
 3 files changed, 103 insertions(+)
 create mode 100644 js/Certificates.js

diff --git a/js/Certificates.js b/js/Certificates.js
new file mode 100644
index 0000000..a2c25a5
--- /dev/null
+++ b/js/Certificates.js
@@ -0,0 +1,96 @@
+Ext.define('PMG.CertificateConfiguration', {
+    extend: 'Ext.tab.Panel',
+    alias: 'widget.pmgCertificateConfiguration',
+
+    title: gettext('Certificates'),
+
+    border: false,
+    defaults: { border: false },
+
+    items: [
+	{
+	    itemId: 'certificates',
+	    xtype: 'pmgCertificatesView',
+	},
+	{
+	    itemId: 'acme',
+	    xtype: 'pmgACMEConfigView',
+	},
+    ],
+});
+
+Ext.define('PMG.CertificateView', {
+    extend: 'Ext.container.Container',
+    alias: 'widget.pmgCertificatesView',
+
+    title: gettext('Certificates'),
+
+    items: [
+	{
+	    xtype: 'pmxCertificates',
+	    border: 0,
+	    infoUrl: '/nodes/' + Proxmox.NodeName + '/certificates/info',
+	    uploadButtons: [
+		{
+		    name: 'API',
+		    id: 'pmg-api.pem',
+		    url: `/nodes/${Proxmox.NodeName}/certificates/custom/api`,
+		    deletable: false,
+		    reloadUi: true,
+		},
+		{
+		    name: 'SMTP',
+		    id: 'pmg-tls.pem',
+		    url: `/nodes/${Proxmox.NodeName}/certificates/custom/smtp`,
+		    deletable: true,
+		},
+	    ],
+	},
+	{
+	    xtype: 'pmxACMEDomains',
+	    border: 0,
+	    url: `/nodes/${Proxmox.NodeName}/config`,
+	    nodename: Proxmox.NodeName,
+	    acmeUrl: '/config/acme',
+	    domainUsages: [
+		{
+		    usage: 'api',
+		    name: 'API',
+		    url: `/nodes/${Proxmox.NodeName}/certificates/acme/api`,
+		    reloadUi: true,
+		},
+		{
+		    usage: 'smtp',
+		    name: 'SMTP',
+		    url: `/nodes/${Proxmox.NodeName}/certificates/acme/smtp`,
+		},
+	    ],
+	},
+    ],
+});
+
+Ext.define('PMG.ACMEConfigView', {
+    extend: 'Ext.panel.Panel',
+    alias: 'widget.pmgACMEConfigView',
+
+    title: gettext('ACME Accounts'),
+
+    //onlineHelp: 'sysadmin_certificate_management',
+
+    items: [
+	{
+	    region: 'north',
+	    border: false,
+	    xtype: 'pmxACMEAccounts',
+	    acmeUrl: '/config/acme',
+	},
+	{
+	    region: 'center',
+	    border: false,
+	    xtype: 'pmxACMEPluginView',
+	    acmeUrl: '/config/acme',
+	},
+    ],
+});
+
+
diff --git a/js/Makefile b/js/Makefile
index a5266fc..43d3ad8 100644
--- a/js/Makefile
+++ b/js/Makefile
@@ -91,6 +91,7 @@ JSSRC=							\
 	ContactStatistics.js				\
 	HourlyMailDistribution.js			\
 	SpamContextMenu.js				\
+	Certificates.js					\
 	Application.js
 
 OnlineHelpInfo.js: /usr/bin/asciidoc-pmg
diff --git a/js/NavigationTree.js b/js/NavigationTree.js
index ac01fd6..63f8e94 100644
--- a/js/NavigationTree.js
+++ b/js/NavigationTree.js
@@ -92,6 +92,12 @@ Ext.define('PMG.store.NavigationStore', {
 			path: 'pmgBackupConfiguration',
 			leaf: true,
 		    },
+		    {
+			text: gettext('Certificates'),
+			iconCls: 'fa fa-certificate',
+			path: 'pmgCertificateConfiguration',
+			leaf: true,
+		    },
 		],
 	    },
 	    {
-- 
2.20.1





More information about the pmg-devel mailing list