diff --git a/swh/graphql/resolvers/visit.py b/swh/graphql/resolvers/visit.py --- a/swh/graphql/resolvers/visit.py +++ b/swh/graphql/resolvers/visit.py @@ -70,3 +70,7 @@ return self.archive.get_origin_visits( self.obj.url, after=self._get_after_arg(), first=self._get_first_arg() ) + + def _get_index_cursor(self, index: int, node: BaseVisitNode): + # Origin visit is using visit number as the cursor + return utils.get_encoded_cursor(str(node.visitId)) diff --git a/swh/graphql/schema/schema.graphql b/swh/graphql/schema/schema.graphql --- a/swh/graphql/schema/schema.graphql +++ b/swh/graphql/schema/schema.graphql @@ -93,10 +93,10 @@ Edge in origin connection """ type OriginEdge { - """ - Cursor to request the next page after the item - """ - cursor: String! + # """ + # Cursor to request the next page after the item + # """ + # cursor: String! """ Origin object @@ -198,10 +198,10 @@ Edge in origin visit connection """ type VisitEdge { - """ - Cursor to request the next page after the item - """ - cursor: String! + # """ + # Cursor to request the next page after the item + # """ + # cursor: String! """ Visit object @@ -305,10 +305,10 @@ Edge in visit status connection """ type VisitStatusEdge { - """ - Cursor to request the next page after the item - """ - cursor: String! + # """ + # Cursor to request the next page after the item + # """ + # cursor: String! """ Visit status object @@ -455,10 +455,10 @@ Edge in snapshot branch connection """ type BranchConnectionEdge { - """ - Cursor to request the next page after the item - """ - cursor: String! + # """ + # Cursor to request the next page after the item + # """ + # cursor: String! """ Branch object @@ -933,10 +933,10 @@ Edge in SearchResult connection """ type SearchResultEdge { - """ - Cursor to request the next page after the item - """ - cursor: String! + # """ + # Cursor to request the next page after the item + # """ + # cursor: String! """ SearchResult object diff --git a/swh/graphql/tests/functional/test_branch_connection.py b/swh/graphql/tests/functional/test_branch_connection.py --- a/swh/graphql/tests/functional/test_branch_connection.py +++ b/swh/graphql/tests/functional/test_branch_connection.py @@ -18,9 +18,6 @@ pageInfo { endCursor } - edges { - cursor - } nodes { targetType name { @@ -147,6 +144,6 @@ second_data, _ = get_branches(client, swhid=swhid, first=3, after=end_cursor) branches = second_data["snapshot"]["branches"] assert len(branches["nodes"]) == 3 - assert branches["edges"][0]["cursor"] == end_cursor + # assert branches["edges"][0]["cursor"] == end_cursor for node in branches["nodes"]: assert node["name"]["text"] > node_name diff --git a/swh/graphql/tests/functional/test_pagination.py b/swh/graphql/tests/functional/test_pagination.py --- a/swh/graphql/tests/functional/test_pagination.py +++ b/swh/graphql/tests/functional/test_pagination.py @@ -77,27 +77,27 @@ ) -def test_edge_cursor(client): - origins = get_origin_nodes(client, first=1)[0]["origins"] - # end cursor here must be the item cursor for the second item - end_cursor = origins["pageInfo"]["endCursor"] - - query_str = """ - query getOrigins($first: Int!, $after: String) { - origins(first: $first, after: $after) { - edges { - cursor - node { - id - } - } - nodes { - id - } - } - } - """ - data, _ = utils.get_query_response(client, query_str, first=1, after=end_cursor) - origins = data["origins"] - assert [edge["node"] for edge in origins["edges"]] == origins["nodes"] - assert origins["edges"][0]["cursor"] == end_cursor +# def test_edge_cursor(client): +# origins = get_origin_nodes(client, first=1)[0]["origins"] +# # end cursor here must be the item cursor for the second item +# end_cursor = origins["pageInfo"]["endCursor"] + +# query_str = """ +# query getOrigins($first: Int!, $after: String) { +# origins(first: $first, after: $after) { +# edges { +# cursor +# node { +# id +# } +# } +# nodes { +# id +# } +# } +# } +# """ +# data, _ = utils.get_query_response(client, query_str, first=1, after=end_cursor) +# origins = data["origins"] +# assert [edge["node"] for edge in origins["edges"]] == origins["nodes"] +# assert origins["edges"][0]["cursor"] == end_cursor diff --git a/swh/graphql/tests/functional/test_visit_status.py b/swh/graphql/tests/functional/test_visit_status.py --- a/swh/graphql/tests/functional/test_visit_status.py +++ b/swh/graphql/tests/functional/test_visit_status.py @@ -53,7 +53,6 @@ endCursor } edges { - cursor node { status } @@ -76,7 +75,6 @@ endCursor } edges { - cursor node { status } @@ -95,7 +93,7 @@ assert data["visit"]["statuses"] == { "edges": [ { - "cursor": "MjAxNC0wNS0wN1QwNDoyMDozOS40MzIyMjIrMDA6MDA=", + # "cursor": "MjAxNC0wNS0wN1QwNDoyMDozOS40MzIyMjIrMDA6MDA=", "node": {"status": "ongoing"}, } ],