Commit Graph

94 Commits (6af4330016f2e70abd79f08b73bf54aa85f8e591)

Author SHA1 Message Date
Alejandro Sirgo Rica 6b33268b5c ogcp: add view to assign repo to clients
Add /action/repo/set in Commands to assign a repository to
multiple clients.

The view includes the actual repo assigned in the client pills
and shows a table with the clients grouped by repo when multiple
repos are assigned among the selected clients.
2024-09-10 15:11:11 +02:00
Alejandro Sirgo Rica 7613cd8017 ogcp: add server ip configuration
Enable server view in the main toolbar.

Hide Add server and Delete server buttons.

Add Update server button.

Add server/update view to edit the server addresses.
2024-09-03 16:26:22 +02:00
Alejandro Sirgo Rica d00e437b8d ogcp: add support for multi-disk partition and format
Add support for selecting different disks in the disk inspector.

Add disk_inspector.html as a template to show the disk contents of
a client. The view can define the variable readonly_disk_inspector
to make the view non editable.

Use disk_inspector.html in the following views:
- client details
- partition and format

Update code to obtain the partitions of a client to better fit the
requirements of disk_inspector.html

Remove code to setup the SetupForm as the contents of the disks
are now dynamically loaded through javascript.
2024-09-02 15:05:45 +02:00
Alejandro Sirgo Rica 31766a3d07 ogcp: add support for multi-ip repositories
Add support for the new API REST for repository management where
the address is a list of ips instead of a single string.

Add dynamic address creation in /action/repo/update and
/action/repo/add forms through delete and add buttons in the form.

Update /image/restore and /cache/fetch to use repository_id.

Add additional repository form validations.
2024-08-30 13:34:55 +02:00
Alejandro Sirgo Rica 844bc1e7c6 ogcp: Add /action/cache/fetch endpoint
Add view to request the download of images into the client's cache.
2024-08-09 10:01:23 +02:00
Alejandro Sirgo Rica efd0b8acb3 ogcp: add image restrict functionality
Add center scope restriction using /image/restrict.

Add view in Images to update scope permissions.

Disable images in Commands for image update and restore if the
client belongs to a disabled center.

Consolidate template code to render scope selection checkboxes.
2024-07-25 09:48:12 +02:00
Alejandro Sirgo Rica 5af2b3738b ogcp: enable modification of client ip
Add 'id' value to the /client/update payload.
Enable modification for the ip input field  in the client update
form.
2024-07-15 14:45:49 +02:00
Alejandro Sirgo Rica 1548b6338a ogcp: show checksum in image info
Improve potential image troubleshooting within ogCP.
Add checksum to the image info view.

Show "Unknown" when no checksum is available.
2024-07-12 09:16:28 +02:00
Alejandro Sirgo Rica e532e9a0c8 ogcp: make client name field mandatory in client form
Add InputRequired validator to the name field of the
ClientDetailsForm.
Validate name value in the POST function.
2024-07-09 09:52:21 +02:00
Alejandro Sirgo Rica 5111733b93 ogcp: use csv as new format for import clients
Replace dhcpd format with the simpler csv format to configure
the list of clients to import in /action/clients/import.
Replace regex parsing with a simpler manual parsing.
Improve error report.

Example configuration:
client_name1,94:c6:91:a6:25:1a,10.141.10.100
client_name2,94:c6:91:a6:25:1b,10.141.10.101
2024-07-09 09:52:07 +02:00
Alejandro Sirgo Rica f473059902 forms: replace Ok with Submit in form submit button
Make the submit label more uniform across the forms.
2024-06-28 08:43:34 +02:00
Alejandro Sirgo Rica 977b457d5c ogcp: add user permission mechanism
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.
2024-06-27 10:03:14 +02:00
Alejandro Sirgo Rica af8236b189 ogcp: add support to run scripts in clients
Add view at /action/script/run to visualize the available scripts
and run a single script file in the selected clients.

