mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 09:35:41 -05:00
Fix model view component updateProperties implementation (#1586)
This commit is contained in:
4
src/sql/sqlops.proposed.d.ts
vendored
4
src/sql/sqlops.proposed.d.ts
vendored
@@ -104,11 +104,11 @@ declare module 'sqlops' {
|
|||||||
/**
|
/**
|
||||||
* Sends any updated properties of the component to the UI
|
* 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
|
* has been applied in the UI
|
||||||
* @memberof Component
|
* @memberof Component
|
||||||
*/
|
*/
|
||||||
updateProperties(properties: { [key: string]: any }): Thenable<boolean>;
|
updateProperties(properties: { [key: string]: any }): Thenable<void>;
|
||||||
|
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -406,12 +406,13 @@ class ComponentWrapper implements sqlops.Component {
|
|||||||
return this._proxy.$setLayout(this._handle, this.id, layout);
|
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();
|
return this.notifyPropertyChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected notifyPropertyChanged(): Thenable<boolean> {
|
protected notifyPropertyChanged(): Thenable<void> {
|
||||||
return this._proxy.$setProperties(this._handle, this._id, this.properties).then(() => true);
|
return this._proxy.$setProperties(this._handle, this._id, this.properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public registerEvent(): Thenable<boolean> {
|
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) {
|
if (!this.properties[key] || this.properties[key] !== value) {
|
||||||
// Only notify the front end if a value has been updated
|
// Only notify the front end if a value has been updated
|
||||||
this.properties[key] = value;
|
this.properties[key] = value;
|
||||||
return this.notifyPropertyChanged();
|
return this.notifyPropertyChanged();
|
||||||
}
|
}
|
||||||
return Promise.resolve(true);
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError(err: Error): void {
|
private handleError(err: Error): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user