Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 530aa4592 -> 639d0d5c0


hooks up exp TO UI to ds regex crud api


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

Branch: refs/heads/master
Commit: 5881037cf927276c42542eca8fec8fc0883bf707
Parents: fe1f251
Author: Jeremy Mitchell <[email protected]>
Authored: Wed Jan 25 08:30:33 2017 -0700
Committer: Jeremy Mitchell <[email protected]>
Committed: Wed Jan 25 08:30:33 2017 -0700

----------------------------------------------------------------------
 traffic_ops/experimental/ui/app/src/app.js      |  6 ++
 .../common/api/DeliveryServiceRegexService.js   | 70 +++++++++++++++++++
 .../src/common/api/DeliveryServiceService.js    |  4 +-
 .../experimental/ui/app/src/common/api/index.js |  8 +--
 .../FormDeliveryServiceRegexController.js       | 47 +++++++++++++
 .../FormEditDeliveryServiceRegexController.js   | 72 ++++++++++++++++++++
 .../form/deliveryServiceRegex/edit/index.js     | 21 ++++++
 .../form.deliveryServiceRegex.tpl.html          | 68 ++++++++++++++++++
 .../modules/form/deliveryServiceRegex/index.js  | 21 ++++++
 .../FormNewDeliveryServiceRegexController.js    | 39 +++++++++++
 .../form/deliveryServiceRegex/new/index.js      | 21 ++++++
 .../TableDeliveryServiceRegexesController.js    | 14 ++--
 .../table.deliveryServiceRegexes.tpl.html       | 10 ++-
 .../regexes/DeliveryServiceRegexesController.js | 24 +++++++
 .../regexes/deliveryServiceRegexes.tpl.html     | 22 ++++++
 .../deliveryServices/regexes/edit/index.js      | 42 ++++++++++++
 .../configure/deliveryServices/regexes/index.js | 14 ++--
 .../deliveryServices/regexes/list/index.js      | 42 ++++++++++++
 .../deliveryServices/regexes/new/index.js       | 42 ++++++++++++
 19 files changed, 558 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/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 b54d85a..fdc00b8 100644
