Jump to content

Revamped Modules install interface


adrian
 Share

Recommended Posts

BTW - Pete mentioned to me elsewhere that perhaps the modules directory should take care of caching a json file with the data for all modules - that was this module won't have to take care of it and the load on the PW server will be minimal because it will only be serving a fairly small json file with no database calls accept for when a module is updated/added.

Of course we need to get Ryan on board with this approach.

Link to comment
Share on other sites

I can take a look at it - what data does it need to pull? Just the same as is in the current feed?

I think the only issue is that depending on the version of PW you run it dynamically filters the modules somehow on the PW server - I'll ask Ryan if it's okay to share the code so you can see what's going on and I'll get back to you.

Link to comment
Share on other sites

Hey Bernhard, that is how the data is output, however a little modification is needed, as there is some metadata. But if you use the items array, you have exactly what you want. Take a look at the data on http://modules.processwire.com/export-json/?apikey=pw223&limit=500 and throw the result into a json formatter like https://jsonformatter.curiousconcept.com/

  • Thanks 1
Link to comment
Share on other sites

9 hours ago, jmartsch said:

Hey Bernhard, that is how the data is output, however a little modification is needed, as there is some metadata. But if you use the items array, you have exactly what you want. Take a look at the data on http://modules.processwire.com/export-json/?apikey=pw223&limit=500 and throw the result into a json formatter like https://jsonformatter.curiousconcept.com/

BTW, if you try 500, then you'll only get 10 returned. 400 is the highest valid limit. See my revised screenshot in the last post where you can see the 400 items. 

Link to comment
Share on other sites

PS - you can also do this to get the second page of results. So 400 + 161 shows the total 561 modules currently in the directory. I still think we should be able to get all in one call, but this is still useful to know.

image.png.f2ab6d6f256e3a2cbfa49919a402500e.png

  • Like 1
Link to comment
Share on other sites

@Pete It would also be nice to have a URL that just returns a timestamp/date when the static/cached module JSON file was last updated. If we have that, we could check if we have to download the module JSON again, or can use the locally cached version.

And it should be separate from the module JSON, because the download would be much smaller.

Link to comment
Share on other sites

36 minutes ago, jmartsch said:

If we have that, we could check if we have to download the module JSON again, or can use the locally cached version.

I understand the need to conserve resources, smaller file sizes, etc. What I'm not getting is whether this is for the benefit of the ProcessWire server or this module. If the latter, then the question is how many times does the average site need to install modules? Usually, is it not a one-off thing? You set up a site, install needed modules and that's it? Or, is it the case that we want to be regularly browsing for new modules from within our sites? Sorry, I'm having a very slow week and I am perhaps missing the plot ?.

Link to comment
Share on other sites

@kongondo Performance is important, even if you visit the modules section not very often. In my case I often need to install or uninstall modules during development of my sites. This might not apply to all sites or the average site, but hey, if we can be fast, why shouldn't we?

Link to comment
Share on other sites

I am slowly progressing, because I struggled with loading the JSON via AJAX in conjunction with vue.js (which I sadly did not managed yet). And had to get used to vue.js a little bit more.  There is a lot of old markup that needs to be refactored, but the module is already working.

I optimized and prioritized which information should be shown, and what is additional information, which will be shown with a specific action like clicking a link or hovering over the card. Don't know it excactly yet.

Here you can see which module is installed or not installed and have options to install it. Support for quick uninstalling/deactivating modules is coming soon.

chrome_2019-01-18_01-36-38.thumb.png.5c73b704668341f92babe97ee30330d7.png

And in this screenshot you see how it looks if a module can be updated.
chrome_2019-01-18_01-35-40.png.46b98a6af06a1c09d6c14f1b51f0bfe8.png

The layout is still work in progress and not finished yet. Still deciding on icons, colors, etc.

 

  • Like 4
Link to comment
Share on other sites

3 hours ago, jmartsch said:

I struggled with loading the JSON via AJAX in conjunction with vue.js (which I sadly did not managed yet)

Is it a Vue issue or CORS with AJAX in general? https://codepen.io/adrianbj/pen/QzXwGz?editors=0010

If it's just Vue related, I use AXIOS for this stuff: https://vuejs.org/v2/cookbook/using-axios-to-consume-apis.html

PS, it's looking great!

PPS - why AJAX - given how small the JSON for all the modules is, why not just load everything at once via PW's $http->getJSON()

  • Like 3
Link to comment
Share on other sites

Hey @adrian. The first problem was with CORS as I tried to query the modules-export directly, as you did in your example.

I am using something similar to $http->getJSON(). The disadvantage is that it is inserted into the HTML and not loaded dynamically which is harder to debug. AJAX requests can be shown in the console. As with everything each method has it advantages and disadvantages and is a matter of choice.

Now I dropped the AJAX approach and list the modules JSON right in the HTML/JavaScript.

Link to comment
Share on other sites

9 hours ago, jmartsch said:

Here you can see which module is installed or not installed and have options to install it.

Looking good! Is it possible to also filter by installed/not installed?

Would you consider a separate tab for core modules? Most of core modules will be already installed and probably most are required by ProcessWire so should not be uninstalled, hence, we don't really need to see them on the main screen. This would help focus on third-party modules, our primary concern. 

Link to comment
Share on other sites

@kongondo

Yes, I am thinking about adding such a filter and maybe even a filter to show only updatable modules.

The core modules can be filtered via the select, but are included if no filter is selected. Think of this module as a complete replacement of the actual ProcessModule so they need to be there, and some core modules are not even installed by default, like Forgot Password, so there needs to be a possibility to install or unistall them.

Link to comment
Share on other sites

One thing I struggle with, is the wording. What does installed mean? Because there are some modules that are physically there on disk, but not "installed". I think "activate" and "deactivate" are better words for enabling or disabling a module. Installing and uninstalling for me means the action to download the file or delete it completely. What do you guys think of that?

Link to comment
Share on other sites

2 minutes ago, jmartsch said:

What do you guys think of that?

I think let's stick to convention. ProcessWire has always used installed ?. For me, it means the module is installed in the ProcessWire system. A module that is present on the disk but not yet installed just means it is not yet part of the ProcessWire system.

7 minutes ago, jmartsch said:

Think of this module as a complete replacement of the actual ProcessModule so they need to be there, and some core modules are not even installed by default, like Forgot Password, so there needs to be a possibility to install or unistall them.

Of course. My point was not that they should not be there, but they should probably be in their own tab, just to make things obvious ?.

9 minutes ago, jmartsch said:

Yes, I am thinking about adding such a filter and maybe even a filter to show only updatable modules.

??

  • Like 1
Link to comment
Share on other sites

I'm sure we can get an "updated" JSON response set up no problem once we get the feed code altered on the modules directory as well. Not heard back from Ryan about that yet so will give him a gentle nudge ?

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...