-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this 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' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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) |
|
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
Issues Fixed or Closed
Type of Change
.github/...
)Checklist