Use shell/list to request the script list and shell/run API call
to request the execution.
2024-06-25 13:53:04 +02:00
Alejandro Sirgo Rica ee42cbd323 views: make password optional in user/edit
Add the option to leave the password fields empty in the form.
When the passwords are not set the user keeps the old password
configuration.
Define a EditUserForm based on UserForm in forms/auth.py to remove
the InputRequired validator in the password fields.
Update the html template to make the password fields optional.
2024-06-19 11:53:56 +02:00
Alejandro Sirgo Rica 4a74de1064 ogcp: add move client to scopes management
Add front end for the client/move REST API.
Enable the move of multiple clients selected from the sidebar of
Scopes Management.
Show the target of the move operation as a list of paths in a
dropdown widget in the form. Each path will be structured as:
Server/Center/Room
The path will also contain folders if they are present.
2024-06-17 14:03:00 +02:00
Alejandro Sirgo Rica 3fa3888b84 forms: improve scopes field description in UserForm
Improve the information provided to the user related to scope
selection.
2024-06-14 15:26:25 +02:00
Alejandro Sirgo Rica c3a2dc028d forms: use checkboxes for scope selection in UserForm
Enable selection of multiple scopes in user/add and user/edit
for restricted users.
Replace quick form creation with an inline form definition in
add_user.html and edit_user.html
2024-06-14 15:26:23 +02:00
Alejandro Sirgo Rica ff3e2d6ff4 forms: disable validation for dynamically populated select fields
Disable form validation for dynamically populated select fields,
otherwise, user hits bogus errors.

This problem was introduced by COMMIT 43e3346.
2024-06-07 14:35:12 +02:00
Alejandro Sirgo Rica 4c97b671aa forms: add support for UNICAST image restore
Add UNICAST and UNICAST-DIRECT to the image restore form.
UNICAST-DIRECT will transfer the images through a samba share
and proceed with the restore process without using any cache
partition.
UNICAST will try to first copy the image to the cache partition
and generate the full.sum file. Then the restore process is
executed.
2024-06-05 09:36:46 +02:00
Alejandro Sirgo Rica 462e6fb0ad forms: set default values to partition and format
Add default values to the partition and format form component.
Prevent index None from showing in the form when the client has an
empty disk with no partitions. Now the form will be created with
an entry of index 1 in adition to  Type and Filesystem as Empty in
that case.
2024-06-04 17:14:08 +02:00
Alejandro Sirgo Rica 43e3346a4a forms: ensure ip and mac are not empty in client add form
Use the WTForms validator InputRequired to check the field
and disable the submit button if either the IP or MAC fields
have no contents.
2024-06-03 17:26:09 +02:00
Alejandro Sirgo Rica 9cb3a952b4 ogcp: add cache management page
Implement cache management through cache/list and cache/delete
API REST methods.
The view corresponds to the URL action/cache and contains three
main parts:
- Free cache available in the client's bubbles.
- Image selection form to request the deletion and view the
client with that image in cache.
- Cache details per client to see total, used and available cache.

The main usecase for the view is the removal of cache to make room
for new images in clients with slow connections. Checking clients
where available cache space is not enough to hold the new image and
then requesting removal of specific images.

The html template receives the following structures from the view:
storage_data[ip] = {'used': 223452345,
                    'total': 2345234523452}

client_images[ip] = [f'{image_name}.{image_checksum}', ...]

image_data[f'{image_name}.{image_checksum}'] = {
    clients: ['192.168.0.1', ...],
    size: 34534530850,
    name: image_name,
}
2024-05-30 15:50:32 +02:00
Alejandro Sirgo Rica 8e60e95df6 make the boot OS form work over multiple clients
Enable working over multiple clients even if their OS configuration
is different to greatly improve the user's workflow.
Group clients with the same configuration under the same checkbox
in the form.
Report clients excluded from the boot instruction due to not
matching OS configuration.
2024-05-16 12:17:21 +02:00
Alejandro Sirgo Rica 7299b157d7 remove Format field from partition setup form
Remove the 'Format' field from the Partition and Format form as
the default value will always be to format the partitions.
This will lead to less portantial codepaths to maintain and
support and less manual clicks in the web form.
2024-05-13 10:07:52 +02:00
Alejandro Sirgo Rica 6034ba2537 Make partition id non editable in partition form
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.
2024-05-12 14:59:53 +02:00
OpenGnSys Support Team 6f488ae251 forms: remove EXFAT
ogclient does not support this filesystem type, remove it.
2024-05-07 11:10:05 +02:00
Javier Hernandez 6ec26d161e views: add update center
add view to update center data such as its name or comment.
2024-02-09 13:21:55 +01:00
Javier Hernandez a609ede7a8 views: Add update room
Add view to modify room information such as name, gateway and netmask
2024-02-09 13:17:29 +01:00
Javier Hernandez 6153ca426f improve delete confirmation
Make delete confirmations show information in a manner that is easier to
read. This includes delete confirmations for centers, room and folder.

