GithubHelp home page GithubHelp logo

openwisp / django-netjsonconfig Goto Github PK

View Code? Open in Web Editor NEW
196.0 196.0 60.0 1.75 MB

Configuration manager for embedded devices, implemented as a reusable django-app

Home Page: http://openwisp.org

License: Other

Python 15.90% HTML 0.11% CSS 2.38% JavaScript 81.59% Shell 0.01%
lede netjson networking openvpn openwrt vpn wifi wireless

django-netjsonconfig's People

Contributors

atb00ker avatar ayzhu avatar cappe87 avatar cargreg avatar daffytheduck avatar edgeking810 avatar gastonche avatar hizkifw avatar marfgold1 avatar nemesifier avatar nepython avatar noumbissivalere avatar okraits avatar pablocastellano avatar pandafy avatar pawelplsi avatar ppabcd avatar r9295 avatar rohithasrk avatar strang1ato avatar waleko avatar wizanyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-netjsonconfig's Issues

[admin] Download configuration 404 if no configuration

Try to create a new device with no configuration, then click on "download", you will notice a 404.

It would be better to tell there's no configuration available yet and advice to create one.

The preview button gives an alert "no configuration available yet", we should add there an advice to create one.

Add support for django 1.11

Django 1.11 has been released last week, it's time to start adding support for it in OpenWISP 2.

django-x509 was easy to upgrade, but there are a few errors in the tests of django-netjsonconfig.

[idea] Device context

It would be very handy to have a new field JSON field that would allow to specify additional context variables (key>values) for each configuration.

This would allow to keep more logic in templates.

[controller] last ip not always updated

the last_ip field is not always up to date. This is because the field is checked and updated only when the configuration is downloaded, while it should be done even when the checksum is requested.

[UI] Full screen for advanced mode

When going into advanced mode, it would be nice to have the possibility to edit the JSON in full screen mode.

The hint "Want learn to use the advanced mode? Consult the netjsonconfig documentation." should be kept.

I think it would also be ok to have the full screen mode as default, but I leave this open for discussion.

[json_editor] Alignment issue

A minor alignment issue that I've encountered while using the application. Look at the 'netjsonconfig documentation' text in the image below.

alignement

[admin] Add preview action (before save)

The "visualize configuration" button only shows configurations already saved.

Currently it is not possible to visualize changes before saving. A "preview" feature would really be helpful.

[sortedm2m] Make widget hint bolder

The help text "Choose items and order by drag & drop" in the sortedm2m widget is helpful but hard to see.

Users have suggested to make it more evident.

[preview] VPN context is broken

VPN context is broken, variables automatically added via auto_cert option are not evaluated in the preview. Not sure about the resulting configuration, I have to check.

[UI] Timezone issue

When creating a new configuration object, if one of the selected templates has the timezone set, the new configuration will override it because timezone is set by default on UTC and shown.

NETJSONCONFIG_BACKENDS should be overridable

The setting NETJSONCONFIG_BACKENDS only adds more backends to the default ones.

This limits the flexibility of the django-app and is counter intuitive compared to how other classic django settings work.

Same applies for the new NETJSONCONFIG_VPN_BACKENDS.

It would be better to allow replacing all the entries entirely.

As a consequence, the behaviour of NETJSONCONFIG_DEFAULT_BACKEND and NETJSONCONFIG_DEFAULT_VPN_BACKEND would change slightly and would need to be documented (the default value is the first backend in the list, not a static value).

  • make NETJSONCONFIG_BACKENDS overridable
  • document NETJSONCONFIG_DEFAULT_BACKEND properly
  • make NETJSONCONFIG_VPN_BACKENDS overridable
  • document NETJSONCONFIG_DEFAULT_VPN_BACKEND properly

Use Vagrant to provide portable virtual environments

There are many advantages of using Vagrant to provide portable virtual environments. It's been widely in use these days by benefiting a developer. One just needs to run a vagrant up command and it will isolate all the dependencies and provide a consistent environment. For more details https://www.vagrantup.com/docs/why-vagrant/ can be referred. This could perhaps be implemented in all the OpenWISP projects. Suggestions please.

[UI] full screen covers preview

Full screen mode covers preview config mode.

It's probably just a matter of adjusting z-index css property so the ones of the preview is higher.

@gastonche would you like to address this?

[sortedm2m] Make the help_text appear somewhere else

When there is some text data given to SortedManyToManyField() as a help_text parameter, the way it is displayed is not at all intuitive. Check the screenshot attached below.
help_text_error
Here, help_text=_('configuration templates, applied from first to last')
This needs to be made more intuitive.

