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

moved config to http-vue-loader #4374

Merged
merged 12 commits into from
Jul 4, 2018
Merged

Conversation

OmgImAlexis
Copy link
Collaborator

@sharkykh
Copy link
Contributor

sharkykh commented Jun 15, 2018

IMO, we have to do something about the fact it loads the config from the API twice.
image
One from core.js and the other from the store.

Edit: Oh, we can't :(

Copy link
Contributor

@sharkykh sharkykh 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 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.

@OmgImAlexis

This comment has been minimized.

@OmgImAlexis OmgImAlexis modified the milestones: 0.2.6, backlog Jun 25, 2018
@OmgImAlexis OmgImAlexis force-pushed the move-config-to-http-vue-loader branch from e5f8096 to ff118dc Compare July 1, 2018 05:31
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@pymedusa pymedusa deleted a comment from todo bot Jul 1, 2018
@OmgImAlexis OmgImAlexis added this to the 0.2.7 milestone Jul 2, 2018
@@ -2,16 +2,7 @@

"""Base handler for Config pages."""

from __future__ import unicode_literals
Copy link
Contributor

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');
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

I removed that code and it still works fine for me? 🤔
2018-07-02_10-10-59

Copy link
Collaborator Author

@OmgImAlexis OmgImAlexis Jul 2, 2018

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.

@OmgImAlexis
Copy link
Collaborator Author

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.

@sharkykh
Copy link
Contributor

sharkykh commented Jul 2, 2018

@OmgImAlexis
Have you tried calling the tabs initializations ($(element).tabs() IIRC) on the component's mounted()?

@OmgImAlexis
Copy link
Collaborator Author

Yes, I also tried commenting it out and running it after everything has loaded via the console and nothing happens.

sharkykh
sharkykh previously approved these changes Jul 2, 2018
Copy link
Contributor

@sharkykh sharkykh left a 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']),
Copy link
Contributor

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.

Copy link
Collaborator Author

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">
Copy link
Contributor

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.

Copy link
Collaborator Author

@OmgImAlexis OmgImAlexis Jul 3, 2018

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>

Copy link
Contributor

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?

Copy link
Collaborator Author

@OmgImAlexis OmgImAlexis Jul 3, 2018

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){
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

@@ -1,122 +1,5 @@
<%inherit file="/layouts/main.mako"/>
Copy link
Contributor

@sharkykh sharkykh Jul 3, 2018

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

@OmgImAlexis
Copy link
Collaborator Author

@sharkykh could you please do a final review.

@OmgImAlexis OmgImAlexis merged commit b88db29 into develop Jul 4, 2018
@OmgImAlexis OmgImAlexis deleted the move-config-to-http-vue-loader branch July 4, 2018 02:27
Copy link
Contributor

@sharkykh sharkykh left a 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'
Copy link
Contributor

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.

Copy link
Collaborator Author

@OmgImAlexis OmgImAlexis Jul 4, 2018

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.

Copy link
Contributor

@sharkykh sharkykh Jul 4, 2018

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

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.


We need to remove this line.

Copy link
Collaborator Author

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'
}])

Copy link
Collaborator Author

@OmgImAlexis OmgImAlexis Jul 4, 2018

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.

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

Successfully merging this pull request may close these issues.

4 participants