-
Notifications
You must be signed in to change notification settings - Fork 278
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
moved config to http-vue-loader #4374
Conversation
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.
I'm sorry but I think I'm against moving to
http-vue-loader
.
It seems to only complicate things right now.
And it adds unnecessary overhead due to our current configuration.
We should do the transitions in steps.
I think we should convert all pages to the mako-vue files we've been doing until now first.
This comment has been minimized.
This comment has been minimized.
e5f8096
to
ff118dc
Compare
medusa/server/web/config/handler.py
Outdated
@@ -2,16 +2,7 @@ | |||
|
|||
"""Base handler for Config pages.""" | |||
|
|||
from __future__ import unicode_literals |
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.
__future__
imports should usually stay. This one in particular.
Basically, they're the first steps of making Python 2 compatible with Python 3.
Sorry for not being more explicit...
computed: store.mapState(['config']), | ||
mounted() { | ||
const { $store } = this; | ||
$store.dispatch('getConfig'); |
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.
You didn't respond to my review about that.
I don't understand why we still need to get the config if we enabled it globally with the mixin?
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.
I have to look into it but for some reason it's not getting the config set to anything but null
like it is when we first load the store.
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.
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.
Who knows then. I remove it.
After trying to convert more templates locally I found that the jQuery tabs refuse to load if a Vue HTML element is found inside of it and if I move the component back to being loaded locally via the x-templates it works fine. |
@OmgImAlexis |
Yes, I also tried commenting it out and running it after everything has loaded via the console and nothing happens. |
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.
Final suggestions...
|
||
module.exports = { | ||
name: 'config', | ||
computed: store.mapState(['config']), |
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.
I don't know if it affects performance, but this mapState is not needed.
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.
I still want to keep it there as I'd like to disable the mixin for .vue
files.
@@ -0,0 +1,64 @@ | |||
<template> | |||
<div id="config-content"> |
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 do you feel about:
<div v-if="!config.pythonVersion" class="vue-loading" id="config-content">
<h3>Loading...</h3>
</div>
<div v-else id="config-content">
It gives it a cleaner look in the meantime, but a little more work when it's no longer needed.
I added class="vue-loading"
so if we keep it the same on all .vue
files it would be easy to remove them.
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.
I was thinking we could just add a loading component before the <router-view>
?
<loading v-if="loading"></loading>
<router-view v-else></router-view>
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 would you know when the values were loaded?
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.
For example on this you'd set loading: true
on data and then set a function to watch config
when it updates set loading: false
.
@@ -0,0 +1,470 @@ | |||
(function umd(root,factory){ |
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.
I still prefer a minimised version of this file, unless you believe it would be easier to debug issues?
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.
Yeah, I think for now it'll be easier.
themes/dark/templates/config.mako
Outdated
@@ -1,122 +1,5 @@ | |||
<%inherit file="/layouts/main.mako"/> |
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.
These files config.mako
didn't get deleted on dark and light themes, need to manually remove
@sharkykh could you please do a final review. |
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.
component: notFoundComponent | ||
}, { | ||
path: '*', | ||
redirect: '/not-found' |
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.
On develop, navigate to http://localhost:8081
Page is loaded but URL is now http://localhost:8081/not-found
It's caused by this redirection.
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.
Not getting this issue on dev with and without webroot so I'm not sure what's causing it on your end.
Do you maybe still have the service worker loaded? Try disabling it by going to the Application
menu in Chrome's dev-tools and hitting Clear site data
.
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.
I don't use a webroot. ServiceWorker is loaded but I don't think it has anything to do with it.
Try navigating from say, /home
to /schedule
by clicking the Schedule nav link. You should get this issue.
Don't know why it only seems to happen on /schedule
route.
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.
That 100% has something todo with it. Remove the service worker.
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.
Oh, I just figured it out.
router, |
We need to remove this line.
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.
Oh.. no we just need to add the route for it. I'm moving the headers and titles over to the router.js
. Just don't add a component property and it works fine.
For example.
routes: Object.assign(routes || [], [{
path: '/config',
name: 'config',
meta: {
title: 'Help & Info',
header: 'Medusa Configuration'
},
component: configComponent
}, {
path: '/home',
name: 'home',
meta: {
title: 'Home',
header: 'Show list'
}
}, {
path: '/history',
name: 'history',
meta: {
title: 'History',
header: 'History'
}
}, {
path: '/not-found',
name: 'not-found',
meta: {
title: '404',
header: '404 - page not found'
},
component: notFoundComponent
}, {
path: '*',
redirect: '/not-found'
}])
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.
We then use this in the pages that aren't .vue
since they don't use the global Vue.
header() {
return this.$route.meta.header;
},
store, // eslint-disable-line no-undef | ||
computed: { | ||
config() { | ||
return this.store.state.config; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@p0psicles