tape: correctly sort drive api subdir

This commit is contained in:
Dietmar Maurer 2020-12-10 10:09:12 +01:00
parent f70d8091d3
commit 55118ca18e

View File

@ -2,7 +2,7 @@ use anyhow::{bail, Error};
use serde_json::Value; use serde_json::Value;
use proxmox::api::{api, Router, SubdirMap}; use proxmox::api::{api, Router, SubdirMap};
use proxmox::list_subdirs_api_method; use proxmox::{sortable, identity, list_subdirs_api_method};
use crate::{ use crate::{
config, config,
@ -216,17 +216,18 @@ pub fn eject_media(drive: String) -> Result<(), Error> {
Ok(()) Ok(())
} }
pub const SUBDIRS: SubdirMap = &[ #[sortable]
( pub const SUBDIRS: SubdirMap = &sorted!([
"erase-media",
&Router::new()
.put(&API_METHOD_ERASE_MEDIA)
),
( (
"eject-media", "eject-media",
&Router::new() &Router::new()
.put(&API_METHOD_EJECT_MEDIA) .put(&API_METHOD_EJECT_MEDIA)
), ),
(
"erase-media",
&Router::new()
.put(&API_METHOD_ERASE_MEDIA)
),
( (
"load-slot", "load-slot",
&Router::new() &Router::new()
@ -247,7 +248,7 @@ pub const SUBDIRS: SubdirMap = &[
&Router::new() &Router::new()
.put(&API_METHOD_UNLOAD) .put(&API_METHOD_UNLOAD)
), ),
]; ]);
pub const ROUTER: Router = Router::new() pub const ROUTER: Router = Router::new()
.get(&list_subdirs_api_method!(SUBDIRS)) .get(&list_subdirs_api_method!(SUBDIRS))