From 55118ca18ed5424de591807d432a355a08f2c600 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 10 Dec 2020 10:09:12 +0100 Subject: [PATCH] tape: correctly sort drive api subdir --- src/api2/tape/drive.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs index 81e234b4..d252d7a1 100644 --- a/src/api2/tape/drive.rs +++ b/src/api2/tape/drive.rs @@ -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))