summaryrefslogtreecommitdiffstats
path: root/ogcp/templates/macros.html
Commit message (Collapse)AuthorAgeFilesLines
* Keep scopes tree stateJavier Sánchez Parra2022-01-281-0/+1
| | | | | | | | | | | | | | | | | | | | 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
* Remove dead code in macro.htmlJavier Sánchez Parra2022-01-281-20/+0
| | | | scopes_tree_collapse() replaces this dead code.
* Ensure unique HTML ids for scope elementsJavier Sánchez Parra2021-11-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise, undesired collapse/expand events may occur when users click an element of the scope. Old id format example: level3-2 New id format example: id_1-1_2-4_3-2 Explanation: * "id" -> Prefix needed because html ids must start with an alphabetic character. * "_" -> Separator. * "1-1" -> Values pair separated by "-". The first value is the level of the node. The second value is its position with respect to its siblings. This is always 1-1 because is the root node. * "_" -> Separator. * "2-4" -> Child node of the previous node. In this example, this node its in level 2 and has the fourth position. * "_" -> Separator. * "3-2" -> Child of node "2-4" in level 3 and in the second position. This is the final node in this example. In other cases ogcp may draws deeper nodes, so it creates longer ids. For example: id_1-1_2-1_3-2_4-1_5-1_6-1
* Keep scopes collapsed by defaultJose M. Guisado2021-10-151-1/+0
| | | | | For large scopes, unfolding by default slows page loading. It also takes lots of vertical space and the scroll bar gets smaller.
* Fix scopes tree draw on empty centers/roomsJavier Sánchez Parra2021-07-301-1/+1
| | | | | Otherwise, ogcp draws empty centers and rooms as computers, with the state circle.
* Add and restyle clients statesJavier Sánchez Parra2021-07-201-5/+7
| | | | | | | | | | | | | | | | 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-2/+18
| | | | | | | | | | | | | | | | | 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.
* Add scopes_tree_collapse macroJose M. Guisado Gomez2021-06-301-0/+29
| | | | | | | | | | | | | Being able to collapse the scopes tree allows to fit a bigger scopes tree. A new macro is introduced to generate the HTML code for the scope tree in such a way that each non-leaf level (center, room) are collapsible. macros.scopes_tree_collapse(scopes) As of now, the state of the scope tree is not saved when changing nav sections.
* Keep the selection in the sidebar for mode & setupDaniel García Moreno2021-06-171-0/+1
|
* Add commands view and macros.htmlJose M. Guisado2021-06-171-0/+19
Commands view has a scope sidebar with the content block filled with command buttons (poweroff, wol, etc.) This commit leaves scope create/delete/update buttons in the /scopes view, which serves that purpose. To avoid duplicating scope tree creation macro, an external macros.html is created, this template can be imported. Future macros needed can be written in there.