Skip to content

XWIKI-22540: Slow loading time when changing the icons theme to Silk in the Icon picker #3537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
96d740e
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Oct 2, 2024
2392ffa
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Oct 3, 2024
fd1505e
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Oct 4, 2024
b50e558
Merge branch 'master' into XWIKI-22540
Sereza7 Nov 27, 2024
cdc937f
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Dec 9, 2024
0053841
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Dec 9, 2024
53b88e0
Merge branch 'xwiki:master' into XWIKI-22540
Sereza7 Jan 10, 2025
3642613
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Jan 10, 2025
1546dc7
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Jan 13, 2025
ec97807
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Jan 13, 2025
4622902
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Jan 13, 2025
127d585
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Jan 13, 2025
6663d3c
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Jan 13, 2025
a0087f8
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Jan 13, 2025
8a7c415
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Jan 13, 2025
4b1f7e1
XWIKI-22540: Slow loading time when changing the icons theme to Silk …
Sereza7 Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ define('xwiki-iconService', [
iconsPromise = iconsPromisesPerTheme[query] = $.getJSON(getResourceURL('data_icons', {
iconTheme,
query,
metadata: true
}));
iconsPromise.catch(() => {
// Reset the promise so that we can try again later.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@
#set ($iconNamePrefix = $request.query.toLowerCase())
#foreach ($xwikiIcon in $xwikiIcons)
#if ("$!iconNamePrefix" == '' || $xwikiIcon.startsWith($iconNamePrefix))
#set ($discard = $icons.add({
#set ($icon = {
'name': $xwikiIcon,
'render': $services.icon.renderHTML($xwikiIcon, $iconTheme),
'metadata': $services.icon.getMetaData($xwikiIcon, $iconTheme)
}))
'render': $services.icon.renderHTML($xwikiIcon, $iconTheme)
})
#if ($request.metadata == 'true')
#set ($icon.metadata = $services.icon.getMetaData($xwikiIcon, $iconTheme))
#end
#set ($discard = $icons.add($icon))
#end
#end
#jsonResponse($icons)
Expand Down Expand Up @@ -233,24 +236,24 @@ require(['jquery', 'xwiki-icon-picker'], function($) {
/**
* Display the list of icons
*/
var displayList = function(iconTheme) {
var displayList = function(iconList) {
// Filter the icons we display based on the value of the input field.
let selectedIconName = '';
if (currentInput.data('xwikiIconPickerSettings') !== '') {
selectedIconName = currentInput[0].value.replace(currentInput.data('xwikiIconPickerSettings').prefix, '');
}
// For each icon
for (var i=0; i < iconTheme.length; ++i) {
iconList.forEach(icon => {
// Display the icon
if (selectedIconName === '' || iconTheme[i].name.includes(selectedIconName)) {
if (selectedIconName === '' || icon.name.includes(selectedIconName)) {
var displayer = $(document.createElement('div'));
iconListSection.append(displayer);
displayer.addClass('xwikiIconPickerIcon');
var imageDiv = $(document.createElement('div'));
imageDiv.addClass('xwikiIconPickerIconImage').html(iconTheme[i].render);
imageDiv.addClass('xwikiIconPickerIconImage').html(icon.render);
displayer.append(imageDiv);
var iconNameSpan = $(document.createElement('span'));
iconNameSpan.addClass('xwikiIconPickerIconName').text(iconTheme[i].name);
iconNameSpan.addClass('xwikiIconPickerIconName').text(icon.name);
displayer.append(iconNameSpan);
// Change the input value when the icon is clicked
displayer.on('click', function(event) {
Expand Down
Loading