Fix validation errors (#14009)

* Fix validation errors

* fix compile

* update return type
This commit is contained in:
Charles Gagnon
2021-01-21 10:40:46 -08:00
committed by GitHub
parent 5f61becd36
commit f986b8cf78
2 changed files with 4 additions and 5 deletions

View File

@@ -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<boolean> {
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<boolean> {
const validations = await Promise.all(this._validationCallbacks.map(callback => callback(component.descriptor.id)));
return validations.every(validation => validation === true);
}
/**