mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
add button to open query store report in new tab (#24303)
* add button to open query store report in new tab * addressing comments
This commit is contained in:
@@ -9,6 +9,10 @@ const localize = nls.loadMessageBundle();
|
||||
|
||||
export function queryStoreDashboardTitle(databaseName: string): string { return localize('queryStoreDashboardTitle', "Query Store - {0}", databaseName); }
|
||||
|
||||
// report dashboard tab ids
|
||||
export const overallResourceConsumptionTabId = 'OverallResourceConsumptionTab';
|
||||
export const topResourceConsumingQueriesTabId = 'TopResourceConsumingQueriesTab';
|
||||
|
||||
export const overallResourceConsumption = localize('overallResourceConsumption', "Overall Resource Consumption");
|
||||
export const duration = localize('duration', "Duration");
|
||||
export const executionCount = localize('executionCount', "Execution Count");
|
||||
@@ -23,6 +27,7 @@ export function plan(queryId: string): string { return localize('plan', "Plan {0
|
||||
export function topResourceConsumingQueriesToolbarLabel(databaseName: string): string { return localize('topResourceConsumingQueriesToolbarLabel', "Top 25 resource consumers for database {0}", databaseName); }
|
||||
|
||||
export const configure = localize('configure', "Configure");
|
||||
export const openInNewTab = localize('openInNewTab', "Open In New Tab");
|
||||
export const okButtonText = localize('okButtonText', "Ok");
|
||||
export const cancelButtonText = localize('cancelButtonText', "Cancel");
|
||||
export const applyButtonText = localize('applyButtonText', "Apply");
|
||||
|
||||
40
extensions/query-store/src/common/iconHelper.ts
Normal file
40
extensions/query-store/src/common/iconHelper.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export interface IconPath {
|
||||
dark: string;
|
||||
light: string;
|
||||
}
|
||||
|
||||
export class IconPathHelper {
|
||||
private static extensionContext: vscode.ExtensionContext;
|
||||
public static multipleWindows: IconPath;
|
||||
public static gear: IconPath;
|
||||
|
||||
public static setExtensionContext(extensionContext: vscode.ExtensionContext) {
|
||||
IconPathHelper.extensionContext = extensionContext;
|
||||
|
||||
IconPathHelper.gear = IconPathHelper.makeIcon('gear');
|
||||
IconPathHelper.multipleWindows = IconPathHelper.makeIcon('multiple-windows');
|
||||
}
|
||||
|
||||
private static makeIcon(name: string, sameIcon: boolean = false) {
|
||||
const folder = 'images';
|
||||
|
||||
if (sameIcon) {
|
||||
return {
|
||||
dark: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/${name}.svg`),
|
||||
light: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/${name}.svg`)
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
dark: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/dark/${name}.svg`),
|
||||
light: IconPathHelper.extensionContext.asAbsolutePath(`${folder}/light/${name}.svg`)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
25
extensions/query-store/src/common/promise.ts
Normal file
25
extensions/query-store/src/common/promise.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Deferred promise
|
||||
*/
|
||||
export class Deferred<T = void> {
|
||||
promise: Promise<T>;
|
||||
resolve!: (value: T | PromiseLike<T>) => void;
|
||||
reject!: (reason?: any) => void;
|
||||
constructor() {
|
||||
this.promise = new Promise<T>((resolve, reject) => {
|
||||
this.resolve = resolve;
|
||||
this.reject = reject;
|
||||
});
|
||||
}
|
||||
|
||||
then<TResult>(onFulfilled?: (value: T) => TResult | Thenable<TResult>, onRejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
|
||||
then<TResult>(onFulfilled?: (value: T) => TResult | Thenable<TResult>, onRejected?: (reason: any) => void): Thenable<TResult>;
|
||||
then<TResult>(onFulfilled?: (value: T) => TResult | Thenable<TResult>, onRejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult> {
|
||||
return this.promise.then(onFulfilled, onRejected);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user