public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v3 1/5] ui: add Schema.js
@ 2021-07-16 14:21 Dominik Csapak
  2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 2/5] ui: move Utils.storageSchema to Schema.storageTypes Dominik Csapak
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dominik Csapak @ 2021-07-16 14:21 UTC (permalink / raw)
  To: pve-devel

this will be the place for all schemas for pve

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/Makefile  | 1 +
 www/manager6/Schema.js | 4 ++++
 2 files changed, 5 insertions(+)
 create mode 100644 www/manager6/Schema.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 75d355a5..0b0d833e 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -4,6 +4,7 @@ JSSRC= 							\
 	Parser.js					\
 	StateProvider.js				\
 	Utils.js					\
+	Schema.js					\
 	Toolkit.js					\
 	VNCConsole.js					\
 	button/ConsoleButton.js				\
diff --git a/www/manager6/Schema.js b/www/manager6/Schema.js
new file mode 100644
index 00000000..5649241a
--- /dev/null
+++ b/www/manager6/Schema.js
@@ -0,0 +1,4 @@
+Ext.define('PVE.Schema', { // a singleton
+    singleton: true,
+
+});
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH manager v3 2/5] ui: move Utils.storageSchema to Schema.storageTypes
  2021-07-16 14:21 [pve-devel] [PATCH manager v3 1/5] ui: add Schema.js Dominik Csapak
