From 2bbb2842e5259b90eb249f97eb7fa3de57afb59d Mon Sep 17 00:00:00 2001 From: Matt Irvine Date: Fri, 8 Jun 2018 09:41:00 -0700 Subject: [PATCH] Fix model view component updateProperties implementation (#1586) --- src/sql/sqlops.proposed.d.ts | 4 ++-- src/sql/workbench/api/node/extHostModelView.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/sql/sqlops.proposed.d.ts b/src/sql/sqlops.proposed.d.ts index 2bf1d16cf9..bbd5b48965 100644 --- a/src/sql/sqlops.proposed.d.ts +++ b/src/sql/sqlops.proposed.d.ts @@ -104,11 +104,11 @@ declare module 'sqlops' { /** * Sends any updated properties of the component to the UI * - * @returns {Thenable} Thenable that completes once the update + * @returns {Thenable} Thenable that completes once the update * has been applied in the UI * @memberof Component */ - updateProperties(properties: { [key: string]: any }): Thenable; + updateProperties(properties: { [key: string]: any }): Thenable; enabled: boolean; /** diff --git a/src/sql/workbench/api/node/extHostModelView.ts b/src/sql/workbench/api/node/extHostModelView.ts index db805e8130..621c45fdbf 100644 --- a/src/sql/workbench/api/node/extHostModelView.ts +++ b/src/sql/workbench/api/node/extHostModelView.ts @@ -406,12 +406,13 @@ class ComponentWrapper implements sqlops.Component { return this._proxy.$setLayout(this._handle, this.id, layout); } - public updateProperties(): Thenable { + public updateProperties(properties: { [key: string]: any }): Thenable { + this.properties = Object.assign(this.properties, properties); return this.notifyPropertyChanged(); } - protected notifyPropertyChanged(): Thenable { - return this._proxy.$setProperties(this._handle, this._id, this.properties).then(() => true); + protected notifyPropertyChanged(): Thenable { + return this._proxy.$setProperties(this._handle, this._id, this.properties); } public registerEvent(): Thenable { @@ -432,13 +433,13 @@ class ComponentWrapper implements sqlops.Component { } } - protected async setProperty(key: string, value: any): Promise { + protected async setProperty(key: string, value: any): Promise { 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 {