mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add excludeFlags to extenson marketplace query (#17121)
* Add excludeFlags to extenson marketplace query * Remove dead code * Remove extraneous blank line * Address code review feedback
This commit is contained in:
@@ -542,6 +542,10 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
|||||||
.withPage(1, pageSize)
|
.withPage(1, pageSize)
|
||||||
.withFilter(FilterType.Target, 'Microsoft.VisualStudio.Code');
|
.withFilter(FilterType.Target, 'Microsoft.VisualStudio.Code');
|
||||||
|
|
||||||
|
if (options.excludeFlags) {
|
||||||
|
query = query.withFilter(FilterType.ExcludeWithFlags, options.excludeFlags); // {{SQL CARBON EDIT}} exclude extensions matching excludeFlags options
|
||||||
|
}
|
||||||
|
|
||||||
if (text) {
|
if (text) {
|
||||||
// Use category filter instead of "category:themes"
|
// Use category filter instead of "category:themes"
|
||||||
text = text.replace(/\bcategory:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g, (_, quotedCategory, category) => {
|
text = text.replace(/\bcategory:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g, (_, quotedCategory, category) => {
|
||||||
@@ -645,6 +649,12 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// {{SQL CARBON EDIT}} - filter out extensions that match the excludeFlags options
|
||||||
|
const flags = query.criteria.filter(x => x.filterType === FilterType.ExcludeWithFlags).map(v => v.value ? v.value.toLocaleLowerCase() : undefined);
|
||||||
|
if (flags && flags.length > 0) {
|
||||||
|
filteredExtensions = filteredExtensions.filter(e => !e.flags || flags.find(x => x === e.flags.toLocaleLowerCase()) === undefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sorting
|
// Sorting
|
||||||
@@ -811,7 +821,7 @@ export class ExtensionGalleryService implements IExtensionGalleryService {
|
|||||||
*/
|
*/
|
||||||
const log = (duration: number) => this.telemetryService.publicLog('galleryService:downloadVSIX', { ...data, duration });
|
const log = (duration: number) => this.telemetryService.publicLog('galleryService:downloadVSIX', { ...data, duration });
|
||||||
|
|
||||||
// {{SQL Carbon Edit}} - Don't append install or update on to the URL
|
// {{SQL CARBON EDIT}} - Don't append install or update on to the URL
|
||||||
// const operationParam = operation === InstallOperation.Install ? 'install' : operation === InstallOperation.Update ? 'update' : '';
|
// const operationParam = operation === InstallOperation.Install ? 'install' : operation === InstallOperation.Update ? 'update' : '';
|
||||||
const operationParam = undefined;
|
const operationParam = undefined;
|
||||||
const downloadAsset = operationParam ? {
|
const downloadAsset = operationParam ? {
|
||||||
|
|||||||
@@ -136,6 +136,11 @@ export interface IQueryOptions {
|
|||||||
sortBy?: SortBy;
|
sortBy?: SortBy;
|
||||||
sortOrder?: SortOrder;
|
sortOrder?: SortOrder;
|
||||||
source?: string;
|
source?: string;
|
||||||
|
// {{SQL CARBON EDIT}} do not show extensions matching excludeFlags in the marketplace
|
||||||
|
// This field only supports an exact match of a single flag. It doesn't currently
|
||||||
|
// support setting multiple flags such as "hidden,preview" since this functionality isn't
|
||||||
|
// required by current usage scenarios.
|
||||||
|
excludeFlags?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const enum StatisticType {
|
export const enum StatisticType {
|
||||||
|
|||||||
@@ -751,6 +751,7 @@ export class ExtensionsListView extends ViewPane {
|
|||||||
// {{SQL CARBON EDIT}}
|
// {{SQL CARBON EDIT}}
|
||||||
private getAllMarketplaceModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
|
private getAllMarketplaceModel(query: Query, options: IQueryOptions, token: CancellationToken): Promise<IPagedModel<IExtension>> {
|
||||||
const value = query.value.trim().toLowerCase();
|
const value = query.value.trim().toLowerCase();
|
||||||
|
options.excludeFlags = 'hidden'; // {{SQL CARBON EDIT}} exclude extensions with 'hidden' flag from marketplace query
|
||||||
return this.extensionsWorkbenchService.queryLocal()
|
return this.extensionsWorkbenchService.queryLocal()
|
||||||
.then(result => result.filter(e => e.type === ExtensionType.User))
|
.then(result => result.filter(e => e.type === ExtensionType.User))
|
||||||
.then(local => {
|
.then(local => {
|
||||||
|
|||||||
Reference in New Issue
Block a user