Skip to content
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
2 changes: 1 addition & 1 deletion frontend/common/types/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ export type Req = {
}
getExperiments: PagedRequest<{
environmentId: string
status?: ExperimentStatus
status?: ExperimentStatus | ExperimentStatus[]
}>
createExperiment: {
environmentId: string
Expand Down
18 changes: 14 additions & 4 deletions frontend/common/utils/base/_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,10 @@ emailRegex: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|
const target = e.target

if (target.getAttribute) {
return target.type === 'checkbox' || target.type === 'radio'
? target.getAttribute('checked')
: typeof target.value === 'string'
if (target.type === 'checkbox' || target.type === 'radio') {
return target.getAttribute('checked')
}
return typeof target.value === 'string'
? target.value
: target.getAttribute('data-value') || target.getAttribute('value')
}
Expand All @@ -519,9 +520,18 @@ emailRegex: /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|

toParam(obj) {
// {min:100,max:200} -> min=100&max=200
// {status:['running','paused']} -> status=running&status=paused
return Object.keys(obj)
.filter((v) => obj[v] !== undefined)
.map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`)
.flatMap((k) => {
const val = obj[k]
if (Array.isArray(val)) {
return val.map(
(v) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`,
)
}
return `${encodeURIComponent(k)}=${encodeURIComponent(val)}`
})
.join('&')
},

Expand Down
Loading