Fix model view component updateProperties implementation (#1586)

This commit is contained in:
Matt Irvine
2018-06-08 09:41:00 -07:00
committed by GitHub
parent a5b4eeb932
commit 2bbb2842e5
2 changed files with 8 additions and 7 deletions

View File

@@ -104,11 +104,11 @@ declare module 'sqlops' {
/**
* Sends any updated properties of the component to the UI
*
* @returns {Thenable<boolean>} Thenable that completes once the update
* @returns {Thenable<void>} Thenable that completes once the update
* has been applied in the UI
* @memberof Component
*/
updateProperties(properties: { [key: string]: any }): Thenable<boolean>;
updateProperties(properties: { [key: string]: any }): Thenable<void>;
enabled: boolean;
/**

View File

@@ -406,12 +406,13 @@ class ComponentWrapper implements sqlops.Component {
return this._proxy.$setLayout(this._handle, this.id, layout);
}
public updateProperties(): Thenable<boolean> {
public updateProperties(properties: { [key: string]: any }): Thenable<void> {
this.properties = Object.assign(this.properties, properties);
return this.notifyPropertyChanged();
}
protected notifyPropertyChanged(): Thenable<boolean> {
return this._proxy.$setProperties(this._handle, this._id, this.properties).then(() => true);
protected notifyPropertyChanged(): Thenable<void> {
return this._proxy.$setProperties(this._handle, this._id, this.properties);
}
public registerEvent(): Thenable<boolean> {
@@ -432,13 +433,13 @@ class ComponentWrapper implements sqlops.Component {
}
}
protected async setProperty(key: string, value: any): Promise<boolean> {
protected async setProperty(key: string, value: any): Promise<void> {
if (!this.properties[key] || this.properties[key] !== value) {
// Only notify the front end if a value has been updated
this.properties[key] = value;
return this.notifyPropertyChanged();
}
return Promise.resolve(true);
return Promise.resolve();
}
private handleError(err: Error): void {