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

Add events to application pages #602

Merged
merged 11 commits into from
May 2, 2019

Conversation

bafonins
Copy link
Contributor

@bafonins bafonins commented May 1, 2019

Summary

This PR adds events to the application management pages.
References: #28

Changes

  • Add redux primitives for events
  • Add the <EventsSubscriptions /> component
  • Add the <ApplicationEvents /> container component
  • Add <Events.Widget /> to the Application Overview Page
  • Add the Application Data page with the <Events /> component
  • Move the paused state handling to the <Events /> component

Screenshot 2019-05-01 at 15 14 08

Screenshot 2019-05-01 at 15 14 34

Notes for Reviewers

  1. After working on this one, it turned out that keeping the paused state in the <Events /> component seems to be a better option than outsourcing it redux. Mainly, because we want to pause events only in the full component, but not in the widget.
  2. Currently, there is not error handling. @kschiffer how should it look like?

Release Notes

  • Added events to the application management pages.

@bafonins bafonins added the c/console This is related to the Console label May 1, 2019
@bafonins bafonins added this to the May 2019 milestone May 1, 2019
@bafonins bafonins requested a review from kschiffer May 1, 2019 13:40
@bafonins bafonins self-assigned this May 1, 2019
@coveralls
Copy link

coveralls commented May 1, 2019

Coverage Status

Coverage increased (+0.05%) to 73.692% when pulling 9bcd6e4 on feature/28-webui-events-applications into aaa2dd5 on master.

Copy link
Member

@kschiffer kschiffer left a comment

Choose a reason for hiding this comment

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

Very good!

Currently, there is not error handling. @kschiffer how should it look like?

This still needs to be discussed and decided here. We can then create some actionable issues from there.

A couple of overall remarks:

  • I think it would be good if clicking anywhere on the widget will take you to the data view
  • Can you add a small bottom margin in the application-data view? The event component now touches the footer.
  • I'm still not very fond of the level of abstraction in our store logic, which has now increased even more. It became quite hard (for me) to review as it is uncommented and has a partly quite misleading variable naming. Should be discussed in a backlog issue.

return true
}

// do not rerender component on new events if it in the `paused` state
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// do not rerender component on new events if it in the `paused` state
// do not rerender component on new events if it is in the `paused` state

limit,
} = this.props

if (
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if we do ourselves a favor with this if statement. We would need to update this for every prop/state structure change we do. Wouldn't it be better to assume rerenders by default and only rule out cases (like below with the paused state)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We would need to update this for every prop/state structure change we do

If anyone changes the internals of the component then the person should also check the shouldComponentUpdate logic. This does influence the api of the component only the logic within the component.

)

export const createGetEventMessageFailureActionType = name => (
`GET_${name}_EVENT_MESSAGE_SUCCESS`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`GET_${name}_EVENT_MESSAGE_SUCCESS`
`GET_${name}_EVENT_MESSAGE_FAILURE`

)

export const createStartEventsStreamFailureActionType = name => (
`START_${name}_EVENT_STREAM_SUCCESS`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`START_${name}_EVENT_STREAM_SUCCESS`
`START_${name}_EVENT_STREAM_FAILURE`

const START_EVENTS_FAILURE = createStartEventsStreamFailureActionType(name)
const STOP_EVENTS = createStopEventsStreamActionType(name)
const startEventsSuccess = startEventsStreamSuccess(name)
const startEventsFailrue = startEventsStreamFailure(name)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const startEventsFailrue = startEventsStreamFailure(name)
const startEventsFailure = startEventsStreamFailure(name)

channel.on('error', error => dispatch(getEventFailure(id, error)))
channel.on('close', () => dispatch(stopEvents(id)))
} catch (error) {
dispatch(startEventsFailrue(error))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
dispatch(startEventsFailrue(error))
dispatch(startEventsFailure(error))

createClearEventsActionType,
} from '../actions/events'

const defualtState = {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const defualtState = {
const defaultState = {

const GET_EVENT_FAILURE = createGetEventMessageFailureActionType(reducerName)
const CLEAR_EVENTS = createClearEventsActionType(reducerName)

return function (state = defualtState, action) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return function (state = defualtState, action) {
return function (state = defaultState, action) {

// See the License for the specific language governing permissions and
// limitations under the License.

const storeSelector = (state, props) => state[props.id]
Copy link
Member

Choose a reason for hiding this comment

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

It really took me a while to figure out what these are. selectors clashes with our term for selectors in the JS SDK. I would really prefer the name mappers, which is more in line with their usage in mapStateToProps().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no, a selector is a well known term in the redux world, not a mapper.

render () {
const { appId } = this.props.match.params

return (
Copy link
Member

Choose a reason for hiding this comment

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

Please add a <ReactHelmet /> entry for the view. In general, a lot of application pages still lack these. Can you follow up with an issue?

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, I'll create an issue for this.

@bafonins
Copy link
Contributor Author

bafonins commented May 2, 2019

I think it would be good if clicking anywhere on the widget will take you to the data view

What is the purpose of the See All Activity link then?

@kschiffer
Copy link
Member

kschiffer commented May 2, 2019

What is the purpose of the See All Activity link then?

To give a visual clue towards the data view with the full event component.

@bafonins
Copy link
Contributor Author

bafonins commented May 2, 2019

I'm still not very fond of the level of abstraction in our store logic, which has now increased even more. It became quite hard (for me) to review as it is uncommented and has a partly quite misleading variable naming. Should be discussed in a backlog issue.

reducers/middleware/action creators are just functions, so we can write tests for them

@bafonins bafonins force-pushed the feature/28-webui-events-applications branch from cc45c90 to 9bcd6e4 Compare May 2, 2019 11:46
@bafonins bafonins requested a review from kschiffer May 2, 2019 11:46
@bafonins bafonins merged commit 3097538 into master May 2, 2019
@bafonins bafonins deleted the feature/28-webui-events-applications branch May 2, 2019 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/console This is related to the Console
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants