rawlinp commented on a change in pull request #5495:
URL: https://github.com/apache/trafficcontrol/pull/5495#discussion_r570623666
##########
File path:
traffic_portal/app/src/common/modules/form/topology/form.topology.tpl.html
##########
@@ -87,7 +87,8 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger"
ng-show="!settings.isNew" ng-click="confirmDelete(topology)">Delete</button>
- <button type="button" class="btn btn-success"
ng-disabled="topologyForm.$pristine || topologyForm.$invalid"
ng-click="save(topology.name, topology.description,
topologyTree)">{{settings.saveLabel}}</button>
+ <button ng-if="settings.isNew" type="button" class="btn
btn-success" ng-disabled="topologyForm.$pristine || topologyForm.$invalid"
ng-click="save(topology.name, topology.description,
topologyTree)">{{settings.saveLabel}}</button>
Review comment:
Shouldn't this call to `save` have all 4 params?
##########
File path:
traffic_portal/app/src/common/modules/form/topology/edit/FormEditTopologyController.js
##########
@@ -37,11 +37,12 @@ var FormEditTopologyController = function(topologies,
cacheGroups, $scope, $cont
saveLabel: 'Update'
};
- $scope.save = function(name, description, topologyTree) {
- let normalizedTopology =
topologyUtils.getNormalizedTopology(name, description, topologyTree);
- topologyService.updateTopology(normalizedTopology).
+ $scope.save = function(currentName, newName, description, topologyTree)
{
+ let normalizedTopology =
topologyUtils.getNormalizedTopology(newName, description, topologyTree);
+ topologyService.updateTopology(normalizedTopology, currentName).
then(function(result) {
- messageModel.setMessages(result.data.alerts,
false);
+ messageModel.setMessages(result.data.alerts,
true);
+ locationUtils.navigateToPath('/topologies');
Review comment:
Why navigate to `/topologies`? Don't we want to stay on the same page?
##########
File path: traffic_ops/traffic_ops_golang/topology/topologies.go
##########
@@ -781,13 +785,13 @@ WHERE tcp.child IN
func updateQuery() string {
query := `
UPDATE topology t SET
-description = $1
-WHERE t.name = $2
+name = $1,
+description = $2
+WHERE t.name = $3
RETURNING t.name, t.description, t.last_updated
`
return query
}
-
Review comment:
gofmt will probably complain about this line missing
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]