line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RapidApp::Module::DbicSchemaGrid; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2488
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
127
|
|
4
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
122
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
17
|
use Moose; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
33
|
|
7
|
|
|
|
|
|
|
extends 'RapidApp::Module::Grid'; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
24439
|
use RapidApp::Util qw(:all); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
3932
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has '+auto_autosize_columns', default => 1; #<-- not working |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'Schema', is => 'ro', isa => 'Object', required => 1; |
14
|
|
|
|
|
|
|
has '+record_pk', default => 'source'; |
15
|
|
|
|
|
|
|
has 'exclude_sources', is => 'ro', isa => 'ArrayRef', default => sub {[]}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'tabTitle', is => 'ro', lazy => 1, default => sub { |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
return (ref $self->Schema); |
20
|
|
|
|
|
|
|
}; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'tabIconCls', is => 'ro', lazy => 1, default => undef; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub BUILD { |
25
|
5
|
|
|
5
|
0
|
49
|
my $self = shift; |
26
|
|
|
|
|
|
|
|
27
|
5
|
|
|
|
|
90
|
$self->apply_columns( |
28
|
|
|
|
|
|
|
source => { |
29
|
|
|
|
|
|
|
header => 'Source', |
30
|
|
|
|
|
|
|
width => 180 |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
table => { |
33
|
|
|
|
|
|
|
header => 'Table Name', |
34
|
|
|
|
|
|
|
width => 150, |
35
|
|
|
|
|
|
|
hidden => \1 |
36
|
|
|
|
|
|
|
}, |
37
|
|
|
|
|
|
|
class => { |
38
|
|
|
|
|
|
|
header => 'Class Name', |
39
|
|
|
|
|
|
|
width => 210, |
40
|
|
|
|
|
|
|
hidden => \1 |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
columns => { |
43
|
|
|
|
|
|
|
header => 'Columns', |
44
|
|
|
|
|
|
|
width => 100, |
45
|
|
|
|
|
|
|
xtype => 'numbercolumn', |
46
|
|
|
|
|
|
|
format => '0', |
47
|
|
|
|
|
|
|
align => 'right', |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
rows => { |
50
|
|
|
|
|
|
|
header => 'Rows', |
51
|
|
|
|
|
|
|
width => 90, |
52
|
|
|
|
|
|
|
xtype => 'numbercolumn', |
53
|
|
|
|
|
|
|
format => '0,0', |
54
|
|
|
|
|
|
|
align => 'right', |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
5
|
|
|
|
|
73
|
$self->set_columns_order(0,qw(source table class columns rows)); |
59
|
|
|
|
|
|
|
|
60
|
5
|
|
|
|
|
154
|
$self->apply_extconfig( |
61
|
|
|
|
|
|
|
tabTitle => $self->tabTitle, |
62
|
|
|
|
|
|
|
use_multifilters => \0, |
63
|
|
|
|
|
|
|
pageSize => undef |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
5
|
50
|
|
|
|
168
|
$self->apply_extconfig(tabIconCls => $self->tabIconCls) if ($self->tabIconCls); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
has '+DataStore_build_params', default => sub {{ |
70
|
|
|
|
|
|
|
preload_data => 1, |
71
|
|
|
|
|
|
|
store_fields => [ |
72
|
|
|
|
|
|
|
{ name => 'source' }, |
73
|
|
|
|
|
|
|
{ name => 'table' }, |
74
|
|
|
|
|
|
|
{ name => 'class' }, |
75
|
|
|
|
|
|
|
{ name => 'columns', sortType => 'asInt', type => 'int' }, |
76
|
|
|
|
|
|
|
{ name => 'rows', sortType => 'asInt', type => 'int' } |
77
|
|
|
|
|
|
|
] |
78
|
|
|
|
|
|
|
}}; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub read_records { |
82
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my @rows = $self->schema_source_rows; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
return { |
87
|
0
|
|
|
|
|
|
results => (scalar @rows), |
88
|
|
|
|
|
|
|
rows => \@rows |
89
|
|
|
|
|
|
|
}; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub schema_source_rows { |
94
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
95
|
|
|
|
|
|
|
return map { |
96
|
0
|
|
|
|
|
|
my $Source = $self->Schema->source($_); |
|
0
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $class = $self->Schema->class($_); |
98
|
0
|
|
|
0
|
|
|
my $url = try{$class->TableSpec_get_conf('open_url_multi')}; |
|
0
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $table = $class->_table_name_safe; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
{ |
102
|
0
|
0
|
|
|
|
|
source => $url ? '<a href="#!' . $url . '">' . $_ . '</a>' : $_, |
103
|
|
|
|
|
|
|
table => $table, |
104
|
|
|
|
|
|
|
class => $class, |
105
|
|
|
|
|
|
|
columns => (scalar $Source->columns), |
106
|
|
|
|
|
|
|
rows => $Source->resultset->count |
107
|
|
|
|
|
|
|
}; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
} $self->sources; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub sources { |
114
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
115
|
0
|
|
|
|
|
|
my %excl_sources = map {$_=>1} @{$self->exclude_sources}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
return grep { ! $excl_sources{$_} } $self->Schema->sources; |
|
0
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
#### --------------------- #### |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
123
|
4
|
|
|
4
|
|
35
|
no Moose; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
21
|
|
124
|
|
|
|
|
|
|
#__PACKAGE__->meta->make_immutable; |
125
|
|
|
|
|
|
|
1; |