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

feat(ui): results of vue create ui using vue2 defaults #1122

Closed
wants to merge 35 commits into from

Conversation

hairmare
Copy link
Member

@hairmare hairmare commented Nov 30, 2020

For now these are the raw results of vue create ui in the root while choosing the new Vue 3 default.

Tasks

  • rework to actual LibreTime specific scaffolding
  • update docs proper to embed in LibreTime proper
  • yarn vs. npm decision (currently uses yarn because ¯_(ツ)_/¯)
  • ensure renovate or dependabot for ui/
  • add css and js assets to legacy mvc stack as part of "strangling" the old views
  • Playout history flash buttons are not executed #518 as PoC widget
  • implement playouthistory page in vue
  • replace favicon/assets 😛
  • squash this PR for clean history
  • storybook scaffolding
  • jest scaffolding
  • working storybook-docs
  • get rid of [Vuetify] Unable to locate target [data-app] warning in tests
  • run jest tests through GitHub Actions
  • finalize api and rebase onto final api variant (needs some cleanup in the playouthistory & playouthistorytemplate endpoints)
  • working i18n conversion script (most packages I found don't do exactly what we need)

Fixes #1121

@zklosko
Copy link
Member

zklosko commented Nov 30, 2020

@hairmare Is there a way I can assist? I would really like to learn Vue and Javascript.

@hairmare
Copy link
Member Author

hairmare commented Nov 30, 2020

@zklosko

  1. Install nodejs on your dev env
  2. Install yarn (there is a task in this PR that might make yarn optional but it won't hurt)
  3. Install vue cli
  4. grab yourself a local working copy of this branch
  5. cd ui/ in the working copy
  6. run yarn install
  7. run yarn serve

yarn serve should output some info on where a local instance of the "Hello World!" example from this PR is hosted.

Most changes you make to the ui/ directory will reload the webpage hosted by yarn serve. Try editing a file in src/components/ and see how it reloads automagically.

  1. Run yarn serve:storybook and have a look at our storybook

@zklosko
Copy link
Member

zklosko commented Dec 5, 2020

@hairmare Just wanted to suggest we step down to Vue 2 if we still plan on using Vuetify. I've gotten a lot of errors trying to add Vuetify to the Vue 3 setup; apparently this is a known issue: vuetifyjs/vue-cli-plugins#140, https://vuetifyjs.com/en/introduction/roadmap/.

@hairmare hairmare changed the title feat(ui): results of vue create ui using vue3 defaults feat(ui): results of vue create ui using vue2 defaults Dec 16, 2020
@hairmare
Copy link
Member Author

hairmare commented Dec 16, 2020

Just wanted to suggest we step down to Vue 2 if we still plan on using Vuetify.

I encountered that as well and downgraded Vue2, it's not only Vuetify but also VueI18n that is't ready yet.

In this PR I've worked on Vuetify since it's what I know, that does't mean I'm not ready to replace it with Bulma (which I dont know enough about, yet). I want to get (jest-based) Unit-Testing up and running next, and I'll contribute to the discussion regarding Vuetify vs. Bulma vs. ... once I have that done in a PoC fashion based on the ExternalDataMenuButton in the PR.

Copy link
Member Author

@hairmare hairmare left a comment

Choose a reason for hiding this comment

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

I should also remove any assets from this while I implement the changes I just self-reviewed.

ui/.gitignore Outdated Show resolved Hide resolved
ui/.storybook/i18n_storybook.js Outdated Show resolved Hide resolved
ui/.storybook/main.js Show resolved Hide resolved
ui/.storybook/main.js Show resolved Hide resolved
ui/.storybook/vuetify_storybook.js Outdated Show resolved Hide resolved
@@ -0,0 +1,28 @@
<template>
Copy link
Member Author

@hairmare hairmare Dec 16, 2020

Choose a reason for hiding this comment

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

Add a comment to clarify that this is just a demo that I expect to be replaced b4 we use this.

Comment on lines 3 to 14
import Vue from 'vue'
import Vuetify from 'vuetify'

import ExportDataButtonMenu from '../../src/components/ExportDataButtonMenu.vue';

describe('ExportDataButtonMenu.vue', () => {
const localVue = createLocalVue()
let vuetify

beforeEach(() => {
vuetify = new Vuetify()
})
Copy link
Member Author

Choose a reason for hiding this comment

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

Figure out if this can be abstracted so we don't have to add it in each test.

export default {
name: 'ExportDataButtonMenu',
props: {
data: String,
Copy link
Member Author

Choose a reason for hiding this comment

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

Consider this:

Suggested change
data: String,
data: Object,

ui/src/plugins/vuetify.js Outdated Show resolved Hide resolved
@@ -0,0 +1,14 @@
module.exports = {
Copy link
Member Author

Choose a reason for hiding this comment

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

Can/should I move this to package.json?

@hairmare
Copy link
Member Author

Most of what is in this PR is scaffolding... The real MVP is in ui/src/components/ExportDataButtonMenu.*.

Those files show how you can add a component (ExportDataButtonMenu.vue), integrate it with storybook (ExportDataButtonMenu.stories.js) and test it with Jest (ExportDataButtonMenu.spec.js).

@hairmare
Copy link
Member Author

Also, here's a storybook.js teaser ;)

image

@hairmare hairmare mentioned this pull request Jan 4, 2021
@hairmare hairmare mentioned this pull request Jan 5, 2021
@stale
Copy link

stale bot commented Jun 11, 2021

This issue has been automatically marked as stale because it has not had activity in the last 5 months. It will be closed if no activity occurs in the next month.
Please chat to us on discourse or ask for help on our chat if you have any questions or need further support with getting this issue resolved.
You may also label an issue as pinned if you would like to make sure that it does not get closed by this bot.

@stale stale bot added the status: stalled This issue or pull request is stalled label Jun 11, 2021
@stale stale bot removed the status: stalled This issue or pull request is stalled label Jun 11, 2021
@paddatrapper paddatrapper mentioned this pull request Jun 11, 2021
@jooola jooola added status: pinned This issue or pull request won't stale and removed pinned labels Sep 18, 2021
@zklosko
Copy link
Member

zklosko commented Oct 16, 2021

@hairmare I've added a bit of work to your branch. How should I fold my commits into your fork?

@paddatrapper
Copy link
Contributor

@zklosko you should be able to push to the branch because the PR is open

@zklosko
Copy link
Member

zklosko commented Oct 16, 2021

Maybe I checked it out incorrectly. VSCode says I don't have permission to push to radiorabe/libretime on Github.

> git push vue feat/init-vue:feat/init-vue
> git ls-tree -l HEAD -- /Users/zacharyklosko/Documents/GitHub/libretime/docs/_docs/host-configuration.md
> git ls-tree -l HEAD -- /Users/zacharyklosko/Documents/GitHub/libretime/docs/_docs/host-configuration.md
> git show --textconv HEAD:docs/_docs/host-configuration.md
> git show --textconv HEAD:docs/_docs/host-configuration.md
remote: Permission to radiorabe/libretime.git denied to zklosko.
fatal: unable to access 'https://github.com/radiorabe/libretime.git/': The requested URL returned error: 403

@paddatrapper
Copy link
Contributor

It may be a maintainer/contributor permission difference...

@hairmare are you still working on this or shall we take it over? I'd like to get working on this soon

@zklosko
Copy link
Member

zklosko commented Nov 20, 2021

@paddatrapper Would it be okay if we switched to a Vue framework like Nuxt JS? There seems to be a lot of boilerplate that could easily make the project complicated.

@paddatrapper
Copy link
Contributor

paddatrapper commented Nov 22, 2021

@zklosko I have no strong feeling either way. Server-side rendering is nice for some of the things we are doing. The requirements I see are:

  1. Matching the UI look and feel that we currently have
  2. Internationalization support using a standard interface supported by Weblate

@zklosko
Copy link
Member

zklosko commented Nov 28, 2021

@paddatrapper I take back my request for Nuxt, but I still feel unclear as to our goals for the rewrite.

Decoupling the backend means we have to put more focus into the API, but we could push ourselves to keep an eye on the API nevertheless. We could pre-render each page on the server (especially helpful for i18n), but that would require an additional server process to keep running. We would also need an additional Docker container in a Docker setup (UI + API + DB + Python + RabbitMQ + Liquidsoap + Icecast + Nginx/Caddy); it seems we are adding in additional points of failure without it greatly benefiting us.

An idea before was to statically generate the app and then serve it from Django, is that still what we're aiming for?

@paddatrapper
Copy link
Contributor

A vue.js app wouldn't need an additional server - the js is generated at build time and served by the webserver. So the apache process already serving the PHP, serves the js. I agree with you that we don't want yet another process running and there is a fair amount of things that wouldn't be able to be rendered server side (live DJ interface, uploading, scheduling, etc). We're going to end up with a lot of client-side js either way

@zklosko
Copy link
Member

zklosko commented Nov 28, 2021

That almost sounds like what we had before - templating in PHP with functionality in JS. Since Django already gives us i18n support and login auth, why not use templating and middleware in Django with component-based functionality in Vue.js? We can still minify and bundle the JS but the UI would be so much faster that way instead of entirely building it client-side. I think we can still use Vuetify as a UI framework.

There's arguably a lot that we don't need JS for:

  • Don't need JS: rendering the bulk of the UI, user auth, i18n, basic forms
  • Do need JS: players, advanced and interactive forms, uploading files, drag and drop, dashboards, interacting with API

@paddatrapper
Copy link
Contributor

@zklosko maybe we should continue this conversation in #2 where the rest of the discussion happened?

@zklosko
Copy link
Member

zklosko commented Dec 2, 2021

I would like to move to Vite from Webpack, because it's a lot faster, simpler, and still works with i18n generation, if that's okay with @hairmare.

@zklosko
Copy link
Member

zklosko commented Dec 4, 2021

So it begins...

Screen Shot 2021-12-03 at 11 22 37 PM

@zklosko
Copy link
Member

zklosko commented Dec 7, 2021

Screen Shot 2021-12-06 at 9 35 43 PM

@paddatrapper
Copy link
Contributor

Closed in favour of #1696

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pinned This issue or pull request won't stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Initialize Vue Env
4 participants