From e2ef1f8a8932e1b55ca3411c598aab170722daed Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Sat, 9 Nov 2019 13:37:09 -0800 Subject: [PATCH] remove the extension name link (#8271) * remove the extension name link * pr comments * pr comments --- .../extensions/browser/extensionEditor.ts | 24 ++++++++++++------- .../browser/extensionsWorkbenchService.ts | 4 ++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts index 065c1f75e9..933c3886ac 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts @@ -60,6 +60,7 @@ import { renderMarkdownDocument } from 'vs/workbench/contrib/markdown/common/mar import { IModeService } from 'vs/editor/common/services/modeService'; import { TokenizationRegistry } from 'vs/editor/common/modes'; import { generateTokensCSSForColorMap } from 'vs/editor/common/modes/supports/tokenization'; +import { ExtensionsViewlet } from 'vs/workbench/contrib/extensions/browser/extensionsViewlet'; function removeEmbeddedSVGs(documentContent: string): string { const newDocument = new DOMParser().parseFromString(documentContent, 'text/html'); @@ -358,7 +359,7 @@ export class ExtensionEditor extends BaseEditor { this.telemetryService.publicLog('extensionGallery:openExtension', assign(extension.telemetryData, recommendationsData)); toggleClass(template.name, 'clickable', !!extension.url); - toggleClass(template.publisher, 'clickable', !!extension.url); + toggleClass(template.publisher, 'clickable', !!extension.publisher); // {{SQL CARBON EDIT}} !!extension.url -> !!extension.publisher, for ADS we don't have marketplace website, but still want to make it clickable and filter extensions by publisher toggleClass(template.rating, 'clickable', !!extension.url); if (extension.url) { this.transientDisposables.add(this.onClick(template.name, () => this.openerService.open(URI.parse(extension.url!)))); @@ -379,13 +380,20 @@ export class ExtensionEditor extends BaseEditor { template.license.style.display = 'none'; } - // {{SQL CARBON EDIT}} add license url - if (extension.licenseUrl) { - template.license.onclick = finalHandler(() => window.open(extension.licenseUrl)); - template.license.style.display = 'initial'; - } else { - template.license.onclick = null; - template.license.style.display = 'none'; + // {{SQL CARBON EDIT}} + // copied from the the extension.url condition block above + // for ADS the extension.url will be empty but we still want to make the publisher and license controls to be clickable + if (!extension.url) { + if (extension.licenseUrl) { + this.transientDisposables.add(this.onClick(template.license, () => this.openerService.open(URI.parse(extension.licenseUrl!)))); + template.license.style.display = 'initial'; + } else { + template.license.style.display = 'none'; + } + this.transientDisposables.add(this.onClick(template.publisher, () => { + this.viewletService.openViewlet(VIEWLET_ID, true) + .then((viewlet: ExtensionsViewlet) => viewlet.search(`publisher:"${extension.publisherDisplayName}"`)); + })); } // {{SQL CARBON EDIT}} - End diff --git a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts index aeeb7e38c5..56f1da277f 100644 --- a/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +++ b/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts @@ -118,11 +118,15 @@ class Extension implements IExtension { } get url(): string | undefined { + // {{SQL CARBON EDIT}} - ADS doesn't have a marketplace website. + return undefined; + /* if (!this.productService.extensionsGallery || !this.gallery) { return undefined; } return `${this.productService.extensionsGallery.itemUrl}?itemName=${this.publisher}.${this.name}`; + */ } // {{SQL CARBON EDIT}}