Project

General

Profile

Actions

action #6408

closed

Create a dashboard as main entry

Added by coolo about 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Feature requests
Target version:
Start date:
2015-02-25
Due date:
% Done:

0%

Estimated time:

Description

I created a number collector and hopefully it's a good enough entry point

+sub dashboard {

  • my ($self) = @_; +
  • my $timecond = { ">" => time2str('%Y-%m-%d %H:%M:%S', time-24*3600*14, 'UTC') };
  • my $schema = $self->app->schema;
  • my $opts = {
  • join => ['settings', 'settings', 'settings', 'settings', 'clone'],
  • 'select' => ['me.id, me.state, me.result, settings.value, settings_2.value, settings_3.value, settings_4.value'],
  • 'as' => [qw/id state result distri version flavor build/],
  • distinct => 1
  • };
  • my $jobs = $schema->resultset("Jobs")->search(
  • {
  • "settings.key" => 'DISTRI',
  • "settings_2.key" => 'VERSION',
  • "settings_3.key" => 'FLAVOR',
  • "settings_4.key" => 'BUILD',
  • "me.t_created" => $timecond,
  • -or => [
  • 'me.clone_id' => undef,
  • 'clone.state' => [OpenQA::Schema::Result::Jobs::PENDING_STATES],
  • ]
  • },
  • $opts
  • ); +
  • my %jhash;
  • my $text = '';
  • while (my $job = $jobs->next) {
  • my $key = sprintf("%s-%s-%s-Build%s",$job->get_column('distri'),
  • $job->get_column('version'), $job->get_column('flavor'),
  • $job->get_column('build'));
  • $jhash{$key} ||= ();
  • $jhash{$key}->{$job->state . "-" . $job->result}++;
  • }
  • for my $flavor (sort keys %jhash) {
  • $text .= $flavor . "\n";
  • for my $state (sort keys %{$jhash{$flavor}}) {
  • $text .= " $state: " . $jhash{$flavor}->{$state} . "\n";
  • }
  • }
  • $self->render(text => $text); + +}
Actions #1

Updated by coolo about 9 years ago

the above is no longer needed as we have group_id in the jobs table now, e.g.
http://gertrude.suse.de:9526/tests?groupid=9 is not a dashboard, but it proves the concept nicely.

Actions #2

Updated by coolo about 9 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF