api/{verify, syncjobs}: add optional datastore parameter
to limit the lists to the given datastores Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
16f9f244cf
commit
d58e6313e1
@ -15,7 +15,12 @@ use crate::tools::systemd::time::{
|
|||||||
|
|
||||||
#[api(
|
#[api(
|
||||||
input: {
|
input: {
|
||||||
properties: {},
|
properties: {
|
||||||
|
store: {
|
||||||
|
schema: DATASTORE_SCHEMA,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
returns: {
|
returns: {
|
||||||
description: "List configured jobs and their status.",
|
description: "List configured jobs and their status.",
|
||||||
@ -25,13 +30,23 @@ use crate::tools::systemd::time::{
|
|||||||
)]
|
)]
|
||||||
/// List all sync jobs
|
/// List all sync jobs
|
||||||
pub fn list_sync_jobs(
|
pub fn list_sync_jobs(
|
||||||
|
store: Option<String>,
|
||||||
_param: Value,
|
_param: Value,
|
||||||
mut rpcenv: &mut dyn RpcEnvironment,
|
mut rpcenv: &mut dyn RpcEnvironment,
|
||||||
) -> Result<Vec<SyncJobStatus>, Error> {
|
) -> Result<Vec<SyncJobStatus>, Error> {
|
||||||
|
|
||||||
let (config, digest) = sync::config()?;
|
let (config, digest) = sync::config()?;
|
||||||
|
|
||||||
let mut list: Vec<SyncJobStatus> = config.convert_to_typed_array("sync")?;
|
let mut list: Vec<SyncJobStatus> = config
|
||||||
|
.convert_to_typed_array("sync")?
|
||||||
|
.into_iter()
|
||||||
|
.filter(|job: &SyncJobStatus| {
|
||||||
|
if let Some(store) = &store {
|
||||||
|
&job.store == store
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}).collect();
|
||||||
|
|
||||||
for job in &mut list {
|
for job in &mut list {
|
||||||
let last_state = JobState::load("syncjob", &job.id)
|
let last_state = JobState::load("syncjob", &job.id)
|
||||||
|
@ -15,7 +15,12 @@ use crate::server::UPID;
|
|||||||
|
|
||||||
#[api(
|
#[api(
|
||||||
input: {
|
input: {
|
||||||
properties: {},
|
properties: {
|
||||||
|
store: {
|
||||||
|
schema: DATASTORE_SCHEMA,
|
||||||
|
optional: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
returns: {
|
returns: {
|
||||||
description: "List configured jobs and their status.",
|
description: "List configured jobs and their status.",
|
||||||
@ -25,13 +30,23 @@ use crate::server::UPID;
|
|||||||
)]
|
)]
|
||||||
/// List all verification jobs
|
/// List all verification jobs
|
||||||
pub fn list_verification_jobs(
|
pub fn list_verification_jobs(
|
||||||
|
store: Option<String>,
|
||||||
_param: Value,
|
_param: Value,
|
||||||
mut rpcenv: &mut dyn RpcEnvironment,
|
mut rpcenv: &mut dyn RpcEnvironment,
|
||||||
) -> Result<Vec<VerificationJobStatus>, Error> {
|
) -> Result<Vec<VerificationJobStatus>, Error> {
|
||||||
|
|
||||||
let (config, digest) = verify::config()?;
|
let (config, digest) = verify::config()?;
|
||||||
|
|
||||||
let mut list: Vec<VerificationJobStatus> = config.convert_to_typed_array("verification")?;
|
let mut list: Vec<VerificationJobStatus> = config
|
||||||
|
.convert_to_typed_array("verification")?
|
||||||
|
.into_iter()
|
||||||
|
.filter(|job: &VerificationJobStatus| {
|
||||||
|
if let Some(store) = &store {
|
||||||
|
&job.store == store
|
||||||
|
} else {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}).collect();
|
||||||
|
|
||||||
for job in &mut list {
|
for job in &mut list {
|
||||||
let last_state = JobState::load("verificationjob", &job.id)
|
let last_state = JobState::load("verificationjob", &job.id)
|
||||||
|
Loading…
Reference in New Issue
Block a user