summaryrefslogtreecommitdiffstats
path: root/ogcp/static
Commit message (Collapse)AuthorAgeFilesLines
* src: add menu to manage reposJavier Hernandez2023-12-011-0/+19
| | | | | | | | | | | | | | | | | | | | | | | The menu includes a list of the repos of each server. The user can select a server or a repo to make changes. As of now, the only action possible is to add a repo to selected server. The work contained in this commit can be structured in: 1. Add the repos menu: - Add a 'repos' button in the menus bar (base.html). - Add repos.html template to create the management repos menu. - In ogcp.js, add function to store in browser's local storage which elements of the sidebar are uncollapsed. This saves the sidebar state after a page refresh. - Add manage_repos() in views.py 2. Allow to add a repo: - Add template with form to add a repo (repos_details.html) - Create RepoForm(FlaskForm) in action_forms.py - Add repo_add_get() and repo_add_post() in views.py
* ogcp.js: fix images selector in "images" sectionJose M. Guisado2023-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Any operation inside "Images" view fails with error message 'missing "image-server" key'. Operations under images view section are loading image info and "delete image". Previously, a hidden checkbox entry was added to support multiple ogServer images entries. This hidden checkbox value holds the corresponding ogServer address of some image list. This hidden 'image-server' checkbox is checked or unchecked whenever some visible image from this server is checked in the list by the user. Commit 70eb7389bb5d introduces checkImageServer javascript function that mainly attaches an onchange event to each image checkbox so that checking or unchecking it updates the hidden 'image-server' checkboxes holding the ogserver address associated with each ogserver entry list. When loading "Images" view each configured ogServer entry is collapsed (thus each image checkbox is hidden). The current selector is ignoring hidden checkboxes and thus checkImageServer is unable to attach the necessary onchange event to each image checkbox. The hidden 'image-server' checkbox is always hidden and does not need attaching any onchange event. Fix selector by not ignoring hidden elements and omitting any checkbox with name 'image-server'. Fixes: 70eb7389bb5d ("Add ogServer parameter to imagesForm")
* Add clients in Linux and Windows modeJavier Sánchez Parra2022-11-172-3/+36
| | | | | Scopes tree shows clients booted in Linux and Windows with ogClient installed. It also shows if the user logs in.
* Improve scopes tree from CommandsJavier Sánchez Parra2022-09-271-3/+10
| | | | | | | Commit 648a1a315e1d35f67c5301833bddd3753cc51793 changes do not work well with large scopes trees. It takes several minutes to check a scope. Improve javascript code to speed up scope selection.
* Fix client room retrievingJavier Sánchez Parra2022-09-271-1/+1
| | | | Otherwise, retrieving do not work on clients inside folders.
* Replace parentheses in pills idsJavier Sánchez Parra2022-09-271-1/+1
| | | | | | | | | | From MDN: Technically, the value for an id attribute may contain any character, except whitespace characters. However, to avoid inadvertent errors, only ASCII letters, digits, '_', and '-' should be used and the value for an id attribute should start with a letter. https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
* Add multiple servers to the dashboard viewDaniel García Moreno2022-09-271-4/+4
|
* Implement single room selection for commands viewDaniel García Moreno2022-09-271-1/+21
|
* Add different selection mode for the tree viewDaniel García Moreno2022-09-271-0/+25
|
* Add ogServer parameter to imagesFormJavier Sánchez Parra2022-09-271-0/+17
| | | | | | | | | | When users select an image, its ogServer is sent too. Then, the back-end (flask) processes the form to obtain this ogServer and send it the pertinent requests. It also makes "Image details" view use this new parameter, and adds javascript code to ensure that users can only work with several images at the same time if they belong to the same ogServer.
* Add current ogServer to scopesFormJavier Sánchez Parra2022-09-271-0/+6
| | | | | | | | | With this commit when users select a scope, the ogServer to which it belongs is also sent. Then when processing the form we obtain this ogServer and we can send it the pertinent requests. This commit also makes action "Add client" to use the ogServer sent in the form.
* Move password hashing to the backendJavier Sánchez Parra2022-06-301-45/+0
| | | | | | | | | | | This patch moves login password hashing from the frontend/javascript to the backend/flask. This patch moves password hashing of login and user management forms. Related commits: * c7b0024 ("Add password hashing") * 661254b ("Add 'Add user' to Users section")
* Increase textarea size from "Import clients"v0.9.3Javier Sánchez Parra2022-06-071-0/+4
| | | | | Improve usability increasing the textarea used to copy the DHCPd configuration.
* Show link speed in Gb/sJavier Sánchez Parra2022-05-271-3/+9
| | | | | If link speed is greater than 1000 Mb/s, show it in Gb/s to improve readability.
* Show last command result for clients in ogLiveJavier Sánchez Parra2022-05-131-5/+10
| | | | | If the last command sent to a client/s finishes with errors, their icons in the scopes tree change to a yellow circle with an times sign inside.
* Add link speed to pillsJavier Sánchez Parra2022-05-111-2/+8
| | | | | If the clients API response include link speed information, show it in clients' pills.
* Add MAC to pillsJavier Sánchez Parra2022-05-061-1/+18
| | | | Retrieve and cache MACs one by one as users select clients.
* Add 'Add user' to Users sectionJavier Sánchez Parra2022-04-271-0/+22
| | | | | Creates "Add user" form with the following inputs: username, password, password confirmation, role (administrator or regular), allowed scopes.
* Add password hashingJavier Sánchez Parra2022-04-221-0/+24
| | | | | | | | | | | The front-end now hashes passwords before sending them to the back-end. It uses SHA-512. This commit adds a hidden input which sends the password hash to not interfere with browsers' save password functionality. Also change passwords of the template configuration file for their hashed/digested versions.
* Add indeterminate checkboxes to scopes treeJavier Sánchez Parra2022-04-081-0/+20
| | | | | | | Each checkbox may have child checkboxes. If all those children are checked, it be checked. If none are checked, it is unchecked. If some of them are checked, then it’s in an indeterminate state (in this case symbolically meaning “partially” checked).
* Replace " " with "_" in HTML scopes IDsJavier Sánchez Parra2022-03-251-2/+2
| | | | | | | | | | | | | | | | | | | Otherwise, scopes with whitespaces in their names breaks the javascript code. From https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id: --- Note: Technically, in HTML5, the value for an id attribute may contain any character, except whitespace characters. However, to avoid inadvertent errors, only ASCII letters, digits, '_', and '-' should be used and the value for an id attribute should start with a letter. For example, . has a special meaning in CSS (it acts as a class selector). Unless you are careful to escape it in the CSS, it won't be recognized as part of the value of an id attribute. It is easy to forget to do this, resulting in bugs in your code that could be hard to detect. ---
* Highlight active navbar linkJavier Sánchez Parra2022-03-091-0/+2
| | | | | Change background color and round borders of active/current navbar link to highlight it.
* Set pills widthJavier Sánchez Parra2022-03-092-1/+5
| | | | Set the same width to all pills.
* Remove common css classes from pills status updateJavier Sánchez Parra2022-03-091-9/+6
| | | | | | | Some css classes are common to all pills statuses, so we do not need to add or delete those classes on status change. It also remove "badge-info" class because is never used.
* Narrow client removal to scopes and commands pagesJavier Sánchez Parra2022-03-031-1/+1
| | | | Otherwise, undesired removal of selected clients pills occurs.
* Show client state on pillsJavier Sánchez Parra2022-02-252-0/+29
| | | | Color pills to represent their state, like scopes tree.
* Replace "." with "_" in HTML scopes IDsJavier Sánchez Parra2022-02-251-1/+1
| | | | | | | | | | | | | | | | | | Otherwise, scopes with dots in their names breaks the javascript code. From https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id: --- Note: Technically, in HTML5, the value for an id attribute may contain any character, except whitespace characters. However, to avoid inadvertent errors, only ASCII letters, digits, '_', and '-' should be used and the value for an id attribute should start with a letter. For example, . has a special meaning in CSS (it acts as a class selector). Unless you are careful to escape it in the CSS, it won't be recognized as part of the value of an id attribute. It is easy to forget to do this, resulting in bugs in your code that could be hard to detect. ---
* Show selected clients in container blockJavier Sánchez Parra2022-02-231-0/+30
| | | | | | | | | | | | | | | | | | | On scopes and commands views, draw clients as users selects them in the scopes tree. Trigger client drawing on two events: 1."change" event, occurs when the user clicks a client checkbox. This event is standard [1]. 2. "show-client" event, fires when ogcp get selected clients from localStorage and when an user checks a parent checkbox. This event is custom. Dot characters (".") in clients names are replaced by underscore("_") when used as id to avoid errors. 1. https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event
* Highlight active nav itemsJose M. Guisado2022-02-221-0/+3
| | | | Use bold font for active nav items.
* Check scopes checkboxes recursivelyJavier Sánchez Parra2022-01-311-0/+13
| | | | | | Otherwise, nested scopes are not checked and mislead users. When a scope is checked, we search all its children and check them too.
* Add helper function to store checksum statusJavier Sánchez Parra2022-01-311-4/+8
| | | | | This function stores checksum status if is checked to browser local storage. Otherwise, it removes checksum from the storage.
* 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-202-13/+14
| | | | | | | | | | | | | | | | 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.
* Add scopes_tree_collapse macroJose M. Guisado Gomez2021-06-301-0/+14
| | | | | | | | | | | | | 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.
* Add chart to dashboardDaniel García Moreno2021-06-086-0/+37010
| | | | | | | This patch adds an example chart using chartjs to the dashboard to show the disk usage. https://www.chartjs.org/docs/latest/getting-started/
* Add sidebar and command bar to base templateDaniel García Moreno2021-06-081-0/+8
| | | | | | | | | | | | | Modify the base template to add the sidebar and command bar, implemented just in the scopes view. This patch also modifies the "actions/mode.html" template to be shown in the scopes page. Any other action that should be inside the scopes should do the same, add the scopes and clients to the template context and use the "scopes.html" as base in those actions. The notification has been also changed to use a toast notification instead of the usual alert to avoid changing the layout on error.
* Use AdminLTE in base.htmlDaniel García Moreno2021-06-011-0/+5
| | | | | | | | | | This patch adds the css and js sources from the AdminLTE template to the base template so it can be used in all templates. There's also some flexbox bootstrap classes [1] to place the footer at the bootom always, even when there's no content to fill the page. [1] https://getbootstrap.com/docs/4.6/utilities/flex/
* Add initial AdminLTE template filesDaniel García Moreno2021-06-01109-0/+162873
| | | | | | | | | | | | | | Add the open source AdminLTE bootstrap dashboard template to the static folder, and some plugins that we'll use in the following changes to the templates. Plugins: * jquery * bootstrap * font-awesome https://adminlte.io/
* Add cosmetic improvementsJose M. Guisado2021-03-241-0/+3
| | | | | | | | * Adds label for each action page. * Adds a colored state for opengnsys connected clients * Fix nav active item * Rename some actions * Adds DISK to partition and format form
* Add bootstrap bundleRoberto Hueso Gómez2020-09-021-0/+7
| | | | This is used for multiple bootstrap components such as dropdown menus.
* Add frontend basic structureRoberto Hueso Gómez2020-08-313-0/+16
This adds base.html and nav.html templates as well as its dependencies on Bootstrap and jQuery.