Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(xo-web): in storage creation, display error when selecting SR type #8250

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

> Users must be able to say: “I had this issue, happy to know it's fixed”

- [New/Storage] When creating a new storage, if an error occurred while selecting a storage type, nothing was displayed (PR [#8250](https://github.com/vatesfr/xen-orchestra/pull/8250))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of: Correctly display error if storage detection failed for HBA or ZFS?


### Packages to release

> When modifying a package, add it here with its release type.
Expand All @@ -35,5 +37,6 @@
<!--packages-start-->

- @xen-orchestra/web-core minor
- xo-web minor

<!--packages-end-->
18 changes: 10 additions & 8 deletions packages/xo-web/src/xo-app/new/sr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import _, { messages } from 'intl'
import ActionButton from 'action-button'
import Component from 'base-component'
import Icon from 'icon'
import ignoreErrors from 'promise-toolbox/ignoreErrors'
import includes from 'lodash/includes'
import info, { error } from 'notification'
import isEmpty from 'lodash/isEmpty'
Expand Down Expand Up @@ -530,19 +529,22 @@ export default class New extends Component {
_probe = async (host, type) => {
const probeMethodFactories = {
hba: async hostId => ({
hbaDevices: await probeSrHba(hostId)::ignoreErrors(),
hbaDevices: await probeSrHba(hostId),
}),
zfs: async hostId => ({
zfsPools: await probeZfs(hostId)::ignoreErrors(),
zfsPools: await probeZfs(hostId),
}),
}
if (probeMethodFactories[type] !== undefined && host != null) {
this.setState(({ loading }) => ({ loading: loading + 1 }))
const probeResult = await probeMethodFactories[type](host.id)
this.setState(({ loading }) => ({
loading: loading - 1,
...probeResult,
}))
try {
const probeResult = await probeMethodFactories[type](host.id)
this.setState({ ...probeResult })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to spread the variable

Suggested change
this.setState({ ...probeResult })
this.setState(probeResult)

} catch (err) {
error('Device detection failed', err.message || String(err))
} finally {
this.setState(({ loading }) => ({ loading: loading - 1 }))
}
}
}

Expand Down
Loading