@ 2021-07-16 14:21 ` Dominik Csapak
  2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 3/5] ui: move sdn schemas to Schema Dominik Csapak
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2021-07-16 14:21 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/Schema.js         |  99 ++++++++++++++++++++++++++++++++
 www/manager6/Utils.js          | 102 +--------------------------------
 www/manager6/dc/StorageView.js |   4 +-
 3 files changed, 102 insertions(+), 103 deletions(-)

diff --git a/www/manager6/Schema.js b/www/manager6/Schema.js
index 5649241a..73d98889 100644
--- a/www/manager6/Schema.js
+++ b/www/manager6/Schema.js
@@ -1,4 +1,103 @@
 Ext.define('PVE.Schema', { // a singleton
     singleton: true,
 
+    storageTypes: {
+	dir: {
+	    name: Proxmox.Utils.directoryText,
+	    ipanel: 'DirInputPanel',
+	    faIcon: 'folder',
+	    backups: true,
+	},
+	lvm: {
+	    name: 'LVM',
+	    ipanel: 'LVMInputPanel',
+	    faIcon: 'folder',
+	    backups: false,
+	},
+	lvmthin: {
+	    name: 'LVM-Thin',
+	    ipanel: 'LvmThinInputPanel',
+	    faIcon: 'folder',
+	    backups: false,
+	},
+	btrfs: {
+	    name: 'BTRFS',
+	    ipanel: 'BTRFSInputPanel',
+	    faIcon: 'folder',
+	    backups: true,
+	},
+	nfs: {
+	    name: 'NFS',
+	    ipanel: 'NFSInputPanel',
+	    faIcon: 'building',
+	    backups: true,
+	},
+	cifs: {
+	    name: 'CIFS',
+	    ipanel: 'CIFSInputPanel',
+	    faIcon: 'building',
+	    backups: true,
+	},
+	glusterfs: {
+	    name: 'GlusterFS',
+	    ipanel: 'GlusterFsInputPanel',
+	    faIcon: 'building',
+	    backups: true,
+	},
+	iscsi: {
+	    name: 'iSCSI',
+	    ipanel: 'IScsiInputPanel',
+	    faIcon: 'building',
+	    backups: false,
+	},
+	cephfs: {
+	    name: 'CephFS',
+	    ipanel: 'CephFSInputPanel',
+	    faIcon: 'building',
+	    backups: true,
+	},
+	pvecephfs: {
+	    name: 'CephFS (PVE)',
+	    ipanel: 'CephFSInputPanel',
+	    hideAdd: true,
+	    faIcon: 'building',
+	    backups: true,
+	},
+	rbd: {
+	    name: 'RBD',
+	    ipanel: 'RBDInputPanel',
+	    faIcon: 'building',
+	    backups: false,
+	},
+	pveceph: {
+	    name: 'RBD (PVE)',
+	    ipanel: 'RBDInputPanel',
+	    hideAdd: true,
+	    faIcon: 'building',
+	    backups: false,
+	},
+	zfs: {
+	    name: 'ZFS over iSCSI',
+	    ipanel: 'ZFSInputPanel',
+	    faIcon: 'building',
+	    backups: false,
+	},
+	zfspool: {
+	    name: 'ZFS',
+	    ipanel: 'ZFSPoolInputPanel',
+	    faIcon: 'folder',
+	    backups: false,
+	},
+	pbs: {
+	    name: 'Proxmox Backup Server',
+	    ipanel: 'PBSInputPanel',
+	    faIcon: 'floppy-o',
+	    backups: true,
+	},
+	drbd: {
+	    name: 'DRBD',
+	    hideAdd: true,
+	    backups: false,
+	},
+    },
 });
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index a22eaaa7..e8c9f218 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -760,106 +760,6 @@ Ext.define('PVE.Utils', {
 	},
     },
 
-    storageSchema: {
-	dir: {
-	    name: Proxmox.Utils.directoryText,
-	    ipanel: 'DirInputPanel',
-	    faIcon: 'folder',
-	    backups: true,
-	},
-	lvm: {
-	    name: 'LVM',
-	    ipanel: 'LVMInputPanel',
-	    faIcon: 'folder',
-	    backups: false,
-	},
-	lvmthin: {
-	    name: 'LVM-Thin',
-	    ipanel: 'LvmThinInputPanel',
-	    faIcon: 'folder',
-	    backups: false,
-	},
-	btrfs: {
-	    name: 'BTRFS',
-	    ipanel: 'BTRFSInputPanel',
-	    faIcon: 'folder',
-	    backups: true,
-	},
-	nfs: {
-	    name: 'NFS',
-	    ipanel: 'NFSInputPanel',
-	    faIcon: 'building',
-	    backups: true,
-	},
-	cifs: {
-	    name: 'CIFS',
-	    ipanel: 'CIFSInputPanel',
-	    faIcon: 'building',
-	    backups: true,
-	},
-	glusterfs: {
-	    name: 'GlusterFS',
-	    ipanel: 'GlusterFsInputPanel',
-	    faIcon: 'building',
-	    backups: true,
-	},
-	iscsi: {
-	    name: 'iSCSI',
-	    ipanel: 'IScsiInputPanel',
-	    faIcon: 'building',
-	    backups: false,
-	},
-	cephfs: {
-	    name: 'CephFS',
-	    ipanel: 'CephFSInputPanel',
-	    faIcon: 'building',
-	    backups: true,
-	},
-	pvecephfs: {
-	    name: 'CephFS (PVE)',
-	    ipanel: 'CephFSInputPanel',
-	    hideAdd: true,
-	    faIcon: 'building',
-	    backups: true,
-	},
-	rbd: {
-	    name: 'RBD',
-	    ipanel: 'RBDInputPanel',
-	    faIcon: 'building',
-	    backups: false,
-	},
-	pveceph: {
-	    name: 'RBD (PVE)',
-	    ipanel: 'RBDInputPanel',
-	    hideAdd: true,
-	    faIcon: 'building',
-	    backups: false,
-	},
-	zfs: {
-	    name: 'ZFS over iSCSI',
-	    ipanel: 'ZFSInputPanel',
-	    faIcon: 'building',
-	    backups: false,
-	},
-	zfspool: {
-	    name: 'ZFS',
-	    ipanel: 'ZFSPoolInputPanel',
-	    faIcon: 'folder',
-	    backups: false,
-	},
-	pbs: {
-	    name: 'Proxmox Backup Server',
-	    ipanel: 'PBSInputPanel',
-	    faIcon: 'floppy-o',
-	    backups: true,
-	},
-	drbd: {
-	    name: 'DRBD',
-	    hideAdd: true,
-	    backups: false,
-	},
-    },
-
     sdnvnetSchema: {
 	vnet: {
 	    name: 'vnet',
@@ -998,7 +898,7 @@ Ext.define('PVE.Utils', {
 	    value = !record || record.get('monhost') ? 'cephfs' : 'pvecephfs';
 	}
 
-	var schema = PVE.Utils.storageSchema[value];
+	var schema = PVE.Schema.storageTypes[value];
 	if (schema) {
 	    return schema.name;
 	}
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index c6417ee7..4f44ad05 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -9,7 +9,7 @@ Ext.define('PVE.dc.StorageView', {
     stateId: 'grid-dc-storage',
 
     createStorageEditWindow: function(type, sid) {
-	let schema = PVE.Utils.storageSchema[type];
+	let schema = PVE.Schema.storageTypes[type];
 	if (!schema || !schema.ipanel) {
 	    throw "no editor registered for storage type: " + type;
 	}
@@ -69,7 +69,7 @@ Ext.define('PVE.dc.StorageView', {
 	    return function() { me.createStorageEditWindow(type); };
 	};
 	let addMenuItems = [];
-	for (const [type, storage] of Object.entries(PVE.Utils.storageSchema)) {
+	for (const [type, storage] of Object.entries(PVE.Schema.storageTypes)) {
 	    if (storage.hideAdd) {
 		continue;
 	    }
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH manager v3 3/5] ui: move sdn schemas to Schema
  2021-07-16 14:21 [pve-devel] [PATCH manager v3 1/5] ui: add Schema.js Dominik Csapak
  2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 2/5] ui: move Utils.storageSchema to Schema.storageTypes Dominik Csapak
@ 2021-07-16 14:21 ` Dominik Csapak
  2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 4/5] ui: use AuthView and authSchema from widget-toolkit Dominik Csapak
  2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 5/5] ui: remove PVE.dc.AuthEditBase window Dominik Csapak
  3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2021-07-16 14:21 UTC (permalink / raw)
  To: pve-devel

