提交 6edddf79 编写于 作者: W Wade Anderson

Added install count to view.

上级 3e61d5b7
......@@ -15,7 +15,7 @@ export interface IExtensionManifest {
version: string;
displayName?: string;
description?: string;
installCount: number;
installs: number;
}
export interface IGalleryInformation {
......
......@@ -56,6 +56,7 @@ interface ITemplateData {
root: HTMLElement;
displayName: HighlightedLabel;
version: HTMLElement;
installs: HTMLElement;
since: HTMLElement;
author: HTMLElement;
actionbar: ActionBar;
......@@ -83,7 +84,7 @@ function extensionEquals(one: IExtension, other: IExtension): boolean {
* Compare by Install count descending.
*/
function extensionEntryCompare(one: IExtensionEntry, other: IExtensionEntry): number {
return other.extension.installCount - one.extension.installCount;
return other.extension.installs - one.extension.installs;
}
class OpenInGalleryAction extends Action {
......@@ -185,6 +186,7 @@ class Renderer implements IRenderer<IExtensionEntry> {
since,
displayName: new HighlightedLabel(dom.append(firstRow, $('span.name'))),
version: dom.append(firstRow, $('span.version')),
installs: dom.append(firstRow, $('span.version')),
actionbar: new ActionBar(dom.append(secondRow, $('.actions'))),
description: new HighlightedLabel(dom.append(secondRow, $('span.description'))),
disposables: []
......@@ -195,6 +197,7 @@ class Renderer implements IRenderer<IExtensionEntry> {
const extension = entry.extension;
const date = extension.galleryInformation ? extension.galleryInformation.date : null;
const publisher = extension.galleryInformation ? extension.galleryInformation.publisherDisplayName : extension.publisher;
const installs = extension.installs;
const actionOptions = { icon: true, label: false };
const updateActions = () => {
......@@ -237,6 +240,7 @@ class Renderer implements IRenderer<IExtensionEntry> {
data.displayName.set(extension.displayName, entry.highlights.displayName);
data.displayName.element.title = extension.name;
data.version.textContent = extension.version;
data.installs.textContent = installs + '';
data.since.textContent = date ? since(new Date(date)) : '';
data.author.textContent = publisher;
data.description.set(extension.description, entry.highlights.description);
......
......@@ -64,7 +64,8 @@ function createExtension(manifest: IExtensionManifest, galleryInformation?: IGal
displayName: manifest.displayName || manifest.name,
publisher: manifest.publisher,
version: manifest.version,
description: manifest.description || ''
description: manifest.description || '',
installs: 0
};
if (galleryInformation) {
......
......@@ -62,7 +62,7 @@ export class GalleryService implements IGalleryService {
/**
* Extracts install count statistic.
*/
private extractInstallCount(statistics: IGalleryExtensionStatistic[]): number {
private extractInstalls(statistics: IGalleryExtensionStatistic[]): number {
var result = 0;
statistics.forEach(stat => {
if (stat.statisticName === 'install') {
......@@ -116,7 +116,7 @@ export class GalleryService implements IGalleryService {
publisher: extension.publisher.publisherName,
version: extension.versions[0].version,
description: extension.shortDescription || '',
installCount: this.extractInstallCount(extension.statistics),
installs: this.extractInstalls(extension.statistics),
galleryInformation: {
galleryApiUrl: this.extensionsGalleryUrl,
id: extension.extensionId,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册