adds /parameters/:id/cache-groups view
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/40b90a56 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/40b90a56 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/40b90a56 Branch: refs/heads/master Commit: 40b90a5612e981cf2efa312d89b080a66a9421ad Parents: 9ffa4f6 Author: Jeremy Mitchell <mitchell...@gmail.com> Authored: Tue Mar 14 21:05:11 2017 -0600 Committer: Dewayne Richardson <dewr...@apache.org> Committed: Thu Apr 6 14:41:34 2017 -0600 ---------------------------------------------------------------------- traffic_ops/experimental/ui/app/src/app.js | 2 + .../ui/app/src/common/api/CacheGroupService.js | 4 ++ .../form/parameter/FormParameterController.js | 4 ++ .../form/parameter/form.parameter.tpl.html | 1 + .../TableParameterCacheGroupsController.js | 50 +++++++++++++++++ .../modules/table/parameterCacheGroups/index.js | 21 +++++++ .../table.parameterCacheGroups.tpl.html | 59 ++++++++++++++++++++ .../TableParameterProfilesController.js | 2 +- .../admin/parameters/cacheGroups/index.js | 42 ++++++++++++++ 9 files changed, 184 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/40b90a56/traffic_ops/experimental/ui/app/src/app.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/app.js b/traffic_ops/experimental/ui/app/src/app.js index a3fa799..d6877f8 100644 --- a/traffic_ops/experimental/ui/app/src/app.js +++ b/traffic_ops/experimental/ui/app/src/app.js @@ -74,6 +74,7 @@ var trafficOps = angular.module('trafficOps', [ require('./modules/private/admin/physLocations/new').name, require('./modules/private/admin/physLocations/servers').name, require('./modules/private/admin/parameters').name, + require('./modules/private/admin/parameters/cacheGroups').name, require('./modules/private/admin/parameters/edit').name, require('./modules/private/admin/parameters/list').name, require('./modules/private/admin/parameters/new').name, @@ -226,6 +227,7 @@ var trafficOps = angular.module('trafficOps', [ require('./common/modules/table/physLocations').name, require('./common/modules/table/physLocationServers').name, require('./common/modules/table/parameters').name, + require('./common/modules/table/parameterCacheGroups').name, require('./common/modules/table/parameterProfiles').name, require('./common/modules/table/profileDeliveryServices').name, require('./common/modules/table/profileParameters').name, http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/40b90a56/traffic_ops/experimental/ui/app/src/common/api/CacheGroupService.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/api/CacheGroupService.js b/traffic_ops/experimental/ui/app/src/common/api/CacheGroupService.js index 2f30df0..fe26d15 100644 --- a/traffic_ops/experimental/ui/app/src/common/api/CacheGroupService.js +++ b/traffic_ops/experimental/ui/app/src/common/api/CacheGroupService.js @@ -88,6 +88,10 @@ var CacheGroupService = function(Restangular, locationUtils, messageModel) { ); }; + this.getParameterCacheGroups = function(paramId) { + // todo: this needs an api: /parameters/:id/cachegroups + return Restangular.one('parameters', paramId).getList('cachegroups'); + }; }; http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/40b90a56/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/FormParameterController.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/FormParameterController.js b/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/FormParameterController.js index d398735..4de9b5a 100644 --- a/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/FormParameterController.js +++ b/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/FormParameterController.js @@ -33,6 +33,10 @@ var FormParameterController = function(parameter, $scope, $location, formUtils, $location.path($location.path() + '/profiles'); }; + $scope.viewCacheGroups = function() { + $location.path($location.path() + '/cache-groups'); + }; + $scope.navigateToPath = locationUtils.navigateToPath; $scope.hasError = formUtils.hasError; http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/40b90a56/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/form.parameter.tpl.html ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/form.parameter.tpl.html b/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/form.parameter.tpl.html index caa2fdc..1958ce9 100644 --- a/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/form.parameter.tpl.html +++ b/traffic_ops/experimental/ui/app/src/common/modules/form/parameter/form.parameter.tpl.html @@ -30,6 +30,7 @@ under the License. <span class="caret"></span> </button> <ul class="dropdown-menu-right dropdown-menu" uib-dropdown-menu> + <li role="menuitem"><a ng-click="viewCacheGroups()">View Cache Groups</a></li> <li role="menuitem"><a ng-click="viewProfiles()">View Profiles</a></li> </ul> </div> http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/40b90a56/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/TableParameterCacheGroupsController.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/TableParameterCacheGroupsController.js b/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/TableParameterCacheGroupsController.js new file mode 100644 index 0000000..ce4c855 --- /dev/null +++ b/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/TableParameterCacheGroupsController.js @@ -0,0 +1,50 @@ +/* + * 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 TableParameterCacheGroupsController = function(parameter, cacheGroups, $scope, $state, locationUtils) { + + $scope.parameter = parameter; + + $scope.cacheGroups = cacheGroups; + + $scope.addCacheGroup = function() { + alert('not hooked up yet: add cg to parameter'); + }; + + $scope.removeCacheGroup = function() { + alert('not hooked up yet: remove cg from parameter'); + }; + + $scope.refresh = function() { + $state.reload(); // reloads all the resolves for the view + }; + + $scope.navigateToPath = locationUtils.navigateToPath; + + angular.element(document).ready(function () { + $('#cacheGroupsTable').dataTable({ + "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]], + "iDisplayLength": 100 + }); + }); + +}; + +TableParameterCacheGroupsController.$inject = ['parameter', 'cacheGroups', '$scope', '$state', 'locationUtils']; +module.exports = TableParameterCacheGroupsController; http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/40b90a56/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/index.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/index.js b/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/index.js new file mode 100644 index 0000000..6a5edaf --- /dev/null +++ b/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/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('trafficOps.table.parameterCacheGroups', []) + .controller('TableParameterCacheGroupsController', require('./TableParameterCacheGroupsController')); http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/40b90a56/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/table.parameterCacheGroups.tpl.html ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/table.parameterCacheGroups.tpl.html b/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/table.parameterCacheGroups.tpl.html new file mode 100644 index 0000000..3da948c --- /dev/null +++ b/traffic_ops/experimental/ui/app/src/common/modules/table/parameterCacheGroups/table.parameterCacheGroups.tpl.html @@ -0,0 +1,59 @@ +<!-- +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/parameters')">Parameters</a></li> + <li><a ng-click="navigateToPath('/admin/parameters/' + parameter.id)">{{parameter.name}}</a></li> + <li class="active">Cache Groups</li> + </ol> + <div class="pull-right"> + <button class="btn btn-primary" title="Add Cache Group" ng-click="addCacheGroup()"><i class="fa fa-plus"></i></button> + <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="cacheGroupsTable" class="table responsive-utilities jambo_table"> + <thead> + <tr class="headings"> + <th>name</th> + <th>shortName</th> + <th>type</th> + <th>latitude</th> + <th>longitude</th> + <th></th> + </tr> + </thead> + <tbody> + <tr ng-repeat="cacheGroup in cacheGroups"> + <td>{{cacheGroup.name}}</td> + <td>{{cacheGroup.shortName}}</td> + <td>{{cacheGroup.typeName}}</td> + <td>{{cacheGroup.latitude}}</td> + <td>{{cacheGroup.longitude}}</td> + <td><button type="button" class="btn btn-link" title="Remove Cache Group" ng-click="removeCacheGroup()"><i class="fa fa-trash-o"></i></button></td> + </tr> + </tbody> + </table> + </div> +</div> + http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/40b90a56/traffic_ops/experimental/ui/app/src/common/modules/table/parameterProfiles/TableParameterProfilesController.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/common/modules/table/parameterProfiles/TableParameterProfilesController.js b/traffic_ops/experimental/ui/app/src/common/modules/table/parameterProfiles/TableParameterProfilesController.js index 97e89a3..06d341a 100644 --- a/traffic_ops/experimental/ui/app/src/common/modules/table/parameterProfiles/TableParameterProfilesController.js +++ b/traffic_ops/experimental/ui/app/src/common/modules/table/parameterProfiles/TableParameterProfilesController.js @@ -38,7 +38,7 @@ var TableParameterProfilesController = function(parameter, parameterProfiles, $s $scope.navigateToPath = locationUtils.navigateToPath; angular.element(document).ready(function () { - $('#parametersTable').dataTable({ + $('#parameterProfilesTable').dataTable({ "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]], "iDisplayLength": 100 }); http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/40b90a56/traffic_ops/experimental/ui/app/src/modules/private/admin/parameters/cacheGroups/index.js ---------------------------------------------------------------------- diff --git a/traffic_ops/experimental/ui/app/src/modules/private/admin/parameters/cacheGroups/index.js b/traffic_ops/experimental/ui/app/src/modules/private/admin/parameters/cacheGroups/index.js new file mode 100644 index 0000000..f5476c6 --- /dev/null +++ b/traffic_ops/experimental/ui/app/src/modules/private/admin/parameters/cacheGroups/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('trafficOps.private.admin.parameters.cacheGroups', []) + .config(function($stateProvider, $urlRouterProvider) { + $stateProvider + .state('trafficOps.private.admin.parameters.cacheGroups', { + url: '/{parameterId}/cache-groups', + views: { + parametersContent: { + templateUrl: 'common/modules/table/parameterCacheGroups/table.parameterCacheGroups.tpl.html', + controller: 'TableParameterCacheGroupsController', + resolve: { + parameter: function($stateParams, parameterService) { + return parameterService.getParameter($stateParams.parameterId); + }, + cacheGroups: function($stateParams, cacheGroupService) { + return cacheGroupService.getParameterCacheGroups($stateParams.parameterId); + } + } + } + } + }) + ; + $urlRouterProvider.otherwise('/'); + });