From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 3274179AA7
 for <pve-devel@lists.proxmox.com>; Wed, 27 Oct 2021 14:57:10 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 3080C134F0
 for <pve-devel@lists.proxmox.com>; Wed, 27 Oct 2021 14:57:10 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 30C49134DE
 for <pve-devel@lists.proxmox.com>; Wed, 27 Oct 2021 14:57:09 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 006EF45FD8
 for <pve-devel@lists.proxmox.com>; Wed, 27 Oct 2021 14:57:09 +0200 (CEST)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed, 27 Oct 2021 14:57:08 +0200
Message-Id: <20211027125708.1068455-4-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20211027125708.1068455-1-d.csapak@proxmox.com>
References: <20211027125708.1068455-1-d.csapak@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.266 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH manager 1/1] ui: realm sync: add
 'remove-vanished' option
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 27 Oct 2021 12:57:10 -0000

in default sync options and the sync window. There we disable it if
'full' sync is enabled to make it clear the combination does not make
sense.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/dc/AuthEditLDAP.js | 14 +++++++++++++-
 www/manager6/dc/SyncWindow.js   | 19 +++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/www/manager6/dc/AuthEditLDAP.js b/www/manager6/dc/AuthEditLDAP.js
index 015a5a6e..2942ae64 100644
--- a/www/manager6/dc/AuthEditLDAP.js
+++ b/www/manager6/dc/AuthEditLDAP.js
@@ -100,7 +100,7 @@ Ext.define('PVE.panel.LDAPSyncInputPanel', {
     xtype: 'pveAuthLDAPSyncPanel',
 
     editableAttributes: ['email'],
-    editableDefaults: ['scope', 'full', 'enable-new', 'purge'],
+    editableDefaults: ['scope', 'full', 'enable-new', 'purge', 'remove-vanished'],
     default_opts: {},
     sync_attributes: {},
 
@@ -216,6 +216,18 @@ Ext.define('PVE.panel.LDAPSyncInputPanel', {
 	    name: 'full',
 	    fieldLabel: gettext('Full'),
 	},
+	{
+	    xtype: 'proxmoxKVComboBox',
+	    value: '__default__',
+	    deleteEmpty: false,
+	    comboItems: [
+		['__default__', Proxmox.Utils.NoneText],
+		['1', Proxmox.Utils.yesText],
+		['0', Proxmox.Utils.noText],
+	    ],
+	    name: 'remove-vanished',
+	    fieldLabel: gettext('Remove vanished'),
+	},
     ],
 
     column2: [
diff --git a/www/manager6/dc/SyncWindow.js b/www/manager6/dc/SyncWindow.js
index 25a42182..c988a4bf 100644
--- a/www/manager6/dc/SyncWindow.js
+++ b/www/manager6/dc/SyncWindow.js
@@ -12,6 +12,11 @@ Ext.define('PVE.dc.SyncWindow', {
 	xclass: 'Ext.app.ViewController',
 
 	control: {
+	    'field[name=full]': {
+		change: function(field, value) {
+		    this.lookup('remove-vanished').setDisabled(value === '1');
+		},
+	    },
 	    'form': {
 		validitychange: function(field, valid) {
 		    let me = this;
@@ -101,6 +106,20 @@ Ext.define('PVE.dc.SyncWindow', {
 			name: 'full',
 			fieldLabel: gettext('Full'),
 		    },
+		    {
+			xtype: 'proxmoxKVComboBox',
+			value: '',
+			emptyText: gettext('No default available'),
+			deleteEmpty: false,
+			allowBlank: false,
+			comboItems: [
+			    ['1', Proxmox.Utils.yesText],
+			    ['0', Proxmox.Utils.noText],
+			],
+			name: 'remove-vanished',
+			reference: 'remove-vanished',
+			fieldLabel: gettext('Remove vanished'),
+		    },
 		],
 
 		column2: [
-- 
2.30.2