From 9d4393dd064e35b38b0b282541c716675adb0f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20L=C3=B3pez-Doriga?= <orildsaga@gmail.com> Date: Tue, 7 Nov 2023 21:30:30 +0100 Subject: [PATCH] fixing controlled and registred bugs --- permissions/controlled_datasets.yml | 1 + permissions/permissions-ui/media/app2.js | 19 ++----------- .../permissions-ui/templates/controlled.html | 27 ++++++++++--------- .../permissions-ui/templates/public.html | 4 +-- .../permissions-ui/templates/registered.html | 3 ++- permissions/public_datasets.yml | 1 + permissions/registered_datasets.yml | 12 --------- 7 files changed, 22 insertions(+), 45 deletions(-) diff --git a/permissions/controlled_datasets.yml b/permissions/controlled_datasets.yml index ff46c590..2442e24f 100644 --- a/permissions/controlled_datasets.yml +++ b/permissions/controlled_datasets.yml @@ -1,3 +1,4 @@ controlled_datasets: - nothing - vamos +- dataset1 diff --git a/permissions/permissions-ui/media/app2.js b/permissions/permissions-ui/media/app2.js index b976b4db..90dcf34d 100644 --- a/permissions/permissions-ui/media/app2.js +++ b/permissions/permissions-ui/media/app2.js @@ -1,7 +1,7 @@ const btnAdd2 = document.querySelector('#btnAdd2'); const btnRemove = document.querySelector('#btnRemove'); -const datasets = document.querySelector('#list_datasets'); -const framework = document.querySelector('#framework'); +const datasets = document.querySelector('#datasets'); +const listbox = document.querySelector('#list'); btnAdd2.onclick = (e) => { e.preventDefault(); @@ -24,21 +24,6 @@ btnAdd2.onclick = (e) => { listbox.add(option, undefined); } // create a new option - - if (framework.value == '') { - alert('Please enter the name.'); - return; - } - - // create a new option - const option = new Option(framework.value, framework.value); - option.setAttribute('selected', 'selected'); - // add it to the list - listbox.add(option, undefined); - - // reset the value of the input - framework.value = ''; - framework.focus(); diff --git a/permissions/permissions-ui/templates/controlled.html b/permissions/permissions-ui/templates/controlled.html index ea04109c..9793db37 100644 --- a/permissions/permissions-ui/templates/controlled.html +++ b/permissions/permissions-ui/templates/controlled.html @@ -58,18 +58,19 @@ <div><h2 style="color: #760509;">Controlled datasets manager</h2></div> <form method="post"> {% csrf_token %} - <label for="framework">Dataset:</label> - <input type="text" id="framework" placeholder="Enter a controlled dataset" autocomplete="off"> - - <button id="btnAdd">Add</button> - - <label for="list">Controlled Datasets List:</label> - <select id="list" name="list" multiple> - {% for item in bash_out %} - <option value="{{item}}" selected="selected">{{item}}</option> - {% endfor %} - </select> - <button id="btnRemove">Remove Dataset</button> + <label for="datasets">Dataset:</label> + + <select id="datasets" name="datasets" multiple> + <option value="dataset1" selected="selected">dataset1</option> + </select> + <button id="btnAdd2">Add</button> + <label for="list">Public Datasets List:</label> + <select id="list" name="list" multiple> + {% for item in bash_out %} + <option value="{{item}}" selected="selected">{{item}}</option> + {% endfor %} + </select> + <button id="btnRemove">Remove Dataset</button> <div class="col-5"> <button type="submit" class="btn btn-success mb-3">Add datasets</button> </div> @@ -130,6 +131,6 @@ } </script> - <script src="media/app.js"></script> + <script src="media/app2.js"></script> </body> </html> diff --git a/permissions/permissions-ui/templates/public.html b/permissions/permissions-ui/templates/public.html index fed62200..007d6090 100644 --- a/permissions/permissions-ui/templates/public.html +++ b/permissions/permissions-ui/templates/public.html @@ -63,7 +63,7 @@ <select id="datasets" name="datasets" multiple> <option value="dataset1" selected="selected">dataset1</option> </select> - <button id="btnAdd">Add</button> + <button id="btnAdd2">Add</button> <label for="list">Public Datasets List:</label> <select id="list" name="list" multiple> {% for item in bash_out %} @@ -131,6 +131,6 @@ } </script> - <script src="media/app.js"></script> + <script src="media/app2.js"></script> </body> </html> diff --git a/permissions/permissions-ui/templates/registered.html b/permissions/permissions-ui/templates/registered.html index faa1e8c0..3541da9b 100644 --- a/permissions/permissions-ui/templates/registered.html +++ b/permissions/permissions-ui/templates/registered.html @@ -20,7 +20,7 @@ <span class="navbar-text "> <img src="media/logo.png" alt="EGA" height="70px"> </span> - <a class="navbar-brand " href="/"><h1 class="bi bi-patch-check display-6 mx-auto p-2 fw-bold ms-5" style="color: #239B56;">Beacon Verifier</h1></a> + <a class="navbar-brand " href="/"><h1 class="bi bi-kanban display-6 mx-auto p-2 fw-bold ms-5" style="color: #760509;"> Beacon Admin Page</h1></a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> @@ -55,6 +55,7 @@ </button> </div> <div id="boxdatasets"> + <div><h2 style="color: #760509;">Registered datasets manager</h2></div> <form method="post"> {% csrf_token %} <label for="framework">Add a new user to the list:</label> diff --git a/permissions/public_datasets.yml b/permissions/public_datasets.yml index d40a005b..2f3c35df 100644 --- a/permissions/public_datasets.yml +++ b/permissions/public_datasets.yml @@ -1,2 +1,3 @@ public_datasets: - CINECA_synthetic_cohort_EUROPE_UK1 +- dataset1 diff --git a/permissions/registered_datasets.yml b/permissions/registered_datasets.yml index 7cf01ee7..ad7bf4d2 100644 --- a/permissions/registered_datasets.yml +++ b/permissions/registered_datasets.yml @@ -1,16 +1,4 @@ app-user3: - CINECA_synthetic_cohort_EUROPE_UK1 -gemma_test: -- CINECA_synthetic_cohort_EUROPE_UK1 hola: - CINECA_synthetic_cohort_EUROPE_UK1 -jane: -- CINECA_synthetic_cohort_EUROPE_UK1 -jofrdo: -- CINECA_synthetic_cohort_EUROPE_UK1 -john: -- CINECA_synthetic_cohort_EUROPE_UK1 -new_user: -- CINECA_synthetic_cohort_EUROPE_UK1 -usuari_creat: -- CINECA_synthetic_cohort_EUROPE_UK1