You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2017/08/22 14:21:40 UTC
[2/2] incubator-trafficcontrol git commit: adds a table to view all
deliveryservices for a given tenant
adds a table to view all deliveryservices for a given tenant
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f8f38925
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f8f38925
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f8f38925
Branch: refs/heads/master
Commit: f8f3892581f82196b0d310042cb2a05050c06ca4
Parents: 2d36fa3
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Mon Aug 21 20:56:17 2017 -0600
Committer: Dewayne Richardson <de...@apache.org>
Committed: Tue Aug 22 08:21:06 2017 -0600
----------------------------------------------------------------------
.../traffic_ops_api/v12/deliveryservice.rst | 2 +
traffic_ops/app/lib/API/Deliveryservice.pm | 5 ++
traffic_portal/app/src/app.js | 2 +
.../modules/form/tenant/FormTenantController.js | 4 ++
.../modules/form/tenant/form.tenant.tpl.html | 1 +
.../TableTenantDeliveryServicesController.js | 47 ++++++++++++
.../table/tenantDeliveryServices/index.js | 22 ++++++
.../table.tenantDeliveryServices.tpl.html | 76 ++++++++++++++++++++
.../admin/tenants/deliveryServices/index.js | 42 +++++++++++
9 files changed, 201 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8f38925/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
index 80b98d8..b26d30e 100644
--- a/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
+++ b/docs/source/development/traffic_ops_api/v12/deliveryservice.rst
@@ -41,6 +41,8 @@ Delivery Service
+-----------------+----------+---------------------------------------------------+
| ``profile`` | no | Filter delivery services by Profile ID. |
+-----------------+----------+---------------------------------------------------+
+ | ``tenant`` | no | Filter delivery services by Tenant ID. |
+ +-----------------+----------+---------------------------------------------------+
| ``type`` | no | Filter delivery services by Type ID. |
+-----------------+----------+---------------------------------------------------+
| ``logsEnabled`` | no | Filter by logs enabled (true|false). |
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8f38925/traffic_ops/app/lib/API/Deliveryservice.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/Deliveryservice.pm b/traffic_ops/app/lib/API/Deliveryservice.pm
index 30b7820..845aac7 100644
--- a/traffic_ops/app/lib/API/Deliveryservice.pm
+++ b/traffic_ops/app/lib/API/Deliveryservice.pm
@@ -37,6 +37,8 @@ sub index {
my $profile_id = $self->param('profile');
my $type_id = $self->param('type');
my $logs_enabled = $self->param('logsEnabled');
+ my $tenant_id = $self->param('tenant');
+
my $current_user = $self->current_user()->{username};
my @data;
@@ -53,6 +55,9 @@ sub index {
if ( defined $logs_enabled ) {
$criteria{'me.logs_enabled'} = $logs_enabled ? 1 : 0; # converts bool to 0|1
}
+ if ( defined $tenant_id ) {
+ $criteria{'me.tenant_id'} = $tenant_id;
+ }
my $tenant_utils = Utils::Tenant->new($self);
my $tenants_data = $tenant_utils->create_tenants_data_from_db();
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8f38925/traffic_portal/app/src/app.js
----------------------------------------------------------------------
diff --git a/traffic_portal/app/src/app.js b/traffic_portal/app/src/app.js
index 19e4e91..ea1b668 100644
--- a/traffic_portal/app/src/app.js
+++ b/traffic_portal/app/src/app.js
@@ -104,6 +104,7 @@ var trafficPortal = angular.module('trafficPortal', [
require('./modules/private/admin/statuses/new').name,
require('./modules/private/admin/statuses/servers').name,
require('./modules/private/admin/tenants').name,
+ require('./modules/private/admin/tenants/deliveryServices').name,
require('./modules/private/admin/tenants/edit').name,
require('./modules/private/admin/tenants/list').name,
require('./modules/private/admin/tenants/new').name,
@@ -274,6 +275,7 @@ var trafficPortal = angular.module('trafficPortal', [
require('./common/modules/table/statuses').name,
require('./common/modules/table/statusServers').name,
require('./common/modules/table/tenants').name,
+ require('./common/modules/table/tenantDeliveryServices').name,
require('./common/modules/table/tenantUsers').name,
require('./common/modules/table/types').name,
require('./common/modules/table/typeCacheGroups').name,
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8f38925/traffic_portal/app/src/common/modules/form/tenant/FormTenantController.js
----------------------------------------------------------------------
diff --git a/traffic_portal/app/src/common/modules/form/tenant/FormTenantController.js b/traffic_portal/app/src/common/modules/form/tenant/FormTenantController.js
index 9dea0e3..dd20274 100644
--- a/traffic_portal/app/src/common/modules/form/tenant/FormTenantController.js
+++ b/traffic_portal/app/src/common/modules/form/tenant/FormTenantController.js
@@ -37,6 +37,10 @@ var FormTenantController = function(tenant, $scope, $location, formUtils, locati
$location.path($location.path() + '/users');
};
+ $scope.viewDSs = function() {
+ $location.path($location.path() + '/delivery-services');
+ };
+
$scope.navigateToPath = locationUtils.navigateToPath;
$scope.hasError = formUtils.hasError;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8f38925/traffic_portal/app/src/common/modules/form/tenant/form.tenant.tpl.html
----------------------------------------------------------------------
diff --git a/traffic_portal/app/src/common/modules/form/tenant/form.tenant.tpl.html b/traffic_portal/app/src/common/modules/form/tenant/form.tenant.tpl.html
index 9f0cadd..2e20650 100644
--- a/traffic_portal/app/src/common/modules/form/tenant/form.tenant.tpl.html
+++ b/traffic_portal/app/src/common/modules/form/tenant/form.tenant.tpl.html
@@ -25,6 +25,7 @@ under the License.
</ol>
<div class="pull-right" role="group" ng-show="!settings.isNew">
<button class="btn btn-primary" title="View Users" ng-click="viewUsers()">View Users</button>
+ <button class="btn btn-primary" title="View Delivery Services" ng-click="viewDSs()">View Delivery Services</button>
</div>
<div class="clearfix"></div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8f38925/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/TableTenantDeliveryServicesController.js
----------------------------------------------------------------------
diff --git a/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/TableTenantDeliveryServicesController.js b/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/TableTenantDeliveryServicesController.js
new file mode 100644
index 0000000..42bdfd7
--- /dev/null
+++ b/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/TableTenantDeliveryServicesController.js
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+var TableTenantDeliveryServicesController = function(tenant, tenantDeliveryServices, $scope, $state, locationUtils) {
+
+ $scope.tenant = tenant;
+
+ $scope.tenantDeliveryServices = tenantDeliveryServices;
+
+ $scope.editDeliveryService = function(ds) {
+ locationUtils.navigateToPath('/configure/delivery-services/' + ds.id + '?type=' + ds.type);
+ };
+
+ $scope.refresh = function() {
+ $state.reload(); // reloads all the resolves for the view
+ };
+
+ $scope.navigateToPath = locationUtils.navigateToPath;
+
+ angular.element(document).ready(function () {
+ $('#tenantDSsTable').dataTable({
+ "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]],
+ "iDisplayLength": 25,
+ "aaSorting": []
+ });
+ });
+
+};
+
+TableTenantDeliveryServicesController.$inject = ['tenant', 'tenantDeliveryServices', '$scope', '$state', 'locationUtils'];
+module.exports = TableTenantDeliveryServicesController;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8f38925/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/index.js
----------------------------------------------------------------------
diff --git a/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/index.js b/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/index.js
new file mode 100644
index 0000000..106a890
--- /dev/null
+++ b/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/index.js
@@ -0,0 +1,22 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+module.exports = angular.module('trafficPortal.table.tenantDeliveryServices', [])
+ .controller('TableTenantDeliveryServicesController', require('./TableTenantDeliveryServicesController'));
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8f38925/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/table.tenantDeliveryServices.tpl.html
----------------------------------------------------------------------
diff --git a/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/table.tenantDeliveryServices.tpl.html b/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/table.tenantDeliveryServices.tpl.html
new file mode 100644
index 0000000..c893b55
--- /dev/null
+++ b/traffic_portal/app/src/common/modules/table/tenantDeliveryServices/table.tenantDeliveryServices.tpl.html
@@ -0,0 +1,76 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<div class="x_panel">
+ <div class="x_title">
+ <ol class="breadcrumb pull-left">
+ <li><a ng-click="navigateToPath('/admin/tenants')">Tenants</a></li>
+ <li><a ng-click="navigateToPath('/admin/tenants/' + tenant.id)">{{::tenant.name}}</a></li>
+ <li class="active">Delivery Services</li>
+ </ol>
+ <div class="pull-right">
+ <button class="btn btn-default" title="Refresh" ng-click="refresh()"><i class="fa fa-refresh"></i></button>
+ </div>
+ <div class="clearfix"></div>
+ </div>
+ <div class="x_content">
+ <br>
+ <table id="tenantDSsTable" class="table responsive-utilities jambo_table">
+ <thead>
+ <tr class="headings">
+ <th>tenant</th>
+ <th>xmlId</th>
+ <th>orgServerFqdn</th>
+ <th>cdn</th>
+ <th>profile</th>
+ <th>ccrDnsTtl</th>
+ <th>active</th>
+ <th>type</th>
+ <th>dscp</th>
+ <th>signed</th>
+ <th>qstringIgnore</th>
+ <th>geoLimit</th>
+ <th>protocol</th>
+ <th>ipv6RoutingEnabled</th>
+ <th>rangeRequestHandling</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-click="editDeliveryService(ds)" ng-repeat="ds in ::tenantDeliveryServices">
+ <td>{{::ds.tenant}}</td>
+ <td>{{::ds.xmlId}}</td>
+ <td>{{::ds.orgServerFqdn}}</td>
+ <td>{{::ds.cdnName}}</td>
+ <td>{{::ds.profileName}}</td>
+ <td>{{::ds.ccrDnsTtl}}</td>
+ <td>{{::ds.active}}</td>
+ <td>{{::ds.type}}</td>
+ <td>{{::ds.dscp}}</td>
+ <td>{{::ds.signed}}</td>
+ <td>{{::ds.qstringIgnore}}</td>
+ <td>{{::ds.geoLimit}}</td>
+ <td>{{::ds.protocol}}</td>
+ <td>{{::ds.ipv6RoutingEnabled}}</td>
+ <td>{{::ds.rangeRequestHandling}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/f8f38925/traffic_portal/app/src/modules/private/admin/tenants/deliveryServices/index.js
----------------------------------------------------------------------
diff --git a/traffic_portal/app/src/modules/private/admin/tenants/deliveryServices/index.js b/traffic_portal/app/src/modules/private/admin/tenants/deliveryServices/index.js
new file mode 100644
index 0000000..a6fa261
--- /dev/null
+++ b/traffic_portal/app/src/modules/private/admin/tenants/deliveryServices/index.js
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+module.exports = angular.module('trafficPortal.private.admin.tenants.deliveryServices', [])
+ .config(function($stateProvider, $urlRouterProvider) {
+ $stateProvider
+ .state('trafficPortal.private.admin.tenants.deliveryServices', {
+ url: '/{tenantId}/delivery-services',
+ views: {
+ tenantsContent: {
+ templateUrl: 'common/modules/table/tenantDeliveryServices/table.tenantDeliveryServices.tpl.html',
+ controller: 'TableTenantDeliveryServicesController',
+ resolve: {
+ tenant: function($stateParams, tenantService) {
+ return tenantService.getTenant($stateParams.tenantId);
+ },
+ tenantDeliveryServices: function(tenant, deliveryServiceService) {
+ return deliveryServiceService.getDeliveryServices({ tenant: tenant.id });
+ }
+ }
+ }
+ }
+ })
+ ;
+ $urlRouterProvider.otherwise('/');
+ });