but dropped the 'Schema' postfix

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/Schema.js             |  91 ++++++++++++++++++++++++++
 www/manager6/Utils.js              | 101 ++---------------------------
 www/manager6/sdn/ControllerView.js |   4 +-
 www/manager6/sdn/DnsView.js        |   4 +-
 www/manager6/sdn/IpamView.js       |   4 +-
 www/manager6/sdn/ZoneView.js       |   4 +-
 6 files changed, 104 insertions(+), 104 deletions(-)

diff --git a/www/manager6/Schema.js b/www/manager6/Schema.js
index 73d98889..374b5f17 100644
--- a/www/manager6/Schema.js
+++ b/www/manager6/Schema.js
@@ -100,4 +100,95 @@ Ext.define('PVE.Schema', { // a singleton
 	    backups: false,
 	},
     },
+
+    sdnvnet: {
+	vnet: {
+	    name: 'vnet',
+	    faIcon: 'folder',
+	},
+    },
+
+    sdnzone: {
+	zone: {
+	     name: 'zone',
+	     hideAdd: true,
+	},
+	simple: {
+	    name: 'Simple',
+	    ipanel: 'SimpleInputPanel',
+	    faIcon: 'th',
+	},
+	vlan: {
+	    name: 'VLAN',
+	    ipanel: 'VlanInputPanel',
+	    faIcon: 'th',
+	},
+	qinq: {
+	    name: 'QinQ',
+	    ipanel: 'QinQInputPanel',
+	    faIcon: 'th',
+	},
+	vxlan: {
+	    name: 'VXLAN',
+	    ipanel: 'VxlanInputPanel',
+	    faIcon: 'th',
+	},
+	evpn: {
+	    name: 'EVPN',
+	    ipanel: 'EvpnInputPanel',
+	    faIcon: 'th',
+	},
+    },
+
+    sdncontroller: {
+	controller: {
+	     name: 'controller',
+	     hideAdd: true,
+	},
+	evpn: {
+	    name: 'evpn',
+	    ipanel: 'EvpnInputPanel',
+	    faIcon: 'crosshairs',
+	},
+	bgp: {
+	    name: 'bgp',
+	    ipanel: 'BgpInputPanel',
+	    faIcon: 'crosshairs',
+	},
+    },
+
+    sdnipam: {
+	ipam: {
+	     name: 'ipam',
+	     hideAdd: true,
+	},
+	pve: {
+	    name: 'PVE',
+	    ipanel: 'PVEIpamInputPanel',
+	    faIcon: 'th',
+	    hideAdd: true,
+	},
+	netbox: {
+	    name: 'Netbox',
+	    ipanel: 'NetboxInputPanel',
+	    faIcon: 'th',
+	},
+	phpipam: {
+	    name: 'PhpIpam',
+	    ipanel: 'PhpIpamInputPanel',
+	    faIcon: 'th',
+	},
+    },
+
+    sdndns: {
+	dns: {
+	     name: 'dns',
+	     hideAdd: true,
+	},
+	powerdns: {
+	    name: 'powerdns',
+	    ipanel: 'PowerdnsInputPanel',
+	    faIcon: 'th',
+	},
+    },
 });
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index e8c9f218..8d210b69 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -760,99 +760,8 @@ Ext.define('PVE.Utils', {
 	},
     },
 
