From d4826258482c1bfc8b58306a1e74993c78ff9f15 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 13 May 2024 23:41:19 +0200 Subject: [PATCH] Add missing jsdoc comments --- assets/js/components/ldap_import_modal.js | 28 +++++++++++++++++++++++ assets/js/pages/ldap_settings.js | 10 ++++++++ 2 files changed, 38 insertions(+) diff --git a/assets/js/components/ldap_import_modal.js b/assets/js/components/ldap_import_modal.js index d06c6a5c..ceaa2416 100644 --- a/assets/js/components/ldap_import_modal.js +++ b/assets/js/components/ldap_import_modal.js @@ -35,6 +35,11 @@ App.Components.LdapImportModal = (function () { let deferred; + /** + * Validate the import modal form. + * + * @return {Boolean} + */ function validate() { $modal.find('.is-invalid').removeClass('is-invalid'); @@ -51,6 +56,13 @@ App.Components.LdapImportModal = (function () { return !missingRequiredField; } + /** + * Get the right HTTP client for the create-user request. + * + * @param {String} roleSlug + * + * @return {Object} + */ function getHttpClient(roleSlug) { switch (roleSlug) { case App.Layouts.Backend.DB_SLUG_CUSTOMER: @@ -66,6 +78,13 @@ App.Components.LdapImportModal = (function () { } } + /** + * Get the user data object, based on the form values the user provided. + * + * @param {String} roleSlug + * + * @return {Object} + */ function getUser(roleSlug) { const user = { first_name: $firstName.val(), @@ -102,6 +121,9 @@ App.Components.LdapImportModal = (function () { $password.val(''); } + /** + * Save the current user data. + */ function onSaveClick() { if (!validate()) { return; @@ -120,6 +142,9 @@ App.Components.LdapImportModal = (function () { }); } + /** + * Reset the modal every time it's hidden. + */ function onModalHidden() { resetModal(); @@ -128,6 +153,9 @@ App.Components.LdapImportModal = (function () { } } + /** + * Reset the modal fields and state. + */ function resetModal() { $modal.find('input, select, textarea').val(''); $modal.find(':checkbox').prop('checked', false); diff --git a/assets/js/pages/ldap_settings.js b/assets/js/pages/ldap_settings.js index 1a63e875..f3a8db90 100644 --- a/assets/js/pages/ldap_settings.js +++ b/assets/js/pages/ldap_settings.js @@ -57,6 +57,11 @@ App.Pages.LdapSettings = (function () { } } + /** + * Apply the setting values to the UI form. + * + * @param {Array} ldapSettings + */ function deserialize(ldapSettings) { ldapSettings.forEach((ldapSetting) => { const $field = $('[data-field="' + ldapSetting.name + '"]'); @@ -67,6 +72,11 @@ App.Pages.LdapSettings = (function () { }); } + /** + * Prepare an array of setting values based on the UI form. + * + * @return {Array} + */ function serialize() { const ldapSettings = [];