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

Webapp Preview: Core components #22869

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

koszti
Copy link
Member

@koszti koszti commented Jul 29, 2024

Description

Core components and layout for the preview UI. Partially addressing and proposing technical solutions for #22697

It uses Material UI and features a look and feel similar to the Trino website and documentation, including a comparable color palette. The code also draws inspiration from the ideas and structure of Trino Gateway.

Additional context and related issues

Components added by this PR:

  • Basic layout with header, drawer and main content
  • Styles aligned with the trino website and documentation (theme.tsx)
  • Basic router with navigation to placeholder pages with themed Material UI sample components
  • State manager - persisting local config. (No authn/authz in this PR for now)
  • Light/Dark theme switcher
  • Error message snackbar (toast)

Screenshots:

Light Theme:
image

Dark Theme:
image

Snackbar (failure message example):
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:

@cla-bot cla-bot bot added the cla-signed label Jul 29, 2024
@koszti koszti force-pushed the webapp-preview-core-components branch from e35e915 to 756330a Compare July 30, 2024 00:00
@koszti koszti force-pushed the webapp-preview-core-components branch from 756330a to 62fc1ec Compare July 30, 2024 00:07
@koszti
Copy link
Member Author

koszti commented Jul 30, 2024

@mosabua , @wendigo, I can keep working on the preview UI and this is the next item in the pipeline. Are you happy if I keep sending relatively small PRs like this one, and by doing that slowly addressing the items in the list in #22697?

@koszti koszti force-pushed the webapp-preview-core-components branch from 62fc1ec to b80ce91 Compare July 30, 2024 00:27
@mosabua
Copy link
Member

mosabua commented Jul 30, 2024

@mosabua , @wendigo, I can keep working on the preview UI and this is the next item in the pipeline. Are you happy if I keep sending relatively small PRs like this one, and by doing that slowly addressing the items in the list in #22697?

Yes.. however I think ideally we start reviewing and merging. We need to get some consensus with other maintainers about the approach and such as well. We should maybe discuss this all some more in either in core-dev channel.

@wendigo
Copy link
Contributor

wendigo commented Jul 31, 2024

@mosabua my quality bar is pretty old at the moment for the preview UI. We should just skim PR and go ahead. There is no point in length discussions imo

@mosabua
Copy link
Member

mosabua commented Jul 31, 2024

Agreed @wendigo .. I just want to make sure it is tucked away safely and doesnt impact the rest of Trino negatively. If that is the case I am happy to just merge rather rapidly all under the understanding that this is a preview and very much under construction.

@mosabua
Copy link
Member

mosabua commented Jul 31, 2024

I think what I am saying is that we need some sort of config that completely disables the new UI from being used.. it can still be in the binary of course but it should be impossible to use it. And users have to switch the property to true for the preview to work.

Something like

web-ui.preview-enabled=true

or maybe even create a namespace in the config in case we need more of them.

web-ui.preview.enabled=true

https://trino.io/docs/current/admin/properties-web-interface.html

Does that make sense @koszti and @wendigo ?

Update: I see that this is already in place from #22783 .. we should add the config to the docs I think. And yes.. lets ship this.

@wendigo
Copy link
Contributor

wendigo commented Jul 31, 2024

@mosabua this is already it. The new web-preview is disabled by default and you need to switch on config property :)

@wendigo
Copy link
Contributor

wendigo commented Jul 31, 2024

@mosabua we should get #22892 first. This is something I've discussed with David

@mosabua
Copy link
Member

mosabua commented Jul 31, 2024

@mosabua we should get #22892 first. This is something I've discussed with David

That sounds good.

@mosabua
Copy link
Member

mosabua commented Jul 31, 2024

If we get the new separate web ui module in .. do we use that same module for the new preview UI .. I assume yes .. but I could also be convinced that having a separate module for the new UI is even cleaner.

@wendigo
Copy link
Contributor

wendigo commented Jul 31, 2024

@mosabua new preview UI is already merged (at least scaffolding) and it's moved to trino-web-ui module too :)

@mosabua
Copy link
Member

mosabua commented Jul 31, 2024

So we still with same module.. sounds good.

@wendigo
Copy link
Contributor

wendigo commented Jul 31, 2024

@koszti please rebase - you need to move these files to the core/trino-web-ui module

@koszti koszti force-pushed the webapp-preview-core-components branch from b80ce91 to 905d0dc Compare July 31, 2024 19:27
@koszti
Copy link
Member Author

koszti commented Jul 31, 2024

@wendigo rebase done

@wendigo
Copy link
Contributor

wendigo commented Jul 31, 2024

@koszti I'll review it tommorow

