Automatically focus the execute button in the DacFx wizard summary screens (#6984)

* Focus piping for extension buttons

* Focus the done button when entering the summary page for DacFx wizard

* Adding internal value resets for extension-side button model.

* Correcting remark string
This commit is contained in:
Benjin Dubishar
2019-09-09 14:57:28 -07:00
committed by GitHub
parent 3e9b694e6f
commit 66cdbbb335
7 changed files with 46 additions and 2 deletions

View File

@@ -207,6 +207,7 @@ class ButtonImpl implements azdata.window.Button {
private _label: string;
private _enabled: boolean;
private _hidden: boolean;
private _focused: boolean;
private _onClick = new Emitter<void>();
public onClick = this._onClick.event;
@@ -243,6 +244,23 @@ class ButtonImpl implements azdata.window.Button {
this._extHostModelViewDialog.updateButton(this);
}
public get focused(): boolean {
return this._focused;
}
/**
* Focuses the button when set to "true", then the internal value is immediately reset to 'undefined'.
*
* @remarks
* Because communication between ADS and extensions is unidirectional, a focus change by the user is not
* communicated to the extension. The internal value is reset to avoid inconsistent models of where focus is.
*/
public set focused(focused: boolean) {
this._focused = focused;
this._extHostModelViewDialog.updateButton(this);
this._focused = undefined;
}
public getOnClickCallback(): () => void {
return () => this._onClick.fire();
}
@@ -568,7 +586,8 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
this._proxy.$setButtonDetails(handle, {
label: button.label,
enabled: button.enabled,
hidden: button.hidden
hidden: button.hidden,
focused: button.focused
});
}

View File

@@ -251,6 +251,7 @@ export interface IModelViewButtonDetails {
label: string;
enabled: boolean;
hidden: boolean;
focused?: boolean;
}
export interface IModelViewWizardPageDetails {