Skip to content

Commit

Permalink
feat(xo-web): use github issue form template when reporting bug
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierFL committed Jan 3, 2024
1 parent 95012a3 commit 7d49eee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Proxies] Fix `this.getObject` is not a function during deployment
- [Settings/Logs] Fix `sr.getAllUnhealthyVdiChainsLength: not enough permissions` error with non-admin users (PR [#7265](https://github.com/vatesfr/xen-orchestra/pull/7265))
- [Settings/Logs] Use an issue form with some pre-filled fields when reporting a bug [#7142](https://github.com/vatesfr/xen-orchestra/issues/7142) (PR [#7274](https://github.com/vatesfr/xen-orchestra/pull/7274))

### Packages to release

Expand All @@ -32,5 +33,6 @@

- xo-cli patch
- xo-server patch
- xo-web patch

<!--packages-end-->
19 changes: 13 additions & 6 deletions packages/xo-web/src/common/report-bug-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const ADDITIONAL_FILES_FETCH_TIMEOUT = 5e3
const jsonStringify = json => JSON.stringify(json, null, 2)
const logger = createLogger('report-bug-button')

const GITHUB_URL = 'https://github.com/vatesfr/xen-orchestra/issues/new/choose'
const GITHUB_URL = 'https://github.com/vatesfr/xen-orchestra/issues/new'
const GITHUB_BUG_TEMPLATE = 'bug_report.yml'
const XO_SUPPORT_URL = 'https://xen-orchestra.com/#!/member/support'
const SUPPORT_PANEL_URL = './api/support/create/ticket'

Expand All @@ -42,12 +43,18 @@ const ADDITIONAL_FILES = [
]

const reportInNewWindow = (url, { title, message, formatMessage = identity }) => {
// message is ignored for the moment
//
// see https://github.com/vatesfr/xen-orchestra/issues/7142

const encodedTitle = encodeURIComponent(title == null ? '' : title)
window.open(`${url}?title=${encodedTitle}`)

let _url = `${url}?title=${encodedTitle}`

if (url === GITHUB_URL) {
const encodedErrorMessage = encodeURIComponent(jsonStringify(message.error))
const encodedLabels = encodeURIComponent('type: bug :bug:,status: triaging :triangular_flag_on_post:')

_url += `&template=${GITHUB_BUG_TEMPLATE}&labels=${encodedLabels}&error-message=${encodedErrorMessage}`
}

window.open(_url)
}

export const reportOnSupportPanel = async ({ files = [], formatMessage = identity, message, title } = {}) => {
Expand Down

0 comments on commit 7d49eee

Please sign in to comment.