这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/error-manager/github-issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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} |

<details>

Expand Down
13 changes: 7 additions & 6 deletions src/error-manager/render-markdown-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
}
Expand Down
7 changes: 7 additions & 0 deletions src/helpers/get-debug-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '-' }

Expand Down Expand Up @@ -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}\
Expand All @@ -125,6 +130,7 @@ Node.js: ${nodeVersion}${eol}\
V8: ${v8Version}${eol}\
OS version: ${osVersion}${eol}\
OS release: ${osType} ${osArch} ${osRelease}\
${bfxApiStagingDetail}
`

return {
Expand All @@ -150,6 +156,7 @@ OS release: ${osType} ${osArch} ${osRelease}\
usedRamMb,
cpuModel,
cpuCount,
isBfxApiStagingUsed,
detail
}
}
4 changes: 3 additions & 1 deletion src/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -25,5 +26,6 @@ module.exports = {
isMainWinAvailable,
productName,
getAlertCustomClassObj,
parseEnvValToBool
parseEnvValToBool,
isBfxApiStaging
}
20 changes: 20 additions & 0 deletions src/helpers/is-bfx-api-staging.js
Original file line number Diff line number Diff line change
@@ -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)
)
}
6 changes: 6 additions & 0 deletions src/window-creators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down Expand Up @@ -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 })

Expand Down