summaryrefslogtreecommitdiffstats
path: root/ogcp/static/js/ogcp.js
Commit message (Collapse)AuthorAgeFilesLines
* Keep selected clients in the scopes treeJavier Sánchez Parra2022-01-281-0/+17
| | | | | | | | | | | | Otherwise, users have to click clients checkboxes every time they switch view. This commit adds one hook to capture when clients checkboxes changes. When they are checked, ogcp (front-end) stores them in browser's local storage. When they are unchecked, ogcp removes them from local storage. Every time users load a page with the scopes tree, ogcp checks local storage to restore selected clients.
* Keep scopes tree stateJavier Sánchez Parra2022-01-281-0/+19
| | | | | | | | | | | | | | | | | | | | Otherwise, users have to expand the scopes tree every time they switch view. This commit adds two hooks to capture when an element of the tree is shown or is hidden[1]. When they are shown, ogcp (front-end) stores them in browser's local storage[2]. When they are hidden, ogcp removes them from local storage. Every time users load a page with the scopes tree, ogcp checks local storage to restore the scopes tree state. Store and remove functions use stopPropagation() to prevent ancestors of clicked elements to also be stored or removed from local storage.[3] 1. https://getbootstrap.com/docs/4.1/components/collapse/#events 2. https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API 3. https://javascript.info/bubbling-and-capturing
* Fix setup form javascriptDaniel García Moreno2021-08-231-5/+12
| | | | | | | | | | | | This patch fixes the javascript that adds/removes rows from the setup form. The AddPartition function now replaces the id `partitions-N-FIELDNAME` using a regular expression. The hidden csrf input is also ignored to get incremental numbers. On deletion, all the ids are reassign from zero, in order, to get always an ordered list with all numbers between the first and the last.
* Add full scheme partitioning supportJavier Sánchez Parra2021-07-281-0/+22
| | | | | | | | | | The initial "Partition & Format" (aka setup) form only allows to modify one partition at a time. This commit updates it to allow to modify the whole disk partition schema in one go, without pop-ups and transitions. This is a remake of the previous form using FieldList de WTForms and javascript to duplicate / remove FieldList adapted to the attributes available in WTForms.
* Add and restyle clients statesJavier Sánchez Parra2021-07-201-9/+10
| | | | | | | | | | | | | | | | This patch adds new states: OPG for clients in ogLive, BSY for busy clients, VDI for clients in OpenGnsys VDI and WOL_SENT for booting clients. It also removes state ON because do not exists. ogCP currently uses the following colors: * OPG -> Solid yellow * BSY -> Solid red * VDI -> Solid green * WOL_SENT -> Solid brown * OFF -> Hollow grey
* Update scopes tree dynamicallyDaniel García Moreno2021-07-071-0/+54
This patch adds a javascript function to update the scope tree (on/off) state. This javacript function is called every second, does a call to the new backend endpoint `/scopes/status` and updates the tree classes depending on the current data. The new `/scopes/status` endpoint just returns the scopes tree as json. This patch also adds an icon in the tree leafs, a filled green circle when the state is `on`, and a empty red circle when the state is `off`. There's also a new javascript function to unfold all collapses in the scope tree.