Lines
88 %
Functions
50 %
Branches
100 %
//! Reports tab keys: re-run, re-edit and open the last report.
use forms::FormValues;
use super::App;
use crate::tabs::reports::ReportKind;
use crate::tabs::seq::Seq;
use crate::view::ViewId;
use crate::window::{Origin, WindowId};
impl App {
/// Re-run the last report of Reports window `window` with its stored values.
pub(super) fn rerun_report(&mut self, window: WindowId) {
let Some((kind, values)) = self.last_report(window) else {
self.set_status("no report run yet");
return;
};
if let Some(id) = self.submit_report(window, kind, &values) {
self.set_report_loading(id, kind, &values);
}
/// Reopen the last report's form prefilled with its stored values.
pub fn edit_last_report(&mut self) {
let Some(window) = self.front_or_say(ViewId::Reports) else {
match self.last_report(window) {
Some((kind, values)) => {
self.report_seq_of(window).map(Seq::advance);
let origin = Origin {
window,
kind: ViewId::Reports,
self.launch_report(origin, kind, &values, true);
None => self.set_status("no report run yet"),
pub fn new_report(&mut self, kind: ReportKind) {
let origin = self.window_or_open(ViewId::Reports);
self.report_seq_of(origin.window).map(Seq::advance);
self.launch_report(origin, kind, &FormValues::default(), true);