Skip to content

refactor(webui): Migrate Vue App to Full SPA #3855

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

TheElixZammuto
Copy link
Member

@TheElixZammuto TheElixZammuto commented May 6, 2025

Description

This PR changes the way the Web UI is built and served, making use of a much more industry-standard SPA.

On Sunshine Server

This means that the only HTML page served is the index.html (which is also served in case of fall-backs to handle SPA auth) with all the assets. It also handles the redirect on the authenticate method now

On the Web UI build

Removed the EJS templating and making Vite only with a single entrypoint, also made the Vite Server working while proxying Sunshine. This way those can be developed and tested separately without building completely Sunshine

On the Web UI runtime

Now the UI is a single Vue App, the navigation is handled by Vue-Router

Advanteges

  • Less boilerplate code on both Sunshine and Vite
  • Can be run standalone with an API proxy, so the UI can be tested without Sunshine running (e.g. with playwright)
  • More standard and less clunky approach

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

@TheElixZammuto TheElixZammuto changed the title (refactor): Migrate Vue App to Full SPA refactor: Migrate Vue App to Full SPA May 6, 2025
@TheElixZammuto TheElixZammuto changed the title refactor: Migrate Vue App to Full SPA refactor(webui): Migrate Vue App to Full SPA May 6, 2025
@TheElixZammuto TheElixZammuto marked this pull request as draft May 6, 2025 20:03
@ReenigneArcher

This comment was marked as resolved.

@TheElixZammuto TheElixZammuto marked this pull request as ready for review May 17, 2025 09:21
Copy link
Member

@ReenigneArcher ReenigneArcher left a comment

Choose a reason for hiding this comment

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

Nice work on this!

I have a few comments below, and a question.

Can be run standalone with an API proxy, so the UI can be tested without Sunshine running (e.g. with playwright)

I assume we still need a server running, just through node instead of Sunshine? Or can we build a "static" site? I'm just thinking if there was a way to host a demo of the site on gh-pages.

@@ -1,7 +1,7 @@
import {createI18n} from "vue-i18n";

// Import only the fallback language files
import en from './public/assets/locale/en.json'
import en from '../../public/assets/locale/en.json'
Copy link
Member

Choose a reason for hiding this comment

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

How hard would it be to change the location of the locale files? It would be nice if they were higher up in the repo, such as in ./locale/web/.

Not a requirement for this PR though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Since the Frontend loads the locale dynamically from the JSON files we need them in the public folder
The only way to change the path is by moving it into bundling statically

vite.config.js Outdated
server: {
proxy: {
'/api': {
target: 'https://localhost:47990',
Copy link
Member

Choose a reason for hiding this comment

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

This is for use/testing outside of Sunshine? Can the port be configurable, and maybe pull in from an env variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, this is used by the vite dev server "npm run dev". When used by Sunshine this is not used
We can of course read it from an env var since it's a Javascript file

@TheElixZammuto
Copy link
Member Author

I assume we still need a server running, just through node instead of Sunshine? Or can we build a "static" site? I'm just thinking if there was a way to host a demo of the site on gh-pages.

We can build a static site, the only thing blocking us here is that we need to provide some mocks for the APIs (version, apps etc)

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
41 New issues
2 New Bugs (required ≤ 0)
3 Duplicated Blocks on New Code (required ≤ 0)
C Reliability Rating on New Code (required ≥ A)
39 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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

Successfully merging this pull request may close these issues.

Sunshine: Migrate Web UI to full SPA
2 participants