From 545d17256aa7942afe934dd5318c72232e39a586 Mon Sep 17 00:00:00 2001 From: Lazlo Westerhof Date: Thu, 3 Oct 2024 08:56:41 +0200 Subject: [PATCH] Group manager: improve render performance of group list --- .../static/group_manager/js/group_manager.js | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/group_manager/static/group_manager/js/group_manager.js b/group_manager/static/group_manager/js/group_manager.js index e3a6e331..0a145d4a 100644 --- a/group_manager/static/group_manager/js/group_manager.js +++ b/group_manager/static/group_manager/js/group_manager.js @@ -2408,32 +2408,28 @@ $(function () { $groupPanel.find('.create-button').removeClass('disabled') } - let a = '' // Indicate which groups are managed by this user. + const groupList = document.querySelector('#group-list') + let icons = '' for (const groupName in this.groups) { - a = '' + const group = groupList.querySelector('.group[data-name="' + Yoda.escapeQuotes(groupName) + '"]') + + icons = '
' if (groupName.match(/^(research)-/)) { - a += '' + icons += '' } if (this.isManagerOfGroup(groupName)) { - $('#group-list .group[data-name="' + Yoda.escapeQuotes(groupName) + '"]').append( - a + '
 ' + '
' - ) + icons += ' ' + '' } else if (!this.isMemberOfGroup(groupName) && this.isRodsAdmin) { - $('#group-list .group[data-name="' + Yoda.escapeQuotes(groupName) + '"]').append( - a + ' ' + '' - ) + icons += ' ' + '' } else if (this.isMemberOfGroup(groupName) && this.groups[groupName].members[this.userNameFull].access === 'reader') { - $('#group-list .group[data-name="' + Yoda.escapeQuotes(groupName) + '"]').append( - a + ' ' + '' - ) + icons += ' ' + '' } else { - $('#group-list .group[data-name="' + Yoda.escapeQuotes(groupName) + '"]').append( - a + '' - ) + icons += '' } + group.insertAdjacentHTML('beforeend', icons) } const isCollapsed = Yoda.storage.session.get('is-collapsed')