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

feat(FEC-10785): add support to remove ui element #613

Merged
merged 2 commits into from
Jun 24, 2021

Conversation

RoyBregman
Copy link
Contributor

@RoyBregman RoyBregman commented Jun 22, 2021

Description of the Changes

Until now it was possible to add new component or to add and replace existing components.
There was no official way to remove an existing ui component.
The new way to that now is to use replaceComponent with the existing component and add the special "remove" string in the get property instead of a new component.

solves FEC-10785
changes were done KP repo also - kaltura/kaltura-player-js#460

CheckLists

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • test are passing in local environment
  • Travis tests are passing (or test results are not worse than on master branch :))
  • Docs have been updated

@@ -82,7 +82,7 @@ class PlayerAreaProvider extends Component {
_validateComponentData = componentData => {
// we keep option `container` for backward compatibility. documentation are showing `area` property
const hasAreaProperty = componentData.container || componentData.area;
if (!componentData.get || !componentData.presets || !hasAreaProperty) {
if ((!componentData.get && !componentData.removeComponent) || !componentData.presets || !hasAreaProperty) {
Copy link
Contributor

Choose a reason for hiding this comment

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

change the log below accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Current message also describes our case. If we need to make it more specific then we need to separate the if statement

OrenMe
OrenMe previously requested changes Jun 23, 2021
@@ -82,7 +82,7 @@ class PlayerAreaProvider extends Component {
_validateComponentData = componentData => {
// we keep option `container` for backward compatibility. documentation are showing `area` property
const hasAreaProperty = componentData.container || componentData.area;
if (!componentData.get || !componentData.presets || !hasAreaProperty) {
if ((!componentData.get && !componentData.removeComponent) || !componentData.presets || !hasAreaProperty) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that because until now our semantics didn't contain action + Component with component suffix we should just call it remove and not removeComponent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Today we have also - replaceComponent, beforeComponent, afterComponent. I kept the same semantics

Copy link
Contributor

Choose a reason for hiding this comment

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

u r totally right, not sure why I thought the other way around :-) so please disregard.

Copy link
Contributor

Choose a reason for hiding this comment

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

but now I have another thought on this.
I don't see removeComponent as same as before|After|replace exactly.
All of the above talk about positional operations, e.g., here to place a component, while remove is not.
Wouldn't it make more sense to re-use replaceComponent and add a get placeholder for a component called None or something that says no component or keep just the replaceComponent and if you have replaceComponent and no get then it means to remove it?

Feels redundant to add more config options and make the object fat where we already have all of the current config options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To me it felt more natural to have a new prop called removeComponent.
But I guess with good documentation it is very possible to do it like you suggested

Copy link
Contributor

Choose a reason for hiding this comment

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

you know how I personally feel about new APIs or config options - we should always consider if it is necessary as new APIs or not as new ones are an obligation by us and cannot be changed/broken easily after they are committed.
In any case, this is great addition - also need to be able to define this from studio and uiconf which is very useful as we saw in VE.

yairans
yairans previously approved these changes Jun 23, 2021
@RoyBregman RoyBregman dismissed OrenMe’s stale review June 23, 2021 07:16

Today we have also - replaceComponent, beforeComponent, afterComponent. I kept the same semantics

@RoyBregman RoyBregman merged commit 0e505e3 into master Jun 24, 2021
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.

3 participants