workaround for the dashboard resets zooming issue (#19576)

This commit is contained in:
Alan Ren
2022-05-31 21:04:23 -07:00
committed by GitHub
parent 6c7a8313b2
commit 11a969f44f
3 changed files with 23 additions and 6 deletions

View File

@@ -31,7 +31,7 @@ import * as nls from 'vs/nls';
import * as objects from 'vs/base/common/objects';
import { Event, Emitter } from 'vs/base/common/event';
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 { INotificationService } from 'vs/platform/notification/common/notification';
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 { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { onUnexpectedError } from 'vs/base/common/errors';
const dashboardRegistry = Registry.as<IDashboardRegistry>(DashboardExtensions.DashboardContributions);
const homeTabGroupId = 'home';
const zoomLevelConfiguration = 'window.zoomLevel';
@Component({
selector: 'dashboard-page',
@@ -130,7 +132,8 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
@Inject(IMenuService) private menuService: IMenuService,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@Inject(IInstantiationService) private instantiationService: IInstantiationService
@Inject(IInstantiationService) private instantiationService: IInstantiationService,
@Inject(IConfigurationService) private configurationService: IConfigurationService
) {
super();
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.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[] {

View File

@@ -22,6 +22,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IMenuService } from 'vs/platform/actions/common/actions';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export class DatabaseDashboardPage extends DashboardPage implements OnInit {
protected propertiesWidget: WidgetConfig = {
@@ -52,9 +53,10 @@ export class DatabaseDashboardPage extends DashboardPage implements OnInit {
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
@Inject(IMenuService) menuService: IMenuService,
@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.refresh(true);
this._cd.detectChanges();

View File

@@ -24,6 +24,7 @@ import { IMenuService } from 'vs/platform/actions/common/actions';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export class ServerDashboardPage extends DashboardPage implements OnInit {
protected propertiesWidget: WidgetConfig = {
@@ -55,9 +56,10 @@ export class ServerDashboardPage extends DashboardPage implements OnInit {
@Inject(IContextKeyService) contextKeyService: IContextKeyService,
@Inject(IMenuService) menuService: IMenuService,
@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
const connInfo = this.dashboardService.connectionManagementService.connectionInfo;