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 2018/10/04 19:53:28 UTC

[trafficcontrol] 01/14: Adding base delivery services dashboard widget

This is an automated email from the ASF dual-hosted git repository.

mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 1fb52315bcd6fa7204c3e6acf1aa64a1ed92c793
Author: cgillo000 <ch...@cable.comcast.com>
AuthorDate: Mon Sep 10 09:52:44 2018 -0600

    Adding base delivery services dashboard widget
---
 traffic_portal/app/src/app.js                      |  1 +
 .../WidgetDeliveryServicesController.js            | 51 +++++++++++++++++
 .../deliveryServices/_widget.deliveryServices.scss | 65 ++++++++++++++++++++++
 .../modules/widget/deliveryServices/index.js       | 21 +++++++
 .../widget.deliveryServices.tpl.html               | 65 ++++++++++++++++++++++
 .../modules/private/dashboard/dashboard.tpl.html   |  5 ++
 .../src/modules/private/dashboard/view/index.js    |  4 ++
 traffic_portal/app/src/styles/main.scss            |  1 +
 8 files changed, 213 insertions(+)

diff --git a/traffic_portal/app/src/app.js b/traffic_portal/app/src/app.js
index a81502e..d00dd6e 100644
--- a/traffic_portal/app/src/app.js
+++ b/traffic_portal/app/src/app.js
@@ -388,6 +388,7 @@ var trafficPortal = angular.module('trafficPortal', [
         require('./common/modules/widget/cdnChart').name,
         require('./common/modules/widget/changeLogs').name,
         require('./common/modules/widget/dashboardStats').name,
+		require('./common/modules/widget/deliveryServices').name,
         require('./common/modules/widget/routing').name,
 
         // models
diff --git a/traffic_portal/app/src/common/modules/widget/deliveryServices/WidgetDeliveryServicesController.js b/traffic_portal/app/src/common/modules/widget/deliveryServices/WidgetDeliveryServicesController.js
new file mode 100644
index 0000000..26eadea
--- /dev/null
+++ b/traffic_portal/app/src/common/modules/widget/deliveryServices/WidgetDeliveryServicesController.js
@@ -0,0 +1,51 @@
+/*
+ * 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 WidgetDeliveryServicesController = function($scope, $interval, deliveryServiceService, locationUtils, propertiesModel) {
+
+	var interval,
+		autoRefresh = propertiesModel.properties.dashboard.autoRefresh;
+
+	var getDeliveryServices = function() {
+		deliveryServiceService.getDeliveryServices()
+			.then(function(result) {
+				$scope.deliveryServices = result;
+			});
+	};
+
+	// pagination
+	$scope.currentDeliveryServicesPage = 1;
+	$scope.deliveryServicesPerPage = 10;
+
+	$scope.navigateToPath = locationUtils.navigateToPath;
+
+
+	$scope.$on("$destroy", function() {
+
+	});
+
+	var init = function() {
+		getDeliveryServices();
+	};
+	init();
+
+};
+
+WidgetDeliveryServicesController.$inject = ['$scope', '$interval', 'deliveryServiceService', 'locationUtils', 'propertiesModel'];
+module.exports = WidgetDeliveryServicesController;
diff --git a/traffic_portal/app/src/common/modules/widget/deliveryServices/_widget.deliveryServices.scss b/traffic_portal/app/src/common/modules/widget/deliveryServices/_widget.deliveryServices.scss
new file mode 100644
index 0000000..f594c45
--- /dev/null
+++ b/traffic_portal/app/src/common/modules/widget/deliveryServices/_widget.deliveryServices.scss
@@ -0,0 +1,65 @@
+/*
+
+
+ Licensed 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.
+
+*/
+
+#delivery-services-outer-container {
+
+  #deliveryServicesContainer {
+    max-height: 452px;
+    margin-bottom: 0;
+
+    .list-group-item {
+      background-color: transparent;
+    }
+
+    .delivery-services-health {
+      height: 45px;
+
+
+      .delivery-services-table {
+        margin-top: -10px;
+        border-style: none;
+
+        td {
+          border-top: none !important;
+          padding: 12px 8px !important;
+        }
+
+      }
+    }
+  }
+
+  .delivery-services-pagination {
+    margin: 0 0 10px 0;
+    float: left;
+  }
+
+  .delivery-services-search-form {
+    float: right;
+    width: 250px;
+    margin-bottom: 10px;
+  }
+
+}
+
+#deliveryServicesLoadingContainer {
+  height: 555px;
+  background-color: transparent;
+}
+
+#delivery-services-chart-container {
+
+}
diff --git a/traffic_portal/app/src/common/modules/widget/deliveryServices/index.js b/traffic_portal/app/src/common/modules/widget/deliveryServices/index.js
new file mode 100644
index 0000000..4884b74
--- /dev/null
+++ b/traffic_portal/app/src/common/modules/widget/deliveryServices/index.js
@@ -0,0 +1,21 @@
+/*
+ * 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.widget.deliveryServices', [])
+	.controller('WidgetDeliveryServicesController', require('./WidgetDeliveryServicesController'));
diff --git a/traffic_portal/app/src/common/modules/widget/deliveryServices/widget.deliveryServices.tpl.html b/traffic_portal/app/src/common/modules/widget/deliveryServices/widget.deliveryServices.tpl.html
new file mode 100644
index 0000000..1d7cc05
--- /dev/null
+++ b/traffic_portal/app/src/common/modules/widget/deliveryServices/widget.deliveryServices.tpl.html
@@ -0,0 +1,65 @@
+<!--
+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_title">
+    <h2>Delivery Services</h2>
+    <div class="clearfix"></div>
+</div>
+<div class="x_content">
+    <div class="row">
+        <div class="col-md-6 col-sm-6 col-xs-12">
+            <div id="delivery-services-outer-container" class="f">
+                <div id="deliveryServicesContainer">
+                    <div class="alert alert-info" ng-show="(deliveryServices | filter:search:strict).length == 0">
+                        No matching delivery services
+                    </div>
+                    <div class="list-group">
+                        <a class="delivery-services-health list-group-item" ng-repeat="ds in deliveryServices">
+                            <div class="row">
+                                <table class="delivery-services-table table">
+                                    <tbody>
+                                    <tr>
+                                        <td class="col-lg-4 col-md-4 col-sm-4">{{ds.displayName}}</td>
+                                        <td class="col-lg-4 col-md-4 col-sm-4">{{ds.tenant}}</td>
+                                        <td class="col-lg-4 col-md-4 col-sm-4">{{ds.orgServerFqdn}}</td>
+                                    </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </a>
+                    </div>
+                </div>
+                <div>
+                    <div ng-show="(deliveryServices | filter:search:strict).length > 0">
+                        <uib-pagination class="delivery-services-pagination pagination-md" boundary-links="true" max-size="2" total-items="(deliveryServices | filter:search:strict).length" items-per-page="deliveryServicesPerPage" ng-model="currentDeliveryServicesPage" previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination>
+                    </div>
+                    <div class="input-group delivery-services-search-form">
+                        <input type="text" class="filter-input form-control" placeholder="Filter delivery services..." ng-model="search.name">
+                        <span class="filter-input-group-btn input-group-btn">
+                                <button class="btn btn-default" type="button"><i class="fa fa-search"></i></button>
+                            </span>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="col-md-6 col-sm-6 col-xs-12">
+            <div>Hello</div>
+        </div>
+    </div>
+</div>
diff --git a/traffic_portal/app/src/modules/private/dashboard/dashboard.tpl.html b/traffic_portal/app/src/modules/private/dashboard/dashboard.tpl.html
index db0ab4b..b7bbd03 100644
--- a/traffic_portal/app/src/modules/private/dashboard/dashboard.tpl.html
+++ b/traffic_portal/app/src/modules/private/dashboard/dashboard.tpl.html
@@ -21,6 +21,11 @@ under the License.
     <div ng-if="hasCapability('stats-read') && hasCapability('cdns-read')" class="row tile_count">
         <div ui-view="dashboardStatsContent"></div>
     </div>
+    <div class="row">
+        <div class="col-md-12 col-sm-12 col-xs-12">
+            <div class="x_panel" ui-view="deliveryServicesContent"></div>
+        </div>
+    </div>
     <div ng-if="hasCapability('cdns-read')" ng-repeat="cdn in ::cdns">
         <div class="row">
             <div class="col-md-12 col-sm-12 col-xs-12 chartContainer" data-cdnid="{{::cdn.id}}" ui-view="cdnChartContent"></div>
diff --git a/traffic_portal/app/src/modules/private/dashboard/view/index.js b/traffic_portal/app/src/modules/private/dashboard/view/index.js
index e9639f2..0dfc783 100644
--- a/traffic_portal/app/src/modules/private/dashboard/view/index.js
+++ b/traffic_portal/app/src/modules/private/dashboard/view/index.js
@@ -31,6 +31,10 @@ module.exports = angular.module('trafficPortal.private.dashboard.view', [])
 						templateUrl: 'common/modules/widget/cacheGroups/widget.cacheGroups.tpl.html',
 						controller: 'WidgetCacheGroupsController'
 					},
+					deliveryServicesContent: {
+						templateUrl: 'common/modules/widget/deliveryServices/widget.deliveryServices.tpl.html',
+						controller: 'WidgetDeliveryServicesController'
+					},
 					capacityContent: {
 						templateUrl: 'common/modules/widget/capacity/widget.capacity.tpl.html',
 						controller: 'WidgetCapacityController'
diff --git a/traffic_portal/app/src/styles/main.scss b/traffic_portal/app/src/styles/main.scss
index 28de213..834f203 100755
--- a/traffic_portal/app/src/styles/main.scss
+++ b/traffic_portal/app/src/styles/main.scss
@@ -39,6 +39,7 @@ $fa-font-path: "../assets/fonts";
 @import "../common/modules/widget/capacity/widget.capacity";
 @import "../common/modules/widget/cacheGroups/widget.cacheGroups";
 @import "../common/modules/widget/cdnChart/widget.cdnChart";
+@import "../common/modules/widget/deliveryServices/widget.deliveryServices";
 @import "../common/modules/widget/routing/widget.routing";
 
 // private