Sorting the data during tree data loading using the natural sort

algorithm.

This patch takes care of:
* Consistent behaviour during create, update operation on any node.
  - It should return the node data during creating a new object, or
    updating the existing one.
* Now that - we have consistent behaviour during these operations, we
  can consistently move, update the tree item based the node data from
  the server.
* Implemented the methods for each node to get the information about
  that particular node only.
* Using the above changes to implement the 'refresh' operation on tree
  node properly.

I must thank Surinder, and Harshal for helping me implement the 'node'
method, and also changed the behaviour of create & update methods to
return the node data for most of the nodes.

Fixes #1244
This commit is contained in:
Ashesh Vashi
2016-08-29 20:06:48 +05:30
parent 2c6f6609bc
commit b6f307256b
156 changed files with 5299 additions and 3400 deletions

View File

@@ -268,6 +268,12 @@ class ServerNode(PGChildNodeView):
wal_pause=wal_paused
)
)
if not len(res):
return gone(errormsg=gettext(
'The specified server group with id# {0} could not be found.'
))
return make_json_response(result=res)
def node(self, gid, sid):
@@ -282,7 +288,7 @@ class ServerNode(PGChildNodeView):
success=0,
errormsg=gettext(
gettext(
"Couldn't find the server with id# %s!"
"Couldn't find the server with id# {0}!"
).format(sid)
)
)
@@ -336,6 +342,7 @@ class ServerNode(PGChildNodeView):
# TODO:: A server, which is connected, can not be deleted
if servers is None:
return make_json_response(
status=410,
success=0,
errormsg=gettext(
'The specified server could not be found.\n'
@@ -364,6 +371,7 @@ class ServerNode(PGChildNodeView):
if server is None:
return make_json_response(
status=410,
success=0,
errormsg=gettext("Could not find the required server.")
)
@@ -439,9 +447,8 @@ class ServerNode(PGChildNodeView):
if not conn.connected():
manager.update(server)
return make_json_response(
success=1,
data=self.blueprint.generate_browser_node(
return jsonify(
node=self.blueprint.generate_browser_node(
"%d" % (server.id), server.servergroup_id,
server.name,
"icon-server-not-connected" if not connected else
@@ -502,6 +509,7 @@ class ServerNode(PGChildNodeView):
if server is None:
return make_json_response(
status=410,
success=0,
errormsg=gettext("Could not find the required server.")
)