Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-12885: Add UI widgets AdminHeader and FormattedAdminHeader. #2003

Merged
merged 1 commit into from
Nov 15, 2018

Conversation

grundleborg
Copy link
Contributor

Summary

Add UI widgets AdminHeader and FormattedAdminHeader.

This adds 2 new widgets:

  • AdminHeader, which is a widget that makes the Admin Console page header which can take any components or values as children.
  • FormattedAdminHeader, which is a child widget that can be used where the AdminHeader component is to contain a single localised (markdown) string.

These are not the most complicated components in existence, but they are
distinctly UI widgets that can be separated from the code, and were
needed for the code I was writing at the present.

This also adds a dependency on sinon for testing.

Ticket Link

https://mattermost.atlassian.net/browse/MM-12885

Checklist

  • Ran make check-style to check for style errors (required for all pull requests)
  • Ran make test to ensure unit and component tests passed
  • Added or updated unit tests (required for all new features)

@grundleborg grundleborg added the 2: Dev Review Requires review by a core commiter label Nov 5, 2018
@grundleborg grundleborg added this to the v5.6.0 milestone Nov 5, 2018
@grundleborg grundleborg added the 1: PM Review Requires review by a product manager label Nov 5, 2018
@grundleborg
Copy link
Contributor Author

@jasonblais added you to review as this PR introduces a new dependency: sinon.

@jasonblais jasonblais requested review from wiersgallak and removed request for jasonblais November 5, 2018 12:20
@jasonblais
Copy link
Contributor

Thanks George - switching PM review to @wiersgallak as she owns legal and licensing now :)

@wiersgallak
Copy link
Contributor

@grundleborg, as a common practice it looks like we add these dependencies to the NOTICE.txt file. Can you please do that for this one as well? Thanks!

@grundleborg grundleborg force-pushed the MM-12885 branch 2 times, most recently from de3df72 to 242153e Compare November 6, 2018 13:18
@grundleborg grundleborg removed the 1: PM Review Requires review by a product manager label Nov 6, 2018
@grundleborg grundleborg removed the request for review from wiersgallak November 6, 2018 13:18
@grundleborg
Copy link
Contributor Author

Made @saturninoabril suggested change, so this PR no longer introduces a new dependency, so removing @wiersgallak from review request.

defaultMessage='System Statistics'
/>
</h3>
<FormattedAdminHeader
Copy link
Member

Choose a reason for hiding this comment

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

This "breaks" the translation extraction mechanism. There are solutions. The simplest one would be add the t function call in the id attribute, something like:

<FormattedAdminHeader
  id={t('analytics.system.title')}
  defaultMessage='System Statistics'
/>

Other solution is to add the new FormattedAdminHeader to the extraction tool, but if you add a lot of this, you will need to add each one to the translations extraction tool.

Other option is try to make the tool smarter, something like try to extract from any component with name starting by "Formatted" with attributes id and defaultMessage, and if is needed, add specific cases for specific components.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think for now I'm going to go for the second option: adding FormattedAdminHeader to the i18n extraction script. If more components like this get added, we can consider the third option then. I don't think the first option is acceptable.

This adds 2 new widgets:
* AdminHeader, which is a widget that makes the Admin Console page
header which can take any components or values as children.
* FormattedAdminHeader, which is a child widget that can be used where
the AdminHeader component is to contain a single localised (markdown)
string.

These are not the most complicated components in existence, but they are
distinctly UI widgets that can be separated from the code, and were
needed for the code I was writing at the present.

This also adds a dependency on `sinon` for testing.
@grundleborg grundleborg merged commit af6a14f into mattermost:master Nov 15, 2018
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Nov 17, 2018
@lindy65 lindy65 added Tests/Not Needed Does not require new release tests and removed 2: Dev Review Requires review by a core commiter labels Dec 4, 2018
@JtheBAB JtheBAB mentioned this pull request Jan 15, 2019
9 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation Tests/Not Needed Does not require new release tests
Projects
None yet
7 participants