diff --git a/src/main/resources/META-INF/resources/webjars/id/container-scope/container-scope.js b/src/main/resources/META-INF/resources/webjars/id/container-scope/container-scope.js index e5ab91e..c1cfbf4 100644 --- a/src/main/resources/META-INF/resources/webjars/id/container-scope/container-scope.js +++ b/src/main/resources/META-INF/resources/webjars/id/container-scope/container-scope.js @@ -50,7 +50,7 @@ define(function () { const $source = $(event.relatedTarget); const $tr = $source.closest('tr'); let uc = ($tr.length && current.table.fnGetData($tr[0])) || undefined; - uc = uc && uc.id ? uc : {}; + uc = uc?.id ? uc : {}; current.currentId = uc.id; _('modal-title').html(Handlebars.compile(current.$messages['container-scope-title'])(current.$messages[current.containerType])); _('name').val(uc.name || null); @@ -63,7 +63,7 @@ define(function () { // Global datatables filter _('search').on('keyup', function () { - current.table && current.table.fnFilter($(this).val()); + current.table?.fnFilter($(this).val()); }); // Also initialize the datatables component @@ -125,7 +125,7 @@ define(function () { success: function (data) { notifyManager.notify(Handlebars.compile( current.$messages[current.currentId ? 'updated' : 'created'])(current.currentId || data)); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); _('popup').modal('hide'); } }); @@ -142,7 +142,7 @@ define(function () { url: REST_PATH + 'service/id/container-scope/' + id, success: function () { notifyManager.notify(Handlebars.compile(current.$messages.deleted)(text + '(' + id + ')')); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); } }); } else { diff --git a/src/main/resources/META-INF/resources/webjars/id/container/container.js b/src/main/resources/META-INF/resources/webjars/id/container/container.js index 7f5222c..b614dda 100644 --- a/src/main/resources/META-INF/resources/webjars/id/container/container.js +++ b/src/main/resources/META-INF/resources/webjars/id/container/container.js @@ -82,7 +82,7 @@ define(function () { success: function (id) { $('.import-summary').html('Processing...'); current.$parent.scheduleUploadStep('service/id/group/batch', id, function() { - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); }); } }); @@ -218,7 +218,7 @@ define(function () { data: JSON.stringify(data), success: function () { notifyManager.notify(Handlebars.compile(current.$messages.created)(data.name)); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); _('popup').modal('hide'); } }); @@ -235,7 +235,7 @@ define(function () { url: REST_PATH + 'service/id/' + current.containerType + '/' + id, success: function () { notifyManager.notify(Handlebars.compile(current.$messages.deleted)(id)); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); } }); } else { @@ -258,7 +258,7 @@ define(function () { url: REST_PATH + 'service/id/' + current.containerType + '/empty/' + id, success: function () { notifyManager.notify(Handlebars.compile(current.$messages.updated)(id)); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); } }); } else { diff --git a/src/main/resources/META-INF/resources/webjars/id/home/home.js b/src/main/resources/META-INF/resources/webjars/id/home/home.js index 23f0faf..984f34e 100644 --- a/src/main/resources/META-INF/resources/webjars/id/home/home.js +++ b/src/main/resources/META-INF/resources/webjars/id/home/home.js @@ -4,7 +4,7 @@ define(function () { function validateMail() { const mail = _('mail').val(); - if (mail.match(/^.*@(gmail|yahoo|free|sfr|live|hotmail)\.[a-zA-Z]+$/i)) { + if (mail.match(/^.*@(gmail|yahoo|free|sfr|live|hotmail)\.[a-z]+$/i)) { validationManager.addWarn(_('mail'), 'warn-mail-perso'); } else { validationManager.reset(_('mail')); @@ -174,7 +174,7 @@ define(function () { }); // Global datatables filter _('search').on('keyup', function () { - current.table && current.table.fnFilter($(this).val()); + current.table?.fnFilter($(this).val()); }); _('table') @@ -352,7 +352,7 @@ define(function () { } else { notifyManager.notify(Handlebars.compile(current.$messages['created-account'])(data)); } - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); if ($('#create-another:checked').length) { // Only reset the popup current.fillPopup({}); @@ -380,7 +380,7 @@ define(function () { _('lastName').val(uc.lastName || ''); _('department').val(uc.department || ''); _('localId').val(uc.localId || ''); - _('mail').val((uc.mails && uc.mails[0]) || ''); + _('mail').val((uc.mails?.[0]) || ''); _('company').select2('val', uc.company || null); _('groups').select2('data', (uc.groups || []).map(g => ({ id: g.name, @@ -418,7 +418,7 @@ define(function () { url: REST_PATH + 'service/id/user/' + id, success: function () { notifyManager.notify(Handlebars.compile(current.$messages.deleted)(name)); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); } }); } else { @@ -475,7 +475,7 @@ define(function () { url: REST_PATH + 'service/id/user/' + id + '/' + operation, success: function (data) { notifyManager.notify(Handlebars.compile(current.$messages[operated + '-confirm'])(name)); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); if (operation === 'reset') { // Callback the popup to display the generated password _('generated-password').val(data); @@ -504,7 +504,7 @@ define(function () { url: REST_PATH + 'service/id/user/' + id + '/' + operation, success: function () { notifyManager.notify(Handlebars.compile(current.$messages[operated + '-confirm'])(name)); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); } }); } diff --git a/src/main/resources/META-INF/resources/webjars/service/id/id.js b/src/main/resources/META-INF/resources/webjars/service/id/id.js index 6d58c8a..ef23edf 100644 --- a/src/main/resources/META-INF/resources/webjars/service/id/id.js +++ b/src/main/resources/META-INF/resources/webjars/service/id/id.js @@ -102,7 +102,7 @@ define(function () { } }).on('change', function (e) { // Member might be selected, enable the 'add' button - if (e.added && e.added.id) { + if (e.added?.id) { // Enable the button _('add-user').removeAttr('disabled'); } else { @@ -127,14 +127,14 @@ define(function () { type: 'PUT', success: function () { notifyManager.notify(Handlebars.compile(current.$messages['service:id:added-member'])([user, group])); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); } }); }); // Global datatables filter _('subscribe-configuration-id-search').on('keyup', function () { - current.table && current.table.fnFilter($(this).val()); + current.table?.fnFilter($(this).val()); }); // Remove the selected user from the current group @@ -147,7 +147,7 @@ define(function () { type: 'DELETE', success: function () { notifyManager.notify(Handlebars.compile(current.$messages['service:id:removed-member'])([user, group])); - current.table && current.table.api().ajax.reload(); + current.table?.api().ajax.reload(); } }); });