-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Infra UI] Consume log entry graphql api in the client #21706
[Infra UI] Consume log entry graphql api in the client #21706
Conversation
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
b2c371d
to
0192aae
Compare
💔 Build Failed |
0192aae
to
875ba2e
Compare
💔 Build Failed |
💚 Build Succeeded |
💔 Build Failed |
f6b131c
to
ad4f34f
Compare
jenkins, test this |
💔 Build Failed |
unrelated region map test failures again |
const index = collectionBisector.left(collection, key); | ||
|
||
if (index >= collection.length) { | ||
return; | ||
return null; | ||
} | ||
|
||
if (compator(collection[index], key) !== 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compator
looks like a typo?
@@ -6,12 +6,18 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could logging_legacy
be moved to logging
at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to skimp on that here because we are about to move these file anyway when moving the redux store to the top level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, makes sense.
|
||
export const createGraphqlInitialState = <State>(initialData?: State): GraphqlState<State> => ({ | ||
current: { | ||
progress: 'idle', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is loading state, could it be named something with loading
? progress
makes me think of a 0-100% range or something similar and I believe we don't have that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I will try to streamline this a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, can I do that in a later PR? there are some containers that rely on that structure until #21859. Afterwards refactoring would be much easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
selectLoadingResult, | ||
selectLoadingState, | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this way of generating all the redux thingies we will need for a GraphQL endpoint. 👍 No detailed comments right now, I might come back to that when I use it for the first time myself.
Given the list of known problems in the opening comment I didn't test thoroughly in the UI. The Some minor comments above. |
I fixed the typo. The slice should definitely be renamed, but I would rather do that as part of the redux store move as well. |
💔 Build Failed |
@weltenwort thanks for the fix and the comments. LGTM 👍 |
region map test failure again, going to merge anyway |
New Redux GraphQL helpers
The
utils/remote_state/remote_graphql_state.ts
file in the client-side code exports a few functions to help with creating redux entities backed by GrahphQL queries:createGraphqlInitialState<State>(initialState: State)
to create the basic state structure derived from a generated GraphQL query resultcreateGraphqlOperationActionCreators()
to create actions creators relating to those queriescreateGraphqlOperationReducer()
to create a reducer for the action creatorscreateGraphqlQueryEpic()
to create an redux-observable epic that manages the side-effects required to resolve the querycreateGraphqlStateSelectors()
to create a set of selectors to inspect the state and results of the queryThe
entries
slice is the first example of usage. (see below)Redux store changes
entries
sliceThe
entries
slice of the redux state now has anentries
key that is managed by the GraphQL helpers described above. It defines two queries:load
to load and replace the set of entries returned via theQuery.source.logEntriesAround
fieldsload_more
to load and append more entries to a set of entries already present in the stateKnown Limitations and follow-up tasks
This PR has several known limitations: