Skip to content
This repository has been archived by the owner on Nov 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #1616 from mitchell852/1.6.x
Browse files Browse the repository at this point in the history
Speeds up fetching of parameters
  • Loading branch information
dangogh authored Jul 20, 2016
2 parents 9d1ef9d + 2888980 commit 4899d30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions traffic_ops/app/lib/UI/Cdn.pm
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ sub aparameter {
}

my $rs = undef;
if ( $col eq 'profile' and $val eq 'ORPHANS' ) {
if ( $col eq 'profile' and $val eq 'ORPHANS' ) { # Used with 'Parameters > Orphaned Parameters' menu item
my $lindked_profile_rs = $self->db->resultset('ProfileParameter')->search(undef);
my $lindked_cachegroup_rs = $self->db->resultset('CachegroupParameter')->search(undef);
$rs = $self->db->resultset('Parameter')->search(
Expand All @@ -287,11 +287,11 @@ sub aparameter {
}
$rs = undef;
}
elsif ( $col eq 'profile' && $val ne 'all' ) {
elsif ( $col eq 'profile' && $val ne 'all' ) { # Used with 'Parameters > Global Profile' menu item
my $p_id = &profile_id( $self, $val );
$rs = $self->db->resultset('ProfileParameter')->search( { $col => $p_id }, { prefetch => [ { 'parameter' => undef }, { 'profile' => undef } ] } );
}
elsif ( !defined($col) || ( $col eq 'profile' && $val eq 'all' ) ) {
elsif ( !defined($col) || ( $col eq 'profile' && $val eq 'all' ) ) { # Used with 'Parameters > All Profiles' menu item
$rs = $self->db->resultset('ProfileParameter')->search( undef, { prefetch => [ { 'parameter' => undef }, { 'profile' => undef } ] } );
}

Expand All @@ -303,7 +303,7 @@ sub aparameter {
}
my $value = $row->parameter->value;
&UI::Parameter::conceal_secure_parameter_value( $self, $row->parameter->secure, \$value );
my @line = [ $row->parameter->id, $row->profile->name, $row->parameter->name, $row->parameter->config_file, $value, $secure, "profile" ];
my @line = [ $row->parameter->id, $row->profile->name, $row->parameter->name, $row->parameter->config_file, $value, $secure ];
push( @{ $data{'aaData'} }, @line );
}
}
Expand All @@ -314,14 +314,19 @@ sub aparameter {
$rs = $self->db->resultset('CachegroupParameter')
->search( { $col => $l_id }, { prefetch => [ { 'parameter' => undef }, { 'cachegroup' => undef } ] } );
}
elsif ( !defined($col) || ( $col eq 'cachegroup' && $val eq 'all' ) ) {
elsif ( !defined($col) || ( $col eq 'cachegroup' && $val eq 'all' ) ) { # Used with 'Parameters > All Cache Groups' menu item
$rs = $self->db->resultset('CachegroupParameter')->search( undef, { prefetch => [ { 'parameter' => undef }, { 'cachegroup' => undef } ] } );
}

if ( defined($rs) ) {
while ( my $row = $rs->next ) {
my @line =
[ $row->parameter->id, $row->cachegroup->name, $row->parameter->name, $row->parameter->config_file, $row->parameter->value, "cachegroup" ];
my $secure = "no";
if ( $row->parameter->secure == 1 ) {
$secure = "yes";
}
my $value = $row->parameter->value;
&UI::Parameter::conceal_secure_parameter_value( $self, $row->parameter->secure, \$value );
my @line = [ $row->parameter->id, $row->cachegroup->name, $row->parameter->name, $row->parameter->config_file, $row->parameter->value, $secure ];
push( @{ $data{'aaData'} }, @line );
}
}
Expand Down
2 changes: 1 addition & 1 deletion traffic_ops/app/lib/UI/Parameter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ sub conceal_secure_parameter_value {
my $self = shift;
my $secure = shift;
my $value = shift;
if ( !&is_admin($self) && $secure == 1 ) {
if ( $secure == 1 && !&is_admin($self) ) {
$$value = '*********';
}
}
Expand Down

0 comments on commit 4899d30

Please sign in to comment.