diff --git a/src/error-manager/github-issue-template.md b/src/error-manager/github-issue-template.md index 184e6489..11c3c131 100644 --- a/src/error-manager/github-issue-template.md +++ b/src/error-manager/github-issue-template.md @@ -16,6 +16,7 @@ ${description} | CPUs | ${cpuModel} x ${cpuCount} | | RAM | ${totalRamGb}GB (${freeRamGb}GB free) | | App RAM limit | ${ramLimitMb}Mb (${usedRamMb}MB used) | +| Is BFX API Staging used | ${isBfxApiStagingUsed} |
diff --git a/src/error-manager/render-markdown-template.js b/src/error-manager/render-markdown-template.js index 9d78f91c..9ec892fa 100644 --- a/src/error-manager/render-markdown-template.js +++ b/src/error-manager/render-markdown-template.js @@ -42,13 +42,14 @@ const _renderMarkdownTemplate = ( const str = template.replace(placeholderPattern, (match) => { const propName = match.replace('${', '').replace('}', '') + if (typeof params?.[propName] === 'boolean') { + params[propName] = params[propName] + ? 'Yes' + : 'No' + } if ( - !params || - typeof params !== 'object' || - ( - !Number.isFinite(params[propName]) && - typeof params[propName] !== 'string' - ) + !Number.isFinite(params?.[propName]) && + typeof params?.[propName] !== 'string' ) { return '' } diff --git a/src/helpers/get-debug-info.js b/src/helpers/get-debug-info.js index 8ae5e7f6..41e240ad 100644 --- a/src/helpers/get-debug-info.js +++ b/src/helpers/get-debug-info.js @@ -9,6 +9,7 @@ const { getAppUpdateConfigSync } = require('../auto-updater') const packageJson = require(path.join(appDir, 'package.json')) const productName = require('./product-name') +const isBfxApiStaging = require('./is-bfx-api-staging') let lastCommit = { hash: '-', date: '-' } @@ -114,6 +115,10 @@ module.exports = (eol = os.EOL) => { ) ? `https://${provider}.com/${owner}/${repo}` : repository + const isBfxApiStagingUsed = isBfxApiStaging() + const bfxApiStagingDetail = isBfxApiStagingUsed + ? `${eol}Is BFX API Staging used: Yes` + : '' const detail = `\ Version: ${version}${eol}\ @@ -125,6 +130,7 @@ Node.js: ${nodeVersion}${eol}\ V8: ${v8Version}${eol}\ OS version: ${osVersion}${eol}\ OS release: ${osType} ${osArch} ${osRelease}\ +${bfxApiStagingDetail} ` return { @@ -150,6 +156,7 @@ OS release: ${osType} ${osArch} ${osRelease}\ usedRamMb, cpuModel, cpuCount, + isBfxApiStagingUsed, detail } } diff --git a/src/helpers/index.js b/src/helpers/index.js index ee064e8a..ef19af8b 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -15,6 +15,7 @@ const isMainWinAvailable = require( const productName = require('./product-name') const getAlertCustomClassObj = require('./get-alert-custom-class-obj') const parseEnvValToBool = require('./parse-env-val-to-bool') +const isBfxApiStaging = require('./is-bfx-api-staging') module.exports = { getFreePort, @@ -25,5 +26,6 @@ module.exports = { isMainWinAvailable, productName, getAlertCustomClassObj, - parseEnvValToBool + parseEnvValToBool, + isBfxApiStaging } diff --git a/src/helpers/is-bfx-api-staging.js b/src/helpers/is-bfx-api-staging.js new file mode 100644 index 00000000..8517d237 --- /dev/null +++ b/src/helpers/is-bfx-api-staging.js @@ -0,0 +1,20 @@ +'use strict' + +const { rootPath } = require('electron-root-path') +const path = require('path') + +const reportServiceConfig = require(path.join( + rootPath, + 'bfx-reports-framework/config/service.report.json' +)) +const pattern = /(staging)|(test)/i + +module.exports = () => { + const { restUrl } = reportServiceConfig ?? {} + + return !!( + restUrl && + typeof restUrl === 'string' && + pattern.test(restUrl) + ) +} diff --git a/src/window-creators.js b/src/window-creators.js index 6fc4a598..2e620aba 100644 --- a/src/window-creators.js +++ b/src/window-creators.js @@ -23,6 +23,7 @@ const { hideWindow, centerWindow } = require('./helpers/manage-window') +const isBfxApiStaging = require('./helpers/is-bfx-api-staging') const publicDir = path.join(__dirname, '../bfx-report-ui/build') const loadURL = serve({ directory: publicDir }) @@ -222,6 +223,11 @@ const createMainWindow = async ({ if (isDevEnv) { wins.mainWindow.webContents.openDevTools() } + if (isBfxApiStaging()) { + const title = wins.mainWindow.getTitle() + + wins.mainWindow.setTitle(`${title} - BFX API STAGING USED`) + } createMenu({ pathToUserData, pathToUserDocuments })