]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/dc/SyncWindow.js
ui: ldap: add 'Check connection' checkbox as advanced option
[pve-manager.git] / www / manager6 / dc / SyncWindow.js
index 351a3f0fed94377c0692da5732f172b04a5863df..0ac109196716bd1f4c529940f16a2f7d0a7f665a 100644 (file)
@@ -21,6 +21,7 @@ Ext.define('PVE.dc.SyncWindow', {
            },
            'button': {
                click: function(btn) {
+                   if (btn.reference === 'help_btn') return;
                    this.sync_realm(btn.reference === 'preview_btn');
                },
            },
@@ -31,6 +32,20 @@ Ext.define('PVE.dc.SyncWindow', {
            let view = me.getView();
            let ipanel = me.lookup('ipanel');
            let params = ipanel.getValues();
+
+           let vanished_opts = [];
+           ['acl', 'entry', 'properties'].forEach((prop) => {
+               if (params[`remove-vanished-${prop}`]) {
+                   vanished_opts.push(prop);
+               }
+               delete params[`remove-vanished-${prop}`];
+           });
+           if (vanished_opts.length > 0) {
+               params['remove-vanished'] = vanished_opts.join(';');
+           } else {
+               params['remove-vanished'] = 'none';
+           }
+
            params['dry-run'] = is_preview ? 1 : 0;
            Proxmox.Utils.API2Request({
                url: `/access/domains/${view.realm}/sync`,
@@ -78,6 +93,7 @@ Ext.define('PVE.dc.SyncWindow', {
                        name: 'scope',
                        fieldLabel: gettext('Scope'),
                        value: '',
+                       emptyText: gettext('No default available'),
                        deleteEmpty: false,
                        allowBlank: false,
                        comboItems: [
@@ -86,18 +102,6 @@ Ext.define('PVE.dc.SyncWindow', {
                            ['both', gettext('Users and Groups')],
                        ],
                    },
-                   {
-                       xtype: 'proxmoxKVComboBox',
-                       value: '',
-                       deleteEmpty: false,
-                       allowBlank: false,
-                       comboItems: [
-                           ['1', Proxmox.Utils.yesText],
-                           ['0', Proxmox.Utils.noText],
-                       ],
-                       name: 'full',
-                       fieldLabel: gettext('Full'),
-                   },
                ],
 
                column2: [
@@ -113,27 +117,39 @@ Ext.define('PVE.dc.SyncWindow', {
                        name: 'enable-new',
                        fieldLabel: gettext('Enable new'),
                    },
-                   {
-                       xtype: 'proxmoxKVComboBox',
-                       value: '',
-                       deleteEmpty: false,
-                       allowBlank: false,
-                       comboItems: [
-                           ['1', Proxmox.Utils.yesText],
-                           ['0', Proxmox.Utils.noText],
-                       ],
-                       name: 'purge',
-                       fieldLabel: gettext('Purge'),
-                   },
                ],
 
                columnB: [
+                   {
+                       xtype: 'fieldset',
+                       title: gettext('Remove Vanished Options'),
+                       items: [
+                           {
+                               xtype: 'proxmoxcheckbox',
+                               fieldLabel: gettext('ACL'),
+                               name: 'remove-vanished-acl',
+                               boxLabel: gettext('Remove ACLs of vanished users and groups.'),
+                           },
+                           {
+                               xtype: 'proxmoxcheckbox',
+                               fieldLabel: gettext('Entry'),
+                               name: 'remove-vanished-entry',
+                               boxLabel: gettext('Remove vanished user and group entries.'),
+                           },
+                           {
+                               xtype: 'proxmoxcheckbox',
+                               fieldLabel: gettext('Properties'),
+                               name: 'remove-vanished-properties',
+                               boxLabel: gettext('Remove vanished properties from synced users.'),
+                           },
+                       ],
+                   },
                    {
                        xtype: 'displayfield',
                        reference: 'defaulthint',
                        value: gettext('Default sync options can be set by editing the realm.'),
                        userCls: 'pmx-hint',
-                       hidden: true
+                       hidden: true,
                    },
                ],
            }],
@@ -141,6 +157,13 @@ Ext.define('PVE.dc.SyncWindow', {
     ],
 
     buttons: [
+       {
+           xtype: 'proxmoxHelpButton',
+           reference: 'help_btn',
+           onlineHelp: 'pveum_ldap_sync',
+           hidden: false,
+       },
+       '->',
        {
            text: gettext('Preview'),
            reference: 'preview_btn',
@@ -172,6 +195,12 @@ Ext.define('PVE.dc.SyncWindow', {
                let default_options = response.result.data['sync-defaults-options'];
                if (default_options) {
                    let options = PVE.Parser.parsePropertyString(default_options);
+                   if (options['remove-vanished']) {
+                       let opts = options['remove-vanished'].split(';');
+                       for (const opt of opts) {
+                           options[`remove-vanished-${opt}`] = 1;
+                       }
+                   }
                    let ipanel = me.lookup('ipanel');
                    ipanel.setValues(options);
                } else {