fix: [SDA-1567] add menu item for disable gpu (#884)

* SDA-1567: upgrade electron to 6.1.7

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* SDA-1567: add menu item for managing gpu

* SDA-1567: add documentation for dialog-handler.ts

* SDA-1567: fix chrome flags unit test

* SDA-1567: update package-lock.json

* SDA-1567: add disable gpu menu item

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* SDA-1567: fix unit tests and update dialog-handler.ts

- Fix unit tests
- Update dialog handler to write to config file regardless of user restarting the app immediately

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* SDA-1567: revert electron upgrade

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>

* SDA-1567: fix translations

Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>
This commit is contained in:
Vishwas Shashidhar 2020-03-04 17:49:43 +05:30 committed by GitHub
parent 62072901a1
commit 5504a8e8ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 117 additions and 25 deletions

View File

@ -10,6 +10,7 @@
"memoryThreshold": "800",
"devToolsEnabled": true,
"contextIsolation": true,
"disableGpu": false,
"ctWhitelist": [],
"podWhitelist": [],
"notificationSettings": {
@ -19,7 +20,6 @@
"customFlags": {
"authServerWhitelist": "",
"authNegotiateDelegateWhitelist": "",
"disableGpu": false,
"disableThrottling": false
},
"permissions": {

32
package-lock.json generated
View File

@ -4736,9 +4736,9 @@
"dev": true
},
"electron": {
"version": "6.1.5",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-6.1.5.tgz",
"integrity": "sha1-HxvFQEJYfYNo7dQ//ssM58hMq4c=",
"version": "6.1.7",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/electron/-/electron-6.1.7.tgz",
"integrity": "sha1-pnaV+B9ct3Hjlbz5cRVgUg40fFQ=",
"dev": true,
"requires": {
"@types/node": "^10.12.18",
@ -4747,9 +4747,9 @@
},
"dependencies": {
"@types/node": {
"version": "10.17.6",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/@types/node/-/node-10.17.6.tgz",
"integrity": "sha1-Gqq9b2Rwpqw4JKselNcxyhMm2T0=",
"version": "10.17.13",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/@types/node/-/node-10.17.13.tgz",
"integrity": "sha1-zOvNuZC9YTnNFuhMOdwvsQI8qQw=",
"dev": true
}
}
@ -12701,6 +12701,12 @@
"integrity": "sha1-LpZJFZmpbN4bUV1WdKj3qRRSkmo=",
"dev": true
},
"run-script-os": {
"version": "1.0.7",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/run-script-os/-/run-script-os-1.0.7.tgz",
"integrity": "sha1-fNURRKGcbKNk/maEM/VbR7q/R0k=",
"optional": true
},
"rxjs": {
"version": "5.5.11",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/rxjs/-/rxjs-5.5.11.tgz",
@ -13060,9 +13066,12 @@
}
},
"screen-share-indicator-frame": {
"version": "1.1.0",
"resolved": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#14cf6452610252458650056d568918345abf4eb4",
"optional": true
"version": "1.4.0",
"resolved": "git+https://github.com/symphonyoss/ScreenShareIndicatorFrame.git#adc3fdb0fa96629773ea2bc13b20b9ffd109ac1d",
"optional": true,
"requires": {
"run-script-os": "1.0.7"
}
},
"screen-snippet": {
"version": "1.0.6",
@ -13908,6 +13917,11 @@
"acorn-node": "^1.2.0"
}
},
"systeminformation": {
"version": "4.21.0",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/systeminformation/-/systeminformation-4.21.0.tgz",
"integrity": "sha1-BAmd3CGK1CmQxL6A98IexO/2upw="
},
"tar": {
"version": "2.2.1",
"resolved": "https://repo.symphony.com/artifactory/api/npm/npm-virtual-dev/tar/-/tar-2.2.1.tgz",

View File

@ -142,7 +142,8 @@
"react": "16.9.0",
"react-dom": "16.9.0",
"ref-napi": "1.4.1",
"shell-path": "2.1.0"
"shell-path": "2.1.0",
"systeminformation": "4.21.0"
},
"optionalDependencies": {
"screen-snippet": "git+https://github.com/symphonyoss/ScreenSnippet2.git#v1.0.6",

View File

@ -3,17 +3,17 @@ import { config } from '../src/app/config-handler';
import { isDevEnv, isLinux, isMac, isWindowsOS } from '../src/common/env';
import { app } from './__mocks__/electron';
jest.mock('../src/common/utils', () => {
jest.mock('../src/app/config-handler', () => {
return {
config: {
getCloudConfigField: jest.fn(() => {
getConfigFields: jest.fn(() => {
return {
customFlags: {
authServerWhitelist: 'url',
authNegotiateDelegateWhitelist: 'whitelist',
disableGpu: true,
disableThrottling: false,
},
disableGpu: true,
};
}),
},
@ -40,8 +40,8 @@ describe('chrome flags', () => {
customFlags: {
authServerWhitelist: 'url',
authNegotiateDelegateWhitelist: 'whitelist',
disableGpu: true,
},
disableGpu: true,
};
});
jest.clearAllMocks();

View File

@ -11,7 +11,7 @@ import {
} from './analytics-handler';
import { autoLaunchInstance as autoLaunch } from './auto-launch-controller';
import { CloudConfigDataTypes, config, IConfig } from './config-handler';
import { titleBarChangeDialog } from './dialog-handler';
import { gpuRestartDialog, titleBarChangeDialog } from './dialog-handler';
import { exportCrashDumps, exportLogs } from './reports-handler';
import { updateAlwaysOnTop } from './window-actions';
import { ICustomBrowserWindow, windowHandler } from './window-handler';
@ -72,12 +72,14 @@ export class AppMenu {
private cloudConfig: IConfig | {};
private readonly menuItemConfigFields: string[];
private disableGpu: boolean;
constructor() {
this.menuList = [];
this.locale = i18n.getLocale();
this.menuItemConfigFields = [ 'minimizeOnClose', 'launchOnStartup', 'alwaysOnTop', 'bringToFront', 'memoryRefresh', 'isCustomTitleBar', 'devToolsEnabled' ];
this.cloudConfig = config.getFilteredCloudConfigFields(this.menuItemConfigFields);
this.disableGpu = config.getConfigFields(['disableGpu']).disableGpu;
this.buildMenu();
// send initial analytic
if (!initialAnalyticsSent) {
@ -450,6 +452,14 @@ export class AppMenu {
return;
}
},
},
{
label: this.disableGpu
? i18n.t('Enable GPU')()
: i18n.t('Disable GPU')(),
click: () => {
gpuRestartDialog(!this.disableGpu);
},
} ],
}, {
label: i18n.t('About Symphony')(),

View File

@ -15,16 +15,16 @@ const specialArgs = [ '--url', '--multiInstance', '--userDataPath=', 'symphony:/
*/
export const setChromeFlags = () => {
logger.info(`chrome-flags: Checking if we need to set chrome flags!`);
const { customFlags } = config.getConfigFields([ 'customFlags' ]) as IConfig;
const flagsConfig = config.getConfigFields(['customFlags', 'disableGpu']) as IConfig;
const configFlags: object = {
'auth-negotiate-delegate-whitelist': customFlags.authServerWhitelist,
'auth-server-whitelist': customFlags.authNegotiateDelegateWhitelist,
'auth-negotiate-delegate-whitelist': flagsConfig.customFlags.authServerWhitelist,
'auth-server-whitelist': flagsConfig.customFlags.authNegotiateDelegateWhitelist,
'disable-background-timer-throttling': 'true',
'disable-d3d11': customFlags.disableGpu || null,
'disable-gpu': customFlags.disableGpu || null,
'disable-gpu-compositing': customFlags.disableGpu || null,
'disable-renderer-backgrounding': customFlags.disableThrottling || null,
'disable-d3d11': flagsConfig.disableGpu || null,
'disable-gpu': flagsConfig.disableGpu || null,
'disable-gpu-compositing': flagsConfig.disableGpu || null,
'disable-renderer-backgrounding': flagsConfig.customFlags.disableThrottling || null,
};
for (const key in configFlags) {

View File

@ -31,6 +31,7 @@ export interface IConfig {
isCustomTitleBar: CloudConfigDataTypes;
memoryRefresh: CloudConfigDataTypes;
memoryThreshold: string;
disableGpu: boolean;
devToolsEnabled: boolean;
ctWhitelist: string[];
podWhitelist: string[];
@ -94,7 +95,6 @@ export interface IPermission {
export interface ICustomFlag {
authServerWhitelist: string;
authNegotiateDelegateWhitelist: string;
disableGpu: boolean;
disableThrottling: boolean;
}

View File

@ -13,6 +13,7 @@ export const getDefaultUserConfig = (): IConfig => {
isCustomTitleBar: CloudConfigDataTypes.ENABLED,
memoryRefresh: CloudConfigDataTypes.ENABLED,
memoryThreshold: '800',
disableGpu: false,
devToolsEnabled: true,
ctWhitelist: [],
podWhitelist: [],
@ -23,7 +24,6 @@ export const getDefaultUserConfig = (): IConfig => {
customFlags: {
authServerWhitelist: '',
authNegotiateDelegateWhitelist: '',
disableGpu: false,
disableThrottling: false,
},
permissions: {

View File

@ -167,3 +167,27 @@ export const titleBarChangeDialog = async (isNativeStyle: CloudConfigDataTypes)
app.exit();
}
};
/**
* Displays a dialog to restart app upon changing gpu settings
* @param disableGpu
*/
export const gpuRestartDialog = async (disableGpu: boolean) => {
const focusedWindow = electron.BrowserWindow.getFocusedWindow();
if (!focusedWindow || !windowExists(focusedWindow)) {
return;
}
const options = {
type: 'question',
title: i18n.t('Relaunch Application')(),
message: i18n.t('Would you like to restart and apply these new settings now?')(),
buttons: [ i18n.t('Restart')(), i18n.t('Later')() ],
cancelId: 1,
};
const { response } = await electron.dialog.showMessageBox(focusedWindow, options);
await config.updateUserConfig({ disableGpu });
if (response === 0) {
app.relaunch();
app.exit();
}
};

View File

@ -1,5 +1,6 @@
import { app } from 'electron';
import * as os from 'os';
import * as si from 'systeminformation';
import { logger } from '../common/logger';
export class AppStats {
@ -16,6 +17,7 @@ export class AppStats {
this.logAppMetrics();
this.logConfigurationData();
this.logAppEvents();
this.logAllStats();
}
/**
@ -96,6 +98,16 @@ export class AppStats {
logger.info(`stats: Electron Version? ${process.versions.electron}`);
}
/**
* Log all system statistics
*/
private async logAllStats() {
try {
logger.info(`All Data: ${JSON.stringify(await si.getAllData())}`);
} catch (e) {
logger.error(`Error gathering all data: ${e}`);
}
}
}
const appStats = new AppStats();

View File

@ -55,6 +55,7 @@
"Dev Tools disabled": "Dev Tools disabled",
"Dev Tools has been disabled! Please contact your system administrator to enable it!": "Dev Tools has been disabled! Please contact your system administrator to enable it!",
"Disable Hamburger menu": "Disable Hamburger menu",
"Disable GPU": "Disable GPU",
"DownloadManager": {
"downloaded": "downloaded",
"File not Found": "File not Found",
@ -65,6 +66,7 @@
},
"Edit": "Edit",
"Enable Hamburger menu": "Enable Hamburger menu",
"Enable GPU": "Enable GPU",
"Error loading configuration": "Error loading configuration",
"Error loading URL": "Error loading URL",
"Error loading window": "Error loading window",
@ -76,6 +78,7 @@
"Hide Others": "Hide Others",
"Hide Symphony": "Hide Symphony",
"Ignore": "Ignore",
"Later": "Later",
"Learn More": "Learn More",
"Loading Error": "Loading Error",
"Minimize": "Minimize",
@ -126,6 +129,7 @@
"Redo": "Redo",
"Refresh app when idle": "Refresh app when idle",
"Relaunch": "Relaunch",
"Restart": "Restart",
"Relaunch Application": "Relaunch Application",
"Reload": "Reload",
"Renderer Process Crashed": "Renderer Process Crashed",
@ -192,6 +196,7 @@
"Updating Title bar style requires Symphony to relaunch.": "Updating Title bar style requires Symphony to relaunch.",
"View": "View",
"Window": "Window",
"Would you like to restart and apply these new settings now?": "Would you like to restart and apply these new settings now?",
"Your administrator has disabled": "Your administrator has disabled",
"Zoom": "Zoom",
"Zoom In": "Zoom In",

View File

@ -55,6 +55,7 @@
"Dev Tools disabled": "Dev Tools disabled",
"Dev Tools has been disabled! Please contact your system administrator to enable it!": "Dev Tools has been disabled! Please contact your system administrator to enable it!",
"Disable Hamburger menu": "Disable Hamburger menu",
"Disable GPU": "Disable GPU",
"DownloadManager": {
"downloaded": "downloaded",
"File not Found": "File not Found",
@ -65,6 +66,7 @@
},
"Edit": "Edit",
"Enable Hamburger menu": "Enable Hamburger menu",
"Enable GPU": "Enable GPU",
"Error loading configuration": "Error loading configuration",
"Error loading URL": "Error loading URL",
"Error loading window": "Error loading window",
@ -76,6 +78,7 @@
"Hide Others": "Hide Others",
"Hide Symphony": "Hide Symphony",
"Ignore": "Ignore",
"Later": "Later",
"Learn More": "Learn More",
"Loading Error": "Loading Error",
"Minimize": "Minimize",
@ -126,6 +129,7 @@
"Redo": "Redo",
"Refresh app when idle": "Refresh app when idle",
"Relaunch": "Relaunch",
"Restart": "Restart",
"Relaunch Application": "Relaunch Application",
"Reload": "Reload",
"Renderer Process Crashed": "Renderer Process Crashed",
@ -192,6 +196,7 @@
"Updating Title bar style requires Symphony to relaunch.": "Updating Title bar style requires Symphony to relaunch.",
"View": "View",
"Window": "Window",
"Would you like to restart and apply these new settings now?": "Would you like to restart and apply these new settings now?",
"Your administrator has disabled": "Your administrator has disabled",
"Zoom": "Zoom",
"Zoom In": "Zoom In",

View File

@ -31,6 +31,7 @@
"Build expired": "Construit expiré",
"Cancel": "Annuler",
"Certificate Error": "Erreur de certificat",
"Changing GPU settings requires Symphony to relaunch.": "La modification des paramètres du GPU nécessite la relance de Symphony.",
"Clear cache and Reload": "Vider le cache et rafraîchir Symphony",
"Close": "Fermer",
"ContextMenu": {
@ -55,6 +56,7 @@
"Dev Tools disabled": "Outils de développement désactivés",
"Dev Tools has been disabled! Please contact your system administrator to enable it!": "Dev Tools a été désactivé ! Veuillez contacter votre administrateur système pour lactiver !",
"Disable Hamburger menu": "Désactiver le menu Hamburger",
"Disable GPU": "Désactiver le GPU",
"DownloadManager": {
"downloaded": "téléchargé",
"File not Found": "Fichier non trouvé",
@ -65,6 +67,7 @@
},
"Edit": "Modifier",
"Enable Hamburger menu": "Activer le menu Hamburger",
"Enable GPU": "Activer le GPU",
"Error loading configuration": "Erreur de chargement de la configuration",
"Error loading URL": "Erreur de chargement de l'URL",
"Error loading window": "Erreur de chargement de la fenêtre",
@ -76,6 +79,7 @@
"Hide Others": "Cacher les autres applications",
"Hide Symphony": "Cacher Symphony",
"Ignore": "Ignorer",
"Later": "Plus tard",
"Learn More": "En savoir plus sur Symphony",
"Loading Error": "Erreur lors du chargement",
"Minimize": "Minimiser",
@ -126,6 +130,7 @@
"Redo": "Répéter la dernière opération",
"Refresh app when idle": "Rafraîchir Symphony pendant les périodes d'inactivité",
"Relaunch": "Redémarrer",
"Restart": "Redémarrer",
"Relaunch Application": "Redémarrer l'application",
"Reload": "Recharger",
"Renderer Process Crashed": "Processus de rendu a eu un crash",
@ -192,6 +197,7 @@
"Updating Title bar style requires Symphony to relaunch.": "La mise à jour du style de la barre de titre nécessite le redémarrage de Symphony.",
"View": "Visualiser",
"Window": "Fenêtre",
"Would you like to restart and apply these new settings now?": "Would you like to restart and apply these new settings now?",
"Your administrator has disabled": "Votre administrateur a désactivé",
"Zoom": "Zoom",
"Zoom In": "Zoom Avant",

View File

@ -55,6 +55,7 @@
"Dev Tools disabled": "Outils de développement désactivés",
"Dev Tools has been disabled! Please contact your system administrator to enable it!": "Dev Tools a été désactivé ! Veuillez contacter votre administrateur système pour lactiver !",
"Disable Hamburger menu": "Désactiver le menu Hamburger",
"Disable GPU": "Désactiver le GPU",
"DownloadManager": {
"downloaded": "téléchargé",
"File not Found": "Fichier non trouvé",
@ -65,6 +66,7 @@
},
"Edit": "Modifier",
"Enable Hamburger menu": "Activer le menu Hamburger",
"Enable GPU": "Activer le GPU",
"Error loading configuration": "Erreur de chargement de la configuration",
"Error loading URL": "Erreur de chargement de l'URL",
"Error loading window": "Erreur de chargement de la fenêtre",
@ -76,6 +78,7 @@
"Hide Others": "Cacher les autres applications",
"Hide Symphony": "Cacher Symphony",
"Ignore": "Ignorer",
"Later": "Plus tard",
"Learn More": "En savoir plus sur Symphony",
"Loading Error": "Erreur lors du chargement",
"Minimize": "Minimiser",
@ -126,6 +129,7 @@
"Redo": "Répéter la dernière opération",
"Refresh app when idle": "Rafraîchir Symphony pendant les périodes d'inactivité",
"Relaunch": "Redémarrer",
"Restart": "Redémarrer",
"Relaunch Application": "Redémarrer l'application",
"Reload": "Recharger",
"Renderer Process Crashed": "Processus de rendu a eu un crash",
@ -192,6 +196,7 @@
"Updating Title bar style requires Symphony to relaunch.": "La mise à jour du style de la barre de titre nécessite le redémarrage de Symphony.",
"View": "Visualiser",
"Window": "Fenêtre",
"Would you like to restart and apply these new settings now?": "Would you like to restart and apply these new settings now?",
"Your administrator has disabled": "Votre administrateur a désactivé",
"Zoom": "Zoom",
"Zoom In": "Zoom Avant",

View File

@ -55,6 +55,7 @@
"Dev Tools disabled": "開発ツールが無効",
"Dev Tools has been disabled! Please contact your system administrator to enable it!": "開発ツールが無効になっています。システム管理者に連絡して、有効にしてください。",
"Disable Hamburger menu": "ハンバーガーメニューを無効にする",
"Disable GPU": "GPUを無効にする",
"DownloadManager": {
"downloaded": "ダウンロード済み",
"File not Found": "ファイルが見つかりません",
@ -65,6 +66,7 @@
},
"Edit": "編集",
"Enable Hamburger menu": "ハンバーガーメニューを有効にする",
"Enable GPU": "GPUを有効にする",
"Error loading configuration": "構成の読み込みエラー",
"Error loading URL": "URLの読み込みエラー",
"Error loading window": "ウィンドウを読み込みエラー",
@ -76,6 +78,7 @@
"Hide Others": "他を隠す",
"Hide Symphony": "Symphonyを隠す",
"Ignore": "無視",
"Later": "後で",
"Learn More": "詳細",
"Loading Error": "読み込みエラー",
"Minimize": "最小化",
@ -126,6 +129,7 @@
"Redo": "やり直し",
"Refresh app when idle": "アイドル時にアプリを再表示",
"Relaunch": "「リスタート」",
"Restart": "再起動する",
"Relaunch Application": "アプリケーションの再起動",
"Reload": "再読み込み",
"Renderer Process Crashed": "レンダラープロセスがクラッシュしました",
@ -192,6 +196,7 @@
"Updating Title bar style requires Symphony to relaunch.": "タイトルバーのスタイルを更新するには、Symphonyが再起動する必要があります。",
"View": "ビュー",
"Window": "ウインドウ",
"Would you like to restart and apply these new settings now?": "今すぐ再起動して、新しい設定を適用しますか?",
"Your administrator has disabled": "管理者によて無効にされています",
"Zoom": "ズーム",
"Zoom In": "ズームイン",

View File

@ -55,6 +55,7 @@
"Dev Tools disabled": "開発ツールが無効",
"Dev Tools has been disabled! Please contact your system administrator to enable it!": "開発ツールが無効になっています。システム管理者に連絡して、有効にしてください。",
"Disable Hamburger menu": "ハンバーガーメニューを無効にする",
"Disable GPU": "GPUを無効にする",
"DownloadManager": {
"downloaded": "ダウンロード済み",
"File not Found": "ファイルが見つかりません",
@ -65,6 +66,7 @@
},
"Edit": "編集",
"Enable Hamburger menu": "ハンバーガーメニューを有効にする",
"Enable GPU": "GPUを有効にする",
"Error loading configuration": "構成の読み込みエラー",
"Error loading URL": "URLの読み込みエラー",
"Error loading window": "ウィンドウを読み込みエラー",
@ -76,6 +78,7 @@
"Hide Others": "他を隠す",
"Hide Symphony": "Symphonyを隠す",
"Ignore": "無視",
"Later": "後で",
"Learn More": "詳細",
"Loading Error": "読み込みエラー",
"Minimize": "最小化",
@ -126,6 +129,7 @@
"Redo": "やり直し",
"Refresh app when idle": "アイドル時にアプリを再表示",
"Relaunch": "「リスタート」",
"Restart": "再起動する",
"Relaunch Application": "アプリケーションの再起動",
"Reload": "再読み込み",
"Renderer Process Crashed": "レンダラープロセスがクラッシュしました",
@ -192,6 +196,7 @@
"Updating Title bar style requires Symphony to relaunch.": "タイトルバーのスタイルを更新するには、Symphonyが再起動する必要があります。",
"View": "ビュー",
"Window": "ウインドウ",
"Would you like to restart and apply these new settings now?": "今すぐ再起動して、新しい設定を適用しますか?",
"Your administrator has disabled": "管理者によて無効にされています",
"Zoom": "ズーム",
"Zoom In": "ズームイン",