Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphql sorting #572

Merged
merged 3 commits into from
Jun 19, 2017
Merged

Graphql sorting #572

merged 3 commits into from
Jun 19, 2017

Conversation

msprunck
Copy link
Contributor

@msprunck msprunck commented Jun 13, 2017

Connected to #571

- Renamed source and target Relationship fields to source_entity and
target_entity. source was in conflict with an existing entity field.
- Removed the specification sort field for Indicators. It's an union of several
schemas (ThreatBrainSpecification, SnortSpecification, ...), there is no common
field to sort on it.
Copy link
Contributor

@yogsototh yogsototh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I would add some "manual" tests that would require to be rewritten in case of schema/sort-keys changes, just to prevent an "invisible bug".

@@ -17,7 +18,7 @@
:startCursor {:type Scalars/GraphQLString}
:endCursor {:type Scalars/GraphQLString}}))

(def connection-arguments
(def connection-arguments ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think leaving the ; here is just a typo

(str "Nodes are correctly sorted by " sort-field))
(is (not-empty (:edges connection-data)))
(is (= edges-ref edges)
(str "Edges are correctly sorted by " sort-field))))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps replace the "are" by "should be" in the test messages.

operation-name)
connection-data (get-in data connection-path)
nodes (->> (:nodes connection-data)
(map sort-field-fn)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as sort-field-fn is used by the the graphql query. I think it would be nice to have one manual test which compare datas directly to check that sort is doing something.

Copy link
Contributor

@craigbro craigbro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not see any glaring issues after a quick review.

I do think we will need a special sort field/keyword for the "UI ordering" of judgements. Please coordinate with @polygloton on that since he is working on implementing an ES sort fragement that handles the sorting.

@msprunck msprunck merged commit fdb2354 into threatgrid:master Jun 19, 2017
@msprunck msprunck removed the review label Jun 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants