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

Update DefaultPage to be more general and add refresh button in web UI #233

Merged
merged 7 commits into from Oct 19, 2019

Conversation

foxbit19
Copy link
Contributor

I've updated DefaultPage component to be more general following @jmattheis suggestions (see here).

Now the component accepts a new argument rightControl useful to specify a react node placed on the top right corner of the page content.
Old specific purpose arguments buttonTitle, fButton, buttonDisabled, hideButton and buttonId were removed.

Using the improved DefaultPage, we can easely solve the issue #171.

@foxbit19 foxbit19 requested a review from a team as a code owner October 18, 2019 15:49
@codecov
Copy link

codecov bot commented Oct 18, 2019

Codecov Report

Merging #233 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #233   +/-   ##
=======================================
  Coverage   90.87%   90.87%           
=======================================
  Files          43       43           
  Lines        1677     1677           
=======================================
  Hits         1524     1524           
  Misses         82       82           
  Partials       71       71

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6055f3...e3f54f8. Read the comment docs.

Copy link
Member

@jmattheis jmattheis left a comment

Choose a reason for hiding this comment

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

Thanks for your second contribution!

Haven't tested it yet, but looks pretty good overall :D.

ui/src/common/DefaultPage.tsx Outdated Show resolved Hide resolved
public refreshByApp = async (appId: number) => {
const state = this.stateOf(appId);
const result = await this.fetchMessages(appId, 0).then((resp) => resp.data);
state.messages.replace(result.messages);
Copy link
Member

Choose a reason for hiding this comment

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

I think we should refresh all messages because when refreshing only one application the "All Messages"-Tab will not get updated resulting in inconsistent state.
So we can use this.clearAll() to discard our state and this.loadMore() to get the most recent messages.

@jmattheis jmattheis added this to the version+1 milestone Oct 18, 2019
buttonTitle?: string;
fButton?: VoidFunction;
buttonDisabled?: boolean;
rightControl?: object;
Copy link
Member

Choose a reason for hiding this comment

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

This can probably be a React.ReactNode

foxbit19 and others added 3 commits October 18, 2019 19:42
Copy link
Member

@jmattheis jmattheis left a comment

Choose a reason for hiding this comment

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

Works great, thank you!

@jmattheis jmattheis merged commit bdb6372 into gotify:master Oct 19, 2019
@jmattheis jmattheis changed the title WIP: Update DefaultPage to be more general and add refresh button in web UI Update DefaultPage to be more general and add refresh button in web UI Oct 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants