Skip to content

Commit

Permalink
Sort the extension names in the 'about' dialog.
Browse files Browse the repository at this point in the history
Fixes #3886

Add minor enhancement to the example `about` dialog present in the example applications
to display the list of sorted extension names. Previously the list was unsorted which
meant it was harder to identify which extensions were in fact present, and a sorted
list is more adherent with good UI practices.

Signed-off-by: Vincent Fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto committed Jun 21, 2019
1 parent 95c4a28 commit 1d20382
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/core/src/browser/about-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { inject, injectable, postConstruct } from 'inversify';
import { AbstractDialog, DialogProps } from './dialogs';
import { ApplicationServer } from '../common/application-protocol';
import { ApplicationServer, ExtensionInfo } from '../common/application-protocol';

export const ABOUT_CONTENT_CLASS = 'theia-aboutDialog';
export const ABOUT_EXTENSIONS_CLASS = 'theia-aboutExtensions';
Expand Down Expand Up @@ -62,17 +62,20 @@ export class AboutDialog extends AbstractDialog<void> {
extensionInfoContent.classList.add(ABOUT_EXTENSIONS_CLASS);
messageNode.appendChild(extensionInfoContent);

const extensionsInfos = await this.appServer.getExtensionsInfos();
const extensionsInfos: ExtensionInfo[] = await this.appServer.getExtensionsInfos();

extensionsInfos.forEach(extension => {
const extensionInfo = document.createElement('li');
extensionInfo.textContent = extension.name + ' ' + extension.version;
extensionInfoContent.appendChild(extensionInfo);
});
extensionsInfos
.sort((a: ExtensionInfo, b: ExtensionInfo) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()))
.forEach((extension: ExtensionInfo) => {
const extensionInfo = document.createElement('li');
extensionInfo.textContent = extension.name + ' ' + extension.version;
extensionInfoContent.appendChild(extensionInfo);
});
messageNode.setAttribute('style', 'flex: 1 100%; padding-bottom: calc(var(--theia-ui-padding)*3);');
this.contentNode.appendChild(messageNode);
this.appendAcceptButton('Ok');
}

get value(): undefined { return undefined; }

}

0 comments on commit 1d20382

Please sign in to comment.