Skip to content

Commit

Permalink
Merge pull request #3370 from dwsutherland/sort_key_camel
Browse files Browse the repository at this point in the history
Allow camel or snake sort key
  • Loading branch information
hjoliver authored Sep 18, 2019
2 parents 287ead8 + ba60af6 commit c86e3c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cylc/flow/network/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from operator import attrgetter
from fnmatch import fnmatchcase
from graphene.utils.str_converters import to_snake_case

from cylc.flow.ws_data_mgr import (
ID_DELIM, EDGES, FAMILY_PROXIES, TASK_PROXIES, WORKFLOW)
Expand Down Expand Up @@ -145,7 +146,7 @@ def sort_elements(elements, args):
if sort_args and elements:
sort_keys = [
key
for key in sort_args.keys
for key in [to_snake_case(k) for k in sort_args.keys]
if hasattr(elements[0], key)
]
if sort_keys:
Expand Down
2 changes: 1 addition & 1 deletion cylc/flow/network/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def parse_node_id(item, node_type=None):
# Field args (i.e. for queries etc):
class SortArgs(InputObjectType):
keys = List(String, default_value=['id'])
reverse = Boolean()
reverse = Boolean(default_value=False)


jobs_args = dict(
Expand Down

0 comments on commit c86e3c5

Please sign in to comment.