Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bacula Community Edition
Bacula Community
Commits
bb910baa
Commit
bb910baa
authored
Dec 09, 2022
by
Marcin Haba
Browse files
baculum: Add multiple jobids filter to jobs endpoint
parent
15fe0531
Changes
1
Hide whitespace changes
Inline
Side-by-side
gui/baculum/protected/API/Pages/API/Jobs.php
View file @
bb910baa
...
...
@@ -35,6 +35,7 @@ class Jobs extends BaculumAPIServer {
public
function
get
()
{
$misc
=
$this
->
getModule
(
'misc'
);
$jobids
=
$this
->
Request
->
contains
(
'jobids'
)
&&
$misc
->
isValidIdsList
(
$this
->
Request
[
'jobids'
])
?
$this
->
Request
[
'jobids'
]
:
''
;
$limit
=
$this
->
Request
->
contains
(
'limit'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'limit'
])
?
(
int
)
$this
->
Request
[
'limit'
]
:
0
;
$offset
=
$this
->
Request
->
contains
(
'offset'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'offset'
])
?
(
int
)
$this
->
Request
[
'offset'
]
:
0
;
$jobstatus
=
$this
->
Request
->
contains
(
'jobstatus'
)
?
$this
->
Request
[
'jobstatus'
]
:
''
;
...
...
@@ -54,6 +55,27 @@ class Jobs extends BaculumAPIServer {
$order_by
=
$this
->
Request
->
contains
(
'order_by'
)
&&
$misc
->
isValidColumn
(
$this
->
Request
[
'order_by'
])
?
$this
->
Request
[
'order_by'
]
:
'JobId'
;
$order_direction
=
$this
->
Request
->
contains
(
'order_direction'
)
&&
$misc
->
isValidOrderDirection
(
$this
->
Request
[
'order_direction'
])
?
$this
->
Request
[
'order_direction'
]
:
'DESC'
;
if
(
!
empty
(
$jobids
))
{
/**
* If jobids parameter provided, all other parameters are not used.
*/
$params
[
'Job.JobId'
]
=
[];
$params
[
'Job.JobId'
][]
=
[
'operator'
=>
'OR'
,
'vals'
=>
explode
(
','
,
$jobids
)
];
$result
=
$this
->
getModule
(
'job'
)
->
getJobs
(
$params
,
null
,
0
,
$order_by
,
$order_direction
);
$this
->
output
=
$result
;
$this
->
error
=
JobError
::
ERROR_NO_ERRORS
;
return
;
}
if
(
!
empty
(
$clientid
)
&&
!
$misc
->
isValidId
(
$clientid
))
{
$this
->
output
=
JobError
::
MSG_ERROR_CLIENT_DOES_NOT_EXISTS
;
$this
->
error
=
JobError
::
ERROR_CLIENT_DOES_NOT_EXISTS
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment