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
efa85058
Commit
efa85058
authored
Dec 05, 2022
by
Marcin Haba
Browse files
baculum: Add age parameter to jobs and objects endpoints
parent
bae2036f
Changes
3
Hide whitespace changes
Inline
Side-by-side
gui/baculum/protected/API/Pages/API/Jobs.php
View file @
efa85058
...
...
@@ -49,6 +49,7 @@ class Jobs extends BaculumAPIServer {
$endtime_to
=
$this
->
Request
->
contains
(
'endtime_to'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'endtime_to'
])
?
(
int
)
$this
->
Request
[
'endtime_to'
]
:
null
;
$realendtime_from
=
$this
->
Request
->
contains
(
'realendtime_from'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'realendtime_from'
])
?
(
int
)
$this
->
Request
[
'realendtime_from'
]
:
null
;
$realendtime_to
=
$this
->
Request
->
contains
(
'realendtime_to'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'realendtime_to'
])
?
(
int
)
$this
->
Request
[
'realendtime_to'
]
:
null
;
$age
=
$this
->
Request
->
contains
(
'age'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'age'
])
?
(
int
)
$this
->
Request
[
'age'
]
:
null
;
$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'
;
...
...
@@ -145,6 +146,12 @@ class Jobs extends BaculumAPIServer {
'vals'
=>
date
(
'Y-m-d H:i:s'
,
$starttime_to
)
];
}
}
elseif
(
!
empty
(
$age
))
{
// Job age (now() - age)
$params
[
'Job.StartTime'
]
=
[];
$params
[
'Job.StartTime'
][]
=
[
'operator'
=>
'>='
,
'vals'
=>
date
(
'Y-m-d H:i:s'
,
(
time
()
-
$age
))
];
}
// End time range
...
...
gui/baculum/protected/API/Pages/API/Objects.php
View file @
efa85058
...
...
@@ -53,6 +53,7 @@ class Objects extends BaculumAPIServer {
$endtime_to
=
$this
->
Request
->
contains
(
'endtime_to'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'endtime_to'
])
?
(
int
)
$this
->
Request
[
'endtime_to'
]
:
null
;
$realendtime_from
=
$this
->
Request
->
contains
(
'realendtime_from'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'realendtime_from'
])
?
(
int
)
$this
->
Request
[
'realendtime_from'
]
:
null
;
$realendtime_to
=
$this
->
Request
->
contains
(
'realendtime_to'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'realendtime_to'
])
?
(
int
)
$this
->
Request
[
'realendtime_to'
]
:
null
;
$age
=
$this
->
Request
->
contains
(
'age'
)
&&
$misc
->
isValidInteger
(
$this
->
Request
[
'age'
])
?
(
int
)
$this
->
Request
[
'age'
]
:
null
;
$order_by
=
$this
->
Request
->
contains
(
'order_by'
)
&&
$misc
->
isValidColumn
(
$this
->
Request
[
'order_by'
])
?
$this
->
Request
[
'order_by'
]
:
'ObjectId'
;
$order_direction
=
$this
->
Request
->
contains
(
'order_direction'
)
&&
$misc
->
isValidOrderDirection
(
$this
->
Request
[
'order_direction'
])
?
$this
->
Request
[
'order_direction'
]
:
'DESC'
;
...
...
@@ -178,6 +179,12 @@ class Objects extends BaculumAPIServer {
'vals'
=>
date
(
'Y-m-d H:i:s'
,
$starttime_to
)
];
}
}
elseif
(
!
empty
(
$age
))
{
// Job age (now() - age)
$params
[
'Job.StartTime'
]
=
[];
$params
[
'Job.StartTime'
][]
=
[
'operator'
=>
'>='
,
'vals'
=>
date
(
'Y-m-d H:i:s'
,
(
time
()
-
$age
))
];
}
// End time range
...
...
gui/baculum/protected/API/openapi_baculum.json
View file @
efa85058
...
...
@@ -959,6 +959,16 @@
"type"
:
"integer"
}
},
{
"name"
:
"age"
,
"in"
:
"query"
,
"required"
:
false
,
"description"
:
"Job age in seconds (used is start time). starttime_from and starttime_to take precedence over this parameter."
,
"schema"
:
{
"type"
:
"integer"
}
},
{
"name"
:
"order_by"
,
"in"
:
"query"
,
...
...
@@ -6602,6 +6612,16 @@
"schema"
:
{
"type"
:
"integer"
}
},
{
"name"
:
"age"
,
"in"
:
"query"
,
"required"
:
false
,
"description"
:
"Job age in seconds (used is start time). starttime_from and starttime_to take precedence over this parameter."
,
"schema"
:
{
"type"
:
"integer"
}
}
]
}
...
...
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