[auto-registration] Common name of certificates is often redundant

When the auto-create certificate feature is being used, the default pattern for creating common names fo new certificates is {mac_address}-{name}.

This was a nice idea, too bad I forgot to think that in the real world most people will also use auto-registration with new devices which do not have a name yet, therefore they will get their mac-address as their name, the resulting common name therefore resulting in {mac_address}-{mac_address}, which is redundant, ugly and useless.

What can we do to alleviate the problem without degrading the experience of those who don't use auto-registration or have some magic auto custom naming of their devices before they register?

We may edit the bit of code which assigns the common name to eliminate the second part ({name}) if it's equal the first part {mac_address}, I think that's simple and would work well enough.

[UI] Improve advanced editor widget

There are few things I noticed after merging #43

  • hitting back after opening the advanced mode on the browser produces inconsistent results
  • the label with netjsonconfig-hint is duplicated, but now we have 2 elements with the same ID in the page, and this is bad
  • when an invalid json value is entered and the exit button is clicked we get the advanced editor but not in full screen
  • minor issues that I'm going to fix right now

[UI] configuration variables clash with validation

The following NetJSON:

{
    "interfaces": [
        {
            "type": "virtual",
            "name": "tap0",
            "mac": "{{ mac_address }}"
        }
    ]
}

Won't validate. This sucks big time!

We should find a solution for this problem. Maybe we can evaluate the variables with javascript. I don't know.

[feature] Add device information

We want to add a Device model which will contain optional information about device model and operating system distribution. This information can be collected automatically during registration.

This is the first step towards adding more data collection features to OpenWISP 2 (geographic location, internal maps, monitoring data) that will be added at later steps in additional optional modules.

Installation package fixes

while trying to setup for development i encountered some problems mainly pertaining to packages that were not installed. on the migration stage i received errors about the following packages not being available or installed,

markupsafe, functools32, cryptography

and from my research i found out that it's due to some dependencies having updated their own, dependencies, like jinja having added markupsafe as a dependency.
I have added these depends to the project requirements on my fork should i make a PR for that?

[rare] Auto-registration fails but device is created anyway

In rare cases, auto-registration may fail because of misconfiguration or bugs introduced during development.

It then may happen that even if the auto-registration fails, the device may be created anyway, eg: if the uncaught exception is triggered in the phase which adds templates (m2m relationship in django are saved after the main object has been created).

This is not good because it triggers other unexpected behaviour, a chain reaction which is hard to debug.
The ideal solution would be to ensure to catch any potential exception during all the critical phases of the autoregistration and if any of these phases fails, the system should log the error, trigger something like a 400 bad request and delete the newly created invalid device.

Add "last_ip" field

In some cases it is very useful to know the last ip from which the configuration was downloaded.

ImportError when attempting to save an empty Device

How to reproduce:

  1. go to admin
  2. add new device
  3. do not fill any information and try to save

Relevant stacktrace:

  File "/var/www/django-netjsonconfig/django_netjsonconfig/models/device.py", line 46, in clean
    self.validate_netjsonconfig_backend(self.backend_instance)
  File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/var/www/django-netjsonconfig/django_netjsonconfig/models/device.py", line 72, in backend_instance
    return self.get_backend_instance()
  File "/var/www/django-netjsonconfig/django_netjsonconfig/models/device.py", line 79, in get_backend_instance
    backend = self.backend_class
  File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/functional.py", line 33, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/var/www/django-netjsonconfig/django_netjsonconfig/models/device.py", line 68, in backend_class
    return import_string(self.backend)
  File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/module_loading.py", line 18, in import_string
    six.reraise(ImportError, ImportError(msg), sys.exc_info()[2])
  File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/nemesis/.virtualenvs/djnetconfig3/lib/python3.4/site-packages/django/utils/module_loading.py", line 15, in import_string
    module_path, class_name = dotted_path.rsplit('.', 1)
ImportError:  doesn't look like a module path

Add hostname validator to Device.name

How to reproduce the issue: try to save a new device with name test device.
Result: netjsonconfig validation complains test device is not a valid hostname and the validation error is shown in the configuration section.
Fix: it would be better to show this validation error relating directly to the name field

[config-editor] VPN servers JSON-schema validation fails

How to reproduce:

  • go to VPN servers
  • add new
  • fill in the minimum required information, click save and continue
  • now try to go into advanced mode, notice the validation failures, even though the entered JSON is considered valid by other json validation libraries

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.