mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 01:25:37 -05:00
Time elapsed status item (#3006)
* added time elapsed status item * add missing files
This commit is contained in:
@@ -14,6 +14,7 @@ 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 { TimeElapsedStatusBarItem } from 'sql/parts/query/common/timeElapsedStatus';
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
|
||||
@@ -86,6 +87,12 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
// Register Statusbar items
|
||||
|
||||
(<statusbar.IStatusbarRegistry>platform.Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(new statusbar.StatusbarItemDescriptor(
|
||||
TimeElapsedStatusBarItem,
|
||||
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(
|
||||
RowCountStatusBarItem,
|
||||
statusbar.StatusbarAlignment.RIGHT,
|
||||
@@ -352,7 +359,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public disposeQuery(ownerUri: string): void {
|
||||
// Get existing query runner
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
let queryRunner = this.internalGetQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
queryRunner.disposeQuery();
|
||||
}
|
||||
@@ -444,7 +451,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public disposeEdit(ownerUri: string): Thenable<void> {
|
||||
// Get existing query runner
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
let queryRunner = this.internalGetQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.disposeEdit(ownerUri);
|
||||
}
|
||||
@@ -453,7 +460,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.internalGetQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.updateCell(ownerUri, rowId, columnId, newValue).then((result) => result, error => {
|
||||
this._notificationService.notify({
|
||||
@@ -468,7 +475,7 @@ export class QueryModelService implements IQueryModelService {
|
||||
|
||||
public commitEdit(ownerUri): Thenable<void> {
|
||||
// Get existing query runner
|
||||
let queryRunner = this.getQueryRunner(ownerUri);
|
||||
let queryRunner = this.internalGetQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.commitEdit(ownerUri).then(() => { }, error => {
|
||||
this._notificationService.notify({
|
||||
@@ -483,7 +490,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.internalGetQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.createRow(ownerUri);
|
||||
}
|
||||
@@ -492,7 +499,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.internalGetQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.deleteRow(ownerUri, rowId);
|
||||
}
|
||||
@@ -501,7 +508,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.internalGetQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.revertCell(ownerUri, rowId, columnId);
|
||||
}
|
||||
@@ -510,16 +517,25 @@ 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.internalGetQueryRunner(ownerUri);
|
||||
if (queryRunner) {
|
||||
return queryRunner.revertRow(ownerUri, rowId);
|
||||
}
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
public getQueryRunner(ownerUri): QueryRunner {
|
||||
let queryRunner: QueryRunner = undefined;
|
||||
if (this._queryInfoMap.has(ownerUri)) {
|
||||
queryRunner = this._getQueryInfo(ownerUri).queryRunner;
|
||||
}
|
||||
// return undefined if not found or is already executing
|
||||
return queryRunner;
|
||||
}
|
||||
|
||||
// PRIVATE METHODS //////////////////////////////////////////////////////
|
||||
|
||||
public getQueryRunner(ownerUri): QueryRunner {
|
||||
private internalGetQueryRunner(ownerUri): QueryRunner {
|
||||
let queryRunner: QueryRunner = undefined;
|
||||
if (this._queryInfoMap.has(ownerUri)) {
|
||||
let existingRunner = this._getQueryInfo(ownerUri).queryRunner;
|
||||
|
||||
Reference in New Issue
Block a user