-    sdnvnetSchema: {
-	vnet: {
-	    name: 'vnet',
-	    faIcon: 'folder',
-	},
-    },
-
-    sdnzoneSchema: {
-	zone: {
-	     name: 'zone',
-	     hideAdd: true,
-	},
-	simple: {
-	    name: 'Simple',
-	    ipanel: 'SimpleInputPanel',
-	    faIcon: 'th',
-	},
-	vlan: {
-	    name: 'VLAN',
-	    ipanel: 'VlanInputPanel',
-	    faIcon: 'th',
-	},
-	qinq: {
-	    name: 'QinQ',
-	    ipanel: 'QinQInputPanel',
-	    faIcon: 'th',
-	},
-	vxlan: {
-	    name: 'VXLAN',
-	    ipanel: 'VxlanInputPanel',
-	    faIcon: 'th',
-	},
-	evpn: {
-	    name: 'EVPN',
-	    ipanel: 'EvpnInputPanel',
-	    faIcon: 'th',
-	},
-    },
-
-    sdncontrollerSchema: {
-	controller: {
-	     name: 'controller',
-	     hideAdd: true,
-	},
-	evpn: {
-	    name: 'evpn',
-	    ipanel: 'EvpnInputPanel',
-	    faIcon: 'crosshairs',
-	},
-	bgp: {
-	    name: 'bgp',
-	    ipanel: 'BgpInputPanel',
-	    faIcon: 'crosshairs',
-	},
-    },
-
-    sdnipamSchema: {
-	ipam: {
-	     name: 'ipam',
-	     hideAdd: true,
-	},
-	pve: {
-	    name: 'PVE',
-	    ipanel: 'PVEIpamInputPanel',
-	    faIcon: 'th',
-	    hideAdd: true,
-	},
-	netbox: {
-	    name: 'Netbox',
-	    ipanel: 'NetboxInputPanel',
-	    faIcon: 'th',
-	},
-	phpipam: {
-	    name: 'PhpIpam',
-	    ipanel: 'PhpIpamInputPanel',
-	    faIcon: 'th',
-	},
-    },
-
-    sdndnsSchema: {
-	dns: {
-	     name: 'dns',
-	     hideAdd: true,
-	},
-	powerdns: {
-	    name: 'powerdns',
-	    ipanel: 'PowerdnsInputPanel',
-	    faIcon: 'th',
-	},
-    },
-
     format_sdnvnet_type: function(value, md, record) {
-	var schema = PVE.Utils.sdnvnetSchema[value];
+	var schema = PVE.Schema.sdnvnet[value];
 	if (schema) {
 	    return schema.name;
 	}
@@ -860,7 +769,7 @@ Ext.define('PVE.Utils', {
     },
 
     format_sdnzone_type: function(value, md, record) {
-	var schema = PVE.Utils.sdnzoneSchema[value];
+	var schema = PVE.Schema.sdnzone[value];
 	if (schema) {
 	    return schema.name;
 	}
@@ -868,7 +777,7 @@ Ext.define('PVE.Utils', {
     },
 
     format_sdncontroller_type: function(value, md, record) {
-	var schema = PVE.Utils.sdncontrollerSchema[value];
+	var schema = PVE.Schema.sdncontroller[value];
 	if (schema) {
 	    return schema.name;
 	}
@@ -876,7 +785,7 @@ Ext.define('PVE.Utils', {
     },
 
     format_sdnipam_type: function(value, md, record) {
-	var schema = PVE.Utils.sdnipamSchema[value];
+	var schema = PVE.Schema.sdnipam[value];
 	if (schema) {
 	    return schema.name;
 	}
@@ -884,7 +793,7 @@ Ext.define('PVE.Utils', {
     },
 
     format_sdndns_type: function(value, md, record) {
-	var schema = PVE.Utils.sdndnsSchema[value];
+	var schema = PVE.Schema.sdndns[value];
 	if (schema) {
 	    return schema.name;
 	}
diff --git a/www/manager6/sdn/ControllerView.js b/www/manager6/sdn/ControllerView.js
index 8d92a715..e548de23 100644
--- a/www/manager6/sdn/ControllerView.js
+++ b/www/manager6/sdn/ControllerView.js
@@ -8,7 +8,7 @@ Ext.define('PVE.sdn.ControllerView', {
     stateId: 'grid-sdn-controller',
 
     createSDNControllerEditWindow: function(type, sid) {
-	var schema = PVE.Utils.sdncontrollerSchema[type];
+	var schema = PVE.Schema.sdncontroller[type];
 	if (!schema || !schema.ipanel) {
 	    throw "no editor registered for controller type: " + type;
 	}
@@ -68,7 +68,7 @@ Ext.define('PVE.sdn.ControllerView', {
 	    return function() { me.createSDNControllerEditWindow(type); };
 	};
 	let addMenuItems = [];
-	for (const [type, controller] of Object.entries(PVE.Utils.sdncontrollerSchema)) {
+	for (const [type, controller] of Object.entries(PVE.Schema.sdncontroller)) {
 	    if (controller.hideAdd) {
 		continue;
 	    }
diff --git a/www/manager6/sdn/DnsView.js b/www/manager6/sdn/DnsView.js
index d1654cab..ed42cbfe 100644
--- a/www/manager6/sdn/DnsView.js
+++ b/www/manager6/sdn/DnsView.js
@@ -6,7 +6,7 @@ Ext.define('PVE.sdn.DnsView', {
     stateId: 'grid-sdn-dns',
 
     createSDNEditWindow: function(type, sid) {
-	let schema = PVE.Utils.sdndnsSchema[type];
+	let schema = PVE.Schema.sdndns[type];
 	if (!schema || !schema.ipanel) {
 	    throw "no editor registered for dns type: " + type;
 	}
@@ -68,7 +68,7 @@ Ext.define('PVE.sdn.DnsView', {
 	    return function() { me.createSDNEditWindow(type); };
 	};
 	let addMenuItems = [];
-	for (const [type, dns] of Object.entries(PVE.Utils.sdndnsSchema)) {
+	for (const [type, dns] of Object.entries(PVE.Schema.sdndns)) {
 	    if (dns.hideAdd) {
 		continue;
 	    }
diff --git a/www/manager6/sdn/IpamView.js b/www/manager6/sdn/IpamView.js
index 0d00d8e6..cc526a9f 100644
--- a/www/manager6/sdn/IpamView.js
+++ b/www/manager6/sdn/IpamView.js
@@ -6,7 +6,7 @@ Ext.define('PVE.sdn.IpamView', {
     stateId: 'grid-sdn-ipam',
 
     createSDNEditWindow: function(type, sid) {
-	let schema = PVE.Utils.sdnipamSchema[type];
+	let schema = PVE.Schema.sdnipam[type];
 	if (!schema || !schema.ipanel) {
 	    throw "no editor registered for ipam type: " + type;
 	}
@@ -66,7 +66,7 @@ Ext.define('PVE.sdn.IpamView', {
 	    return function() { me.createSDNEditWindow(type); };
 	};
 	let addMenuItems = [];
-	for (const [type, ipam] of Object.entries(PVE.Utils.sdnipamSchema)) {
+	for (const [type, ipam] of Object.entries(PVE.Schema.sdnipam)) {
 	    if (ipam.hideAdd) {
 		continue;
 	    }
diff --git a/www/manager6/sdn/ZoneView.js b/www/manager6/sdn/ZoneView.js
index ac812d4a..b700909a 100644
--- a/www/manager6/sdn/ZoneView.js
+++ b/www/manager6/sdn/ZoneView.js
@@ -8,7 +8,7 @@ Ext.define('PVE.sdn.ZoneView', {
     stateId: 'grid-sdn-zone',
 
     createSDNEditWindow: function(type, sid) {
-	let schema = PVE.Utils.sdnzoneSchema[type];
+	let schema = PVE.Schema.sdnzone[type];
 	if (!schema || !schema.ipanel) {
 	    throw "no editor registered for zone type: " + type;
 	}
@@ -83,7 +83,7 @@ Ext.define('PVE.sdn.ZoneView', {
 	    return function() { me.createSDNEditWindow(type); };
 	};
 	let addMenuItems = [];
-	for (const [type, zone] of Object.entries(PVE.Utils.sdnzoneSchema)) {
+	for (const [type, zone] of Object.entries(PVE.Schema.sdnzone)) {
 	    if (zone.hideAdd) {
 		continue;
 	    }
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH manager v3 4/5] ui: use AuthView and authSchema from widget-toolkit
  2021-07-16 14:21 [pve-devel] [PATCH manager v3 1/5] ui: add Schema.js Dominik Csapak
  2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 2/5] ui: move Utils.storageSchema to Schema.storageTypes Dominik Csapak
  2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 3/5] ui: move sdn schemas to Schema Dominik Csapak
@ 2021-07-16 14:21 ` Dominik Csapak
  2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 5/5] ui: remove PVE.dc.AuthEditBase window Dominik Csapak
  3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2021-07-16 14:21 UTC (permalink / raw)
  To: pve-devel

* moves the authSchema to the overrideAuthSchema call so that it can
  be found in Proxmox.Utils.authSchema instead.
* changes the dc/AuthView to be a subclass of Proxmox.panel.AuthView
  with the necesary changes (onlinehelp, columns, etc.)
* changes all calls from PVE.Utils.authSchema to Proxmox.Utils.authSchema

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/Schema.js          |  49 +++++++++++++
 www/manager6/Utils.js           |  40 ----------
 www/manager6/Workspace.js       |   2 +-
 www/manager6/dc/AuthEditBase.js |   2 +-
 www/manager6/dc/AuthView.js     | 126 ++++++--------------------------
 www/manager6/dc/UserView.js     |   8 +-
 6 files changed, 76 insertions(+), 151 deletions(-)

diff --git a/www/manager6/Schema.js b/www/manager6/Schema.js
index 374b5f17..446f33e4 100644
--- a/www/manager6/Schema.js
+++ b/www/manager6/Schema.js
@@ -191,4 +191,53 @@ Ext.define('PVE.Schema', { // a singleton
 	    faIcon: 'th',
 	},
     },
+
+    constructor: function() {
+	var me = this;
+
+	Proxmox.Schema.overrideAuthDomains({
+	    ad: {
+		name: gettext('Active Directory Server'),
+		ipanel: 'pveAuthADPanel',
+		syncipanel: 'pveAuthLDAPSyncPanel',
+		add: true,
+		edit: true,
+		tfa: true,
+		pwchange: true,
+	    },
+	    ldap: {
+		name: gettext('LDAP Server'),
+		ipanel: 'pveAuthLDAPPanel',
+		syncipanel: 'pveAuthLDAPSyncPanel',
+		add: true,
+		edit: true,
+		tfa: true,
+		pwchange: true,
+	    },
+	    openid: {
+		name: gettext('OpenID Connect Server'),
+		ipanel: 'pveAuthOpenIDPanel',
+		add: true,
+		edit: true,
+		tfa: false,
+		pwchange: false,
+		iconCls: 'pmx-itype-icon-openid-logo',
+	    },
+	    pam: {
+		name: 'Linux PAM',
+		ipanel: 'pveAuthBasePanel',
+		add: false,
+		edit: true,
+		tfa: true,
+		pwchange: true,
+	    },
+	    pve: {
+		name: 'Proxmox VE authentication server',
+		ipanel: 'pveAuthBasePanel',
+		add: false,
+		edit: true,
+		pwchange: true,
+	    },
+	});
+    },
 });
diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 8d210b69..03494d94 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -720,46 +720,6 @@ Ext.define('PVE.Utils', {
 	return format === 'pbs-ct' || volid.match(':backup/vzdump-(lxc|openvz)-');
     },
 
-    authSchema: {
-	ad: {
-	    name: gettext('Active Directory Server'),
-	    ipanel: 'pveAuthADPanel',
-	    syncipanel: 'pveAuthLDAPSyncPanel',
-	    add: true,
-	    tfa: true,
-	    pwchange: true,
-	},
-	ldap: {
-	    name: gettext('LDAP Server'),
-	    ipanel: 'pveAuthLDAPPanel',
-	    syncipanel: 'pveAuthLDAPSyncPanel',
-	    add: true,
-	    tfa: true,
-	    pwchange: true,
-	},
-	openid: {
-	    name: gettext('OpenID Connect Server'),
-	    ipanel: 'pveAuthOpenIDPanel',
-	    add: true,
-	    tfa: false,
-	    pwchange: false,
-	    iconCls: 'pmx-itype-icon-openid-logo',
-	},
-	pam: {
-	    name: 'Linux PAM',
-	    ipanel: 'pveAuthBasePanel',
-	    add: false,
-	    tfa: true,
-	    pwchange: true,
-	},
-	pve: {
-	    name: 'Proxmox VE authentication server',
-	    ipanel: 'pveAuthBasePanel',
-	    add: false,
-	    pwchange: true,
-	},
-    },
-
     format_sdnvnet_type: function(value, md, record) {
 	var schema = PVE.Schema.sdnvnet[value];
 	if (schema) {
diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 0e2a750b..bb873d67 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -180,7 +180,7 @@ Ext.define('PVE.StdWorkspace', {
 		    let [_username, realm] = Proxmox.Utils.parse_userid(Proxmox.UserName);
 		    response.result.data.forEach((domain) => {
 			if (domain.realm === realm) {
-			    let schema = PVE.Utils.authSchema[domain.type];
+			    let schema = Proxmox.Schema.authDomains[domain.type];
 			    if (schema) {
 				me.query('#tfaitem')[0].setHidden(!schema.tfa);
 				me.query('#passworditem')[0].setHidden(!schema.pwchange);
diff --git a/www/manager6/dc/AuthEditBase.js b/www/manager6/dc/AuthEditBase.js
index e18fbc3b..996ed6a8 100644
--- a/www/manager6/dc/AuthEditBase.js
+++ b/www/manager6/dc/AuthEditBase.js
@@ -24,7 +24,7 @@ Ext.define('PVE.panel.AuthBase', {
     initComponent: function() {
 	let me = this;
 
-	let options = PVE.Utils.authSchema[me.type];
+	let options = Proxmox.Schema.authDomains[me.type];
 
 	if (!me.column1) { me.column1 = []; }
 	if (!me.column2) { me.column2 = []; }
diff --git a/www/manager6/dc/AuthView.js b/www/manager6/dc/AuthView.js
index 48a51015..521e16a2 100644
--- a/www/manager6/dc/AuthView.js
+++ b/www/manager6/dc/AuthView.js
@@ -1,17 +1,9 @@
 Ext.define('PVE.dc.AuthView', {
-    extend: 'Ext.grid.GridPanel',
-
-    alias: ['widget.pveAuthView'],
+    extend: 'Proxmox.panel.AuthView',
+    alias: 'widget.pveAuthView',
 
     onlineHelp: 'pveum_authentication_realms',
 
-    stateful: true,
-    stateId: 'grid-authrealms',
-
-    viewConfig: {
-	trackOver: false,
-    },
-
     columns: [
 	{
 	    header: gettext('Realm'),
@@ -40,101 +32,25 @@ Ext.define('PVE.dc.AuthView', {
 	},
     ],
 
-    store: {
-	model: 'pmx-domains',
-	sorters: {
-	    property: 'realm',
-	    order: 'DESC',
-	},
-    },
-
-    openEditWindow: function(authType, realm) {
-	let me = this;
-	Ext.create('PVE.dc.AuthEditBase', {
-	    authType,
-	    realm,
-	    listeners: {
-		destroy: () => me.reload(),
-	    },
-	}).show();
-    },
-
-    reload: function() {
-	let me = this;
-	me.getStore().load();
-    },
-
-    run_editor: function() {
-	let me = this;
-	let rec = me.getSelection()[0];
-	if (!rec) {
-	    return;
-	}
-	me.openEditWindow(rec.data.type, rec.data.realm);
-    },
-
-    open_sync_window: function() {
-	let me = this;
-	let rec = me.getSelection()[0];
-	if (!rec) {
-	    return;
-	}
-	Ext.create('PVE.dc.SyncWindow', {
-	    realm: rec.data.realm,
-	    listeners: {
-		destroy: () => me.reload(),
-	    },
-	}).show();
-    },
-
-    initComponent: function() {
-	var me = this;
-
-	let items = [];
-	for (const [authType, config] of Object.entries(PVE.Utils.authSchema)) {
-	    if (!config.add) { continue; }
-	    items.push({
-		text: config.name,
-		iconCls: 'fa fa-fw ' + (config.iconCls || 'fa-address-book-o'),
-		handler: () => me.openEditWindow(authType),
-	    });
-	}
-
-	Ext.apply(me, {
-	    tbar: [
-		{
-		    text: gettext('Add'),
-		    menu: {
-			items: items,
+    extraButtons: [
+	{
+	    xtype: 'proxmoxButton',
+	    text: gettext('Sync'),
+	    disabled: true,
+	    enableFn: (rec) => Boolean(Proxmox.Schema.authDomains[rec.data.type].syncipanel),
+	    handler: function() {
+		let panel = this.up('pveAuthView');
+		let rec = panel.getSelection()[0];
+		if (!rec) {
+		    return;
+		}
+		Ext.create('PVE.dc.SyncWindow', {
+		    realm: rec.data.realm,
+		    listeners: {
+			destroy: () => panel.reload(),
 		    },
-		},
-		{
-		    xtype: 'proxmoxButton',
-		    text: gettext('Edit'),
-		    disabled: true,
-		    handler: () => me.run_editor(),
-		},
-		{
-		    xtype: 'proxmoxStdRemoveButton',
-		    baseurl: '/access/domains/',
-		    enableFn: (rec) => PVE.Utils.authSchema[rec.data.type].add,
-		    callback: () => me.reload(),
-		},
-		'-',
-		{
-		    xtype: 'proxmoxButton',
-		    text: gettext('Sync'),
-		    disabled: true,
-		    enableFn: (rec) => Boolean(PVE.Utils.authSchema[rec.data.type].syncipanel),
-		    handler: () => me.open_sync_window(),
-		},
-	    ],
-	    listeners: {
-		activate: () => me.reload(),
-		itemdblclick: () => me.run_editor(),
+		}).show();
 	    },
-	});
-
-	me.callParent();
-    },
+	},
+    ],
 });
diff --git a/www/manager6/dc/UserView.js b/www/manager6/dc/UserView.js
index ef394bdb..ed1ee8f4 100644
--- a/www/manager6/dc/UserView.js
+++ b/www/manager6/dc/UserView.js
@@ -61,8 +61,8 @@ Ext.define('PVE.dc.UserView', {
 	    enableFn: function(record) {
 		let type = record.data['realm-type'];
 		if (type) {
-		    if (PVE.Utils.authSchema[type]) {
-			return !!PVE.Utils.authSchema[type].pwchange;
+		    if (Proxmox.Schema.authDomains[type]) {
+			return !!Proxmox.Schema.authDomains[type].pwchange;
 		    }
 		}
 		return false;
@@ -84,8 +84,8 @@ Ext.define('PVE.dc.UserView', {
 	    enableFn: function(record) {
 		let type = record.data['realm-type'];
 		if (type) {
-		    if (PVE.Utils.authSchema[type]) {
-			return !!PVE.Utils.authSchema[type].tfa;
+		    if (Proxmox.Schema.authDomains[type]) {
+			return !!Proxmox.Schema.authDomains[type].tfa;
 		    }
 		}
 		return false;
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH manager v3 5/5] ui: remove PVE.dc.AuthEditBase window
  2021-07-16 14:21 [pve-devel] [PATCH manager v3 1/5] ui: add Schema.js Dominik Csapak
                   ` (2 preceding siblings ...)
  2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 4/5] ui: use AuthView and authSchema from widget-toolkit Dominik Csapak
@ 2021-07-16 14:21 ` Dominik Csapak
  3 siblings, 0 replies; 5+ messages in thread
From: Dominik Csapak @ 2021-07-16 14:21 UTC (permalink / raw)
  To: pve-devel

this is not needed anymore since we now use Proxmox.window.AuthEditBase

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/dc/AuthEditBase.js | 91 ---------------------------------
 1 file changed, 91 deletions(-)

diff --git a/www/manager6/dc/AuthEditBase.js b/www/manager6/dc/AuthEditBase.js
index 996ed6a8..3c66b4bf 100644
--- a/www/manager6/dc/AuthEditBase.js
+++ b/www/manager6/dc/AuthEditBase.js
@@ -64,94 +64,3 @@ Ext.define('PVE.panel.AuthBase', {
 	me.callParent();
     },
 });
-
-Ext.define('PVE.dc.AuthEditBase', {
-    extend: 'Proxmox.window.Edit',
-
-    onlineHelp: 'pveum_authentication_realms',
-
-    isAdd: true,
-
-    fieldDefaults: {
-	labelWidth: 120,
-    },
-
-    initComponent: function() {
-	var me = this;
-
-	me.isCreate = !me.realm;
-
-	if (me.isCreate) {
-	    me.url = '/api2/extjs/access/domains';
-	    me.method = 'POST';
-	} else {
-	    me.url = '/api2/extjs/access/domains/' + me.realm;
-	    me.method = 'PUT';
-	}
-
-	let authConfig = PVE.Utils.authSchema[me.authType];
-	if (!authConfig) {
-	    throw 'unknown auth type';
-	} else if (!authConfig.add && me.isCreate) {
-	    throw 'trying to add non addable realm';
-	}
-
-	me.subject = authConfig.name;
-
-	let items;
-	let bodyPadding;
-	if (authConfig.syncipanel) {
-	    bodyPadding = 0;
-	    items = {
-		xtype: 'tabpanel',
-		region: 'center',
-		layout: 'fit',
-		bodyPadding: 10,
-		items: [
-		    {
-			title: gettext('General'),
-			realm: me.realm,
-			xtype: authConfig.ipanel,
-			isCreate: me.isCreate,
-			type: me.authType,
-		    },
-		    {
-			title: gettext('Sync Options'),
-			realm: me.realm,
-			xtype: authConfig.syncipanel,
-			isCreate: me.isCreate,
-			type: me.authType,
-		    },
-		],
-	    };
-	} else {
-	    items = [{
-		realm: me.realm,
-		xtype: authConfig.ipanel,
-		isCreate: me.isCreate,
-		type: me.authType,
-	    }];
-	}
-
-	Ext.apply(me, {
-	    items,
-	    bodyPadding,
-	});
-
-	me.callParent();
-
-	if (!me.isCreate) {
-	    me.load({
-		success: function(response, options) {
-		    var data = response.result.data || {};
-		    // just to be sure (should not happen)
-		    if (data.type !== me.authType) {
-			me.close();
-			throw "got wrong auth type";
-		    }
-		    me.setValues(data);
-		},
-	    });
-	}
-    },
-});
-- 
2.30.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-16 14:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 14:21 [pve-devel] [PATCH manager v3 1/5] ui: add Schema.js Dominik Csapak
2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 2/5] ui: move Utils.storageSchema to Schema.storageTypes Dominik Csapak
2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 3/5] ui: move sdn schemas to Schema Dominik Csapak
2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 4/5] ui: use AuthView and authSchema from widget-toolkit Dominik Csapak
2021-07-16 14:21 ` [pve-devel] [PATCH manager v3 5/5] ui: remove PVE.dc.AuthEditBase window Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal