mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 17:22:51 -05:00
added graph node types from edit and publish results (#18891)
* added graph node types from edit and publish results * make generic property bag * review comments * add comment for function * edit comment * change name to telemetry info
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export class TableDesignerMetadata {
|
||||
|
||||
// Allowed metadata for every provider
|
||||
public static mssqlAllowedMetdata: Set<string> = new Set(['isNode', 'isEdge', 'isSystemVersioned']);
|
||||
|
||||
// Provider ID to allowed metadata list set mapping
|
||||
public static providerMetadataMap: Map<string, Set<string>> = new Map<string, Set<string>>([
|
||||
['MSSQL', TableDesignerMetadata.mssqlAllowedMetdata]
|
||||
]);
|
||||
|
||||
/**
|
||||
* Validates given metadata and adds metadata from the allowed list
|
||||
* @param providerId provider ID for the table designer provider
|
||||
* @param metadata incoming metadata from the table designer provider
|
||||
* @returns filtered telemetry info with only allowed metadata points
|
||||
*/
|
||||
public static getTelemetryInfo(providerId: string, metadata: { [key: string]: string }): { [key: string]: string } {
|
||||
if (!TableDesignerMetadata.providerMetadataMap.has(providerId)) {
|
||||
return undefined;
|
||||
}
|
||||
const allowedSet = TableDesignerMetadata.providerMetadataMap.get(providerId);
|
||||
for (const key of Object.keys(metadata)) {
|
||||
if (!allowedSet.has(key)) {
|
||||
delete metadata[key];
|
||||
}
|
||||
}
|
||||
return metadata;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user