mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Error handling for dashboard tab contributions (#851)
* support tab without title * address comments * formatting * support error validation for dashboard tab and container contributions * formatting
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { IExtensionPointUser } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
@@ -18,3 +19,17 @@ let gridContainersSchema: IJSONSchema = {
|
||||
|
||||
registerContainerType(GRID_CONTAINER, gridContainersSchema);
|
||||
registerNavSectionContainerType(GRID_CONTAINER, gridContainersSchema);
|
||||
|
||||
export function validateGridContainerContribution(extension: IExtensionPointUser<any>, gridConfigs: object[]): boolean {
|
||||
let result = true;
|
||||
gridConfigs.forEach(widgetConfig => {
|
||||
let allKeys = Object.keys(widgetConfig);
|
||||
let widgetOrWebviewKey = allKeys.find(key => key === 'widget' || key === 'webview');
|
||||
if (!widgetOrWebviewKey) {
|
||||
result = false;
|
||||
extension.collector.error(nls.localize('gridContainer.invalidInputs', 'widgets or webviews are expected inside widgets-container for extension.'));
|
||||
return;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user