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

ocket8888 pushed a commit to branch 5.0.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/5.0.x by this push:
     new b67c079  TP: adds the ability to clone a topology (#5400)
b67c079 is described below

commit b67c079389c84b16a46865b500d7d2ef36dd8ffc
Author: Jeremy Mitchell <[email protected]>
AuthorDate: Wed Jan 6 15:56:51 2021 -0700

    TP: adds the ability to clone a topology (#5400)
    
    * adds the ability to clone a topology
    
    * adds ui test for cloning a topology
    
    * adds changelog.md entry
    
    (cherry picked from commit 60e7f208d8abca7bc8ef9ffce09de978f5878062)
---
 CHANGELOG.md                                       | 29 +++++++++++++++++
 traffic_portal/app/src/app.js                      |  2 ++
 .../form/topology/FormTopologyController.js        |  4 +++
 .../topology/clone/FormCloneTopologyController.js} | 35 ++++++++++++--------
 .../common/modules/form/topology/clone/index.js}   | 17 ++--------
 .../modules/form/topology/form.topology.tpl.html   |  4 +++
 .../src/modules/private/topologies/clone/index.js} | 38 +++++++++++++---------
 .../test/end_to_end/topologies/pageData.js         |  2 ++
 .../test/end_to_end/topologies/topologies-spec.js  | 12 +++++++
 9 files changed, 99 insertions(+), 44 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f33ac4..a8c3402 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,34 @@ All notable changes to this project will be documented in this 
file.
 
 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 
