summaryrefslogtreecommitdiffstats
path: root/ogcp/forms
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-16 12:38:28 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-05-30 15:50:32 +0200
commit9cb3a952b4ceb3c33e8481250179023fdf5ceebb (patch)
tree6d590a2b18869a20370ae4513cbd4ad4559fb603 /ogcp/forms
parentf896107375cc2a47a5c4eb3095c6c365d8eed98e (diff)
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, }
Diffstat (limited to 'ogcp/forms')
-rw-r--r--ogcp/forms/action_forms.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py
index 46081b5..19387aa 100644
--- a/ogcp/forms/action_forms.py
+++ b/ogcp/forms/action_forms.py
@@ -87,6 +87,15 @@ class SessionForm(FlaskForm):
ips = HiddenField()
os = RadioField(label=_l('Session'), choices=[])
+class CacheImage(FlaskForm):
+ selected = BooleanField()
+ image_name = HiddenField()
+ clients = HiddenField()
+
+class CacheForm(FlaskForm):
+ ips = HiddenField()
+ images = FieldList(FormField(CacheImage))
+
class ImageRestoreForm(FlaskForm):
ips = HiddenField()
partition = SelectField(label=_l('Partition'), choices=[])