summaryrefslogtreecommitdiffstats
path: root/ogcp/forms
Commit message (Collapse)AuthorAgeFilesLines
* views: add action to delete repoJavier Hernandez2023-12-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | allow the user to delete a repo by selecting one and pressing the delete button. Previous to deletion, show the user a confirmation page (a form) with the details of the repo to delete the confirmation form is constructed with the fields of Repoform. RepoForm is also used in template used to create a repo. To make both templates work with RepoForm, RepoForm's field 'create' has been renamed to 'submit' ogcp.js: add a function to make that, when the user selects a repository, the server in which it is contained is automatically checked. We need it checked so that action_repo_delete can know the server to which it has to send the delete request. Use data-server in repos_details.html to make this work Validate, in action_delete_repo, that user has only selected one repo to delete. In order to do that, action_delete_repo view needs to be able to get a list of all selected repos. This is only possible if <input> elements that are associated with repos info contain a different name attribute per repo. In this case, template repos.html has been modified to use name={repo name}-{repo_id}. After this, parse_elements() will work and parse a set containing all selected repos. modify html input associated to repos server in order to follow same convention as in other templates. For example, images uses image-server; scopes, scope-server.
* src: add menu to manage reposJavier Hernandez2023-12-011-0/+6
| | | | | | | | | | | | | | | | | | | | | | | 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
* views: populate repositories in client formJavier Hernandez2023-11-291-2/+1
| | | | | Make, in add and edit clients forms, the field repository show the list with the actual repositories, not a harcoded value.
* image: rename and remove fieldsv1.1.3-4Javier Hernandez2023-11-271-3/+2
| | | | | | - remove field image 'id' - change size to display MiB instead of GiB - replace 'Modified' with 'Last update'
* client: Remove 'netmask' in formJavier Hernandez2023-11-271-1/+0
| | | | | Remove unnecessary field 'netmask' from forms used to create and update clients. Netmask is configured in rooms instead.
* src: Remove netdriver field in client formJavier Hernandez2023-11-231-2/+0
| | | | | | | | Remove netdriver field from forms used to add or update a client. At the time of creating (or updating) a client, ogCP uses a hardcoded value for this field of the payload. This field is not used by oglive in any way, remove it.
* views: add field 'gateway' in add-room formJavier Hernandez2023-11-141-0/+2
| | | | Add the possibility to configure a gateway in a room.
* ogcp: add backup boolean field in image updatev1.1.3Jose M. Guisado2023-07-071-0/+1
| | | | | | | | User can use this boolean field to specify if an backup copy needs to be created before updating an image. This only applies when sending a request to a client (ogClient) supporting this parameter.
* Add Servers sectionJavier Sánchez Parra2022-09-271-1/+5
| | | | | | | In Servers section/view, users can add or delete ogServers from ogCP configuration file. Replaces Repositories views and recycle some of its code.
* Adapt Delete image to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Delete image view to use ogServer field from imagesForm to send the deletion request to the correct ogServer.
* Adapt Delete center to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Delete center view to use ogServer field from scopesForm to send the command to the correct ogServer.
* Adapt Add center to work with several ogServersJavier Sánchez Parra2022-09-271-0/+2
| | | | | | This commit adds a new select input with all available ogServers to "Add center" view. The ogCP creates the center in the ogServer selected by the user.
* Adapt Delete room to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Delete room view to use ogServer field from scopesForm to send the command to the correct ogServer.
* Adapt Add room to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Add room view to use ogServer field from scopesForm to send the command to the correct ogServer.
* Adapt Import Clients to work with several ogServersJavier Sánchez Parra2022-09-271-0/+1
| | | | | This commit makes Import Clients view to use ogServer field from scopesForm to send the command to the correct ogServer.
* Add current ogServer to scopesFormJavier Sánchez Parra2022-09-271-0/+1
| | | | | | | | | 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.
* Add "Delete Repository"Javier Sánchez Parra2022-07-041-0/+5
| | | | | In "Repositories" view, users select a repository from the list on the left and press "Delete repository".
* Create "Add Repository" form and viewJavier Sánchez Parra2022-07-041-0/+7
| | | | Creates "Add repository" form with the required inputs: name and IP.
* Move password hashing to the backendJavier Sánchez Parra2022-06-301-8/+2
| | | | | | | | | | | 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")
* Rename field "OS" from "Create image"Javier Sánchez Parra2022-06-071-1/+1
| | | | | | Rename "OS" to "Partition" to improve clarity. This field represent which partition is used to create the image.
* Add repository field to "Create image" formJavier Sánchez Parra2022-05-241-0/+2
| | | | Let users choose which repository want to use to save the image.
* Add 'Delete user' to Users sectionv0.9.2Javier Sánchez Parra2022-04-271-0/+9
| | | | | Creates "Delete user" form. The user to be deleted is selected from the sidebar in Users section.
* Add 'Add user' to Users sectionJavier Sánchez Parra2022-04-271-1/+30
| | | | | 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/+2
| | | | | | | | | | | 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.
* Rename "submit" to "submit_btn"Javier Sánchez Parra2022-04-221-1/+1
| | | | | Otherwise, wtforms use "submit" as id of the <input> tag, shadowing javascript function ".submit()".
* Add import clients actionJavier Sánchez Parra2022-04-191-1/+6
| | | | | | | | | | | Add import clients form with required inputs: room and dhcpd.conf. This permits users to rapidly add large amounts of clients to a room using dhcpd.conf's syntax. Users can copy full dhcpd.conf files to the text area and the parser only matches lines with the following format as clients: host dummy {hardware ethernet 12:34:56:78:90:ab; fixed-address 192.168.1.55; }
* Add Update image to commandsJavier Sánchez Parra2022-04-081-0/+8
| | | | | | | | Allows updating the image file for an existing image. This action is related to /image/create in ogServer API. If ogServer receives an POST /image/create without the parameter "description", it does not create a new image and only updates.
* Ask for reference when partitioning several clientsJavier Sánchez Parra2022-04-011-0/+6
| | | | | Allow the user to choose a computer as reference to display the partition scheme form.
* Add confirmation page when deleting imageJose M. Guisado2022-01-271-0/+1
| | | | | | | | User can confirm when deleting an image by double checking the information displayed on this page. Adds a new optional field in GenericForm: 'ids'. Used when dealing with ids instead of ips.
* Rename MSDOS to MBRJavier Sánchez Parra2022-01-201-1/+1
| | | | | | | This commit rename partition table type MSDOS to MBR in the front-end. At the back-end ogCP still uses MSDOS string because ogClient scripts (aka cloning engine) expects it.
* Ask twice to delete clientsJavier Sánchez Parra2022-01-191-0/+6
| | | | | | | This commit adds an extra view to ensure users do not clients accidentally. It also includes Spanish translation of the new strings.
* Use lazy translation in classesJavier Sánchez Parra2022-01-132-61/+63
| | | | | | | | | | | | | From flask babel documentation: --- Additionally if you want to use constant strings somewhere in your application and define them outside of a request, you can use a lazy strings. Lazy strings will not be evaluated until they are actually used. To use such a lazy string, use the lazy_gettext() function. --- _() and _l() functions are aliases of gettext() and lazy_gettext() respectively. Both functions belong to flask babel library.
* Add set ogLive to commandsJavier Sánchez Parra2021-12-161-0/+5
| | | | | | This action is related to /oglive in ogServer's API. Allows changing the ogLive for a set of given clients, previously selected in the /commands view.
* Set tiptorrent as unique restore image methodJavier Sánchez Parra2021-10-201-2/+1
| | | | | Soleta Networks only offers support of tiptorrent for restore image transferences.
* Add image details actionJavier Sánchez Parra2021-09-031-1/+10
| | | | | This action is used to visualize the specific details of an image, as its ID, name, size, etc.
* Add most common partition codes and filesystemsJavier Sánchez Parra2021-08-241-0/+16
| | | | To increase the compatibility of "Partition & format" (aka setup).
* Add "Delete center" actionJavier Sánchez Parra2021-07-301-0/+5
| | | | | | | | Creates "delete center" form with a select to choose a center to delete. Adds a new button in the scopes view. Because scopes checkboxes values maps to ips the only way to specify the center to delete is in the delete center form itself, using a select input.
* Add full scheme partitioning supportJavier Sánchez Parra2021-07-281-21/+11
| | | | | | | | | | 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.
* Create "Add Center" form and viewJavier Sánchez Parra2021-06-301-0/+6
| | | | | | | | Creates "add center" form with "name" as required input and "comment" as optional input. In the future, the CenterForm can be used to display center information once such functionality lands in the ogserver.
* Add new partition button in setup actionDaniel García Moreno2021-06-301-0/+16
| | | | | | | | | | | | | | | | | | | | | This patch adds a way to add a new partition to the setup.html template. This button opens a modal dialog with a new form and calls a new endpoint to create the new partition (this endpoint does nothing, it's needed to be implemented in the future). I've followed the initial design for this template, with one form per each partition, so every button will call a function and reload the page. It's possible to do all actions at once, but that will require a rework of this, to do that we can just define an unique form in the whole html, remove all the "Modify" buttons and add just one "Apply" button at the end. But maybe that option is a lot complex in the backend because will require to validate all the changes at once. This patch also improves the setup.html form without using flask-bootstrap and rendering the form in the template directly with the bootstrap4 classes.
* ogcp is AGPLv3+OpenGnSys Support Team2021-05-202-0/+14
| | | | Update license header in files.
* Add "Delete Room" form and viewJavier Sánchez Parra2021-05-201-0/+5
| | | | | | | | Creates "delete room" form with a select to choose a room to delete. Adds a new button inside the button group in the scopes view. Because scopes checkboxes values maps to ips the only way to specify the room to delete is in the delete room form itself, using a select input.
* Create "Add Room" form and viewJose M. Guisado2021-05-201-0/+9
| | | | | | | | | | | | | Creates "add room" form with required inputs only: center, name and netmask. Adds a new button inside the button group in the scopes view. Because scopes checkboxes values maps to ips the only way to specify the center in which to add the room is in the add room form itself, using a select input. In the future, the RoomForm can be used to display room information once such functionality lands in the ogserver.
* Add cosmetic improvementsJose M. Guisado2021-03-241-0/+1
| | | | | | | | * 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 loginJose M. Guisado2021-03-051-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Ogcp requires a simple login page in order to avoid exposure of the ogServer API to anyone trying to access the web page. Because the main authorization mechanism in ogServer is the api token the login implemented for the ogcp does not include registration process but a single user and password specified in the ogcp.json. "USER": "user", "PASS": "pass" Adds two new views: /login and /logout. They are used to login the user so that the rest of views regarding ogServer functionality can be accessed in a "login required" fashion. Index view (/) is an exception, it can be accessed logged in or not so different data can be displayed. Templates can now access a variable "current_user" to get information about login status. This is a Flask-Login feature. - Templates regarding login can be found in templates/auth/ - Login form is defined in forms/auth.py to separate it from action_forms.py - Adds Flask-Login module to requirements.txt - Adds default user and pass in ogcp.json
* Add boot mode to actionsJose M. Guisado2021-02-171-0/+5
| | | | | | This action is related to /mode in ogServer API. Allows changing the netboot template for a set of given clients, previously selected in the /scopes view.
* Add example image creation WTForms validatorJose M. Guisado2021-02-161-1/+3
| | | | | | | | | | | Adds in a declarative way the validation of the image name form control when creating a partition image. This commit serves as an example of adding a predefined validator of the WTForms module. Custom validator may be added by creating a given function and appending it to the list of validators. See https://wtforms.readthedocs.io/en/2.3.x/validators/#custom-validators
* Add UNICAST-DIRECT method to image restoreJose M. Guisado2021-02-101-1/+2
| | | | | | | | | | | | Previously the only method (in the form select) was "UNICAST". This patch enables specifying a correct parameter for the underlying script to fetch the image to be restored. UNICAST-DIRECT makes the administrator transfer the image through the network. UNICAST-CACHE indicates the taget pc to search for the image in its cache partition. Also redirects to the /scopes when ogserver responds with 200 OK.
* Add software actionJose M. Guisado2020-10-291-0/+6
| | | | | | | | This action lists every piece of software installed in an OS from a client. This action can handle listing the software from the DB as well as updating that DB with the latest client information.
* Add image create actionRoberto Hueso Gómez2020-10-291-0/+7
| | | | | This action handles the creation of the image in the DB as well as the '.img' file.