Skip to content

Commit

Permalink
fix(xo-web/github): use github issue form template when reporting bug…
Browse files Browse the repository at this point in the history
… from settings/logs
  • Loading branch information
OlivierFL committed Jan 2, 2024
1 parent b1e879c commit 6d8a2fe
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 54 deletions.
48 changes: 0 additions & 48 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

119 changes: 119 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Bug Report
description: Create a report to help us improve
labels: ['type: bug :bug:', 'status: triaging :triangular_flag_on_post:']
body:
- type: markdown
attributes:
value: |
1. ⚠️ **If you don't follow this template, the issue will be closed**.
2. ⚠️ **If your issue can't be easily reproduced, please report it [on the forum first](https://xcp-ng.org/forum/category/12/xen-orchestra)**.
- type: markdown
attributes:
value: '## Are you using XOA or XO from the sources?'
- type: dropdown
id: xo-origin
attributes:
label: Are you using XOA or XO from the sources?
options:
- XOA
- XO from the sources
- both
validations:
required: false
- type: markdown
attributes:
value: '### If XOA:'
- type: dropdown
id: xoa-channel
attributes:
label: Which release channel?
description: please consider creating a support ticket in [your dedicated support area](https://xen-orchestra.com/#!/member/support)
options:
- stable
- latest
- both
validations:
required: false
- type: markdown
attributes:
value: '### If XO from the sources:'
- type: markdown
attributes:
value: |
- Don't forget to [read this first](https://xen-orchestra.com/docs/community.html)
- As well as follow [this guide](https://xen-orchestra.com/docs/community.html#report-a-bug)
- type: input
id: xo-sources-commit-number
attributes:
label: Provide your commit number
description: If it's older than a week, we won't investigate
placeholder: e.g. 579f0
validations:
required: false
- type: markdown
attributes:
value: '## Bug description:'
- type: textarea
id: bug-description
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is
validations:
required: true
- type: textarea
id: error-message
attributes:
label: Error message
render: Markdown
validations:
required: false
- type: textarea
id: steps
attributes:
label: To reproduce
description: 'Steps to reproduce the behavior:'
value: |
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
validations:
required: false
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen
validations:
required: false
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem
validations:
required: false
- type: markdown
attributes:
value: '## Environment (please provide the following information):'
- type: input
id: node-version
attributes:
label: Node
placeholder: e.g. 16.12.1
validations:
required: true
- type: input
id: hypervisor-version
attributes:
label: Hypervisor
placeholder: e.g. XCP-ng 8.2.0
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other context about the problem here
validations:
required: false
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 6d8a2fe

Please sign in to comment.