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

Rewriting poudriere web app #1172

Open
1 task
fel1x-developer opened this issue Sep 23, 2024 · 1 comment
Open
1 task

Rewriting poudriere web app #1172

fel1x-developer opened this issue Sep 23, 2024 · 1 comment

Comments

@fel1x-developer
Copy link
Contributor

fel1x-developer commented Sep 23, 2024

Prerequisites

  • Have you checked for an existing issue describing your idea?

What is your proposal?

Rewriting poudriere web app under src/share/poudriere/html with introduction of modern web technologies such as Node.js and React.

What is the existing behavior, if any?

The current implementation of the web app uses bare HTML/CSS, jQuery, Bootstrap 5, and DataTables. However, it is hard to maintain the web app under these libraries/frameworks. For example, if someone wants to update Bootstrap in the current web app, one has to

  1. Download latest version of Bootstrap from web browser/curl/wget.
  2. Remove the old version of Bootstrap and copy the new version.
  3. Edit index.html, jail.html, and build.html to update the folder name of the new version.

In node.js/npm, this can be simply done by npm update bootstrap --save.

@bapt also mentioned that the web app needs to include more information about poudriere instance, which I find easier on JSX than HTML/jQuery.

Our poudriere.js was written 10 years ago, and since it has almost 1500 lines of code, it has been really difficult to add/maintain features. I think it needs to be modularized into several files, but introducing ES6 modules in existing code might break some features and create circular dependency on each other. 'poudriere.js' was not designed to be structured through modularization at first place, so that can also be achieved through this rewrite.

Lastly, I find that libraries/frameworks that runs on nodejs/npm have better integration in IDEs such as VS Code, Webstorm, and Phpstorm, so I expect a huge improvement in the speed of development.

What is the motivation / use case for the change?

As mentioned above, the main advantage of this rewrite will be the ease of maintaining and adding features. Through Webpack/Turbopack/Vite, web app can have better performance and smaller file size than manually coding bare HTML and Javascript.

Did you consider any alternatives?

I see that this is the best way to maintain/develop poudriere web app. This approach also has a potential of extending capabilities of poudriere, such as controlling multiple poudriere instances or cli on web.

Is this really a ports feature request?

As the web app is already a part of the poudriere port, I think this is a valid request. There is no reason to have such things like ports/pourdiere-web-app-new.

Example

Cockpit, a server management web app, uses Node.js and React for its frontend. Github repo If it had this much features in bare HTML/Javascript, it would have been really hard to maintain and updating features.

Additional context

There should be a discussion/consensus on two topics.

  1. Which framework to use?
    This is a hot topic in some places. (Google "Which web framework is the best and you will see different answers on Reddit/Youtube) I already have some experience with React/Next.js so I prefer using them. Next.js has also good integration with shadcn/ui and TailwindCSS. I heard that Nuxtjs/Vue and Sveltekit are also good options, but I would need to spend some months in studying new web frameworks. If there are any thoughts/suggestions about which framework to use, please let me know down in the comment.
  2. Which repo should the new web app be hosted?
    I suggest creating a new repo(freebsd/poudriere-web-app) for this rewrite, as it requires less CI customization. Having an isolated repo for the web app can help focusing on web specific issues/PRs apart from core pourdiere features. Maybe this needs a n approval from the core team?

Edit: I want to resolve dependency PRs on the current web instance before moving on a new one. Please review #1160 and once it is closed #1134 .

@michael-o
Copy link
Contributor

This, of course, add a huge dependency trail...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants