Skip to content

Commit

Permalink
[IJ Plugin] Cache viewer: add cache size to selector (#5357)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoD authored Nov 8, 2023
1 parent 9c1fd7b commit c919897
Show file tree
Hide file tree
Showing 15 changed files with 502 additions and 283 deletions.
2 changes: 1 addition & 1 deletion intellij-plugin/src/main/graphql/operations.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ query GetNormalizedCache($apolloClientId: ID!, $normalizedCacheId: ID!) {
displayName
records {
key
size
sizeInBytes
fields
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data class NormalizedCache(
data class Record(
val key: String,
val fields: List<Field>,
val size: Int,
val sizeInBytes: Int,
)

data class Field(
Expand All @@ -27,12 +27,16 @@ data class NormalizedCache(
}

fun sorted() = NormalizedCache(
records.sortedWith { o1, o2 ->
when {
o1.key == "QUERY_ROOT" -> -1
o2.key == "QUERY_ROOT" -> 1
else -> o1.key.compareTo(o2.key, ignoreCase = true)
}
}
records.sortedWith(RecordKeyComparator)
)

companion object {
val RecordKeyComparator = Comparator<Record> { o1, o2 ->
when {
o1.key == "QUERY_ROOT" -> -1
o2.key == "QUERY_ROOT" -> 1
else -> o1.key.compareTo(o2.key, ignoreCase = true)
}
}
}
}
Loading

0 comments on commit c919897

Please sign in to comment.