pub async fn index(req: Request<AppSate>) -> tide::Result {
    let (storage, _) = req.state();
    let which: Option<MainPageShowFunction> = req.query().ok();
    trace!("Called index function with parameters: {:?}", which);

    let mut functions = storage.values().await;
    functions.sort_by(|e1, e2| e1.name().cmp(e2.name()));

    let selected = which
        .map(|w| functions.iter().position(|f| f.name() == &w.show))
        .flatten();
    IndexViewModel {
        functions,
        http_triggers: Trigger::all_http(),
        programming_languages: ProgrammingLanguage::available(),
        selected,
        base_url: "".to_owned(),
        fn_base_path: format!("{}/{}", API_VERSION, FUNC_CALL_PATH),
    }
    .render()
    .map(|body| {
        let mut resp = Response::new(StatusCode::Ok);
        resp.set_body(body);
        resp.set_content_type(http_types::Mime::from_str("text/html;charset=utf-8").unwrap());
        resp
    })
    .map_err(|_| tide::Error::from_str(StatusCode::InternalServerError, ":("))
}
///
/// The main page showing all active functions.
///
///
The main page showing all active functions.
The main page showing all active functions .
pub async fn index(req: Request<AppSate>) -> tide::Result {
    let (storage, _) = req.state();
    let which: Option<MainPageShowFunction> = req.query().ok();
    trace!("Called index function with parameters: {:?}", which);
    let mut functions = storage.values().await;
    functions.sort_by(|e1, e2| e1.name().cmp(e2.name()));
    let selected = which
        .map(|w| functions.iter().position(|f| f.name() == &w.show))
        .flatten();
    IndexViewModel {
        functions,
        http_triggers: Trigger::all_http(),
        programming_languages: ProgrammingLanguage::available(),
        selected,
        base_url: "".to_owned(),
        fn_base_path: format!("{}/{}", API_VERSION, FUNC_CALL_PATH),
    }
    .render()
    .map(|body| {
        let mut resp = Response::new(StatusCode::Ok);
        resp.set_body(body);
        resp.set_content_type(http_types::Mime::from_str("text/html;charset=utf-8").unwrap());
        resp
    })
    .map_err(|_| tide::Error::from_str(StatusCode::InternalServerError, ":("))
}
pub async fn index ( req : Request < AppSate > ) -> tide :: Result { let ( storage , _ ) = req . state ( ) ; let which : Option < MainPageShowFunction > = req . query ( ) . ok ( ) ; trace ! ( " " which ) ; let mut functions = storage . values ( ) . await ; functions . sort_by ( | e1 , e2 | e1 . name ( ) . cmp ( e2 . name ( ) ) ) ; let selected = which . map ( | w | functions . iter ( ) . position ( | f | f . name ( ) == & w . show ) ) . flatten ( ) ; IndexViewModel { functions , http_triggers : Trigger :: all_http ( ) , programming_languages : ProgrammingLanguage :: available ( ) , selected , base_url : " " . to_owned ( ) , fn_base_path : format ! ( " " API_VERSION FUNC_CALL_PATH ) , } . render ( ) . map ( | body | { let mut resp = Response :: new ( StatusCode :: Ok ) ; resp . set_body ( body ) ; resp . set_content_type ( http_types :: Mime :: from_str ( " " ) . unwrap ( ) ) ; resp } ) . map_err ( | _ | tide :: Error :: from_str ( StatusCode :: InternalServerError , " " ) ) }
The main page showing all active functions.
The main page showing all active functions .
req
Request<AppSate>
req
Request<AppSate>