1 |
dpavlin |
14 |
use strict; |
2 |
|
|
use warnings; |
3 |
|
|
|
4 |
|
|
=head1 NAME |
5 |
|
|
|
6 |
|
|
Perly::Action::Run |
7 |
|
|
|
8 |
|
|
=cut |
9 |
|
|
|
10 |
|
|
package Perly::Action::Run; |
11 |
|
|
use base qw/Perly::Action Jifty::Action/; |
12 |
|
|
|
13 |
|
|
use Jifty::Param::Schema; |
14 |
|
|
use Jifty::Action schema { |
15 |
|
|
|
16 |
|
|
param input => |
17 |
|
|
label is 'Input data', |
18 |
|
|
available are defer { |
19 |
|
|
my $coll = Perly::Model::InputCollection->new; |
20 |
|
|
$coll->unlimit; |
21 |
|
|
[ '', { |
22 |
|
|
display_from => 'name', |
23 |
|
|
value_from => 'id', |
24 |
|
|
collection => $coll, |
25 |
|
|
}]; |
26 |
|
|
}, |
27 |
|
|
render as 'Select'; |
28 |
|
|
|
29 |
|
|
param code => |
30 |
|
|
label is 'Source code', |
31 |
|
|
available are defer { |
32 |
|
|
my $coll = Perly::Model::CodeCollection->new; |
33 |
|
|
$coll->unlimit; |
34 |
|
|
[{ |
35 |
|
|
display_from => 'name', |
36 |
|
|
value_from => 'id', |
37 |
|
|
collection => $coll, |
38 |
|
|
}]; |
39 |
|
|
}, |
40 |
|
|
render as 'Select', |
41 |
|
|
is mandatory; |
42 |
|
|
}; |
43 |
|
|
|
44 |
|
|
sub sticky_on_success { 1 } |
45 |
|
|
sub sticky_on_failure { 1 } |
46 |
|
|
|
47 |
|
|
=head2 take_action |
48 |
|
|
|
49 |
|
|
=cut |
50 |
|
|
|
51 |
|
|
sub take_action { |
52 |
|
|
my $self = shift; |
53 |
|
|
|
54 |
|
|
# Custom action code |
55 |
|
|
|
56 |
|
|
$self->report_success if not $self->result->failure; |
57 |
|
|
|
58 |
|
|
return 1; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
=head2 report_success |
62 |
|
|
|
63 |
|
|
=cut |
64 |
|
|
|
65 |
|
|
sub report_success { |
66 |
|
|
my $self = shift; |
67 |
|
|
# Your success message here |
68 |
|
|
$self->result->message('Success'); |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
1; |
72 |
|
|
|