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

New (preview) Web UI scaffolding #22783

Merged
merged 1 commit into from
Jul 29, 2024
Merged

Conversation

koszti
Copy link
Member

@koszti koszti commented Jul 24, 2024

Description

================================================
=== This is the re-opened version of the accidentally closed #22695 ===
================================================

This scaffolding PR aims to modernize the web UI for Trino, incorporating up-to-date tools and a contemporary look and feel.

Partially addressing and proposing technical solutions for #22697

Additional context and related issues

Currently, the Trino web UI uses outdated components like React 16, jQuery, and Bootstrap 3. Updating the UI to use more recent tools and frameworks will provide a fresher appearance and improved functionality. For instance, the Trino gateway utilizes Vite with modern dependencies, suggesting that the Trino web UI could benefit from adopting a similar approach for consistency.

Original slack thread: https://trinodb.slack.com/archives/CKCEWGYT0/p1720904086284609

IMPORTANT: This PR does not disrupt the current web app. Instead, it introduces a new web app scaffolding accessible at a new endpoint (/ui/preview), which is visible only in development mode. This approach allows for further development and testing and can switch to the new web app once migrating of all functionalities is completed.

This PR Utilizes the Following Tools and Development Features:

  • Using vite.js as the primary frontend tool. Similar to trino-gateway.
  • Hot Module Replacement (HMR) for instant and precise updates without reloading the page or losing the application state
  • Proxying API requests from the development UI to the Trino development server
  • Eliminating the need to rebuild the Java project after packaging, unlike the current web app

What's not included:

  • A React component library. We can decide on one later, with options like Semi Design (used in Trino Gateway) or Ant Design, among others.

To Develop the preview webapp locally

Run the PreviewUiQueryRunner class. This will start a minimalistic development server configured with the Preview UI.

Once the dev server is running start the preview webapp in dev mode:

$ cd core/trino-main/src/main/resources/webapp-preview
$ npm install && npm run dev

  VITE v5.3.4  ready in 108 ms

  ➜  Local:   http://localhost:5173/ui/preview
  ➜  Network: use --host to expose
  ➜  press h + enter to show help

To Build and package the preview webapp

Build steps are fully automated using Maven, eliminating the need to commit generated JS files to the git repository as was done with the current web app.

The preview web app is disabled by default and enabled only in the full development server by setting the web-ui.preview.enabled=true property. This ensures that the preview web app is available only to developers and not to production end users. Once all functionalities are migrated from the old web app to the new one, we can swap them, making the new web app the default for end users.

If the preview webapp is enabled then it's running in parallel to the current one and accessible at /ui/preview:

image

Release notes

(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@wendigo
Copy link
Contributor

wendigo commented Jul 24, 2024

@koszti You've inspired me to actually build the existing UI in a similar way so we don't keep checked in dist directory anymore: #22785.

@koszti
Copy link
Member Author

koszti commented Jul 24, 2024

@mosabua added an initial list of tasks that needs to be completed to the parent issue at #22697 (comment). We can review and can link future PRs to it.

@wendigo
Copy link
Contributor

wendigo commented Jul 26, 2024

@koszti can you rebase this PR? Some shared plugins are already added to the poms. This PR should be much smaller

@koszti koszti force-pushed the preview-ui-scaffold branch 2 times, most recently from 14e649d to 795c077 Compare July 26, 2024 15:18
core/trino-main/pom.xml Outdated Show resolved Hide resolved
Copy link
Contributor

@wendigo wendigo left a comment

Choose a reason for hiding this comment

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

LGTM % includes vs excludes

@koszti koszti force-pushed the preview-ui-scaffold branch from 795c077 to 28e83ab Compare July 28, 2024 16:02
@wendigo wendigo force-pushed the preview-ui-scaffold branch from 28e83ab to 983ed1a Compare July 29, 2024 08:44
@wendigo wendigo merged commit 2d48f85 into trinodb:master Jul 29, 2024
4 of 12 checks passed
@github-actions github-actions bot added this to the 454 milestone Jul 29, 2024
@wendigo
Copy link
Contributor

wendigo commented Jul 29, 2024

Merged. Thanks @koszti

cc @mosabua

@koszti koszti deleted the preview-ui-scaffold branch July 29, 2024 09:56
@wendigo
Copy link
Contributor

wendigo commented Jul 29, 2024

I've verified that the reproducible builds are not broken

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

Successfully merging this pull request may close these issues.

2 participants