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

Builder - Content Editor - Web page (C039 - #32) #4600

Merged
merged 10 commits into from Dec 10, 2019
Merged

Builder - Content Editor - Web page (C039 - #32) #4600

merged 10 commits into from Dec 10, 2019

Conversation

ghost
Copy link

@ghost ghost commented Dec 4, 2019

Description

In this PR I've addeed create new geostory component mechanism - WebPage

Issues

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Feature

What is the current behavior? (You can also link to an open issue here)

What is the new behavior?

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

@ghost ghost requested a review from MV88 December 4, 2019 12:17
@ghost ghost self-assigned this Dec 4, 2019
@ghost ghost mentioned this pull request Dec 4, 2019
12 tasks
@coveralls
Copy link

coveralls commented Dec 4, 2019

Coverage Status

Coverage decreased (-0.03%) to 84.444% when pulling d82fe49 on kboczkowski-clurgo:feature/C039-32 into 91cf087 on geosolutions-it:master.

Copy link
Contributor

@MV88 MV88 left a comment

Choose a reason for hiding this comment

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

Hi, there are some problems with this pr

@tdipisa I noticed that you cannot add directly a web page content, you have to add a media section or paragraph

  • Open a new story
  • Add a media section and select an image
  • Add a first web content with aaaa
  • Add a second web content with bbb, below the previous one
  • edit the first one with ccccc

current result

  • you cannot save, the modal does not closes, and it updates the wrong web content
    4600 web component problems

expected

  • to save correct web content

  • I'm not able to reproduce the following error

Uncaught Invariant Violation: branch(Preview)(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
    at eval (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:15693:36)
    at reconcileChildFibers (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:15696:15)
    at reconcileChildren (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:18026:28)
    at mountIndeterminateComponent (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:18794:5)
    at beginWork$1 (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:20084:16)
    at HTMLUnknownElement.callCallback (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:362:14)
    at Object.invokeGuardedCallbackDev (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:411:16)
    at invokeGuardedCallback (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:466:31)
    at beginWork$$1 (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:25730:7)
    at performUnitOfWork (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:24638:12)
    at workLoopSync (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:24614:22)
    at performSyncWorkOnRoot (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:24182:11)
    at eval (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:12238:24)
    at unstable_runWithPriority (webpack:///./node_modules/scheduler/cjs/scheduler.development.js?:815:12)
    at runWithPriority$2 (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:12188:10)
    at flushSyncCallbackQueueImpl (webpack:///./node_modules/react-dom/cjs/react-dom.development.js?:12233:7)

@tdipisa
Copy link
Member

tdipisa commented Dec 5, 2019

@kboczkowski-clurgo please fix the issues identified by @MV88, the Web Page content must be added not only as an additional content of an existing section (immersive or not) but also as a section per se like the other ones (images, paragraph etc). The requirement in the issue description is quite clear about that I think.

@tdipisa
Copy link
Member

tdipisa commented Dec 6, 2019

@tdipisa I noticed that you cannot add directly a web page content, you have to add a media section or paragraph

@kboczkowski-clurgo looking at the last commit message I suppose that latest updates don't fix this problem but only the consol error. Isn't it?

@ghost
Copy link
Author

ghost commented Dec 6, 2019

@tdipisa actualy I've fixed problem with editing which @MV88 discover. Now I'm working on adding this component via section directly.

@ghost ghost requested a review from MV88 December 6, 2019 13:26
Copy link
Contributor

@MV88 MV88 left a comment

Choose a reason for hiding this comment

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

Hi, I have found something that can be improved.

  • For the moment, use the same "code" icon for webpage content in section p
    image

  • Please align the webpage section with other ones in a single row

  • can you avoid to close the modal by clicking on the shadow (similar to media editor)?

  • I have found a weird interaction with drag and drop of web page content
    The drag and drop, works, but the modal appears

  • Add url validation, maybe via a regex. See if there is already something in the codebase, maybe among utils

@ghost
Copy link
Author

ghost commented Dec 9, 2019

#4600 (review)
It's done

@ghost ghost requested a review from MV88 December 9, 2019 12:06
Copy link
Contributor

@MV88 MV88 left a comment

Choose a reason for hiding this comment

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

@@ -139,6 +140,7 @@ const previewContents = {
const contentType = content.type === 'column'
? `${content.type}${content.align || 'center'}`
: content.type;
console.log(contentType, content.type);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
console.log(contentType, content.type);

* Validator of URL
* @param {string} url - url to validate
*/
export const isValidURL = (url) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hello, can you add tests for this, to see which use cases we are considering

@tdipisa
Copy link
Member

tdipisa commented Dec 9, 2019

Hi, i was not able to load these urls:

This doesn't make sens to me, why we should support these kind of URLs?

Maybe what we can do here is just to make the regex configurable from plugin config

@offtherailz what do you think?

@offtherailz
Copy link
Member

the only problem concerns "localhost", because the regex denies domain names without a point. This may fail with host files or local DNS.

Because the system may need to satisfy different requirements, as @tdipisa suggested, I should allow to configure the regex (2nd param of isValidURL may be the regex, by default the one currently used, maybe without the . check, but this is not necessary, if configurable.
From outside, (where isValidURL is called) you can get it from ConfigUtils.getConfigProp("GeoStoryValidIframeURLRegex") and pass it as 2nd param. I think it's enough.

@ghost
Copy link
Author

ghost commented Dec 10, 2019

@MV88 @tdipisa @offtherailz PR is updated with changes suggested by @offtherailz. Now validation util has optional parameter to pass custom regexp.

@ghost ghost requested a review from MV88 December 10, 2019 08:13
Copy link
Contributor

@MV88 MV88 left a comment

Choose a reason for hiding this comment

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

Hi @kboczkowski-clurgo just a minor update needed


save = () => {
const { url } = this.state;
const error = !isValidURL(url);
Copy link
Contributor

Choose a reason for hiding this comment

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

can you pass ConfigUtils.getConfigProp("GeoStoryValidIframeURLRegex") as second argument?
in that case we can override it anytime without changing the code

Verify that if the property is missing in config, then it uses the default one

Copy link
Author

Choose a reason for hiding this comment

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

ok

Copy link
Author

Choose a reason for hiding this comment

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

@MV88 done

save = () => {
const { url } = this.state;
const error = !isValidURL(url);
this.setState({ error: !isValidURL(url) });
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
this.setState({ error: !isValidURL(url) });
this.setState({ error });

@ghost ghost requested a review from MV88 December 10, 2019 09:04
Copy link
Contributor

@MV88 MV88 left a comment

Choose a reason for hiding this comment

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

Hi, i think now we are good

@tdipisa tdipisa merged commit 0424c9d into geosolutions-it:master Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants