diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-06-07 14:21:40 +0200 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-06-07 15:38:53 +0200 |
commit | 037275412fb72a27c8bb0347d047e1a2b65e0569 (patch) | |
tree | 2296221f6d1a5e29f98662b90525053ad130af6c | |
parent | 8f9c7d77acfa16ebe9660eba113fbebd68b96eed (diff) |
Add endpoint filtering in "db jobs" subcommand
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r-- | src/cli.rs | 11 | ||||
-rw-r--r-- | src/commands/db.rs | 4 |
2 files changed, 15 insertions, 0 deletions
@@ -292,6 +292,17 @@ pub fn cli<'a>() -> App<'a> { .arg(arg_older_than_date("List only jobs older than DATE")) .arg(arg_newer_than_date("List only jobs newer than DATE")) + + .arg(Arg::new("endpoint") + .required(false) + .multiple(false) + .long("endpoint") + .short('e') + .takes_value(true) + .value_name("ENDPOINT") + .about("Only show jobs from ENDPOINT") + ) + ) .subcommand(App::new("job") diff --git a/src/commands/db.rs b/src/commands/db.rs index 4ece20a..a296579 100644 --- a/src/commands/db.rs +++ b/src/commands/db.rs @@ -457,6 +457,10 @@ fn jobs(conn_cfg: DbConnectionConfig<'_>, matches: &ArgMatches) -> Result<()> { sel = sel.limit(limit) } + if let Some(ep_name) = matches.value_of("endpoint") { + sel = sel.filter(schema::endpoints::name.eq(ep_name)) + } + let data = sel .order_by(schema::jobs::id.desc()) // required for the --limit implementation .load::<(models::Job, models::Submit, models::Endpoint, models::Package)>(&conn)? |