mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Feature/extension manager (#689)
* getting the extension gallery from a static file and enabling the extension manager
This commit is contained in:
13
extensionsGallery.json
Normal file
13
extensionsGallery.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"results": [{
|
||||
"extensions": [
|
||||
],
|
||||
"resultMetadata": [{
|
||||
"metadataType": "ResultCount",
|
||||
"metadataItems": [{
|
||||
"name": "TotalCount",
|
||||
"count": 0
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
}
|
||||
@@ -28,5 +28,11 @@
|
||||
"releaseNotesUrl": "https://go.microsoft.com/fwlink/?linkid=862039",
|
||||
"documentationUrl": "https://go.microsoft.com/fwlink/?linkid=862277",
|
||||
"commit": "9ca6200018fc206d67a47229f991901a8a453781",
|
||||
"date": "2017-12-15T12:00:00.000Z"
|
||||
"date": "2017-12-15T12:00:00.000Z",
|
||||
"extensionsGallery": {
|
||||
"serviceUrl":"https://raw.githubusercontent.com/Microsoft/sqlopsstudio/release/extensions/extensionsGallery.json"
|
||||
},
|
||||
"extensionTips": {
|
||||
"TestExtension": "{**/*.*}"
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,8 @@ export function asJson<T>(context: IRequestContext): TPromise<T> {
|
||||
}
|
||||
|
||||
if (!/application\/json/.test(context.res.headers['content-type'])) {
|
||||
return e('Response doesn\'t appear to be JSON');
|
||||
// {{SQL CARBON EDIT}}
|
||||
//return e('Response doesn\'t appear to be JSON');
|
||||
}
|
||||
|
||||
const buffer: string[] = [];
|
||||
|
||||
@@ -690,7 +690,7 @@ export class CodeMenu {
|
||||
const scm = this.createMenuItem(nls.localize({ key: 'miViewSCM', comment: ['&& denotes a mnemonic'] }, "S&&CM"), 'workbench.view.scm');
|
||||
// {{SQL CARBON EDIT}}
|
||||
// const debug = this.createMenuItem(nls.localize({ key: 'miViewDebug', comment: ['&& denotes a mnemonic'] }, "&&Debug"), 'workbench.view.debug');
|
||||
// const extensions = this.createMenuItem(nls.localize({ key: 'miViewExtensions', comment: ['&& denotes a mnemonic'] }, "E&&xtensions"), 'workbench.view.extensions');
|
||||
const extensions = this.createMenuItem(nls.localize({ key: 'miViewExtensions', comment: ['&& denotes a mnemonic'] }, "E&&xtensions"), 'workbench.view.extensions');
|
||||
const output = this.createMenuItem(nls.localize({ key: 'miToggleOutput', comment: ['&& denotes a mnemonic'] }, "&&Output"), 'workbench.action.output.toggleOutput');
|
||||
// {{SQL CARBON EDIT}}
|
||||
// const debugConsole = this.createMenuItem(nls.localize({ key: 'miToggleDebugConsole', comment: ['&& denotes a mnemonic'] }, "De&&bug Console"), 'workbench.debug.action.toggleRepl');
|
||||
@@ -766,7 +766,7 @@ export class CodeMenu {
|
||||
scm,
|
||||
// {{SQL CARBON EDIT}}
|
||||
// debug,
|
||||
// extensions,
|
||||
extensions,
|
||||
additionalViewlets,
|
||||
__separator__(),
|
||||
output,
|
||||
|
||||
@@ -131,6 +131,7 @@ export interface IGalleryExtensionAssets {
|
||||
readme: IGalleryExtensionAsset;
|
||||
changelog: IGalleryExtensionAsset;
|
||||
download: IGalleryExtensionAsset;
|
||||
downloadPage?: IGalleryExtensionAsset;
|
||||
icon: IGalleryExtensionAsset;
|
||||
license: IGalleryExtensionAsset;
|
||||
repository: IGalleryExtensionAsset;
|
||||
|
||||
@@ -110,7 +110,9 @@ const AssetType = {
|
||||
Manifest: 'Microsoft.VisualStudio.Code.Manifest',
|
||||
VSIX: 'Microsoft.VisualStudio.Services.VSIXPackage',
|
||||
License: 'Microsoft.VisualStudio.Services.Content.License',
|
||||
Repository: 'Microsoft.VisualStudio.Services.Links.Source'
|
||||
Repository: 'Microsoft.VisualStudio.Services.Links.Source',
|
||||
// {{SQL CARBON EDIT}}
|
||||
DownloadPage: 'Microsoft.SQLOps.DownloadPage'
|
||||
};
|
||||
|
||||
const PropertyType = {
|
||||
@@ -204,6 +206,12 @@ function getStatistic(statistics: IRawGalleryExtensionStatistics[], name: string
|
||||
function getVersionAsset(version: IRawGalleryExtensionVersion, type: string): IGalleryExtensionAsset {
|
||||
const result = version.files.filter(f => f.assetType === type)[0];
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
let uriFromSource: string = undefined;
|
||||
if (result) {
|
||||
uriFromSource = result.source;
|
||||
}
|
||||
|
||||
if (type === AssetType.Repository) {
|
||||
if (version.properties) {
|
||||
const results = version.properties.filter(p => p.key === type);
|
||||
@@ -235,15 +243,26 @@ function getVersionAsset(version: IRawGalleryExtensionVersion, type: string): IG
|
||||
|
||||
if (type === AssetType.VSIX) {
|
||||
return {
|
||||
uri: `${version.fallbackAssetUri}/${type}?redirect=true&install=true`,
|
||||
// {{SQL CARBON EDIT}}
|
||||
uri: uriFromSource || `${version.fallbackAssetUri}/${type}?redirect=true&install=true`,
|
||||
fallbackUri: `${version.fallbackAssetUri}/${type}?install=true`
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
uri: `${version.assetUri}/${type}`,
|
||||
fallbackUri: `${version.fallbackAssetUri}/${type}`
|
||||
};
|
||||
// {{SQL CARBON EDIT}}
|
||||
if (version.assetUri) {
|
||||
return {
|
||||
uri: `${version.assetUri}/${type}`,
|
||||
fallbackUri: `${version.fallbackAssetUri}/${type}`
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
uri: uriFromSource,
|
||||
fallbackUri: `${version.fallbackAssetUri}/${type}`
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getDependencies(version: IRawGalleryExtensionVersion): string[] {
|
||||
@@ -268,6 +287,8 @@ function toExtension(galleryExtension: IRawGalleryExtension, extensionsGalleryUr
|
||||
readme: getVersionAsset(version, AssetType.Details),
|
||||
changelog: getVersionAsset(version, AssetType.Changelog),
|
||||
download: getVersionAsset(version, AssetType.VSIX),
|
||||
// {{SQL CARBON EDIT}}
|
||||
downloadPage: getVersionAsset(version, AssetType.DownloadPage),
|
||||
icon: getVersionAsset(version, AssetType.Icon),
|
||||
license: getVersionAsset(version, AssetType.License),
|
||||
repository: getVersionAsset(version, AssetType.Repository),
|
||||
@@ -336,7 +357,8 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
||||
}
|
||||
|
||||
private api(path = ''): string {
|
||||
return `${this.extensionsGalleryUrl}${path}`;
|
||||
// {{SQL CARBON EDIT}}
|
||||
return `${this.extensionsGalleryUrl}`;
|
||||
}
|
||||
|
||||
isEnabled(): boolean {
|
||||
@@ -428,7 +450,8 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
||||
});
|
||||
|
||||
return this.requestService.request({
|
||||
type: 'POST',
|
||||
// {{SQL CARBON EDIT}}
|
||||
type: 'GET',
|
||||
url: this.api('/extensionquery'),
|
||||
data,
|
||||
headers
|
||||
@@ -538,7 +561,9 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
||||
if (rawVersion) {
|
||||
extension.properties.dependencies = getDependencies(rawVersion);
|
||||
extension.properties.engine = getEngine(rawVersion);
|
||||
// {{SQL CARBON EDIT}}
|
||||
extension.assets.download = getVersionAsset(rawVersion, AssetType.VSIX);
|
||||
extension.assets.downloadPage = getVersionAsset(rawVersion, AssetType.DownloadPage);
|
||||
extension.version = rawVersion.version;
|
||||
return extension;
|
||||
}
|
||||
|
||||
@@ -571,8 +571,12 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
|
||||
if (!gallery) {
|
||||
return TPromise.wrapError<void>(new Error('Missing gallery'));
|
||||
}
|
||||
|
||||
return this.extensionService.installFromGallery(gallery);
|
||||
if (ext.gallery.assets.downloadPage && ext.gallery.assets.downloadPage.uri) {
|
||||
window.open(ext.gallery.assets.downloadPage.uri);
|
||||
return TPromise.wrap<void>(void 0);
|
||||
} else {
|
||||
return this.extensionService.installFromGallery(gallery);
|
||||
}
|
||||
}
|
||||
|
||||
setEnablement(extension: IExtension, enablementState: EnablementState): TPromise<void> {
|
||||
|
||||
@@ -68,8 +68,8 @@ import 'vs/workbench/parts/html/browser/html.contribution';
|
||||
// import 'vs/workbench/parts/welcome/walkThrough/electron-browser/walkThrough.contribution';
|
||||
|
||||
import 'vs/workbench/parts/extensions/electron-browser/extensions.contribution';
|
||||
//import 'vs/workbench/parts/extensions/browser/extensionsQuickOpen';
|
||||
//import 'vs/workbench/parts/extensions/electron-browser/extensionsViewlet'; // can be packaged separately
|
||||
import 'vs/workbench/parts/extensions/browser/extensionsQuickOpen';
|
||||
import 'vs/workbench/parts/extensions/electron-browser/extensionsViewlet'; // can be packaged separately
|
||||
|
||||
// import 'vs/workbench/parts/welcome/page/electron-browser/welcomePage.contribution';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user