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