@@ -11,19 +11,25 @@
"preview": "vite preview"
},
"dependencies": {
"@douyinfe/semi-icons": "^2.63.1",
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 we should rather use https://www.npmjs.com/package/material-symbols

cc @mosabua

Copy link
Member Author

@koszti koszti Aug 1, 2024

Choose a reason for hiding this comment

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

let’s not mix items from two different design packages. (semi and material). If you prefer material design then let’s switch not only the icons but the entire lib, otherwise we might end up with a weird and mixed look and feel.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah! makes sense :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@koszti is this a heavy lift to use material ui here?

Copy link
Contributor

Choose a reason for hiding this comment

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

so material ui + material symbols (as called out here: https://m3.material.io/styles/icons/overview)

* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Empty } from "@douyinfe/semi-ui";
Copy link
Contributor

Choose a reason for hiding this comment

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

why not material design? it's more established than semi-ui

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

@koszti koszti Aug 1, 2024

Choose a reason for hiding this comment

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

semi design only because its been used in trino-gateway. But I’m happy to use something else, including material-ui as well as I’m not the greatest fan of semi design :)I leave it you to decide

Copy link
Contributor

Choose a reason for hiding this comment

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

Me neither. I think we should stick to the material-ui

Copy link
Member Author

@koszti koszti Aug 1, 2024

Choose a reason for hiding this comment

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

ok I will rework this PR and let you know when it’s ready to review again

Copy link
Member

Choose a reason for hiding this comment

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

I am also inclined to go with material but I am not a webdev any more... @colebow has more experience.

The fact that semi is used in the Trino Gateway UI is something we should keep in mind but it should not force us. Ideally we want to be able to reuse components across at some stage .. but we are not there yet.

Also .. if material proofs to be a good choice here.. we can also refactor the Trino Gateway UI if we want.

Copy link
Member

@mosabua mosabua Aug 1, 2024

Choose a reason for hiding this comment

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

Also .... we already use material for the website as well. And Trino Gateway docs uses material for mkdocs

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah. Material it is

Copy link
Member Author

Choose a reason for hiding this comment

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

@wendigo @mosabua it seems Material UI is the clear winner. I've updated the PR to use MUI and refreshed the screenshots above. Additionally, I made a minimalistic theme adjustment to align the basic styles with the Trino website and documentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

That looks nice!

@koszti koszti force-pushed the webapp-preview-core-components branch 2 times, most recently from e3ff489 to ba669ae Compare August 4, 2024 22:50
Copy link
Member

@colebow colebow left a comment

Choose a reason for hiding this comment

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

I'm not sure how much we need all of the snackbar-themed Snackbar, but it's easy enough to remove and I like that I'm learning MaterialUI by reviewing it. This looks good.

);
}

const NotFound = () => {
Copy link
Member

Choose a reason for hiding this comment

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

It'd be fun to include a Commander Bun Bun image as part of this.

Copy link
Member Author

Choose a reason for hiding this comment

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

voila

Screenshot 2024-08-05 220239

@koszti koszti force-pushed the webapp-preview-core-components branch from ba669ae to 2f147cc Compare August 5, 2024 21:09
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.

overall LGTM. I'd add prettier though

@koszti koszti force-pushed the webapp-preview-core-components branch from 2f147cc to b2aa67c Compare August 6, 2024 12:42
@koszti
Copy link
Member Author

koszti commented Aug 6, 2024

overall LGTM. I'd add prettier though

@wendigo I added prettier with the same .prettierrc to this PR: #22953 . All files are reformatted.

The package.json now has three targets:

  • lint: To run eslint enforcing coding standards and patterns, detecting code quality issues, and identifying bugs
  • prettier:format: To write the formatted files. This comes handy during development
  • prettier:check: To check if all files are formatted correctly. This can be used to run at PR time by github actions.

Wdyt, is this OK and should we add npm run prettier:check and maybe npm run lint to GHA, if yes then where is the right place?

@wendigo
Copy link
Contributor

wendigo commented Aug 6, 2024

@koszti we should add probably a separate "npm run check" execution to the pom which will run all checkers (linters, tests if any in the future etc)

@koszti koszti force-pushed the webapp-preview-core-components branch from b2aa67c to 2505cf1 Compare August 6, 2024 16:08
@koszti
Copy link
Member Author

koszti commented Aug 6, 2024

ok, added a new check script to package.json and a new execute to pom.xml so prettier, eslint and other future checkers will run automatically.

@koszti
Copy link
Member Author

koszti commented Aug 8, 2024

Is there anything I can do to help get this merged?I'm asking because I'd like to start working on more PRs that depending on this one.

@wendigo
Copy link
Contributor

wendigo commented Aug 8, 2024

@koszti I'm gonna review it really soon :)

@wendigo wendigo force-pushed the webapp-preview-core-components branch from 2505cf1 to 4240906 Compare August 13, 2024 12:40
@wendigo
Copy link
Contributor

wendigo commented Aug 13, 2024

I've applied some small fixes and going to merge this soon.

@wendigo wendigo merged commit 918af78 into trinodb:master Aug 13, 2024
93 of 94 checks passed
@github-actions github-actions bot added this to the 454 milestone Aug 13, 2024
@wendigo
Copy link
Contributor

wendigo commented Aug 13, 2024

@koszti here you go :)

@koszti koszti deleted the webapp-preview-core-components branch August 13, 2024 16:54
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.

4 participants