aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/nms-ui-switch.js
Commit message (Collapse)AuthorAgeLines
* Make network work againOle Mathias Aa. Heggem2019-04-11-3/+4
|
* Front + api: Fix parsing of JSON-fields for switchesKristian Lyngstol2019-02-13-10/+10
| | | | | | | | | | | | | | | | | | | | | | | Sort of. It's two issues at once, related: 1. API: The problem here was that the old way of updating tags simply didn't use actual JSON, but just sent "'foo','bar','baz'" as a text string. This seems dumb so I've made it send actual JSON now - just like the "placement" field. This meant updating the API. And it's not pretty, but it works. 2. Front: I've simplified nms-types a bit (hopefully to provide to simple methods: either get/set the raw value, or get/set strings. There was a bug where we sent text-encoded json instead of real json, and the reason was a confusion between when we're dealing with JSON and when we're dealing with strings. Now we are explicit. This makes the nmsEditRow-thing slightly uglier, but it needs to be fixed properly either way. In the future, we should provide renderers and editors based on types, e.g.: Placement-editor could start as a general-purpose JSON-editor, and the "switch reference" should be a drop-down.... etc. Fixes #202
* front: Switch editing: Don't nest panel-body elementsKristian Lyngstol2019-02-11-1/+1
| | | | It creates an extra margin that serves no purpose but to take up space.
* js front: Add missing file and minor tweakKristian Lyngstol2019-01-29-0/+2
|
* front: Implement new network/switch and moreKristian Lyngstol2019-01-12-60/+107
| | | | | | | | | | | | | | | Fixes #183 References #182 It's now possible to add new networks and switches, and it's also possible to edit networks, but since I haven't exposed it in the UI yet, I can't really close the bug. This is also a major step in stripping nms-info-box apart. Next up is listing existing networks, possibly linking to them. I think that might be a decent first-step towards a new core nms-info-box since it doesn't alreay exist.
* Move the info summary in the info-box into nmsBox-logicKristian Lyngstol2019-01-11-0/+2
| | | | | | | Also some other random drive-by fixes :D Fixes #180 References #181
* Expose validation and "changed or not" to end userKristian Lyngstol2019-01-09-13/+57
| | | | | | | Starting to look seeeexy. Also killed off some redundant stuff that should be covered by templates instead now.
* Fix switch-deletion in frontend after misspellKristian Lyngstol2019-01-09-2/+2
|
* Move switch-editing further away from nms-info-boxKristian Lyngstol2019-01-09-0/+38
| | | | Still needs to be tidied up, but we're getting there.
* Expose new-style edit-stuff in old-style panelKristian Lyngstol2019-01-09-6/+29
| | | | | | | | | | | The integration is a hack, but a first step. I will eventually remove all the code in nms-info-box, but I needed a simple test. This also demonstrates how to add a new switch.... simply hit edit, then change the name. It aint pretty, and shouldn't work like it does today, but it's a decent example. Also, had to fix the backend again now that I actually tested the write-api :D
* Extenstive frontend work on box/type/switch editingKristian Lyngstol2019-01-06-44/+81
| | | | | | | | | | | | | | | | | | | | | | | Still not very visible, but the nmsModSwitch() class is starting to look very interesting. This introduces a big thing: A type system. So far it is "only" used to provide generic validation-services for all fields that will be edited, but the scope can extend further into other uses. The implementation as it is does shallow validation for IP addresses, JSON-input (tags,placement), durations/intervals (poll frequency), sysname references (checks that distro_name is a valid system), and networks (verifying that mgmt_vlan / traffic_vlan exists). This is expected to improve over time, and should eventually lead to things like "if it doesn't exist, then please make it." As the big comment in nms-ui-switch.js now suggests: This is still just a proof of concept and while the fundamental concepts of nmsBox seems to work well, I still feel like I have a lot to iron out in nmsModSwitch, which really should be generic for networks and switches at the very least. But we're getting there.
* Introduce nms-ui-boxes, a big step for GUIKristian Lyngstol2019-01-06-0/+126
nmsBox is a new class for generic HTML-based elements, and will eventually be used to replace nms-info-box. The idea is simple: a generic way to deal with containers that are usually represented in HTML too. To test it, I've re-implemented the GUI for the oplog. This rewrite didn't really utilize the new benefits of the framework, but was a small step. I've also added nms-ui-switch, which isn't exposed anywhere yet and isn't done, but is a good start. nms-ui-switch will be the new way to add and edit switches in the future, it will probably be made more generic over time and thus can be reused for networks too. Note how x = nmsUiSwitch() will allow you to do x.row["community"].value to both get and set the value, and setting will visually update and run any verifier that will be relevant, and alert the parent. This can then be used for simple stuff like json-verification, but also for stuff like auto-complete or whatnot. God only knows. Obviously I will continue to work on this over the next few days...