tape: ui - avoid changer status query in backup content panel

This commit is contained in:
Dietmar Maurer 2021-02-15 12:17:36 +01:00
parent 41a8db3576
commit 159100b944
2 changed files with 16 additions and 6 deletions

View File

@ -45,6 +45,11 @@ use crate::{
schema: MEDIA_POOL_NAME_SCHEMA, schema: MEDIA_POOL_NAME_SCHEMA,
optional: true, optional: true,
}, },
"update-status": {
description: "Try to update tape library status (check what tapes are online).",
optional: true,
default: true,
},
}, },
}, },
returns: { returns: {
@ -56,18 +61,23 @@ use crate::{
}, },
)] )]
/// List pool media /// List pool media
pub async fn list_media(pool: Option<String>) -> Result<Vec<MediaListEntry>, Error> { pub async fn list_media(
pool: Option<String>,
update_status: bool,
) -> Result<Vec<MediaListEntry>, Error> {
let (config, _digest) = config::media_pool::config()?; let (config, _digest) = config::media_pool::config()?;
let status_path = Path::new(TAPE_STATUS_DIR); let status_path = Path::new(TAPE_STATUS_DIR);
let catalogs = tokio::task::spawn_blocking(move || { let catalogs = tokio::task::spawn_blocking(move || {
if update_status {
// update online media status // update online media status
if let Err(err) = update_online_status(status_path) { if let Err(err) = update_online_status(status_path) {
eprintln!("{}", err); eprintln!("{}", err);
eprintln!("update online media status failed - using old state"); eprintln!("update online media status failed - using old state");
} }
}
// test what catalog files we have // test what catalog files we have
MediaCatalog::media_with_catalogs(status_path) MediaCatalog::media_with_catalogs(status_path)
}).await??; }).await??;

View File

@ -40,7 +40,7 @@ Ext.define('PBS.TapeManagement.BackupOverview', {
loadContent: async function() { loadContent: async function() {
let me = this; let me = this;
let content_response = await PBS.Async.api2({ let content_response = await PBS.Async.api2({
url: '/api2/extjs/tape/media/list', url: '/api2/extjs/tape/media/list?update-status=false',
}); });
let data = {}; let data = {};