mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
enable keyboard for explain button and Line1 link in message pane (#1132)
This commit is contained in:
@@ -153,12 +153,18 @@ export class ActionBar extends ActionRunner implements IActionRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateFocusedItem(): void {
|
private updateFocusedItem(): void {
|
||||||
|
let actionIndex = 0;
|
||||||
for (let i = 0; i < this._actionsList.children.length; i++) {
|
for (let i = 0; i < this._actionsList.children.length; i++) {
|
||||||
let elem = this._actionsList.children[i];
|
let elem = this._actionsList.children[i];
|
||||||
|
|
||||||
if (DOM.isAncestor(document.activeElement, elem)) {
|
if (DOM.isAncestor(document.activeElement, elem)) {
|
||||||
this._focusedItem = i;
|
this._focusedItem = actionIndex;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (elem.classList.contains('action-item')) {
|
||||||
|
actionIndex++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
<ng-template ngFor let-message [ngForOf]="messages">
|
<ng-template ngFor let-message [ngForOf]="messages">
|
||||||
<tr class='messageRow'>
|
<tr class='messageRow'>
|
||||||
<td><span *ngIf="message.link">[{{message.time}}]</span></td>
|
<td><span *ngIf="message.link">[{{message.time}}]</span></td>
|
||||||
<td class="resultsMessageValue" [class.errorMessage]="message.isError" [class.batchMessage]="!message.link">{{message.message}} <a class="queryLink" *ngIf="message.link" (click)="onSelectionLinkClicked(message.batchId)">{{message.link.text}}</a>
|
<td class="resultsMessageValue" [class.errorMessage]="message.isError" [class.batchMessage]="!message.link">{{message.message}} <a tabindex="0" #queryLink class="queryLink" *ngIf="message.link" (click)="onSelectionLinkClicked(message.batchId)" (keyup)="onKey($event, message.batchId)">{{message.link.text}}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@@ -26,10 +26,12 @@ import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/
|
|||||||
import { QueryComponentParams } from 'sql/services/bootstrap/bootstrapParams';
|
import { QueryComponentParams } from 'sql/services/bootstrap/bootstrapParams';
|
||||||
import { error } from 'sql/base/common/log';
|
import { error } from 'sql/base/common/log';
|
||||||
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
||||||
|
import { clone } from 'sql/base/common/objects';
|
||||||
|
|
||||||
import * as strings from 'vs/base/common/strings';
|
import * as strings from 'vs/base/common/strings';
|
||||||
import { clone } from 'sql/base/common/objects';
|
|
||||||
import * as DOM from 'vs/base/browser/dom';
|
import * as DOM from 'vs/base/browser/dom';
|
||||||
|
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||||
|
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||||
|
|
||||||
export const QUERY_SELECTOR: string = 'query-component';
|
export const QUERY_SELECTOR: string = 'query-component';
|
||||||
|
|
||||||
@@ -150,7 +152,7 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
|||||||
@ViewChildren('slickgrid') slickgrids: QueryList<SlickGrid>;
|
@ViewChildren('slickgrid') slickgrids: QueryList<SlickGrid>;
|
||||||
// tslint:disable-next-line:no-unused-variable
|
// tslint:disable-next-line:no-unused-variable
|
||||||
@ViewChild('resultsPane', { read: ElementRef }) private _resultsPane: ElementRef;
|
@ViewChild('resultsPane', { read: ElementRef }) private _resultsPane: ElementRef;
|
||||||
|
@ViewChild('queryLink', { read: ElementRef }) private _queryLinkElement: ElementRef;
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
|
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
|
||||||
@Inject(forwardRef(() => ChangeDetectorRef)) cd: ChangeDetectorRef,
|
@Inject(forwardRef(() => ChangeDetectorRef)) cd: ChangeDetectorRef,
|
||||||
@@ -404,6 +406,16 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
|||||||
this.dataService.setEditorSelection(index);
|
this.dataService.setEditorSelection(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onKey(e: Event, index: number) {
|
||||||
|
if (DOM.isAncestor(<HTMLElement>e.target, this._queryLinkElement.nativeElement) && e instanceof KeyboardEvent) {
|
||||||
|
let event = new StandardKeyboardEvent(e);
|
||||||
|
if (event.equals(KeyCode.Enter)) {
|
||||||
|
this.onSelectionLinkClicked(index);
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the resize for the messages/results panes bar
|
* Sets up the resize for the messages/results panes bar
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user