Skip to content

Conversation

@sampaiodiego
Copy link
Member

@sampaiodiego sampaiodiego commented Jul 1, 2020

Proposed changes

License tags will be used to display which types of license a server has.

Issue(s)

How to test or reproduce

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Hotfix (a major bugfix that has to be merged asap)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Changelog

Enterprise installations will show tags on Admin panel with the type of the license applied. The tag will be visible on the top-left corner of the administration area as a badge helping administrators to identify which license they have.

Further comments

@sampaiodiego sampaiodiego added this to the 3.5.0 milestone Jul 1, 2020
@sampaiodiego sampaiodiego requested review from ggazzo and rodrigok July 1, 2020 02:55
@ggazzo ggazzo self-assigned this Jul 1, 2020
};

const getBundleFromModule = (moduleName: string): string|undefined => {
export const getBundleFromModule = (moduleName: string): string => {
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this misleading since an empty string isn't a module and may be checked somewhere as != null?

Copy link
Member Author

Choose a reason for hiding this comment

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

it will still work if you compare with != null, so no issue with this. it would break though if there was a code comparing !== ''. but it was not the case.

but the only reason for this change was actually to be able to use in this .map .. I didn't found other solution for this, suggestions are welcome. this is what TS complains if keep it as string|undefined:
image

Copy link
Member

Choose a reason for hiding this comment

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

You can change the forEach to

.forEach((m) => m && this.tags.add(m));

and prevent from add an empty string as a tag as well

Copy link
Member Author

Choose a reason for hiding this comment

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

not that beauty but it works.. I'd like it to be clever and work with an additional filter:

			license.modules
				.filter(isBundle)
				.map(getBundleFromModule)
				.filter((tag) => !!tag)
				.forEach(this.tags.add, this.tags);

but I'll revert this 👍

@sampaiodiego sampaiodiego force-pushed the enterprise-license-tags branch 2 times, most recently from d91136a to 1062848 Compare July 17, 2020 15:05
ggazzo
ggazzo previously approved these changes Jul 17, 2020
@sampaiodiego sampaiodiego requested a review from rodrigok July 20, 2020 18:46
@sampaiodiego sampaiodiego merged commit dae7b70 into develop Jul 21, 2020
@sampaiodiego sampaiodiego deleted the enterprise-license-tags branch July 21, 2020 00:25
@sampaiodiego sampaiodiego mentioned this pull request Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants