mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fix validation errors (#14009)
* Fix validation errors * fix compile * update return type
This commit is contained in:
@@ -77,7 +77,7 @@ export interface IModelStore {
|
|||||||
/**
|
/**
|
||||||
* Run all validations for the given component and return the new validation value
|
* Run all validations for the given component and return the new validation value
|
||||||
*/
|
*/
|
||||||
validate(component: IComponent): Thenable<boolean>;
|
validate(component: IComponent): Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Deferred } from 'sql/base/common/promise';
|
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 { IComponentDescriptor, IModelStore, IComponent } from 'sql/platform/dashboard/browser/interfaces';
|
||||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
@@ -76,9 +75,9 @@ export class ModelStore implements IModelStore {
|
|||||||
this._validationCallbacks.push(callback);
|
this._validationCallbacks.push(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(component: IComponent): Thenable<boolean> {
|
async validate(component: IComponent): Promise<boolean> {
|
||||||
let componentId = entries(this._componentMappings).find(([id, mappedComponent]) => component === mappedComponent)[0];
|
const validations = await Promise.all(this._validationCallbacks.map(callback => callback(component.descriptor.id)));
|
||||||
return Promise.all(this._validationCallbacks.map(callback => callback(componentId))).then(validations => validations.every(validation => validation === true));
|
return validations.every(validation => validation === true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user