From 9c68043137f58c182eec9925c025fd48747e6ccc Mon Sep 17 00:00:00 2001 From: Aasim Khan Date: Thu, 27 Apr 2023 13:15:11 -0400 Subject: [PATCH] Adding OE filtering interfaces. (#22738) * Adding interfaces for tree filtering * fixing type * Adding enums in sqlhost * Fixing comment * Fixed filters lol * Fixing some contract definitions * Removing flag * Update src/sql/azdata.proposed.d.ts Co-authored-by: Charles Gagnon * Removing filters * Removing filters2 * Fixing enum * Fixing interface and enum names * Fixing interface name * Update src/sql/azdata.proposed.d.ts Co-authored-by: Charles Gagnon * Removing type from filter * Adding is null and is not null operators * Fixing enums * Update src/sql/azdata.proposed.d.ts Co-authored-by: Charles Gagnon * Update src/sql/azdata.proposed.d.ts Co-authored-by: Charles Gagnon * Update src/sql/azdata.proposed.d.ts Co-authored-by: Charles Gagnon --------- Co-authored-by: Charles Gagnon --- src/sql/azdata.proposed.d.ts | 72 +++++++++++++++++++ .../api/common/sqlExtHost.api.impl.ts | 2 + .../workbench/api/common/sqlExtHostTypes.ts | 23 ++++++ 3 files changed, 97 insertions(+) diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index 5a2c26b7d1..3be7b98b4c 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -605,6 +605,11 @@ declare module 'azdata' { * Authentication token for the current session. */ securityToken?: accounts.AccountSecurityToken | undefined; + + /** + * Filters to apply to the child nodes being returned + */ + filters?: NodeFilter[]; } // End Object Explorer interfaces ---------------------------- @@ -1793,6 +1798,73 @@ declare module 'azdata' { * The path of the parent node. */ parentNodePath: string; + /** + * Filterable properties that this node supports + */ + filterableProperties?: NodeFilterProperty[]; + } + + export interface NodeFilterProperty { + /** + * The name of the filter property displayed to the user + */ + displayName: string; + /** + * The type of the filter property + */ + type: NodeFilterPropertyDataType; + /** + * The description of the filter property + */ + description: string; + } + + /** + * NodeFilterChoiceProperty is used to define the choices for the filter property if the type is choice + */ + export interface NodeFilterChoiceProperty extends NodeFilterProperty { + /** + * The list of choices for the filter property if the type is choice + */ + choices: string[]; + } + + export interface NodeFilter { + /** + * The name of the filter property + */ + name: string; + /** + * The operator of the filter property + */ + operator: NodeFilterOperator; + /** + * The applied values of the filter property + */ + value: string | string[] | number | boolean | undefined; + } + + export enum NodeFilterPropertyDataType { + String = 0, + Number = 1, + Boolean = 2, + Date = 3, + Choice = 4 + } + + export enum NodeFilterOperator { + Equals = 0, + NotEquals = 1, + LessThan = 2, + LessThanOrEquals = 3, + GreaterThan = 4, + GreaterThanOrEquals = 5, + Between = 6, + NotBetween = 7, + Contains = 8, + NotContains = 9, + IsNull = 10, + IsNotNull = 11 } export namespace window { diff --git a/src/sql/workbench/api/common/sqlExtHost.api.impl.ts b/src/sql/workbench/api/common/sqlExtHost.api.impl.ts index a9cdaae626..4d6dc20b1f 100644 --- a/src/sql/workbench/api/common/sqlExtHost.api.impl.ts +++ b/src/sql/workbench/api/common/sqlExtHost.api.impl.ts @@ -657,6 +657,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp FrequencyTypes: sqlExtHostTypes.FrequencyTypes, FrequencySubDayTypes: sqlExtHostTypes.FrequencySubDayTypes, FrequencyRelativeIntervals: sqlExtHostTypes.FrequencyRelativeIntervals, + NodeFilterPropertyDataType: sqlExtHostTypes.NodeFilterPropertyDataType, + NodeFilterOperator: sqlExtHostTypes.NodeFilterOperator, window, tasks, dashboard, diff --git a/src/sql/workbench/api/common/sqlExtHostTypes.ts b/src/sql/workbench/api/common/sqlExtHostTypes.ts index 306f5dfe0f..e147813cb2 100644 --- a/src/sql/workbench/api/common/sqlExtHostTypes.ts +++ b/src/sql/workbench/api/common/sqlExtHostTypes.ts @@ -478,6 +478,29 @@ export enum AzureResource { Custom = 12 // Handles custom resource URIs as received from server endpoint. } +export enum NodeFilterPropertyDataType { + String = 0, + Number = 1, + Boolean = 2, + Date = 3, + Choice = 4 +} + +export enum NodeFilterOperator { + Equals = 0, + NotEquals = 1, + LessThan = 2, + LessThanOrEquals = 3, + GreaterThan = 4, + GreaterThanOrEquals = 5, + Between = 6, + NotBetween = 7, + Contains = 8, + NotContains = 9, + IsNull = 10, + IsNotNull = 11 +} + export class TreeItem extends vsExtTypes.TreeItem { payload?: azdata.IConnectionProfile; providerHandle?: string;