forked from lix-project/hydra
Remove some obsolete JSON APIs
This commit is contained in:
parent
c8e5faf81e
commit
adcdfcde6b
|
@ -15,8 +15,6 @@ use Digest::SHA qw(sha256_hex);
|
||||||
use Text::Diff;
|
use Text::Diff;
|
||||||
use File::Slurp;
|
use File::Slurp;
|
||||||
|
|
||||||
# !!! Rewrite this to use View::JSON.
|
|
||||||
|
|
||||||
|
|
||||||
sub api : Chained('/') PathPart('api') CaptureArgs(0) {
|
sub api : Chained('/') PathPart('api') CaptureArgs(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
|
@ -24,32 +22,6 @@ sub api : Chained('/') PathPart('api') CaptureArgs(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub projectToHash {
|
|
||||||
my ($project) = @_;
|
|
||||||
return {
|
|
||||||
name => $project->name,
|
|
||||||
description => $project->description
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub projects : Chained('api') PathPart('projects') Args(0) {
|
|
||||||
my ($self, $c) = @_;
|
|
||||||
|
|
||||||
my @projects = $c->model('DB::Projects')->search({hidden => 0}, {order_by => 'name'});
|
|
||||||
|
|
||||||
my @list;
|
|
||||||
foreach my $p (@projects) {
|
|
||||||
push @list, projectToHash($p);
|
|
||||||
}
|
|
||||||
|
|
||||||
$c->stash->{'plain'} = {
|
|
||||||
data => scalar (JSON::Any->objToJson(\@list))
|
|
||||||
};
|
|
||||||
$c->forward('Hydra::View::Plain');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub buildToHash {
|
sub buildToHash {
|
||||||
my ($build) = @_;
|
my ($build) = @_;
|
||||||
my $result = {
|
my $result = {
|
||||||
|
|
|
@ -613,17 +613,6 @@ sub clone_submit : Chained('buildChain') PathPart('clone/submit') Args(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sub get_info : Chained('buildChain') PathPart('api/get-info') Args(0) {
|
|
||||||
my ($self, $c) = @_;
|
|
||||||
my $build = $c->stash->{build};
|
|
||||||
$c->stash->{json}->{buildId} = $build->id;
|
|
||||||
$c->stash->{json}->{drvPath} = $build->drvpath;
|
|
||||||
my $out = getMainOutput($build);
|
|
||||||
$c->stash->{json}->{outPath} = $out->path if defined $out;
|
|
||||||
$c->forward('View::JSON');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub evals : Chained('buildChain') PathPart('evals') Args(0) {
|
sub evals : Chained('buildChain') PathPart('evals') Args(0) {
|
||||||
my ($self, $c) = @_;
|
my ($self, $c) = @_;
|
||||||
|
|
||||||
|
|
|
@ -55,11 +55,10 @@ sub index :Path :Args(0) {
|
||||||
$c->stash->{template} = 'overview.tt';
|
$c->stash->{template} = 'overview.tt';
|
||||||
$c->stash->{projects} = [$c->model('DB::Projects')->search(isAdmin($c) ? {} : {hidden => 0}, {order_by => 'name'})];
|
$c->stash->{projects} = [$c->model('DB::Projects')->search(isAdmin($c) ? {} : {hidden => 0}, {order_by => 'name'})];
|
||||||
$c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, { order_by => ['createtime DESC'], rows => 5 })];
|
$c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, { order_by => ['createtime DESC'], rows => 5 })];
|
||||||
$self->status_ok(
|
$self->status_ok($c,
|
||||||
$c,
|
|
||||||
entity => [$c->model('DB::Projects')->search(isAdmin($c) ? {} : {hidden => 0}, {
|
entity => [$c->model('DB::Projects')->search(isAdmin($c) ? {} : {hidden => 0}, {
|
||||||
order_by => 'name',
|
order_by => 'name',
|
||||||
columns => [ 'name', 'displayname' ]
|
columns => [ 'name', 'displayname', 'description' ]
|
||||||
})]
|
})]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue