mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
add row status on status bar for queries (#1841)
This commit is contained in:
@@ -13,6 +13,7 @@ import { IQueryModelService } from 'sql/parts/query/execution/queryModel';
|
||||
import { QueryInput } from 'sql/parts/query/common/queryInput';
|
||||
import { QueryStatusbarItem } from 'sql/parts/query/execution/queryStatus';
|
||||
import { SqlFlavorStatusbarItem } from 'sql/parts/query/common/flavorStatus';
|
||||
import { RowCountStatusBarItem } from 'sql/parts/query/common/rowCountStatus';
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
import { ISlickRange } from 'angular2-slickgrid';
|
||||
@@ -85,6 +86,13 @@ export class QueryModelService implements IQueryModelService {
|
||||
this._onEditSessionReady = new Emitter<sqlops.EditSessionReadyParams>();
|
||||
|
||||
// Register Statusbar items
|
||||
|
||||
(<statusbar.IStatusbarRegistry>platform.Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(new statusbar.StatusbarItemDescriptor(
|
||||
RowCountStatusBarItem,
|
||||
statusbar.StatusbarAlignment.RIGHT,
|
||||
100 /* Should appear to the right of the SQL editor status */
|
||||
));
|
||||
|
||||
(<statusbar.IStatusbarRegistry>platform.Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(new statusbar.StatusbarItemDescriptor(
|
||||
QueryStatusbarItem,
|
||||
statusbar.StatusbarAlignment.RIGHT,
|
||||
@@ -345,7 +353,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public disposeQuery(ownerUri: string): void {
|
||||
// Get existing query runner
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
queryRunner.disposeQuery();
|
||||
}
|
||||
@@ -437,7 +445,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public disposeEdit(ownerUri: string): Thenable<void> {
|
||||
// Get existing query runner
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.disposeEdit(ownerUri);
|
||||
}
|
||||
@@ -446,7 +454,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public updateCell(ownerUri: string, rowId: number, columnId: number, newValue: string): Thenable<sqlops.EditUpdateCellResult> {
|
||||
// Get existing query runner
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.updateCell(ownerUri, rowId, columnId, newValue).then((result) => result, error => {
|
||||
this._notificationService.notify({
|
||||
@@ -461,7 +469,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public commitEdit(ownerUri): Thenable<void> {
|
||||
// Get existing query runner
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.commitEdit(ownerUri).then(() => { }, error => {
|
||||
this._notificationService.notify({
|
||||
@@ -476,7 +484,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public createRow(ownerUri: string): Thenable<sqlops.EditCreateRowResult> {
|
||||
// Get existing query runner
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.createRow(ownerUri);
|
||||
}
|
||||
@@ -485,7 +493,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public deleteRow(ownerUri: string, rowId: number): Thenable<void> {
|
||||
// Get existing query runner
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.deleteRow(ownerUri, rowId);
|
||||
}
|
||||
@@ -494,7 +502,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public revertCell(ownerUri: string, rowId: number, columnId: number): Thenable<sqlops.EditRevertCellResult> {
|
||||
// Get existing query runner
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.revertCell(ownerUri, rowId, columnId);
|
||||
}
|
||||
@@ -503,7 +511,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public revertRow(ownerUri: string, rowId: number): Thenable<void> {
|
||||
// Get existing query runner
|
||||
let queryRunner = this._getQueryRunner(ownerUri);
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.revertRow(ownerUri, rowId);
|
||||
}
|
||||
@@ -512,7 +520,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
// PRIVATE METHODS //////////////////////////////////////////////////////
|
||||
|
||||
private _getQueryRunner(ownerUri): QueryRunner {
|
||||
public getQueryRunner(ownerUri): QueryRunner {
|
||||
let queryRunner: QueryRunner = undefined;
|
||||
if (this._queryInfoMap.has(ownerUri)) {
|
||||
let existingRunner = this._getQueryInfo(ownerUri).queryRunner;
|
||||
|
||||
Reference in New Issue
Block a user