You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/03/09 19:09:12 UTC

[04/44] incubator-trafficcontrol git commit: CDN form & UI

CDN form & UI


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/8cf46ac7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/8cf46ac7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/8cf46ac7

Branch: refs/heads/master
Commit: 8cf46ac7b8096a56edc7cfdb3483acd77203f6fa
Parents: 05798ae
Author: Jan van Doorn <ja...@cable.comcast.com>
Authored: Sat Dec 31 16:56:56 2016 -0700
Committer: Jan van Doorn <jv...@apache.org>
Committed: Fri Feb 17 17:49:10 2017 +0000

----------------------------------------------------------------------
 traffic_ops/app/lib/UI/Cdn.pm               | 19 ++++++++++++++++---
 traffic_ops/app/templates/cdn/_form.html.ep | 21 +++++++++++++++++++--
 traffic_ops/app/templates/cdn/index.html.ep |  1 +
 3 files changed, 36 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/8cf46ac7/traffic_ops/app/lib/UI/Cdn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Cdn.pm b/traffic_ops/app/lib/UI/Cdn.pm
index d9f9d80..f36bd07 100644
--- a/traffic_ops/app/lib/UI/Cdn.pm
+++ b/traffic_ops/app/lib/UI/Cdn.pm
@@ -79,6 +79,8 @@ sub update {
         cdn_data    => {
             id   => $id,
             name => $self->param('cdn_data.name'),
+            domain_name => $self->param('cdn_data.domain_name'),
+            dnssec_enabled => $self->param('cdn_data.dnssec_enabled'),
         }
     );
 
@@ -107,14 +109,22 @@ sub update {
 sub create {
     my $self = shift;
     my $name = $self->param('cdn_data.name');
+    my $dnssec_enabled = defined($self->param('cdn_data.dnssec_enabled')) ? $self->param('cdn_data.dnssec_enabled') : 0;
+    my $domain_name = $self->param('cdn_data.domain_name');
     my $data = $self->get_cdns();
     my $cdns = $data->{'cdn'};
 
+    foreach my $f ($self->param) {
+      print $f . " => " . Dumper($self->param($f)) . "\n";
+    }
+
     if ( !$self->isValidCdn() ) {
         $self->stash(
             fbox_layout => 1,
             cdn_data    => {
                 name => $name,
+                domain_name => $domain_name,
+                dnssec_enabled => $dnssec_enabled,
             }
         );
         return $self->render('cdn/add');
@@ -125,6 +135,8 @@ sub create {
             fbox_layout => 1,
             cdn_data    => {
                 name => $name,
+                domain_name => $domain_name,
+                dnssec_enabled => $dnssec_enabled,
             }
         );
         return $self->render('cdn/add');
@@ -136,7 +148,7 @@ sub create {
         return $self->redirect_to( '/cdn/edit/' . $new_id );
     }
     else {
-        my $insert = $self->db->resultset('Cdn')->create( { name => $name } );
+        my $insert = $self->db->resultset('Cdn')->create( { name => $name, domain_name => $domain_name, dnssec_enabled => $dnssec_enabled } );
         $insert->insert();
         $new_id = $insert->id;
     }
@@ -445,9 +457,10 @@ sub adeliveryservice {
         # This will be undefined for 'Steering' delivery services
         my $org_server_fqdn = defined($row->org_server_fqdn) ? $row->org_server_fqdn : "";
 
+        my $ptext = defined($row->profile) ? $row->profile->name : "-";
         my $line = [
             $row->id,                       $row->xml_id,                $org_server_fqdn,                "dummy",
-            $cdn_name,                      $row->profile->name,         $row->ccr_dns_ttl,                    $yesno{ $row->active },
+            $cdn_name,                      $ptext,                      $row->ccr_dns_ttl,                    $yesno{ $row->active },
             $row->type->name,               $row->dscp,                  $yesno{ $row->signed },               $row->qstring_ignore,
             $geo_limits{ $row->geo_limit }, $protocol{ $row->protocol }, $yesno{ $row->ipv6_routing_enabled }, $row->range_request_handling,
             $row->http_bypass_fqdn,         $row->dns_bypass_ip,         $row->dns_bypass_ip6,                 $row->dns_bypass_ttl,
@@ -586,7 +599,7 @@ sub acdn {
 
     $rs = $self->db->resultset('Cdn')->search(undef);
     while ( my $row = $rs->next ) {
-        my @line = [ $row->id, $row->name, $yesno{ $row->dnssec_enabled }, $row->last_updated ];
+        my @line = [ $row->id, $row->name, $row->domain_name, $yesno{ $row->dnssec_enabled }, $row->last_updated ];
         push( @{ $data{'aaData'} }, @line );
     }
     $self->render( json => \%data );

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/8cf46ac7/traffic_ops/app/templates/cdn/_form.html.ep
----------------------------------------------------------------------
diff --git a/traffic_ops/app/templates/cdn/_form.html.ep b/traffic_ops/app/templates/cdn/_form.html.ep
index b886a36..68edabf 100644
--- a/traffic_ops/app/templates/cdn/_form.html.ep
+++ b/traffic_ops/app/templates/cdn/_form.html.ep
@@ -18,7 +18,24 @@
 			<span class="field-with-error"><%= field('cdn_data.name')->error %></span>
 		<% } %>
 		%= label_for 'name' => '* Name', class => 'label'
-		%= field('cdn_data.name')->text(class => 'field', required => 'required', size => 10, name => 'cdn_data.name', id => 'cdn_data.name')
+          %= field('cdn_data.name')->text(class => 'field', required => 'required', size => 10, name => 'cdn_data.name', id => 'cdn_data.name')
 	</div>
-	<br>
+     <div class="block">
+          <% unless (field('cdn_data.domain_name')->valid) { %>
+               <span class="field-with-error"><%= field('cdn_data.domain_name')->error %></span>
+          <% } %>
+          %= label_for 'domain_name' => '* Domain Name', class => 'label'
+          %= field('cdn_data.domain_name')->text(class => 'field', required => 'required', size => 10, name => 'cdn_data.domain_name', id => 'cdn_data.domain_name')
+    </div>
+    <div class="block">
+    <% unless(field('cdn_data.dnssec_enabled')->valid) { %>
+     <span class="field-with-error"><%= field('cdn_data.dnssec_enabled')->error %></span>
+    <% } %>
+    %= label_for 'dnssec_enabled' => '* DNSSEC Enabled', class => 'label'
+    <% if (field('cdn_data.dnssec_enabled') == 0) { %>
+        %= check_box 'cdn_data.dnssec_enabled' => 1
+    <% } else { %>
+        %= check_box 'cdn_data.dnssec_enabled' => 1, checked => 1
+    <% } %>
+</div><br>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/8cf46ac7/traffic_ops/app/templates/cdn/index.html.ep
----------------------------------------------------------------------
diff --git a/traffic_ops/app/templates/cdn/index.html.ep b/traffic_ops/app/templates/cdn/index.html.ep
index b086d0c..bc16a03 100644
--- a/traffic_ops/app/templates/cdn/index.html.ep
+++ b/traffic_ops/app/templates/cdn/index.html.ep
@@ -82,6 +82,7 @@ $(function () {
 					<tr>
 						<td></td>
 						<td>Name</td>
+						<td>Domain Name</td>
 						<td>DNSSEC enabled?</td>
 						<td>Last Updated</td>
 					</tr>