Table Designer - Save Changes feature and Editor related features (#17335)

* table designer add/remove row support

* save changes and editor support

* address comments

* fix build error

* including missing change

* lower case request name
This commit is contained in:
Alan Ren
2021-10-11 15:09:25 -07:00
committed by GitHub
parent e5f50499ce
commit ce4459a7b2
23 changed files with 495 additions and 90 deletions

View File

@@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { TableDesignerComponentInput } from 'sql/workbench/services/tableDesigner/browser/tableDesignerComponentInput';
import { Action } from 'vs/base/common/actions';
import { Codicon } from 'vs/base/common/codicons';
import { IDisposable } from 'vs/base/common/lifecycle';
import { localize } from 'vs/nls';
export class SaveTableChangesAction extends Action {
public static ID = 'tableDesigner.saveTableChanges';
public static LABEL = localize('tableDesigner.saveTableChanges', "Save Changes");
private _input: TableDesignerComponentInput;
private _onStateChangeDisposable: IDisposable;
constructor(
) {
super(SaveTableChangesAction.ID, SaveTableChangesAction.LABEL, Codicon.save.classNames);
}
public setContext(input: TableDesignerComponentInput): void {
this._input = input;
this.updateState();
this._onStateChangeDisposable?.dispose();
this._onStateChangeDisposable = input.onStateChange((e) => {
this.updateState();
});
}
public override async run(): Promise<void> {
await this._input.save();
}
private updateState(): void {
this.enabled = this._input.dirty && this._input.valid && !this._input.saving;
}
override dispose() {
super.dispose();
this._onStateChangeDisposable?.dispose();
}
}