fix(xo-web/job): properly handle array arguments (#5944)
See https://xcp-ng.org/forum/topic/5010 When creating/editing a job, properties of type `array` must not go through the cross product builder, they must be saved as arrays.
This commit is contained in:
parent
84dccd800f
commit
e2e453985f
@ -14,6 +14,7 @@
|
|||||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||||
|
|
||||||
- [Backups] Delete unused snapshots related to other schedules (even no longer existing) (PR [#5949](https://github.com/vatesfr/xen-orchestra/pull/5949))
|
- [Backups] Delete unused snapshots related to other schedules (even no longer existing) (PR [#5949](https://github.com/vatesfr/xen-orchestra/pull/5949))
|
||||||
|
- [Jobs] Fix `job.runSequence` method (PR [#5944](https://github.com/vatesfr/xen-orchestra/pull/5944))
|
||||||
|
|
||||||
### Packages to release
|
### Packages to release
|
||||||
|
|
||||||
|
@ -92,10 +92,10 @@ const reduceObject = (value, propertyName = 'id') => (value != null && value[pro
|
|||||||
/**
|
/**
|
||||||
* Adapts all data "arrayed" by UI-multiple-selectors to job's cross-product trick
|
* Adapts all data "arrayed" by UI-multiple-selectors to job's cross-product trick
|
||||||
*/
|
*/
|
||||||
const dataToParamVectorItems = function (params, data) {
|
const dataToParamVectorItems = function (params, data, properties) {
|
||||||
const items = []
|
const items = []
|
||||||
forEach(params, (param, name) => {
|
forEach(params, (param, name) => {
|
||||||
if (Array.isArray(data[name]) && param.items) {
|
if (properties[name].multi && param.items) {
|
||||||
// We have an array for building cross product, the "real" type was $type
|
// We have an array for building cross product, the "real" type was $type
|
||||||
const values = []
|
const values = []
|
||||||
if (data[name].length === 1) {
|
if (data[name].length === 1) {
|
||||||
@ -286,8 +286,9 @@ export default class Jobs extends Component {
|
|||||||
|
|
||||||
_handleSubmit = () => {
|
_handleSubmit = () => {
|
||||||
const { name, method, params } = this.refs
|
const { name, method, params } = this.refs
|
||||||
|
const { action, actions, job, owner, timeout } = this.state
|
||||||
|
|
||||||
const { job, owner, timeout } = this.state
|
const _action = job === undefined ? action : find(actions, { method: job.method })
|
||||||
const _job = {
|
const _job = {
|
||||||
type: 'call',
|
type: 'call',
|
||||||
name: name.value,
|
name: name.value,
|
||||||
@ -295,7 +296,7 @@ export default class Jobs extends Component {
|
|||||||
method: method.value.method,
|
method: method.value.method,
|
||||||
paramsVector: {
|
paramsVector: {
|
||||||
type: 'crossProduct',
|
type: 'crossProduct',
|
||||||
items: dataToParamVectorItems(method.value.info.properties, params.value),
|
items: dataToParamVectorItems(method.value.info.properties, params.value, _action.uiSchema.properties),
|
||||||
},
|
},
|
||||||
userId: owner !== undefined ? owner : this.props.currentUser.id,
|
userId: owner !== undefined ? owner : this.props.currentUser.id,
|
||||||
timeout: timeout ? timeout * 1e3 : undefined,
|
timeout: timeout ? timeout * 1e3 : undefined,
|
||||||
|
Loading…
Reference in New Issue
Block a user