summaryrefslogtreecommitdiffstats
path: root/ogcp/templates/base.html
Commit message (Collapse)AuthorAgeFilesLines
* ogcp: add user permission mechanismAlejandro Sirgo Rica2024-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new user permission system to control the allowed operations accessible from each account. Add a permission matrix editable through the user/add and user/edit views. The permission matrix has client, center, room, folder, image and repository as permission targets and add, update and delete as permission types. Restrict each view based on the user permissions, hide all actions from not autheticated users. permissions defined in the class UserForm. Serialize each user permissions into ogcp.json as: { ... "USERS" [ { "USER": "admin" ... "PERMISSIONS": { "CLIENT": { "ADD": true, "UPDATE": true, "DELETE": true, }, ... <- same structure for "CENTER", "ROOM", "FOLDER", "IMAGE" and "REPOSITORY" } }, ... ], ... } Grant all the permissions to old user configuration to not disrupt their workflow. The administrator will need to assign the permissions for each user. Ignore scope and permission restrictions for admin users. Save permissions and scopes even if the user is admin to account for the case of a temporal admin promotion without losing the previous configuration. Use template inheritance for add_user.html and edit_user.html to prevent big code duplication with the new HTML code to render the permission matrix. Make user administration an admin only feature. Define methods get_permission and target_is_disabled to improve readability in template conditionals that disable features based on user permissions.
* templates: make opengnsys buttom redirect to dashboardAlejandro Sirgo Rica2024-06-251-1/+1
| | | | | | Add functionality to the "Opengnsys" text in the top navbar. Comform to the general design priciple of executing a redirecting after clicking the main logo.
* templates: remove servers view in main navbarAlejandro Sirgo Rica2024-06-181-3/+0
| | | | | Remove the Servers button from the main navbar but keep the multiserver related code.
* css: offset the sidebar to acommodate all disclosure widgetsAlejandro Sirgo Rica2024-06-181-1/+1
| | | | | Add a left padding to show the disclosure widget associated to a server item. Prevent the positioning of out of screen components.
* js: show correct initial disclosure widget stateAlejandro Sirgo Rica2024-06-171-1/+1
| | | | | Add the class "collapsed" to the html elements defined as not shown in the local storage for the images list sidebar.
* js: allow selection of multiple clients in scopes sidebarAlejandro Sirgo Rica2024-06-141-1/+1
| | | | | | | | | | | Allow the selection of multiple client checkboxes if they belong to the same room. Each checkbox input in the DOM has a "data-parent-room" attribute whose value is the value of the "name" attribute of its parent room scope component. To check if a checkbox is a client and a sibling of the one being checked we check if "data-parent-room" is available for both nodes and if they have the same value.
* ogcp: add disclosure widget to sidebarAlejandro Sirgo Rica2024-06-141-1/+1
| | | | | | | | | | | | Add cache buster to soleta.css in base.html to have control over cache expirity. Bump soleta.css version to ensure browser does not used older (cached) version. Add CSS rules to show a disclosure widget in the sidebar. Show center checkboxes as disabled in the commands view sidebar for visual consistency. Add class "collapsed" to the proper HTML components to keep a proper state on page reload.
* src: revisit sidebar context storage approachAlejandro Sirgo Rica2024-06-141-1/+1
| | | | | | | | | | | Maintain selections made in scope sidebar after clicking an action (ie. client add, room delete, etc.) Use ids instead of names as the name html property is the same for every room and center. Call keepSelectedClients() in macros.html for both Scope Management and Commands instead of only in Commands. Add a "context" value to the checkbox id to separate scope and commands values in local storage.
* templates: fix error report with multiple messagesAlejandro Sirgo Rica2024-06-131-2/+4
| | | | | | | | | Fix the definition of javascript code to generate a correct message window for multiple error messages. The error is cause by a redefinition of 'let bgclass' in multiple lines when the html template receives multiple error messages. Each iteration to generate the code for the error messages tries to redefine the variable bgclass and it causes the js to fail.
* js: only add MAC to client pills1.1.3-19Alejandro Sirgo Rica2024-05-131-1/+1
| | | | | | Ignore any room, center or folder as they don't have a MAC address. Trying to get the MAC of an scope element without one leads to a JS exception.
* js: remove console.log statementAlejandro Sirgo Rica2024-05-131-1/+1
| | | | Remove print statement generating noise in the browser logs.
* js: prevent js exception in pages without pill controlAlejandro Sirgo Rica2024-05-131-1/+1
| | | | | Add check to test if a pill control has been found and don't try to add mac data to non existent client pill controls.
* Make partition id non editable in partition formAlejandro Sirgo Rica2024-05-121-1/+1
| | | | | | | Show the partition id as a non editable label in each partition of the Partition and Format form. Assign sequential partition id from top to down and recalculate every partition id when a partition is removed.
* js: fix id update in partition form deletionAlejandro Sirgo Rica2024-05-101-1/+1
| | | | | | | Update all the name and id fields of the elements in the partition form after a delete operation. Inconsistent ids make form.validate() to always return False, this causes all the form validation code to be skipped.
* templates: Add versioning to avoid browser caching ogcp.js errorsJavier Hernandez2024-01-191-1/+1
| | | | | | | | | Add version parameter to ogcp.js url. This is so that, if ogcp.js is modified, the browser is able to see that that file has been changed and that it has to load the new version instead of acquiring it from cache. We have experienced stranged errors, related to browsers caching old javascript files, leading to python flask backend backtraces
* templates: Show username in top navbarv1.1.3-9Javier Hernandez2023-12-181-0/+5
| | | | Show the username of the user currently logged-in in the top navbar.
* Add scope-management for non-admin usersJavier Hernandez2023-12-151-1/+1
| | | | | Add scope-management menu with limited commands for non-admin users; commands allowed are add/edit/edit/delete/import client(s)
* base: Increase column size for sidebarv1.1.3-8Javier Hernandez2023-12-121-1/+1
| | | | Make the sidebar wider to improve readability of its content
* src: add menu to manage reposJavier Hernandez2023-12-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | 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
* Rename "Scopes" section to "Scopes management"Javier Sánchez Parra2022-11-171-1/+1
|
* Show scopes section only to administratorsJavier Sánchez Parra2022-11-171-3/+3
|
* Show servers section only to administratorsJavier Sánchez Parra2022-11-171-1/+1
|
* Add multiple servers to the dashboard viewDaniel García Moreno2022-09-271-1/+1
|
* Add Servers sectionJavier Sánchez Parra2022-09-271-2/+2
| | | | | | | In Servers section/view, users can add or delete ogServers from ogCP configuration file. Replaces Repositories views and recycle some of its code.
* Add Repositories sectionJavier Sánchez Parra2022-07-041-0/+3
| | | | | In Repositories section/view, users can manage task related to repositories. For example: list, add, delete and edit them.
* Add Users sectionJavier Sánchez Parra2022-04-271-0/+5
| | | | | In Users section/view, administrator accounts can manage all task related to users. For example: add, delete and edit users.
* Increase toast auto hide delay to 30 secondsJavier Sánchez Parra2022-04-121-1/+1
|
* Move toasts messages to the bottom rightJavier Sánchez Parra2022-04-081-2/+2
| | | | Also, increase its duration from 5 to 10 seconds.
* Remove "Tasks" and "Schedule" from the navbarJavier Sánchez Parra2022-02-231-6/+0
| | | | Remove them until we add their functionality.
* Merge nav into base templateJose M. Guisado2022-02-221-2/+47
| | | | | | | | | | | | | | | | | {% block %} defined in nav template cannot be overriden by child templates from base. This is a limitation in jinja. Merge nav into base template so jinja blocks so no {% include %} is used and these blocks can be overriden by child templates (commands, images, dashboard...) Avoid using request.endpoint to determine active nav item, decoupling endpoint names from navigation. Instead use child templates to override jinja blocks. [1] https://stackoverflow.com/q/40537752 https://stackoverflow.com/a/40562662 https://github.com/pallets/jinja/issues/243
* Add new partition button in setup actionDaniel García Moreno2021-06-301-0/+2
| | | | | | | | | | | | | | | | | | | | | 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.
* Don't show sidebar in login viewJose M. Guisado2021-06-171-2/+2
| | | | | Commit 22dcea19 introduced sidebar, which is not shown in index view. Disable sidebar in the login view too.
* Add chart to dashboardDaniel García Moreno2021-06-081-0/+4
| | | | | | | 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-17/+39
| | | | | | | | | | | | | 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-31/+44
| | | | | | | | | | 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 cosmetic improvementsJose M. Guisado2021-03-241-1/+2
| | | | | | | | * 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/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 some minor cosmetic changesJose M. Guisado2021-02-161-4/+9
| | | | | | | | | | | | This commit may serve for future reference as to how some cosmetic changes have been applied to the web. Primarily using bootstrap classes in order to adjust margin or padding, there are mechanisms that allow modifying the class of an underlying html element in WTForms. Bootstrap classes are written directly in html templates for Flask. Also add a Soleta branded footer.
* Start using Flask flash messagesJose M. Guisado2021-02-161-0/+15
| | | | | | These are used to store a message string that can be later accessed. We can use Flask flash messages to alert about any error or providing info when processing a request.
* Add bootstrap bundleRoberto Hueso Gómez2020-09-021-0/+1
| | | | This is used for multiple bootstrap components such as dropdown menus.
* Add frontend basic structureRoberto Hueso Gómez2020-08-311-0/+19
This adds base.html and nav.html templates as well as its dependencies on Bootstrap and jQuery.