forked from lix-project/hydra
Remove support for views
They're replaced by aggregates, which are declarative, faster, and have a better interface.
This commit is contained in:
parent
5e0d10a392
commit
affec8881d
|
@ -29,7 +29,6 @@ sub project_GET {
|
|||
|
||||
$c->stash->{template} = 'project.tt';
|
||||
|
||||
$c->stash->{views} = [$c->stash->{project}->views->all];
|
||||
$c->stash->{jobsets} = [jobsetOverview($c, $c->stash->{project})];
|
||||
$c->stash->{releases} = [$c->stash->{project}->releases->search({},
|
||||
{order_by => ["timestamp DESC"]})];
|
||||
|
@ -174,36 +173,6 @@ sub get_builds : Chained('projectChain') PathPart('') CaptureArgs(0) {
|
|||
}
|
||||
|
||||
|
||||
sub create_view_submit : Chained('projectChain') PathPart('create-view/submit') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
my $viewName = $c->request->params->{name};
|
||||
|
||||
my $view;
|
||||
txn_do($c->model('DB')->schema, sub {
|
||||
# Note: $viewName is validated in updateView, which will abort
|
||||
# the transaction if the name isn't valid.
|
||||
$view = $c->stash->{project}->views->create({name => $viewName});
|
||||
Hydra::Controller::View::updateView($c, $view);
|
||||
});
|
||||
|
||||
$c->res->redirect($c->uri_for($c->controller('View')->action_for('view_view'),
|
||||
[$c->stash->{project}->name, $view->name]));
|
||||
}
|
||||
|
||||
|
||||
sub create_view : Chained('projectChain') PathPart('create-view') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
$c->stash->{template} = 'edit-view.tt';
|
||||
$c->stash->{create} = 1;
|
||||
}
|
||||
|
||||
|
||||
sub create_release : Chained('projectChain') PathPart('create-release') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
|
|
@ -1,233 +0,0 @@
|
|||
package Hydra::Controller::View;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use base 'Catalyst::Controller';
|
||||
use Hydra::Helper::Nix;
|
||||
use Hydra::Helper::CatalystUtils;
|
||||
|
||||
|
||||
sub getView {
|
||||
my ($c, $projectName, $viewName) = @_;
|
||||
|
||||
my $project = $c->model('DB::Projects')->find($projectName);
|
||||
notFound($c, "Project $projectName doesn't exist.") if !defined $project;
|
||||
$c->stash->{project} = $project;
|
||||
|
||||
(my $view) = $c->model('DB::Views')->find($projectName, $viewName);
|
||||
notFound($c, "View $viewName doesn't exist.") if !defined $view;
|
||||
$c->stash->{view} = $view;
|
||||
|
||||
(my $primaryJob) = $view->viewjobs->search({isprimary => 1});
|
||||
#die "View $viewName doesn't have a primary job." if !defined $primaryJob;
|
||||
|
||||
my $jobs = [$view->viewjobs->search({},
|
||||
{order_by => ["isprimary DESC", "job", "attrs"]})];
|
||||
|
||||
$c->stash->{jobs} = $jobs;
|
||||
|
||||
return ($project, $view, $primaryJob, $jobs);
|
||||
}
|
||||
|
||||
|
||||
sub updateView {
|
||||
my ($c, $view) = @_;
|
||||
|
||||
my $viewName = trim $c->request->params->{name};
|
||||
error($c, "Invalid view name: $viewName")
|
||||
unless $viewName =~ /^[[:alpha:]][\w\-]*$/;
|
||||
|
||||
$view->update(
|
||||
{ name => $viewName
|
||||
, description => trim $c->request->params->{description} });
|
||||
|
||||
$view->viewjobs->delete;
|
||||
|
||||
foreach my $param (keys %{$c->request->params}) {
|
||||
next unless $param =~ /^job-(\d+)-name$/;
|
||||
my $baseName = $1;
|
||||
|
||||
my $name = trim $c->request->params->{"job-$baseName-name"};
|
||||
my $description = trim $c->request->params->{"job-$baseName-description"};
|
||||
my $attrs = trim $c->request->params->{"job-$baseName-attrs"};
|
||||
|
||||
$name =~ /^([\w\-]+):($jobNameRE)$/ or error($c, "Invalid job name: $name");
|
||||
my $jobsetName = $1;
|
||||
my $jobName = $2;
|
||||
|
||||
error($c, "Jobset `$jobsetName' doesn't exist.")
|
||||
unless $view->project->jobsets->find({name => $jobsetName});
|
||||
|
||||
# !!! We could check whether the job exists, but that would
|
||||
# require the evaluator to have seen the job, which may not be
|
||||
# the case.
|
||||
|
||||
$view->viewjobs->create(
|
||||
{ jobset => $jobsetName
|
||||
, job => $jobName
|
||||
, description => $description
|
||||
, attrs => $attrs
|
||||
, isprimary => $c->request->params->{"primary"} eq $baseName ? 1 : 0
|
||||
});
|
||||
}
|
||||
|
||||
error($c, "There must be one primary job.")
|
||||
if $view->viewjobs->search({isprimary => 1})->count != 1;
|
||||
}
|
||||
|
||||
|
||||
sub view : Chained('/') PathPart('view') CaptureArgs(2) {
|
||||
my ($self, $c, $projectName, $viewName) = @_;
|
||||
my ($project, $view, $primaryJob, $jobs) = getView($c, $projectName, $viewName);
|
||||
$c->stash->{project} = $project;
|
||||
$c->stash->{view} = $view;
|
||||
$c->stash->{primaryJob} = $primaryJob;
|
||||
$c->stash->{jobs} = $jobs;
|
||||
}
|
||||
|
||||
|
||||
sub view_view : Chained('view') PathPart('') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
$c->stash->{template} = 'view.tt';
|
||||
|
||||
my $resultsPerPage = 10;
|
||||
my $page = int($c->req->param('page') || "1") || 1;
|
||||
|
||||
my @results = ();
|
||||
push @results, getViewResult($_, $c->stash->{jobs}) foreach
|
||||
getPrimaryBuildsForView($c->stash->{project}, $c->stash->{primaryJob}, $page, $resultsPerPage);
|
||||
|
||||
$c->stash->{baseUri} = $c->uri_for($self->action_for("view_view"), $c->req->captures);
|
||||
$c->stash->{results} = [@results];
|
||||
$c->stash->{page} = $page;
|
||||
$c->stash->{totalResults} = getPrimaryBuildTotal($c->stash->{project}, $c->stash->{primaryJob});
|
||||
$c->stash->{resultsPerPage} = $resultsPerPage;
|
||||
}
|
||||
|
||||
|
||||
sub edit : Chained('view') PathPart('edit') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
$c->stash->{template} = 'edit-view.tt';
|
||||
}
|
||||
|
||||
|
||||
sub submit : Chained('view') PathPart('submit') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
if (($c->request->params->{submit} || "") eq "delete") {
|
||||
$c->stash->{view}->delete;
|
||||
$c->res->redirect($c->uri_for($c->controller('Project')->action_for('project'),
|
||||
[$c->stash->{project}->name]));
|
||||
}
|
||||
txn_do($c->model('DB')->schema, sub {
|
||||
updateView($c, $c->stash->{view});
|
||||
});
|
||||
$c->res->redirect($c->uri_for($self->action_for("view_view"), $c->req->captures));
|
||||
}
|
||||
|
||||
|
||||
sub latest : Chained('view') PathPart('latest') {
|
||||
my ($self, $c, @args) = @_;
|
||||
|
||||
# Redirect to the latest result in the view in which every build
|
||||
# is successful.
|
||||
my $latest = getLatestSuccessfulViewResult(
|
||||
$c->stash->{project}, $c->stash->{primaryJob}, $c->stash->{jobs}, 0);
|
||||
error($c, "This view set has no successful results yet.") if !defined $latest;
|
||||
$c->res->redirect($c->uri_for($self->action_for("view_view"), $c->req->captures, $latest->id, @args, $c->req->params));
|
||||
}
|
||||
|
||||
|
||||
sub latest_finished : Chained('view') PathPart('latest-finished') {
|
||||
my ($self, $c, @args) = @_;
|
||||
|
||||
# Redirect to the latest result in the view in which every build
|
||||
# is successful *and* where the jobset evaluation has finished
|
||||
# completely.
|
||||
my $latest = getLatestSuccessfulViewResult(
|
||||
$c->stash->{project}, $c->stash->{primaryJob}, $c->stash->{jobs}, 1);
|
||||
error($c, "This view set has no successful results yet.") if !defined $latest;
|
||||
$c->res->redirect($c->uri_for($self->action_for("view_view"), $c->req->captures, $latest->id, @args, $c->req->params));
|
||||
}
|
||||
|
||||
|
||||
sub result : Chained('view') PathPart('') {
|
||||
my ($self, $c, $id, @args) = @_;
|
||||
|
||||
$c->stash->{template} = 'view-result.tt';
|
||||
|
||||
# Note: we don't actually check whether $id is a primary build,
|
||||
# but who cares?
|
||||
my $primaryBuild = $c->stash->{project}->builds->find($id)
|
||||
or error($c, "Build $id doesn't exist.");
|
||||
|
||||
my $result = getViewResult($primaryBuild, $c->stash->{jobs});
|
||||
$c->stash->{result} = $result;
|
||||
|
||||
my %jobNames;
|
||||
$jobNames{$_->{job}->job}++ foreach @{$result->{jobs}};
|
||||
$c->stash->{jobNames} = \%jobNames;
|
||||
|
||||
if (scalar @args == 1 && $args[0] eq "release") {
|
||||
requireProjectOwner($c, $c->stash->{project});
|
||||
|
||||
error($c, "The primary build of this view result did not provide a release name.")
|
||||
unless $result->{releasename};
|
||||
|
||||
error($c, "A release named `" . $result->{releasename} . "' already exists.")
|
||||
if $c->stash->{project}->releases->find({name => $result->{releasename}});
|
||||
|
||||
my $release;
|
||||
|
||||
txn_do($c->model('DB')->schema, sub {
|
||||
|
||||
$release = $c->stash->{project}->releases->create(
|
||||
{ name => $result->{releasename}
|
||||
, timestamp => time
|
||||
});
|
||||
|
||||
foreach my $job (@{$result->{jobs}}) {
|
||||
$release->releasemembers->create(
|
||||
{ build => $job->{build}->id
|
||||
, description => $job->{job}->description
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$c->res->redirect($c->uri_for($c->controller('Release')->action_for('view'),
|
||||
[$c->stash->{project}->name, $release->name]));
|
||||
}
|
||||
|
||||
elsif (scalar @args >= 1 && $args[0] eq "eval") {
|
||||
my $eval = $c->stash->{result}->{eval};
|
||||
notFound($c, "This view result has no evaluation.") unless defined $eval;
|
||||
$c->res->redirect($c->uri_for($c->controller('JobsetEval')->action_for("view"),
|
||||
[$eval->id], @args[1..$#args], $c->req->params));
|
||||
}
|
||||
|
||||
# Provide a redirect to the specified job of this view result
|
||||
# through `http://.../view/$project/$viewName/$viewResult/$jobName'.
|
||||
# Optionally, you can append `-$system' to the $jobName to get a
|
||||
# build for a specific platform.
|
||||
elsif (scalar @args != 0) {
|
||||
my $jobName = shift @args;
|
||||
my $system;
|
||||
if ($jobName =~ /^($jobNameRE)-($systemRE)$/) {
|
||||
$jobName = $1;
|
||||
$system = $2;
|
||||
}
|
||||
(my $build, my @others) =
|
||||
grep { $_->{job}->job eq $jobName && (!defined $system || ($_->{build} && $_->{build}->system eq $system)) }
|
||||
@{$result->{jobs}};
|
||||
notFound($c, "View doesn't have a job named ‘$jobName’" . ($system ? " for ‘$system’" : "") . ".")
|
||||
unless defined $build;
|
||||
error($c, "Job `$jobName' isn't unique.") if @others;
|
||||
return $c->res->redirect($c->uri_for($c->controller('Build')->action_for('build'),
|
||||
[$build->{build}->id], @args));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1;
|
|
@ -256,36 +256,6 @@ __PACKAGE__->has_many(
|
|||
undef,
|
||||
);
|
||||
|
||||
=head2 viewjobs
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::ViewJobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"viewjobs",
|
||||
"Hydra::Schema::ViewJobs",
|
||||
{ "foreign.project" => "self.name" },
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 views
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::Views>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"views",
|
||||
"Hydra::Schema::Views",
|
||||
{ "foreign.project" => "self.name" },
|
||||
undef,
|
||||
);
|
||||
|
||||
=head2 usernames
|
||||
|
||||
Type: many_to_many
|
||||
|
@ -297,8 +267,8 @@ Composing rels: L</projectmembers> -> username
|
|||
__PACKAGE__->many_to_many("usernames", "projectmembers", "username");
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2014-04-23 22:48:21
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:l8eN9UAavdqnL7Sjv4rmFw
|
||||
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2014-04-23 23:13:08
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fkd9ruEoVSBGIktmAj4u4g
|
||||
|
||||
my %hint = (
|
||||
columns => [
|
||||
|
|
|
@ -1,157 +0,0 @@
|
|||
use utf8;
|
||||
package Hydra::Schema::ViewJobs;
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader
|
||||
# DO NOT MODIFY THE FIRST PART OF THIS FILE
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Hydra::Schema::ViewJobs
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use base 'DBIx::Class::Core';
|
||||
|
||||
=head1 COMPONENTS LOADED
|
||||
|
||||
=over 4
|
||||
|
||||
=item * L<Hydra::Component::ToJSON>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->load_components("+Hydra::Component::ToJSON");
|
||||
|
||||
=head1 TABLE: C<ViewJobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->table("ViewJobs");
|
||||
|
||||
=head1 ACCESSORS
|
||||
|
||||
=head2 project
|
||||
|
||||
data_type: 'text'
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
|
||||
=head2 view_
|
||||
|
||||
data_type: 'text'
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
|
||||
=head2 job
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 0
|
||||
|
||||
=head2 attrs
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 0
|
||||
|
||||
=head2 isprimary
|
||||
|
||||
data_type: 'integer'
|
||||
default_value: 0
|
||||
is_nullable: 0
|
||||
|
||||
=head2 description
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 jobset
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 0
|
||||
|
||||
=head2 autorelease
|
||||
|
||||
data_type: 'integer'
|
||||
default_value: 0
|
||||
is_nullable: 0
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
"project",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
"view_",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
"job",
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
"attrs",
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
"isprimary",
|
||||
{ data_type => "integer", default_value => 0, is_nullable => 0 },
|
||||
"description",
|
||||
{ data_type => "text", is_nullable => 1 },
|
||||
"jobset",
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
"autorelease",
|
||||
{ data_type => "integer", default_value => 0, is_nullable => 0 },
|
||||
);
|
||||
|
||||
=head1 PRIMARY KEY
|
||||
|
||||
=over 4
|
||||
|
||||
=item * L</project>
|
||||
|
||||
=item * L</view_>
|
||||
|
||||
=item * L</job>
|
||||
|
||||
=item * L</attrs>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->set_primary_key("project", "view_", "job", "attrs");
|
||||
|
||||
=head1 RELATIONS
|
||||
|
||||
=head2 project
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Projects>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"project",
|
||||
"Hydra::Schema::Projects",
|
||||
{ name => "project" },
|
||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
=head2 view
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Views>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"view",
|
||||
"Hydra::Schema::Views",
|
||||
{ name => "view_", project => "project" },
|
||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hz912vBfYw0rHslBPqJW2w
|
||||
|
||||
1;
|
|
@ -1,123 +0,0 @@
|
|||
use utf8;
|
||||
package Hydra::Schema::Views;
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader
|
||||
# DO NOT MODIFY THE FIRST PART OF THIS FILE
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Hydra::Schema::Views
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use base 'DBIx::Class::Core';
|
||||
|
||||
=head1 COMPONENTS LOADED
|
||||
|
||||
=over 4
|
||||
|
||||
=item * L<Hydra::Component::ToJSON>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->load_components("+Hydra::Component::ToJSON");
|
||||
|
||||
=head1 TABLE: C<Views>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->table("Views");
|
||||
|
||||
=head1 ACCESSORS
|
||||
|
||||
=head2 project
|
||||
|
||||
data_type: 'text'
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
|
||||
=head2 name
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 0
|
||||
|
||||
=head2 description
|
||||
|
||||
data_type: 'text'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 keep
|
||||
|
||||
data_type: 'integer'
|
||||
default_value: 0
|
||||
is_nullable: 0
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
"project",
|
||||
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
|
||||
"name",
|
||||
{ data_type => "text", is_nullable => 0 },
|
||||
"description",
|
||||
{ data_type => "text", is_nullable => 1 },
|
||||
"keep",
|
||||
{ data_type => "integer", default_value => 0, is_nullable => 0 },
|
||||
);
|
||||
|
||||
=head1 PRIMARY KEY
|
||||
|
||||
=over 4
|
||||
|
||||
=item * L</project>
|
||||
|
||||
=item * L</name>
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->set_primary_key("project", "name");
|
||||
|
||||
=head1 RELATIONS
|
||||
|
||||
=head2 project
|
||||
|
||||
Type: belongs_to
|
||||
|
||||
Related object: L<Hydra::Schema::Projects>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->belongs_to(
|
||||
"project",
|
||||
"Hydra::Schema::Projects",
|
||||
{ name => "project" },
|
||||
{ is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" },
|
||||
);
|
||||
|
||||
=head2 viewjobs
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Hydra::Schema::ViewJobs>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"viewjobs",
|
||||
"Hydra::Schema::ViewJobs",
|
||||
{ "foreign.project" => "self.project", "foreign.view_" => "self.name" },
|
||||
undef,
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07033 @ 2013-06-13 01:54:50
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:U23GZ3k5KZk2go6j2LYLHA
|
||||
|
||||
1;
|
|
@ -1,106 +0,0 @@
|
|||
[% WRAPPER layout.tt title=(create ? "New view" : "View $project.name:$view.name") %]
|
||||
[% PROCESS common.tt %]
|
||||
[% USE HTML %]
|
||||
|
||||
|
||||
[% BLOCK renderJob %]
|
||||
<tr id="[% id %]" >
|
||||
<td>
|
||||
<button type="button" class="btn btn-warning" onclick='$(this).parents("tr").remove()'>
|
||||
<i class="icon-trash icon-white"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td><input type="radio" id="[% "$baseName-primary" %]" name="primary" [% IF job.isprimary %]
|
||||
checked="checked" [% END %] [% HTML.attributes(value => "$n") %] /></td>
|
||||
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-name", name => "$baseName-name", value => "$job.jobset:$job.job") %] /></td>
|
||||
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-description", name => "$baseName-description", value => job.description) %] /></td>
|
||||
<td><input type="text" class="string" [% HTML.attributes(id => "$baseName-attrs", name => "$baseName-attrs", value => job.attrs) %] /></td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
||||
|
||||
<form class="form-horizontal" action="[% IF create %][% c.uri_for('/project' project.name 'create-view/submit') %][% ELSE %][% c.uri_for('/view' project.name view.name 'submit') %][% END %]" method="post">
|
||||
|
||||
<fieldset>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Identifier</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="span3" name="name" [% HTML.attributes(value => view.name) %]/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Description</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="span3" name="description" [% HTML.attributes(value => view.description) %]/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-condensed table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Primary job</th>
|
||||
<th>Job name</th>
|
||||
<th>Description</th>
|
||||
<th>Constraint</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[% n = 0 %]
|
||||
[% FOREACH j IN jobs %]
|
||||
[% INCLUDE renderJob baseName="job-$n" job=j %]
|
||||
[% n = n + 1 %]
|
||||
[% END %]
|
||||
<tr>
|
||||
<td colspan="5" style="text-align: center;"><button type="button" class="add-job btn btn-success"><i class="icon-plus icon-white"></i> Add a job</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="icon-ok icon-white"></i>
|
||||
[%IF create %]Create[% ELSE %]Apply changes[% END %]
|
||||
</button>
|
||||
[% IF !create %]
|
||||
<button id="delete-view" type="submit" class="btn btn-danger" name="submit" value="delete">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
Delete this view
|
||||
</button>
|
||||
<script type="text/javascript">
|
||||
$("#delete-view").click(function() {
|
||||
return confirm("Are you sure you want to delete this view?");
|
||||
});
|
||||
</script>
|
||||
[% END %]
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<table class="template"> <!-- dummy wrapper needed because “hidden” trs are visible anyway -->
|
||||
[% INCLUDE renderJob job="" id="job-template" baseName="job-template" %]
|
||||
</table>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var id = [% n %];
|
||||
|
||||
$(".add-job").click(function() {
|
||||
var newnr = id++;
|
||||
var newid = "job-" + newnr;
|
||||
var x = $("#job-template").clone(true).attr("id", "").insertBefore($(this).parents("tr")).show();
|
||||
$("#job-template-name", x).attr("name", newid + "-name");
|
||||
$("#job-template-description", x).attr("name", newid + "-description");
|
||||
$("#job-template-attrs", x).attr("name", newid + "-attrs");
|
||||
$("#job-template-primary", x).attr("value", newnr);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
[% END %]
|
|
@ -20,9 +20,6 @@
|
|||
<li class="active"><a href="#tabs-project" data-toggle="tab">Jobsets</a></li>
|
||||
<li><a href="#tabs-configuration" data-toggle="tab">Configuration</a></li>
|
||||
<li><a href="#tabs-releases" data-toggle="tab">Releases</a></li>
|
||||
[% IF views.size > 0 %]
|
||||
<li><a href="#tabs-views" data-toggle="tab">Views</a></li>
|
||||
[% END %]
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
@ -99,34 +96,6 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div id="tabs-views" class="tab-pane">
|
||||
|
||||
[% IF views.size > 0 %]
|
||||
|
||||
<p>Project <tt>[% project.name %]</tt> has the following views:</p>
|
||||
|
||||
<ul>
|
||||
[% FOREACH view IN views %]
|
||||
<li>
|
||||
<a href="[% c.uri_for('/view' project.name view.name) %]"><tt>[% view.name %]</tt></a>
|
||||
</li>
|
||||
[% END %]
|
||||
</ul>
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
<p>Project <tt>[% project.name %]</tt> has no views.</p>
|
||||
|
||||
[% END %]
|
||||
|
||||
<!--
|
||||
<p>
|
||||
<a class="btn" href="[% c.uri_for('/project' project.name 'create-view') %]"><i class="icon-plus"></i> Create a new view</a>
|
||||
</p>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
[% releaseName = (result.releasename || "(No name)") %]
|
||||
[% WRAPPER layout.tt title="View $releaseName" %]
|
||||
[% PROCESS common.tt %]
|
||||
[% PROCESS "product-list.tt" %]
|
||||
[% USE HTML %]
|
||||
|
||||
<p><em>Finished building on [% INCLUDE renderDateTime timestamp = result.timestamp %].</em></p>
|
||||
|
||||
[% IF result.status == 1 %]
|
||||
<p class="error">Note: One or more of the jobs in the view did not build correctly. See below for details.</p>
|
||||
[% ELSIF result.status == 2 %]
|
||||
<p class="error">Note: One or more of the jobs in the view have not been built (yet). See below for details.</p>
|
||||
[% END %]
|
||||
|
||||
[% FOREACH j IN result.jobs %]
|
||||
|
||||
<h2>
|
||||
[% IF j.build %]<a href="[% c.uri_for('/build' j.build.id) %]">[% END %]
|
||||
[% INCLUDE renderViewJobName job=j.job %]
|
||||
[% IF j.build %]</a>[% END %]
|
||||
</h2>
|
||||
|
||||
[% IF j.build %]
|
||||
|
||||
[% IF j.build.buildstatus == 0 %]
|
||||
|
||||
[% IF j.build.buildproducts %]
|
||||
[% p = jobNames.${j.job.job} > 1 ? "-${j.build.system}" : "";
|
||||
INCLUDE renderProductList build=j.build latestRoot=['/view' project.name view.name 'latest' "${j.job.job}${p}"]
|
||||
%]
|
||||
[% ELSE %]
|
||||
<p><em>Succeeded.</em></p>
|
||||
[% END %]
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
<p class="error">Build failed</p>
|
||||
|
||||
[% END %]
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
<p class="error">Build not (yet) performed.</p>
|
||||
|
||||
[% END %]
|
||||
|
||||
<br />
|
||||
|
||||
[% END %]
|
||||
|
||||
[% IF c.user_exists %]
|
||||
<p>
|
||||
<a class="btn" href="[% c.uri_for('/view' project.name view.name result.id 'release') %]">Release</a>
|
||||
</p>
|
||||
[% END %]
|
||||
|
||||
[% END %]
|
|
@ -1,86 +0,0 @@
|
|||
[% WRAPPER layout.tt title="View $view.project.name:$view.name" %]
|
||||
[% PROCESS common.tt %]
|
||||
[% USE HTML %]
|
||||
|
||||
<p>
|
||||
<a class="btn" href="[% c.uri_for('/view' project.name view.name "edit") %]"><i class="icon-edit"></i> Edit</a>
|
||||
<a class="btn" href="[% c.uri_for('/view' project.name view.name "latest") %]"><i class="icon-share-alt"></i> Latest</a>
|
||||
</p>
|
||||
|
||||
<p>Showing results [% (page - 1) * resultsPerPage + 1 %] - [% (page - 1) * resultsPerPage + results.size %] out of [% totalResults %].</p>
|
||||
|
||||
<table class="table table-condensed table-striped clickable-rows">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>#</th>
|
||||
<th>Name</th>
|
||||
<th>Date</th>
|
||||
[% FOREACH j IN jobs %]
|
||||
<th class="releaseSetJobName">[% INCLUDE renderViewJobName job=j %]</th>
|
||||
[% END %]
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
[% FOREACH result IN results %]
|
||||
<tr>
|
||||
<td>
|
||||
[% IF result.status == 0 %]
|
||||
<img src="[% c.uri_for("/static/images/checkmark_16.png") %]" />
|
||||
[% ELSIF result.status == 1 %]
|
||||
<img src="[% c.uri_for("/static/images/error_16.png") %]" />
|
||||
[% ELSIF result.status == 2 %]
|
||||
<img src="[% c.uri_for("/static/images/help_16.png") %]" />
|
||||
[% END %]
|
||||
</td>
|
||||
<td><a class="row-link" href="[% c.uri_for('/view' project.name view.name result.id) %]">[% result.id %]</a></td>
|
||||
<td>
|
||||
[% IF result.releasename %]
|
||||
<tt>[% result.releasename %]</tt>
|
||||
[% ELSE %]
|
||||
<em>No name</em>
|
||||
[% END %]
|
||||
</td>
|
||||
<td>[% INCLUDE renderDateTime timestamp=result.timestamp %]</td>
|
||||
[% FOREACH j IN result.jobs %]
|
||||
<td class="centered">
|
||||
[% IF j.build %]
|
||||
<a href="[% c.uri_for('/build' j.build.id) %]">
|
||||
[% IF j.build.get_column('buildstatus') == 0 %]
|
||||
<img src="[% c.uri_for("/static/images/checkmark_16.png") %]" />
|
||||
[% ELSE %]
|
||||
<img src="[% c.uri_for("/static/images/error_16.png") %]" />
|
||||
[% END %]
|
||||
</a>
|
||||
[% END %]
|
||||
</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<ul class="pager">
|
||||
[% IF page > 1 %]
|
||||
<li class="previous"><a href="[% "$baseUri?page="; (page - 1) %]">Prev</a></li>
|
||||
[% END %]
|
||||
[% IF page * resultsPerPage < totalResults %]
|
||||
<li class="next"><a href="[% "$baseUri?page="; (page + 1) %]">Next</a></li>
|
||||
[% END %]
|
||||
</ul>
|
||||
|
||||
<!--
|
||||
<p>
|
||||
[<a href="[% "$baseUri?page=1" %]">First</a>]
|
||||
[% IF page > 1 %]
|
||||
[<a href="[% "$baseUri?page="; (page - 1) %]">Prev</a>]
|
||||
[% END %]
|
||||
[% IF page * resultsPerPage < totalResults %]
|
||||
[<a href="[% "$baseUri?page="; (page + 1) %]">Next</a>]
|
||||
[% END %]
|
||||
[<a href="[% "$baseUri?page="; (totalResults - 1) div resultsPerPage + 1 %]">Last</a>]
|
||||
</p>
|
||||
-->
|
||||
|
||||
[% END %]
|
|
@ -372,57 +372,6 @@ create table SystemTypes (
|
|||
);
|
||||
|
||||
|
||||
-- Views are a mechanism to automatically group related builds
|
||||
-- together. A view definition consists of a build of some "primary"
|
||||
-- job, plus all builds of the other jobs named in ViewJobs that have
|
||||
-- that build as an input. If there are multiple builds matching a
|
||||
-- ViewJob, then we take the oldest successful build, or the oldest
|
||||
-- unsuccessful build if there is no successful build.
|
||||
create table Views (
|
||||
project text not null,
|
||||
name text not null,
|
||||
|
||||
description text,
|
||||
|
||||
-- If true, don't garbage-collect builds included in this view.
|
||||
keep integer not null default 0,
|
||||
|
||||
primary key (project, name),
|
||||
foreign key (project) references Projects(name) on delete cascade on update cascade
|
||||
);
|
||||
|
||||
|
||||
create table ViewJobs (
|
||||
project text not null,
|
||||
view_ text not null,
|
||||
|
||||
job text not null,
|
||||
|
||||
-- A constraint on the job consisting of `name=value' pairs,
|
||||
-- e.g. "system=i686-linux officialRelease=true". Should really
|
||||
-- be a separate table but I'm lazy.
|
||||
attrs text not null,
|
||||
|
||||
-- If set, this is the primary job for the view. There can be
|
||||
-- only one such job per view.
|
||||
isPrimary integer not null default 0,
|
||||
|
||||
description text,
|
||||
|
||||
jobset text not null,
|
||||
|
||||
-- If set, once there is a successful build for every job
|
||||
-- associated with a build of the view's primary job, that set of
|
||||
-- builds is automatically added as a release to the Releases
|
||||
-- table.
|
||||
autoRelease integer not null default 0,
|
||||
|
||||
primary key (project, view_, job, attrs),
|
||||
foreign key (project) references Projects(name) on delete cascade on update cascade,
|
||||
foreign key (project, view_) references Views(project, name) on delete cascade on update cascade
|
||||
);
|
||||
|
||||
|
||||
-- A release is a named set of builds. The ReleaseMembers table lists
|
||||
-- the builds that constitute each release.
|
||||
create table Releases (
|
||||
|
|
2
src/sql/upgrade-27.sql
Normal file
2
src/sql/upgrade-27.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
drop table ViewJobs;
|
||||
drop table Views;
|
Loading…
Reference in a new issue