This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Add support full static generation #11
Labels
Comments
From my own research and experimentation, it feels like react-snap might be able to help but there are some things to figure out. I sent a test patch which adds the react-snap dependency, a The generated tree looks like this:
Observations:
If react-snap is the right choice, we need to figure out:
If it's not the right choice, I am most definitely open to suggestions. |
Yeah, switching from onclick to href made react-snap able to find links to the playbook pages properly, see: https://review.opendev.org/#/c/664941/2/src/playbooks/PlaybookSummary.js $ npm run snapshot
> [email protected] snapshot /home/dmsimard/dev/git/ansible-community/ara-web
> react-scripts build && react-snap
Creating an optimized production build...
Compiled with warnings.
./src/playbooks/PlaybookSummary.js
Line 148: 'history' is assigned a value but never used no-unused-vars
./src/index.js
Line 2: 'ReactDOM' is defined but never used no-unused-vars
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
File sizes after gzip:
126.69 KB build/static/js/2.fb10dc57.chunk.js
59.57 KB build/static/css/2.b346d2ff.chunk.css
5.4 KB build/static/js/main.eeeae9ea.chunk.js
762 B build/static/js/runtime~main.a8a9905a.js
The project was built assuming it is hosted at http://localhost:3000/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
npm install -g serve
serve -s build
Find out more about deployment here:
https://bit.ly/CRA-deploy
/playbooks
💬 in browser redirect (/playbooks)
✅ crawled 1 out of 11 (/)
⚠️ warning: 404 page title does not contain "404" string
✅ crawled 2 out of 11 (/404.html)
✅ crawled 3 out of 11 (/playbooks)
✅ crawled 4 out of 11 (/playbooks/1)
✅ crawled 5 out of 11 (/playbooks/2)
✅ crawled 6 out of 11 (/playbooks/3)
✅ crawled 7 out of 11 (/playbooks/4)
✅ crawled 8 out of 11 (/playbooks/6)
✅ crawled 9 out of 11 (/playbooks/5)
✅ crawled 10 out of 11 (/playbooks/7)
✅ crawled 11 out of 11 (/playbooks/8) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In ARA 0.x, there is a
ara generate html
command that wraps aroundFrozen-Flask which takes care of crawling all the pages known by the web application and generate the static HTML/JS/CSS files as a result.
It is a useful feature since it allows users to generate a report and render it without requiring a database or an API server -- regardless of the tooling or platform they run Ansible with.
At this time, ara-web can be built to static html/js/css but still expects an API server to query in order to retrieve the data it needs to render the report pages.
We would need a way to generate a static version of the web application that doesn't call out to the API.
The text was updated successfully, but these errors were encountered: