diff --git a/components/graphql/field.vue b/components/graphql/field.vue index a07d72970..ef8896c2b 100644 --- a/components/graphql/field.vue +++ b/components/graphql/field.vue @@ -1,6 +1,6 @@ + + diff --git a/pages/graphql.vue b/pages/graphql.vue index 85605c31b..bd3c57194 100644 --- a/pages/graphql.vue +++ b/pages/graphql.vue @@ -295,7 +295,12 @@
- +
@@ -451,6 +456,28 @@ export default { } }, methods: { + isGqlTypeHighlighted({ gqlType }) { + if (!this.graphqlFieldsFilterText) return false + + return this.isTextFoundInGraphqlFieldObject({ + text: this.graphqlFieldsFilterText, + graphqlFieldObject: gqlType, + }) + }, + getGqlTypeHighlightedFields({ gqlType }) { + if (!this.graphqlFieldsFilterText) return [] + + const fields = Object.values(gqlType._fields || {}) + + if (!fields || fields.length === 0) return [] + + return fields.filter((field) => { + return this.isTextFoundInGraphqlFieldObject({ + text: this.graphqlFieldsFilterText, + graphqlFieldObject: field, + }) + }) + }, isTextFoundInGraphqlFieldObject({ text, graphqlFieldObject }) { const normalizedText = text.toLowerCase()