Add missing jsdoc comments

This commit is contained in:
Alex Tselegidis 2024-05-13 23:41:19 +02:00
parent 5967864e4a
commit d482625848
2 changed files with 38 additions and 0 deletions

View file

@ -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);

View file

@ -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 = [];