From da1b81db40377f9d4dd12150a5c6bb64fce2a1bb Mon Sep 17 00:00:00 2001
From: Stefano Alberto Russo <stefano.russo@gmail.com>
Date: Sat, 9 Apr 2022 20:32:20 +0200
Subject: [PATCH] Added the browsable attirbute and made the bind optional in
 the Storage model.

---
 .../migrations/0032_auto_20220409_1813.py     | 23 +++++++++++++++++++
 .../webapp/code/rosetta/core_app/models.py    |  5 +++-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 services/webapp/code/rosetta/core_app/migrations/0032_auto_20220409_1813.py

diff --git a/services/webapp/code/rosetta/core_app/migrations/0032_auto_20220409_1813.py b/services/webapp/code/rosetta/core_app/migrations/0032_auto_20220409_1813.py
new file mode 100644
index 0000000..3007106
--- /dev/null
+++ b/services/webapp/code/rosetta/core_app/migrations/0032_auto_20220409_1813.py
@@ -0,0 +1,23 @@
+# Generated by Django 2.2.1 on 2022-04-09 18:13
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('core_app', '0031_container_env_vars'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='storage',
+            name='browsable',
+            field=models.BooleanField(default=False, verbose_name='Browsable in the file manager?'),
+        ),
+        migrations.AlterField(
+            model_name='storage',
+            name='bind_path',
+            field=models.CharField(blank=True, max_length=4096, null=True, verbose_name='Bind path'),
+        ),
+    ]
diff --git a/services/webapp/code/rosetta/core_app/models.py b/services/webapp/code/rosetta/core_app/models.py
index 4ea37b7..0b7b8c7 100644
--- a/services/webapp/code/rosetta/core_app/models.py
+++ b/services/webapp/code/rosetta/core_app/models.py
@@ -383,7 +383,7 @@ class Storage(models.Model):
      
     # Paths
     base_path = models.CharField('Base path', max_length=4096, blank=False, null=False) 
-    bind_path = models.CharField('Bind path', max_length=4096, blank=False, null=False) 
+    bind_path = models.CharField('Bind path', max_length=4096, blank=True, null=True) 
  
     # Link with a computing resource
     computing = models.ForeignKey(Computing, related_name='storages', on_delete=models.CASCADE, blank=True, null=True) # Make optional?
@@ -393,6 +393,9 @@ class Storage(models.Model):
     # Configuration
     conf = JSONField(blank=True, null=True)
  
+    # Include as browsable in the file manager?
+    browsable = models.BooleanField('Browsable in the file manager?', default=False)
+
  
     class Meta:
         ordering = ['name']
-- 
GitLab