Messages are now more clear. Also, content table shows the type of the
items (folder, room, etc.)
2024-02-05 11:48:35 +01:00
Javier Hernandez d075cdd003 forms: Remove netiface from client's form
Remove netiface selectable in clientsDetails form.

eth{0,1,2} is misleading, it does not represent the real device in the client.

And users we know always boot from the first device.

Hide this feature until there is a better design for this.
2024-01-15 10:23:05 +01:00
Javier Hernandez b542031193 views: add room to folder
Support adding a room to a folder
2024-01-11 13:36:23 +01:00
Javier Hernandez cba7a0c1c6 views: Add computers to folder
Add support for adding computers to a folder.

It uses a js script that when selecting a folder in the html form, it
will also select the parent of the folder. For instance, if the user
were to select a folder that is contained inside a room, the room would
also get selected. This allows the view to know which parent contains
the folder.
2024-01-11 13:36:19 +01:00
Javier Hernandez 2509cacc00 views: Add delete folder
Add functionality to allow the user to delete a folder.

Show a confirmation page to the user listing the content of the folder
that is about to delete
2024-01-10 11:31:15 +01:00
Javier Hernandez 695fcfe625 src: Add support for adding folders
Add support to create a folder able to contain multiple computers.

Add support for adding a folder able to contain rooms
2024-01-10 11:31:08 +01:00
Javier Hernandez 52c5555f65 templates: rename 'create' button to 'submit'
In client_details template, rename 'create' button to 'submit'.

This template is used by both client-add and client-edit commands; it
would not make sense to have a 'Create' button in client-edit.
2023-12-21 11:54:01 +01:00
Javier Hernandez 609ff0e19e views: add select repo in import clients
Add, in import clients menu, a selector to select the repo to be
associated with the clients about to import

modify OG_CLIENT_DEFAULT_BOOT variable to be 'oglive'; 'pxe' is not a
valid boot mode, and ogserver would return an error
2023-12-13 11:39:08 +01:00
Javier Hernandez 0f5ba31c09 views: Add 'description' field to image details
Add a 'description' field to the image-details form.
2023-12-12 11:42:43 +01:00
Javier Hernandez 84bcdb3cae Change Image-details' 'Datasize' unit to MiB
Change the Image details form to display the 'Datasize' field of the
image in MiB instead of GiB
2023-12-12 11:00:19 +01:00
Javier Hernandez 152337b6bd views: add action to delete repo
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.
2023-12-05 10:21:09 +01:00
Javier Hernandez 2858436341 src: add menu to manage repos
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
2023-12-01 17:20:08 +01:00
Javier Hernandez 4a70bc174c views: populate repositories in client form
Make, in add and edit clients forms, the field repository show the list
with the actual repositories, not a harcoded value.
2023-11-29 10:43:02 +01:00
Javier Hernandez ad41a0dfbe image: rename and remove fields
- remove field image 'id'
- change size to display MiB instead of GiB
- replace 'Modified' with 'Last update'
2023-11-27 09:45:16 +01:00
Javier Hernandez 4f565255af client: Remove 'netmask' in form
Remove unnecessary field 'netmask' from forms used to create and update
clients. Netmask is configured in rooms instead.
2023-11-27 09:44:47 +01:00
Javier Hernandez 3a0cdbda5a src: Remove netdriver field in client form
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.
2023-11-23 10:21:22 +01:00
Javier Hernandez 739ac075dc views: add field 'gateway' in add-room form
Add the possibility to configure a gateway in a room.
2023-11-14 15:44:14 +01:00
Jose M. Guisado db68dcea46 ogcp: add backup boolean field in image update
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.
2023-07-07 13:22:23 +02:00
Javier Sánchez Parra 3459de36f3 Add Servers section
In Servers section/view, users can add or delete ogServers from ogCP
configuration file.

Replaces Repositories views and recycle some of its code.
2022-09-27 09:48:36 +02:00
Javier Sánchez Parra 083caf00c6 Adapt Delete image to work with several ogServers
This commit makes Delete image view to use ogServer field from
imagesForm to send the deletion request to the correct ogServer.
2022-09-27 09:48:36 +02:00
Javier Sánchez Parra 873bee30aa Adapt Delete center to work with several ogServers
This commit makes Delete center view to use ogServer field from
scopesForm to send the command to the correct ogServer.
2022-09-27 09:48:35 +02:00
Javier Sánchez Parra 9ca010a981 Adapt Add center to work with several ogServers
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.
2022-09-27 09:48:35 +02:00