[GUIDE] DIY Plugin Development Part 1-3

  • Hi Guys,


    first thanks for this guide! Im on the way to create my first omv-plugin :)


    I have some improvements for the guide:


    - there is a bug in part 3 . The class name is "OMVModuleVirtualBox". I think it should be "OMVModuleExample" instead.


    - in part 1 (step 2) you should mention, how to clean the gui cache ( in /var/cache/openmediavault/). It takes me some time on debugging to find out, why my example node is not showing as expected. I curent use

    Code
    rm /var/cache/openmediavault/*

    is there an official omv command for this?



    Thanks
    ocean

  • omv_purge_internal_cache


    You need to reload or restart nginx to get the browser to refresh. This is needed for any change in javascript, like a new node.


    invoke-rc.d nginx restart
    invoke-rc.d nginx reload


  • Guide updated. Good luck! :)


    omv_purge_internal_cache


    You need to reload or restart nginx to get the browser to refresh. This is needed for any change in javascript, like a new node.


    invoke-rc.d nginx restart
    invoke-rc.d nginx reload


    No, this isn't true.


    You just need to purge the cache for new or deleted Javascript files. The only other thing you need to to is reload the page in the web browser.

  • No, it doesn't depend on what he's doing. Reloading or restarting Nginx doesn't magically make the web browser refresh it resources or purge the Javascript cache. It does however reload the configuration of Nginx (and restart it in the case of restart).

  • This is used with the helper functions: . /usr/share/openmediavault/scripts/helper-functions
    omv_purge_internal_cache


    In the helper functions you find:

    Code
    # void omv_purge_internal_cache ()
    # Purge the internal cache, e.g. used to speedup WebGUI loading.
    omv_purge_internal_cache() {
        rm -f ${OMV_CACHE_DIR}/cache.*.json
    }


    In /etc/default/openmediavault is:
    OMV_CACHE_DIR="/var/cache/openmediavault"


    So I guess official command line would be:
    rm -f /var/cache/openmediavault/cache.*.json

  • @HK, yeah I was thinking it was coming from those lines but I see now it is from here.


    /var/www/openmediavault/js/omv/module/admin/system/plugin/Plugins.js


  • When I change a .js file, I just do a page refresh and if I change a .inc file I do a engined restart and a page refresh, never had a problem doing it that way.

    [align=center]banner@1x.jpg
    What I am watching/watched on my Popcorn Hour media player
    omv 2.1.1 stoneburner | 64 bit | omvextrasorg 1.29
    MySQL (Percona[size=8]) | Newznab | Sonarr | CP | HP | NZBget | YAMJ | CUPS

  • Make a node and see if it shows without purging the cache. It won't show with just a refresh anymore.


    Just tested... created node and refreshed browser like 5 times. Nothing. Then ran this command:
    rm -f /var/cache/openmediavault/cache.*.json
    Refresh browser once and the node shows.


    Changing and creating are 2 different things.

  • When I Dev, add, modify, del files


    I do :
    $ service openmediavault-engined restart
    $ rm - f /var/cache/openmediavault/cache. *


    I logout
    Refresh my browser


    I can now login and see the results :D

  • Thanks for the apt-clean.
    But when you develop and create / modify .js and .inc is more quickly. Install and desinstall plugin (in fact a deb packet) is long and boring

  • What are you guys using to develop plugins?


    Im wanting to give it a bash and package up an already existing linux app in the form of a plugin but not sure how to go about it.


    Ive read the guides and managed to do whats in the guides but not sure on how to use github to keep track of the plugin files and what IDE to use.


    Ta

    • Offizieller Beitrag

    I use the developer plugin. It kind of obscures some of the github details, keeps permissions right, helps with proper changelog format, and helps testing. I am pretty much only use Sublime Text now but I use notepad++ on Windows and nano on the command line.

    omv 7.0-32 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.9 | compose 7.0.9 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • I found moving the files forwards and back to a text editor was too slow. I just edit them in the file manager in webmin. To make the config for OMV I create an init script. I make/test all the files in the location where they reside. Once I have it all working then I start to move it to github. Once in github I'll usually do edits there. Sometimes I just copy the whole edited file from the file manager in webmin and paste it in github, depending on home many changes to the file. Once it is all working decent you need to start creating all the files (control, postinst, postrm, etc..) to make the package.


    Before I build the package I usually create any needed user/group manually. I add any dependencies manually too. Here is an example of a init script to make the OMV config. This will later be done in the package by the postinst file, which is a little different. A file like this needs to be executable. Then you run it and it will create an entry for your service in the /etc/openmediavault/config.xml file. You have to do these things if you want to run/test it prior to packaging it.



    PS- Edits to .js (javascript files) only need a refresh of the browser. Edits to the mkconf file you can test right away. Most other files you will need to restart engined.


    PPS- I use Github for Windows to move up the folder structure and a lot of files at once to Github.

  • No, I create them on the machine I run them on. Testing is done on that machine before there is a package. Then files are downloaded to my windows machine and then put in a folder for Github for Windows. Or copy and pasted directly into Github.


    Aaron does it different. He does not work on Windows machine and has developers plugin to aid him.

    • Offizieller Beitrag

    Is the way plugins are developed/written changed drastically for OMV 3.0?


    Up to OMV 3.0.13, no. After 3.0.13, there have been some significant changes but nothing that increases the complexity in my opinion. 3.0.13 is the latest release though.

    omv 7.0-32 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.9 | compose 7.0.9 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!