+<<<<<<< HEAD
+=======
+## [unreleased]
+### Added
+- Traffic Portal: 
[#5394](https://github.com/apache/trafficcontrol/issues/5394) - Converts the 
tenant table to a tenant tree for usability
+- Traffic Ops: added a feature so that the user can specify 
`maxRequestHeaderBytes` on a per delivery service basis
+- Traffic Router: log warnings when requests to Traffic Monitor return a 503 
status code
+- [#5344](https://github.com/apache/trafficcontrol/issues/5344) - Add a page 
that addresses migrating from Traffic Ops API v1 for each endpoint
+- [#5296](https://github.com/apache/trafficcontrol/issues/5296) - Fixed a bug 
where users couldn't update any regex in Traffic Ops/ Traffic Portal
+- Added API endpoints for ACME accounts
+- Traffic Ops: Added validation to ensure that the cachegroups of a delivery 
services' assigned ORG servers are present in the topology
+
+### Fixed
+- [#5396](https://github.com/apache/trafficcontrol/issues/5396) - Return the 
correct error type if user tries to update the root tenant
+- [#5378](https://github.com/apache/trafficcontrol/issues/5378) - Updating a 
non existent DS should return a 404, instead of a 500
+- [#5380](https://github.com/apache/trafficcontrol/issues/5380) - Show the 
correct servers (including ORGs) when a topology based DS with required 
capabilities + ORG servers is queried for the assigned servers
+- [#5195](https://github.com/apache/trafficcontrol/issues/5195) - Correctly 
show CDN ID in Changelog during Snap
+- Fixed Traffic Router logging unnecessary warnings for IPv6-only caches
+- Fixed parent.config generation for topology-based delivery services (inline 
comments not supported)
+- Fixed parent.config generation for MSO delivery services with required 
capabilities
+- [#5294](https://github.com/apache/trafficcontrol/issues/5294) - TP ag grid 
tables now properly persist column filters
+    on page refresh.
+- [#5295](https://github.com/apache/trafficcontrol/issues/5295) - TP 
types/servers table now clears all filters instead
+    of just column filters
+- #2881 Some API endpoints have incorrect Content-Types
+- [#5311](https://github.com/apache/trafficcontrol/issues/5311) - Better TO 
log messages when failures calling TM CacheStats
+
+>>>>>>> 60e7f208d (TP: adds the ability to clone a topology (#5400))
 ## [5.0.0] - 2020-10-20
 ### Added
 - Traffic Ops Ort: Disabled ntpd verification (ntpd is deprecated in CentOS)
@@ -74,6 +102,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - Traffic Portal: change log days are now configurable in 
traffic_portal_properties.json (default is 7 days) and can be overridden by the 
user in TP
 - [#5319](https://github.com/apache/trafficcontrol/issues/5319) - Added 
support for building RPMs that target CentOS 8
 - Traffic Ops: Added validation to ensure assigned ORG server cachegroups are 
in the topology when updating a delivery service
+- Traffic Portal: 
[#5360](https://github.com/apache/trafficcontrol/issues/5360) - Adds the 
ability to clone a topology
 
 ### Fixed
 - Fixed #5188 - DSR (delivery service request) incorrectly marked as complete 
and error message not displaying when DSR fulfilled and DS update fails in 
Traffic Portal. [Related Github 
issue](https://github.com/apache/trafficcontrol/issues/5188)
diff --git a/traffic_portal/app/src/app.js b/traffic_portal/app/src/app.js
index 0bdf95f..a5dd32e 100644
--- a/traffic_portal/app/src/app.js
+++ b/traffic_portal/app/src/app.js
@@ -212,6 +212,7 @@ var trafficPortal = angular.module('trafficPortal', [
         require('./modules/private/types').name,
         require('./modules/private/topologies').name,
         require('./modules/private/topologies/cacheGroups').name,
+        require('./modules/private/topologies/clone').name,
         require('./modules/private/topologies/deliveryServices').name,
         require('./modules/private/topologies/edit').name,
         require('./modules/private/topologies/list').name,
@@ -337,6 +338,7 @@ var trafficPortal = angular.module('trafficPortal', [
         require('./common/modules/form/tenant/edit').name,
         require('./common/modules/form/tenant/new').name,
         require('./common/modules/form/topology').name,
+        require('./common/modules/form/topology/clone').name,
         require('./common/modules/form/topology/edit').name,
         require('./common/modules/form/topology/new').name,
         require('./common/modules/form/type').name,
diff --git 
a/traffic_portal/app/src/common/modules/form/topology/FormTopologyController.js 
b/traffic_portal/app/src/common/modules/form/topology/FormTopologyController.js
index 00e6016..1ebdfb5 100644
--- 
a/traffic_portal/app/src/common/modules/form/topology/FormTopologyController.js
+++ 
b/traffic_portal/app/src/common/modules/form/topology/FormTopologyController.js
@@ -106,6 +106,10 @@ var FormTopologyController = function(topology, 
cacheGroups, $anchorScroll, $sco
 
        $scope.hasPropertyError = formUtils.hasPropertyError;
 
+       $scope.clone = function(topology) {
+               locationUtils.navigateToPath('/topologies/clone?name=' + 
topology.name);
+       };
+
        $scope.viewCacheGroups = function() {
                $location.path('/topologies/cache-groups');
        };
diff --git a/traffic_portal/test/end_to_end/topologies/pageData.js 
b/traffic_portal/app/src/common/modules/form/topology/clone/FormCloneTopologyController.js
similarity index 50%
copy from traffic_portal/test/end_to_end/topologies/pageData.js
copy to 
traffic_portal/app/src/common/modules/form/topology/clone/FormCloneTopologyController.js
index 62723d6..039a092 100644
--- a/traffic_portal/test/end_to_end/topologies/pageData.js
+++ 
b/traffic_portal/app/src/common/modules/form/topology/clone/FormCloneTopologyController.js
@@ -17,18 +17,25 @@
  * under the License.
  */
 
-module.exports = function(){
-       this.moreBtn=element(by.name('moreBtn'));
-       this.topLink=element(by.name('topLink'));
-       
this.searchFilter=element(by.id('topologiesTable_filter')).element(by.css('label
 input'));
-       this.name=element(by.name('name'));
-       this.description=element(by.id('description'));
-       this.addChildCacheGroupBtn=element(by.css('.add-child-cg-btn'));
-       this.selectFormSubmitButton=element(by.buttonText('Submit'));
-       this.selectAllCB=element(by.id('selectAllCB'));
-       this.updateButton=element(by.buttonText('Update'));
-       this.createButton=element(by.buttonText('Create'));
-       
this.viewDeliveryServicesMenuItem=element(by.name('viewDeliveryServicesMenuItem'));
-       
this.viewCacheGroupsMenuItem=element(by.name('viewCacheGroupsMenuItem'));
-       this.viewServersMenuItem=element(by.name('viewServersMenuItem'));
+var FormCloneTopologyController = function(topologies, cacheGroups, $scope, 
$controller) {
+
+       // extends the FormNewTopologyController to inherit common methods
+       angular.extend(this, $controller('FormNewTopologyController', { 
topology: topologies[0], cacheGroups: cacheGroups, $scope: $scope }));
+
+       $scope.topologyName = angular.copy($scope.topology.name) + ' clone';
+
+       $scope.settings = {
+               isNew: true,
+               saveLabel: 'Clone'
+       };
+
+       let init = function() {
+               // cloned topology needs a new name
+               $scope.topology.name = '';
+       };
+       init();
+
 };
+
+FormCloneTopologyController.$inject = ['topologies', 'cacheGroups', '$scope', 
'$controller'];
+module.exports = FormCloneTopologyController;
diff --git a/traffic_portal/test/end_to_end/topologies/pageData.js 
b/traffic_portal/app/src/common/modules/form/topology/clone/index.js
similarity index 50%
copy from traffic_portal/test/end_to_end/topologies/pageData.js
copy to traffic_portal/app/src/common/modules/form/topology/clone/index.js
index 62723d6..43bc315 100644
--- a/traffic_portal/test/end_to_end/topologies/pageData.js
+++ b/traffic_portal/app/src/common/modules/form/topology/clone/index.js
@@ -17,18 +17,5 @@
  * under the License.
  */
 
-module.exports = function(){
-       this.moreBtn=element(by.name('moreBtn'));
-       this.topLink=element(by.name('topLink'));
-       
this.searchFilter=element(by.id('topologiesTable_filter')).element(by.css('label
 input'));
-       this.name=element(by.name('name'));
-       this.description=element(by.id('description'));
-       this.addChildCacheGroupBtn=element(by.css('.add-child-cg-btn'));
-       this.selectFormSubmitButton=element(by.buttonText('Submit'));
-       this.selectAllCB=element(by.id('selectAllCB'));
-       this.updateButton=element(by.buttonText('Update'));
-       this.createButton=element(by.buttonText('Create'));
-       
this.viewDeliveryServicesMenuItem=element(by.name('viewDeliveryServicesMenuItem'));
-       
this.viewCacheGroupsMenuItem=element(by.name('viewCacheGroupsMenuItem'));
-       this.viewServersMenuItem=element(by.name('viewServersMenuItem'));
-};
+module.exports = angular.module('trafficPortal.form.topology.clone', [])
+       .controller('FormCloneTopologyController', 
require('./FormCloneTopologyController'));
diff --git 
a/traffic_portal/app/src/common/modules/form/topology/form.topology.tpl.html 
b/traffic_portal/app/src/common/modules/form/topology/form.topology.tpl.html
index df8822a..b223af4 100644
--- a/traffic_portal/app/src/common/modules/form/topology/form.topology.tpl.html
+++ b/traffic_portal/app/src/common/modules/form/topology/form.topology.tpl.html
@@ -31,6 +31,10 @@ under the License.
                 </button>
                 <ul class="dropdown-menu-right dropdown-menu" 
uib-dropdown-menu>
                     <li role="menuitem">
+                        <button type="button" name="cloneToplogyMenuItem" 
title="Clone Topology" ng-click="clone(topology)">Clone Topology</button>
+                    </li>
+                    <hr class="divider"/>
+                    <li role="menuitem">
                         <button type="button" 
name="viewDeliveryServicesMenuItem" title="View Delivery Services" 
ng-click="viewDeliveryServices()">View Delivery Services</button>
                     </li>
                     <li class="divider"></li>
diff --git a/traffic_portal/test/end_to_end/topologies/pageData.js 
b/traffic_portal/app/src/modules/private/topologies/clone/index.js
similarity index 50%
copy from traffic_portal/test/end_to_end/topologies/pageData.js
copy to traffic_portal/app/src/modules/private/topologies/clone/index.js
index 62723d6..6fcdfa1 100644
--- a/traffic_portal/test/end_to_end/topologies/pageData.js
+++ b/traffic_portal/app/src/modules/private/topologies/clone/index.js
@@ -17,18 +17,26 @@
  * under the License.
  */
 
-module.exports = function(){
-       this.moreBtn=element(by.name('moreBtn'));
-       this.topLink=element(by.name('topLink'));
-       
this.searchFilter=element(by.id('topologiesTable_filter')).element(by.css('label
 input'));
-       this.name=element(by.name('name'));
-       this.description=element(by.id('description'));
-       this.addChildCacheGroupBtn=element(by.css('.add-child-cg-btn'));
-       this.selectFormSubmitButton=element(by.buttonText('Submit'));
-       this.selectAllCB=element(by.id('selectAllCB'));
-       this.updateButton=element(by.buttonText('Update'));
-       this.createButton=element(by.buttonText('Create'));
-       
this.viewDeliveryServicesMenuItem=element(by.name('viewDeliveryServicesMenuItem'));
-       
this.viewCacheGroupsMenuItem=element(by.name('viewCacheGroupsMenuItem'));
-       this.viewServersMenuItem=element(by.name('viewServersMenuItem'));
-};
+module.exports = angular.module('trafficPortal.private.topologies.clone', [])
+       .config(function($stateProvider, $urlRouterProvider) {
+               $stateProvider
+                       .state('trafficPortal.private.topologies.clone', {
+                               url: '/clone?name',
+                               views: {
+                                       topologiesContent: {
+                                               templateUrl: 
'common/modules/form/topology/form.topology.tpl.html',
+                                               controller: 
'FormCloneTopologyController',
+                                               resolve: {
+                                                       topologies: 
function($stateParams, topologyService) {
+                                                               return 
topologyService.getTopologies({ name: $stateParams.name });
+                                                       },
+                                                       cacheGroups: 
function(cacheGroupService) {
+                                                               return 
cacheGroupService.getCacheGroups();
+                                                       }
+                                               }
+                                       }
+                               }
+                       })
+               ;
+               $urlRouterProvider.otherwise('/');
+       });
diff --git a/traffic_portal/test/end_to_end/topologies/pageData.js 
b/traffic_portal/test/end_to_end/topologies/pageData.js
index 62723d6..385bf57 100644
--- a/traffic_portal/test/end_to_end/topologies/pageData.js
+++ b/traffic_portal/test/end_to_end/topologies/pageData.js
@@ -26,8 +26,10 @@ module.exports = function(){
        this.addChildCacheGroupBtn=element(by.css('.add-child-cg-btn'));
        this.selectFormSubmitButton=element(by.buttonText('Submit'));
        this.selectAllCB=element(by.id('selectAllCB'));
+       this.cloneButton=element(by.buttonText('Clone'));
        this.updateButton=element(by.buttonText('Update'));
        this.createButton=element(by.buttonText('Create'));
+       this.cloneToplogyMenuItem=element(by.name('cloneToplogyMenuItem'));
        
this.viewDeliveryServicesMenuItem=element(by.name('viewDeliveryServicesMenuItem'));
        
this.viewCacheGroupsMenuItem=element(by.name('viewCacheGroupsMenuItem'));
        this.viewServersMenuItem=element(by.name('viewServersMenuItem'));
diff --git a/traffic_portal/test/end_to_end/topologies/topologies-spec.js 
b/traffic_portal/test/end_to_end/topologies/topologies-spec.js
index c2da821..548e47d 100644
--- a/traffic_portal/test/end_to_end/topologies/topologies-spec.js
+++ b/traffic_portal/test/end_to_end/topologies/topologies-spec.js
@@ -108,4 +108,16 @@ describe('Traffic Portal Topologies Test Suite', 
function() {
                pageData.viewServersMenuItem.click();
                
expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toMatch(commonFunctions.urlPath(browser.baseUrl)+"#!/topologies/servers");
        });
+
+       it('should navigate back to the topology and clone the topology', 
function() {
+               console.log('Cloning topology: ' + myNewTopology.name);
+               pageData.topLink.click();
+               pageData.moreBtn.click();
+               pageData.cloneToplogyMenuItem.click();
+               expect(pageData.cloneButton.isEnabled()).toBe(false);
+               pageData.name.sendKeys(myNewTopology.name + '-clone');
+               expect(pageData.cloneButton.isEnabled()).toBe(true);
+               pageData.cloneButton.click();
+               
expect(browser.getCurrentUrl().then(commonFunctions.urlPath)).toEqual(commonFunctions.urlPath(browser.baseUrl)+"#!/topologies");
+       });
 });

Reply via email to