mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
workaround for the dashboard resets zooming issue (#19576)
This commit is contained in:
@@ -31,7 +31,7 @@ import * as nls from 'vs/nls';
|
|||||||
import * as objects from 'vs/base/common/objects';
|
import * as objects from 'vs/base/common/objects';
|
||||||
import { Event, Emitter } from 'vs/base/common/event';
|
import { Event, Emitter } from 'vs/base/common/event';
|
||||||
import { Action, IAction, SubmenuAction } from 'vs/base/common/actions';
|
import { Action, IAction, SubmenuAction } from 'vs/base/common/actions';
|
||||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
import { ConfigurationTarget, IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
import Severity from 'vs/base/common/severity';
|
import Severity from 'vs/base/common/severity';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
import { IContextKeyService, ContextKeyExpr, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
import { IContextKeyService, ContextKeyExpr, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||||
@@ -54,9 +54,11 @@ import { LabeledMenuItemActionItem } from 'sql/platform/actions/browser/menuEntr
|
|||||||
import { DASHBOARD_BORDER, TOOLBAR_OVERFLOW_SHADOW } from 'sql/workbench/common/theme';
|
import { DASHBOARD_BORDER, TOOLBAR_OVERFLOW_SHADOW } from 'sql/workbench/common/theme';
|
||||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||||
|
|
||||||
const dashboardRegistry = Registry.as<IDashboardRegistry>(DashboardExtensions.DashboardContributions);
|
const dashboardRegistry = Registry.as<IDashboardRegistry>(DashboardExtensions.DashboardContributions);
|
||||||
const homeTabGroupId = 'home';
|
const homeTabGroupId = 'home';
|
||||||
|
const zoomLevelConfiguration = 'window.zoomLevel';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dashboard-page',
|
selector: 'dashboard-page',
|
||||||
@@ -130,7 +132,8 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
|||||||
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
|
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
|
||||||
@Inject(IMenuService) private menuService: IMenuService,
|
@Inject(IMenuService) private menuService: IMenuService,
|
||||||
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
|
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
|
||||||
@Inject(IInstantiationService) private instantiationService: IInstantiationService
|
@Inject(IInstantiationService) private instantiationService: IInstantiationService,
|
||||||
|
@Inject(IConfigurationService) private configurationService: IConfigurationService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this._tabName = DashboardPage.tabName.bindTo(contextKeyService);
|
this._tabName = DashboardPage.tabName.bindTo(contextKeyService);
|
||||||
@@ -172,6 +175,16 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
|||||||
this._register(this.themeService.onDidColorThemeChange((event: IColorTheme) => {
|
this._register(this.themeService.onDidColorThemeChange((event: IColorTheme) => {
|
||||||
this.updateTheme(event);
|
this.updateTheme(event);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// Workaround for issue: https://github.com/microsoft/azuredatastudio/issues/14128
|
||||||
|
// While the Angular loads the dashboard components, the Electron's zoom level will be reset without going through
|
||||||
|
// the setZoomLevel API in VSCode.
|
||||||
|
// Before a permanent fix is available, to workaround the issue, we can get the current zoom level and
|
||||||
|
// set it so that the electron's zoom level is consistent with the vscode configuration.
|
||||||
|
const currentZoom: number = this.configurationService.getValue(zoomLevelConfiguration);
|
||||||
|
this.configurationService.updateValue(zoomLevelConfiguration, currentZoom - 1).then(() => {
|
||||||
|
return this.configurationService.updateValue(zoomLevelConfiguration, currentZoom);
|
||||||
|
}).catch(onUnexpectedError);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getContributedTasks(tabId: string): ITaskbarContent[] {
|
private getContributedTasks(tabId: string): ITaskbarContent[] {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
|||||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
|
|
||||||
export class DatabaseDashboardPage extends DashboardPage implements OnInit {
|
export class DatabaseDashboardPage extends DashboardPage implements OnInit {
|
||||||
protected propertiesWidget: WidgetConfig = {
|
protected propertiesWidget: WidgetConfig = {
|
||||||
@@ -52,9 +53,10 @@ export class DatabaseDashboardPage extends DashboardPage implements OnInit {
|
|||||||
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
|
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
|
||||||
@Inject(IMenuService) menuService: IMenuService,
|
@Inject(IMenuService) menuService: IMenuService,
|
||||||
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService,
|
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService,
|
||||||
@Inject(IInstantiationService) instantiationService: IInstantiationService
|
@Inject(IInstantiationService) instantiationService: IInstantiationService,
|
||||||
|
@Inject(IConfigurationService) configurationService: IConfigurationService
|
||||||
) {
|
) {
|
||||||
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, themeService, instantiationService);
|
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, themeService, instantiationService, configurationService);
|
||||||
this._register(dashboardService.onUpdatePage(() => {
|
this._register(dashboardService.onUpdatePage(() => {
|
||||||
this.refresh(true);
|
this.refresh(true);
|
||||||
this._cd.detectChanges();
|
this._cd.detectChanges();
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { IMenuService } from 'vs/platform/actions/common/actions';
|
|||||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
|
|
||||||
export class ServerDashboardPage extends DashboardPage implements OnInit {
|
export class ServerDashboardPage extends DashboardPage implements OnInit {
|
||||||
protected propertiesWidget: WidgetConfig = {
|
protected propertiesWidget: WidgetConfig = {
|
||||||
@@ -55,9 +56,10 @@ export class ServerDashboardPage extends DashboardPage implements OnInit {
|
|||||||
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
|
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
|
||||||
@Inject(IMenuService) menuService: IMenuService,
|
@Inject(IMenuService) menuService: IMenuService,
|
||||||
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService,
|
@Inject(IWorkbenchThemeService) themeService: IWorkbenchThemeService,
|
||||||
@Inject(IInstantiationService) instantiationService: IInstantiationService
|
@Inject(IInstantiationService) instantiationService: IInstantiationService,
|
||||||
|
@Inject(IConfigurationService) configurationService: IConfigurationService
|
||||||
) {
|
) {
|
||||||
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, themeService, instantiationService);
|
super(dashboardService, el, _cd, notificationService, angularEventingService, logService, commandService, contextKeyService, menuService, themeService, instantiationService, configurationService);
|
||||||
|
|
||||||
// special-case handling for MSSQL data provider
|
// special-case handling for MSSQL data provider
|
||||||
const connInfo = this.dashboardService.connectionManagementService.connectionInfo;
|
const connInfo = this.dashboardService.connectionManagementService.connectionInfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user