Skip to content

Commit

Permalink
Revert "fix(xo-web/job): properly handle array arguments (#5944)" (#6156
Browse files Browse the repository at this point in the history
)

This reverts commit e2e4539.

See #5983
See #5973
See zammad#5844
  • Loading branch information
pdonias committed Mar 29, 2022
1 parent 5de5a80 commit 857e467
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [Backup/Restore] Fix missing backups on Backblaze
- [Templates] Fix "incorrect state" error when trying to delete a default template [#6124](https://github.com/vatesfr/xen-orchestra/issues/6124) (PR [#6119](https://github.com/vatesfr/xen-orchestra/pull/6119))
- [New SR] Fix "SR_BACKEND_FAILURE_103" error when selecting "No selected value" for the path [#5991](https://github.com/vatesfr/xen-orchestra/issues/5991) (PR [#6137](https://github.com/vatesfr/xen-orchestra/pull/6137))
- [Jobs] Fix "invalid parameters" error when running jobs in some cases (PR [#6156](https://github.com/vatesfr/xen-orchestra/pull/6156))

### Packages to release

Expand Down
9 changes: 4 additions & 5 deletions packages/xo-web/src/xo-app/jobs/new/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ const reduceObject = (value, propertyName = 'id') => (value != null && value[pro
/**
* Adapts all data "arrayed" by UI-multiple-selectors to job's cross-product trick
*/
const dataToParamVectorItems = function (params, data, properties) {
const dataToParamVectorItems = function (params, data) {
const items = []
forEach(params, (param, name) => {
if (properties[name].multi && param.items) {
if (Array.isArray(data[name]) && param.items) {
// We have an array for building cross product, the "real" type was $type
const values = []
if (data[name].length === 1) {
Expand Down Expand Up @@ -287,17 +287,16 @@ export default class Jobs extends Component {

_handleSubmit = () => {
const { name, method, params } = this.refs
const { action, actions, job, owner, timeout } = this.state

const _action = job === undefined ? action : find(actions, { method: job.method })
const { job, owner, timeout } = this.state
const _job = {
type: 'call',
name: name.value,
key: JOB_KEY,
method: method.value.method,
paramsVector: {
type: 'crossProduct',
items: dataToParamVectorItems(method.value.info.properties, params.value, _action.uiSchema.properties),
items: dataToParamVectorItems(method.value.info.properties, params.value),
},
userId: owner !== undefined ? owner : this.props.currentUser.id,
timeout: timeout ? timeout * 1e3 : undefined,
Expand Down

0 comments on commit 857e467

Please sign in to comment.