--- a/traffic_ops/experimental/ui/app/src/app.js
+++ b/traffic_ops/experimental/ui/app/src/app.js
@@ -125,6 +125,9 @@ var trafficOps = angular.module('trafficOps', [
         require('./modules/private/configure/deliveryServices/list').name,
         require('./modules/private/configure/deliveryServices/new').name,
         require('./modules/private/configure/deliveryServices/regexes').name,
+        
require('./modules/private/configure/deliveryServices/regexes/edit').name,
+        
require('./modules/private/configure/deliveryServices/regexes/list').name,
+        
require('./modules/private/configure/deliveryServices/regexes/new').name,
         require('./modules/private/configure/deliveryServices/servers').name,
         require('./modules/private/configure/deliveryServices/users').name,
         require('./modules/private/configure/servers').name,
@@ -164,6 +167,9 @@ var trafficOps = angular.module('trafficOps', [
         require('./common/modules/form/deliveryService').name,
         require('./common/modules/form/deliveryService/edit').name,
         require('./common/modules/form/deliveryService/new').name,
+        require('./common/modules/form/deliveryServiceRegex').name,
+        require('./common/modules/form/deliveryServiceRegex/edit').name,
+        require('./common/modules/form/deliveryServiceRegex/new').name,
         require('./common/modules/form/division').name,
         require('./common/modules/form/division/edit').name,
         require('./common/modules/form/division/new').name,

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/api/DeliveryServiceRegexService.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/api/DeliveryServiceRegexService.js 
b/traffic_ops/experimental/ui/app/src/common/api/DeliveryServiceRegexService.js
new file mode 100644
index 0000000..8276a3c
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/common/api/DeliveryServiceRegexService.js
@@ -0,0 +1,70 @@
+/*
+ * 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 DeliveryServiceRegexService = function(Restangular, locationUtils, 
messageModel) {
+
+       this.getDeliveryServiceRegexes = function(dsId) {
+               return Restangular.one('deliveryservices', 
dsId).getList('regexes');
+       };
+
+       this.getDeliveryServiceRegex = function(dsId, regexId) {
+               return Restangular.one('deliveryservices', dsId).one('regexes', 
regexId).get();
+       };
+
+       this.createDeliveryServiceRegex = function(dsId, regex) {
+               return Restangular.one('deliveryservices', 
dsId).all('regexes').post(regex)
+                       .then(
+                               function() {
+                                       messageModel.setMessages([ { level: 
'success', text: 'Regex created' } ], true);
+                                       
locationUtils.navigateToPath('/configure/delivery-services/' + dsId + 
'/regexes');
+                               },
+                               function(fault) {
+                                       
messageModel.setMessages(fault.data.alerts, false);
+                               }
+                       );
+       };
+
+       this.updateDeliveryServiceRegex = function(regex) {
+               return regex.put()
+                       .then(
+                               function() {
+                                       messageModel.setMessages([ { level: 
'success', text: 'Regex updated' } ], false);
+                               },
+                               function(fault) {
+                                       
messageModel.setMessages(fault.data.alerts, false);
+                               }
+                       );
+       };
+
+       this.deleteDeliveryServiceRegex = function(dsId, regexId) {
+               return Restangular.one('deliveryservices', dsId).one('regexes', 
regexId).remove()
+                       .then(
+                               function() {
+                                       messageModel.setMessages([ { level: 
'success', text: 'Regex deleted' } ], true);
+                               },
+                               function(fault) {
+                                       
messageModel.setMessages(fault.data.alerts, true);
+                               }
+                       );
+       };
+
+};
+
+DeliveryServiceRegexService.$inject = ['Restangular', 'locationUtils', 
'messageModel'];
+module.exports = DeliveryServiceRegexService;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/api/DeliveryServiceService.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/api/DeliveryServiceService.js 
b/traffic_ops/experimental/ui/app/src/common/api/DeliveryServiceService.js
index 62b2e0d..2178fcf 100644
--- a/traffic_ops/experimental/ui/app/src/common/api/DeliveryServiceService.js
+++ b/traffic_ops/experimental/ui/app/src/common/api/DeliveryServiceService.js
@@ -30,9 +30,9 @@ var DeliveryServiceService = function(Restangular, 
locationUtils, messageModel)
     this.createDeliveryService = function(deliveryService) {
         return Restangular.service('deliveryservices').post(deliveryService)
             .then(
-                function() {
+                function(response) {
                     messageModel.setMessages([ { level: 'success', text: 
'DeliveryService created' } ], true);
-                    
locationUtils.navigateToPath('/configure/delivery-services');
+                    
locationUtils.navigateToPath('/configure/delivery-services/' + response.id);
                 },
                 function(fault) {
                     messageModel.setMessages(fault.data.alerts, false);

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/api/index.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/app/src/common/api/index.js 
b/traffic_ops/experimental/ui/app/src/common/api/index.js
index 455e4dd..445b566 100644
--- a/traffic_ops/experimental/ui/app/src/common/api/index.js
+++ b/traffic_ops/experimental/ui/app/src/common/api/index.js
@@ -6,9 +6,9 @@
  * 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
@@ -24,14 +24,14 @@ module.exports = angular.module('trafficOps.api', [])
     .service('cacheGroupParameterService', 
require('./CacheGroupParameterService'))
     .service('cdnService', require('./CDNService'))
     .service('deliveryServiceService', require('./DeliveryServiceService'))
-    .service('divisionService', require('./DivisionService'))
+       .service('deliveryServiceRegexService', 
require('./DeliveryServiceRegexService'))
+       .service('divisionService', require('./DivisionService'))
     .service('httpService', require('./HttpService'))
     .service('physLocationService', require('./PhysLocationService'))
     .service('parameterService', require('./ParameterService'))
     .service('profileService', require('./ProfileService'))
     .service('roleService', require('./RoleService'))
     .service('regionService', require('./RegionService'))
-    .service('regexService', require('./RegexService'))
     .service('serverService', require('./ServerService'))
     .service('statusService', require('./StatusService'))
     .service('tenantService', require('./TenantService'))

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/FormDeliveryServiceRegexController.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/FormDeliveryServiceRegexController.js
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/FormDeliveryServiceRegexController.js
new file mode 100644
index 0000000..8494256
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/FormDeliveryServiceRegexController.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 FormDeliveryServiceRegexController = function(deliveryService, regex, 
$scope, formUtils, locationUtils, typeService) {
+
+       var getTypes = function() {
+               typeService.getTypes({ useInTable: 'regex' })
+                       .then(function(result) {
+                               $scope.types = result;
+                       });
+       };
+
+       $scope.deliveryService = deliveryService;
+
+       $scope.regex = regex;
+
+       $scope.navigateToPath = locationUtils.navigateToPath;
+
+       $scope.hasError = formUtils.hasError;
+
+       $scope.hasPropertyError = formUtils.hasPropertyError;
+
+       var init = function () {
+               getTypes();
+       };
+       init();
+
+};
+
+FormDeliveryServiceRegexController.$inject = ['deliveryService', 'regex', 
'$scope', 'formUtils', 'locationUtils', 'typeService'];
+module.exports = FormDeliveryServiceRegexController;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/edit/FormEditDeliveryServiceRegexController.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/edit/FormEditDeliveryServiceRegexController.js
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/edit/FormEditDeliveryServiceRegexController.js
new file mode 100644
index 0000000..bcfab5c
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/edit/FormEditDeliveryServiceRegexController.js
@@ -0,0 +1,72 @@
+/*
+ * 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 FormEditDeliveryServiceRegexController = function(deliveryService, regex, 
$scope, $controller, $uibModal, $anchorScroll, locationUtils, 
deliveryServiceRegexService) {
+
+       // extends the FormDeliveryServiceController to inherit common methods
+       angular.extend(this, $controller('FormDeliveryServiceRegexController', 
{ deliveryService: deliveryService, regex: regex, $scope: $scope }));
+
+       var deleteDeliveryServiceRegex = function(dsId, regexId) {
+               deliveryServiceRegexService.deleteDeliveryServiceRegex(dsId, 
regexId)
+                       .then(function() {
+                               
locationUtils.navigateToPath('/configure/delivery-services/' + dsId + 
'/regexes');
+                       });
+       };
+
+       $scope.regexPattern = angular.copy(regex.pattern);
+
+       $scope.settings = {
+               isNew: false,
+               saveLabel: 'Update'
+       };
+
+       $scope.save = function(dsId, regex) {
+               deliveryServiceRegexService.updateDeliveryServiceRegex(regex).
+                       then(function() {
+                               $scope.regexPattern = 
angular.copy(regex.pattern);
+                               $anchorScroll(); // scrolls window to top
+                       });
+       };
+
+       $scope.confirmDelete = function(regex) {
+               var params = {
+                       title: 'Delete Delivery Service Regex: ' + 
regex.pattern,
+                       key: regex.pattern
+               };
+               var modalInstance = $uibModal.open({
+                       templateUrl: 
'common/modules/dialog/delete/dialog.delete.tpl.html',
+                       controller: 'DialogDeleteController',
+                       size: 'md',
+                       resolve: {
+                               params: function () {
+                                       return params;
+                               }
+                       }
+               });
+               modalInstance.result.then(function() {
+                       deleteDeliveryServiceRegex(deliveryService.id, 
regex.id);
+               }, function () {
+                       // do nothing
+               });
+       };
+
+};
+
+FormEditDeliveryServiceRegexController.$inject = ['deliveryService', 'regex', 
'$scope', '$controller', '$uibModal', '$anchorScroll', 'locationUtils', 
'deliveryServiceRegexService'];
+module.exports = FormEditDeliveryServiceRegexController;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/edit/index.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/edit/index.js
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/edit/index.js
new file mode 100644
index 0000000..ebef271
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/edit/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.form.deliveryServiceRegex.edit', 
[])
+       .controller('FormEditDeliveryServiceRegexController', 
require('./FormEditDeliveryServiceRegexController'));

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/form.deliveryServiceRegex.tpl.html
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/form.deliveryServiceRegex.tpl.html
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/form.deliveryServiceRegex.tpl.html
new file mode 100644
index 0000000..93c06ee
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/form.deliveryServiceRegex.tpl.html
@@ -0,0 +1,68 @@
+<!--
+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('/configure/delivery-services')">Delivery 
Services</a></li>
+            <li><a ng-click="navigateToPath('/configure/delivery-services/' + 
deliveryService.id)">{{deliveryService.displayName}}</a></li>
+            <li><a ng-click="navigateToPath('/configure/delivery-services/' + 
deliveryService.id + '/regexes')">Regexes</a></li>
+            <li class="active">{{regexPattern}}</li>
+        </ol>
+        <div class="clearfix"></div>
+    </div>
+    <div class="x_content">
+        <br>
+        <form name="dsRegexForm" class="form-horizontal form-label-left" 
novalidate>
+            <div class="form-group" ng-class="{'has-error': 
hasError(dsRegexForm.pattern), 'has-feedback': hasError(dsRegexForm.pattern)}">
+                <label class="control-label col-md-2 col-sm-2 
col-xs-12">Pattern *</label>
+                <div class="col-md-10 col-sm-10 col-xs-12">
+                    <input id="pattern" name="pattern" type="text" 
class="form-control" ng-model="regex.pattern" ng-required="true" 
ng-maxlength="48" ng-pattern="/^\S*$/" autofocus>
+                    <small class="input-error" 
ng-show="hasPropertyError(dsRegexForm.pattern, 'required')">Required</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(dsRegexForm.pattern, 'maxlength')">Too Long</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(dsRegexForm.pattern, 'pattern')">No spaces</small>
+                    <span ng-show="hasError(dsRegexForm.pattern)" 
class="form-control-feedback"><i class="fa fa-times"></i></span>
+                </div>
+            </div>
+            <div class="form-group" ng-class="{'has-error': 
hasError(dsRegexForm.type), 'has-feedback': hasError(dsRegexForm.type)}">
+                <label class="control-label col-md-2 col-sm-2 col-xs-12">Type 
*</label>
+                <div class="col-md-10 col-sm-10 col-xs-12">
+                    <select id="type" name="type" class="form-control" 
ng-model="regex.type" ng-options="type.id as type.name for type in types" 
required>
+                        <option value="">Select...</option>
+                    </select>
+                    <small class="input-error" 
ng-show="hasPropertyError(dsRegexForm.type, 'required')">Required</small>
+                </div>
+            </div>
+            <div class="form-group" ng-class="{'has-error': 
hasError(dsRegexForm.setNumber), 'has-feedback': 
hasError(dsRegexForm.setNumber)}">
+                <label class="control-label col-md-2 col-sm-2 col-xs-12">Order 
*</label>
+                <div class="col-md-10 col-sm-10 col-xs-12">
+                    <input id="setNumber" name="setNumber" type="text" 
class="form-control" ng-model="regex.setNumber" ng-required="true" 
ng-maxlength="3" ng-pattern="/^\d+$/" autofocus>
+                    <small class="input-error" 
ng-show="hasPropertyError(dsRegexForm.setNumber, 'required')">Required</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(dsRegexForm.setNumber, 'maxlength')">Too Long</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(dsRegexForm.setNumber, 'pattern')">Number</small>
+                    <span ng-show="hasError(dsRegexForm.setNumber)" 
class="form-control-feedback"><i class="fa fa-times"></i></span>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-danger" 
ng-show="!settings.isNew" ng-click="confirmDelete(regex)">Delete</button>
+                <button type="button" class="btn btn-success" 
ng-disabled="dsRegexForm.$pristine || dsRegexForm.$invalid" 
ng-click="save(deliveryService.id, regex)">{{settings.saveLabel}}</button>
+            </div>
+        </form>
+    </div>
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/index.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/index.js
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/index.js
new file mode 100644
index 0000000..abd990e
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/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.form.deliveryServiceRegex', [])
+       .controller('FormDeliveryServiceRegexController', 
require('./FormDeliveryServiceRegexController'));

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/new/FormNewDeliveryServiceRegexController.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/new/FormNewDeliveryServiceRegexController.js
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/new/FormNewDeliveryServiceRegexController.js
new file mode 100644
index 0000000..5b314b7
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/new/FormNewDeliveryServiceRegexController.js
@@ -0,0 +1,39 @@
+/*
+ * 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 FormNewDeliveryServiceRegexController = function(deliveryService, regex, 
$scope, $controller, deliveryServiceRegexService) {
+
+       // extends the FormDeliveryServiceRegexController to inherit common 
methods
+       angular.extend(this, $controller('FormDeliveryServiceRegexController', 
{ deliveryService: deliveryService, regex: regex, $scope: $scope }));
+
+       $scope.regexPattern = 'New';
+
+       $scope.settings = {
+               isNew: true,
+               saveLabel: 'Create'
+       };
+
+       $scope.save = function(dsId, regex) {
+               deliveryServiceRegexService.createDeliveryServiceRegex(dsId, 
regex);
+       };
+
+};
+
+FormNewDeliveryServiceRegexController.$inject = ['deliveryService', 'regex', 
'$scope', '$controller', 'deliveryServiceRegexService'];
+module.exports = FormNewDeliveryServiceRegexController;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/new/index.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/new/index.js
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/new/index.js
new file mode 100644
index 0000000..557e123
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryServiceRegex/new/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.form.deliveryServiceRegex.new', [])
+       .controller('FormNewDeliveryServiceRegexController', 
require('./FormNewDeliveryServiceRegexController'));

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/TableDeliveryServiceRegexesController.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/TableDeliveryServiceRegexesController.js
 
b/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/TableDeliveryServiceRegexesController.js
index cdc04e0..0f05998 100644
--- 
a/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/TableDeliveryServiceRegexesController.js
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/TableDeliveryServiceRegexesController.js
@@ -21,14 +21,14 @@ var TableDeliveryServiceRegexesController = 
function(deliveryService, regexes, $
 
        $scope.deliveryService = deliveryService;
 
-       $scope.regexes = _.find(regexes, function(dsRegexes) { return 
dsRegexes.dsName == deliveryService.xmlId; });
+       $scope.regexes = regexes;
 
-       $scope.addRegex = function() {
-               alert('not hooked up yet: addRegex to ds');
+       $scope.editRegex = function(dsId, regexId) {
+               locationUtils.navigateToPath('/configure/delivery-services/' + 
dsId + '/regexes/' + regexId);
        };
 
-       $scope.removeRegex = function() {
-               alert('not hooked up yet: removeRegex from ds');
+       $scope.createRegex = function(dsId) {
+               locationUtils.navigateToPath('/configure/delivery-services/' + 
dsId + '/regexes/new');
        };
 
        $scope.navigateToPath = locationUtils.navigateToPath;
@@ -36,11 +36,11 @@ var TableDeliveryServiceRegexesController = 
function(deliveryService, regexes, $
        angular.element(document).ready(function () {
                $('#regexesTable').dataTable({
                        "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, 
"All"]],
-                       "iDisplayLength": 100
+                       "iDisplayLength": -1
                });
        });
 
 };
 
-TableDeliveryServiceRegexesController.$inject = ['deliveryService', 'regexes', 
'$scope', 'locationUtils'];
+TableDeliveryServiceRegexesController.$inject = ['deliveryService', 'regexes', 
'$scope', 'locationUtils', 'deliveryServiceRegexService'];
 module.exports = TableDeliveryServiceRegexesController;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/table.deliveryServiceRegexes.tpl.html
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/table.deliveryServiceRegexes.tpl.html
 
b/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/table.deliveryServiceRegexes.tpl.html
index 298319f..8d98e97 100644
--- 
a/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/table.deliveryServiceRegexes.tpl.html
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/table/deliveryServiceRegexes/table.deliveryServiceRegexes.tpl.html
@@ -24,7 +24,7 @@ under the License.
             <li><a ng-click="navigateToPath('/configure/delivery-services/' + 
deliveryService.id)">{{deliveryService.displayName}}</a></li>
             <li class="active">Regexes</li>
         </ol>
-        <button class="btn btn-primary pull-right" ng-click="addRegex()"><i 
class="fa fa-plus"></i>&nbsp;&nbsp; Add Regex to DS</button>
+        <button class="btn btn-primary pull-right" 
ng-click="createRegex(deliveryService.id)"><i class="fa 
fa-plus"></i>&nbsp;&nbsp; Create Regex</button>
         <div class="clearfix"></div>
     </div>
     <div class="x_content">
@@ -34,16 +34,14 @@ under the License.
             <tr class="headings">
                 <th>type</th>
                 <th>pattern</th>
-                <th>setNumber</th>
-                <th></th>
+                <th>order</th>
             </tr>
             </thead>
             <tbody>
-            <tr ng-repeat="regex in regexes.regexes | orderBy:['setNumber']">
-                <td>{{regex.type}}</td>
+            <tr ng-click="editRegex(deliveryService.id, regex.id)" 
ng-repeat="regex in regexes | orderBy:['setNumber']">
+                <td>{{regex.typeName}}</td>
                 <td>{{regex.pattern}}</td>
                 <td>{{regex.setNumber}}</td>
-                <td><button type="button" class="btn btn-link" title="Remove 
from Delivery Service" ng-click="removeRegex()"><i class="fa 
fa-trash-o"></i></button></td>
             </tr>
             </tbody>
         </table>

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/DeliveryServiceRegexesController.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/DeliveryServiceRegexesController.js
 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/DeliveryServiceRegexesController.js
new file mode 100644
index 0000000..ea723a1
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/DeliveryServiceRegexesController.js
@@ -0,0 +1,24 @@
+/*
+ * 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 DeliveryServiceRegexesController = function() {
+};
+
+DeliveryServiceRegexesController.$inject = [];
+module.exports = DeliveryServiceRegexesController;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/deliveryServiceRegexes.tpl.html
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/deliveryServiceRegexes.tpl.html
 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/deliveryServiceRegexes.tpl.html
new file mode 100644
index 0000000..5b2af62
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/deliveryServiceRegexes.tpl.html
@@ -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.
+-->
+
+<div id="deliveryServiceRegexesContainer">
+    <div ui-view="deliveryServiceRegexesContent"></div>
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/edit/index.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/edit/index.js
 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/edit/index.js
new file mode 100644
index 0000000..0548401
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/edit/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.configure.deliveryServices.regexes.edit', [])
+       .config(function($stateProvider, $urlRouterProvider) {
+               $stateProvider
+                       
.state('trafficOps.private.configure.deliveryServices.regexes.edit', {
+                               url: '/{regexId:[0-9]{1,8}}',
+                               views: {
+                                       deliveryServiceRegexesContent: {
+                                               templateUrl: 
'common/modules/form/deliveryServiceRegex/form.deliveryServiceRegex.tpl.html',
+                                               controller: 
'FormEditDeliveryServiceRegexController',
+                                               resolve: {
+                                                       deliveryService: 
function($stateParams, deliveryServiceService) {
+                                                               return 
deliveryServiceService.getDeliveryService($stateParams.deliveryServiceId);
+                                                       },
+                                                       regex: 
function($stateParams, deliveryServiceRegexService) {
+                                                               return 
deliveryServiceRegexService.getDeliveryServiceRegex($stateParams.deliveryServiceId,
 $stateParams.regexId);
+                                                       }
+                                               }
+                                       }
+                               }
+                       })
+               ;
+               $urlRouterProvider.otherwise('/');
+       });

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/index.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/index.js
 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/index.js
index 15384f5..1290154 100644
--- 
a/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/index.js
+++ 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/index.js
@@ -18,22 +18,16 @@
  */
 
 module.exports = 
angular.module('trafficOps.private.configure.deliveryServices.regexes', [])
+       .controller('DeliveryServiceRegexesController', 
require('./DeliveryServiceRegexesController'))
        .config(function($stateProvider, $urlRouterProvider) {
                $stateProvider
                        
.state('trafficOps.private.configure.deliveryServices.regexes', {
                                url: '/{deliveryServiceId}/regexes',
+                               abstract: true,
                                views: {
                                        deliveryServicesContent: {
-                                               templateUrl: 
'common/modules/table/deliveryServiceRegexes/table.deliveryServiceRegexes.tpl.html',
-                                               controller: 
'TableDeliveryServiceRegexesController',
-                                               resolve: {
-                                                       deliveryService: 
function($stateParams, deliveryServiceService) {
-                                                               return 
deliveryServiceService.getDeliveryService($stateParams.deliveryServiceId);
-                                                       },
-                                                       regexes: 
function($stateParams, regexService) {
-                                                               return 
regexService.getRegexes($stateParams.deliveryServiceId);
-                                                       }
-                                               }
+                                               templateUrl: 
'modules/private/configure/deliveryServices/regexes/deliveryServiceRegexes.tpl.html',
+                                               controller: 
'DeliveryServiceRegexesController'
                                        }
                                }
                        })

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/list/index.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/list/index.js
 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/list/index.js
new file mode 100644
index 0000000..3b27105
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/list/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.configure.deliveryServices.regexes.list', [])
+       .config(function($stateProvider, $urlRouterProvider) {
+               $stateProvider
+                       
.state('trafficOps.private.configure.deliveryServices.regexes.list', {
+                               url: '',
+                               views: {
+                                       deliveryServiceRegexesContent: {
+                                               templateUrl: 
'common/modules/table/deliveryServiceRegexes/table.deliveryServiceRegexes.tpl.html',
+                                               controller: 
'TableDeliveryServiceRegexesController',
+                                               resolve: {
+                                                       deliveryService: 
function($stateParams, deliveryServiceService) {
+                                                               return 
deliveryServiceService.getDeliveryService($stateParams.deliveryServiceId);
+                                                       },
+                                                       regexes: 
function($stateParams, deliveryServiceRegexService) {
+                                                               return 
deliveryServiceRegexService.getDeliveryServiceRegexes($stateParams.deliveryServiceId);
+                                                       }
+                                               }
+                                       }
+                               }
+                       })
+               ;
+               $urlRouterProvider.otherwise('/');
+       });

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5881037c/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/new/index.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/new/index.js
 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/new/index.js
new file mode 100644
index 0000000..5361bd7
--- /dev/null
+++ 
b/traffic_ops/experimental/ui/app/src/modules/private/configure/deliveryServices/regexes/new/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.configure.deliveryServices.regexes.new', [])
+       .config(function($stateProvider, $urlRouterProvider) {
+               $stateProvider
+                       
.state('trafficOps.private.configure.deliveryServices.regexes.new', {
+                               url: '/new',
+                               views: {
+                                       deliveryServiceRegexesContent: {
+                                               templateUrl: 
'common/modules/form/deliveryServiceRegex/form.deliveryServiceRegex.tpl.html',
+                                               controller: 
'FormNewDeliveryServiceRegexController',
+                                               resolve: {
+                                                       deliveryService: 
function($stateParams, deliveryServiceService) {
+                                                               return 
deliveryServiceService.getDeliveryService($stateParams.deliveryServiceId);
+                                                       },
+                                                       regex: function() {
+                                                               return {};
+                                                       }
+                                               }
+                                       }
+                               }
+                       })
+               ;
+               $urlRouterProvider.otherwise('/');
+       });


Reply via email to