diff --git a/src/sql/platform/dashboard/browser/interfaces.ts b/src/sql/platform/dashboard/browser/interfaces.ts index 1d86c98449..0674275272 100644 --- a/src/sql/platform/dashboard/browser/interfaces.ts +++ b/src/sql/platform/dashboard/browser/interfaces.ts @@ -77,7 +77,7 @@ export interface IModelStore { /** * Run all validations for the given component and return the new validation value */ - validate(component: IComponent): Thenable; + validate(component: IComponent): Promise; } /** diff --git a/src/sql/workbench/browser/modelComponents/modelStore.ts b/src/sql/workbench/browser/modelComponents/modelStore.ts index 75a8b062a2..ee79de4ed4 100644 --- a/src/sql/workbench/browser/modelComponents/modelStore.ts +++ b/src/sql/workbench/browser/modelComponents/modelStore.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import { Deferred } from 'sql/base/common/promise'; -import { entries } from 'sql/base/common/collections'; import { IComponentDescriptor, IModelStore, IComponent } from 'sql/platform/dashboard/browser/interfaces'; import { onUnexpectedError } from 'vs/base/common/errors'; import { ILogService } from 'vs/platform/log/common/log'; @@ -76,9 +75,9 @@ export class ModelStore implements IModelStore { this._validationCallbacks.push(callback); } - validate(component: IComponent): Thenable { - let componentId = entries(this._componentMappings).find(([id, mappedComponent]) => component === mappedComponent)[0]; - return Promise.all(this._validationCallbacks.map(callback => callback(componentId))).then(validations => validations.every(validation => validation === true)); + async validate(component: IComponent): Promise { + const validations = await Promise.all(this._validationCallbacks.map(callback => callback(component.descriptor.id))); + return validations.every(validation => validation === true); } /**