Commit c7214f6b authored by jlopez's avatar jlopez
Browse files

Merge branch 'develop' into 'master'

New version

Closes #16, #20, and #18

See merge request !11
parents eed362d0 25d0858e
Pipeline #214 failed with stage
in 44 seconds
...@@ -57,25 +57,34 @@ class DBquery ...@@ -57,25 +57,34 @@ class DBquery
$result = mysqli_query($this->dbh, $sql); $result = mysqli_query($this->dbh, $sql);
$results = array(); $results = array();
while($row = mysqli_fetch_assoc($result)){ while($row = mysqli_fetch_assoc($result)){
$d = new Distribution($row['ID'], $row['name'], $row['version'], $row['manager'], $row['active']); $d = new Distribution($row['ID'], $row['name'], $row['version'], $row['manager'], $row['active'], $row['vname']);
array_push($results, $d); array_push($results, $d);
} }
return $results; return $results;
} }
public function getVName($name, $version) {
$sql = "SELECT vname FROM `Distrib` WHERE active = 1 AND `name`='$name' AND `version`='$version';";
$result = mysqli_query($this->dbh, $sql);
while($row = mysqli_fetch_assoc($result)){
return $row['vname'];
}
return "";
}
public function getActiveDistributions() { public function getActiveDistributions() {
$sql = "SELECT * FROM `Distrib` WHERE active = 1 ORDER BY `Distrib`.`name` ASC;"; $sql = "SELECT * FROM `Distrib` WHERE active = 1 ORDER BY `Distrib`.`name` ASC;";
$result = mysqli_query($this->dbh, $sql); $result = mysqli_query($this->dbh, $sql);
$results = array(); $results = array();
while($row = mysqli_fetch_assoc($result)){ while($row = mysqli_fetch_assoc($result)){
$d = new Distribution($row['ID'], $row['name'], $row['version'], $row['manager'], $row['active']); $d = new Distribution($row['ID'], $row['name'], $row['version'], $row['manager'], $row['active'], $row['vname']);
array_push($results, $d); array_push($results, $d);
} }
return $results; return $results;
} }
public function getActiveDistributionsFullName() { public function getActiveDistributionsFullName() {
$sql = "SELECT name,version FROM `Distrib` WHERE active = 1 ORDER BY `Distrib`.`name` ASC;"; $sql = "SELECT name,version,vname FROM `Distrib` WHERE active = 1 ORDER BY `Distrib`.`name` ASC;";
$result = mysqli_query($this->dbh, $sql); $result = mysqli_query($this->dbh, $sql);
$results = array(); $results = array();
while($row = mysqli_fetch_assoc($result)){ while($row = mysqli_fetch_assoc($result)){
......
<?php
session_start ();
require_once "./inc/php/buildHeader.php";
?>
<div class="container">
<br/>
<div class="row justify-content-center">
<h1> FAQ </h1>
</div>
</div>
</body>
</html>
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
require_once "./dao/DBquery.php"; require_once "./dao/DBquery.php";
require_once "./package.php";
$db = new DBquery(); $db = new DBquery();
...@@ -29,9 +30,10 @@ if(isset($_GET['filter'])) { ...@@ -29,9 +30,10 @@ if(isset($_GET['filter'])) {
$filter = $_GET['filter']; $filter = $_GET['filter'];
} }
$patternName = false; $patternName = true;
$patternDescription = false; $patternDescription = true;
/*
if(isset($_GET['patternName'])) { if(isset($_GET['patternName'])) {
if($_GET['patternName'] == "true") { if($_GET['patternName'] == "true") {
$patternName = true; $patternName = true;
...@@ -42,16 +44,44 @@ if(isset($_GET['patternDescription'])) { ...@@ -42,16 +44,44 @@ if(isset($_GET['patternDescription'])) {
if($_GET['patternDescription'] == "true") { if($_GET['patternDescription'] == "true") {
$patternDescription = true; $patternDescription = true;
} }
} }*/
$limit = "25";
if(isset($_GET['limit'])) { if(isset($_GET['limit'])) {
$limit = $_GET['limit']; $limit = $_GET['limit'];
} }
$result = $db->getPackages($distrib, $filter, $patternName, $patternDescription, $limit); $result = array();
if(strpos($distrib, ':') !== false) {
$os = explode (":", $distrib);
$os_name = $os[0];
$version_num = $os[1];
$version_name = $db->getVName($os_name, $version_num);
$result = findDistributionPackage($os_name, $version_num, $version_name, $filter, $limit, false);
} else {
if($distrib == "Conda") {
$result = findCondaPackage($distrib, $version_num, $version_name, $filter, $limit, false);
}
else if($distrib == "Rubygems") {
$result = findRubyPackage($distrib, $version_num, $version_name, $filter, $limit, false);
}
else if($distrib == "NPM") {
$result = findNPMPackage($distrib, $version_num, $version_name, $filter, $limit, false);
}
else if($distrib == "CPAN") {
$result = findCPANPackage($distrib, $version_num, $version_name, $filter, $limit, false);
}
else if($distrib == "CRAN" || $distrib == "Bioconductor") {
$result = findRPackage($distrib, $version_num, $version_name, $filter, $limit, false);
}
else if($distrib == "Python") {
$result = findPythonPackage($distrib, $version_num, $version_name, $filter, $limit, false);
}
else {
$result = $db->getPackages($distrib, $filter, $patternName, $patternDescription, $limit);
}
}
echo ' echo '
<div class="container"> <div class="container">
......
...@@ -19,7 +19,7 @@ $( "#generateButton" ).click(function() { ...@@ -19,7 +19,7 @@ $( "#generateButton" ).click(function() {
}); });
function buildRecipe() { function buildCommand() {
var filename = document.getElementById("imageNameInput").value; var filename = document.getElementById("imageNameInput").value;
...@@ -263,6 +263,39 @@ function generate_container() { ...@@ -263,6 +263,39 @@ function generate_container() {
} }
var timezone = document.getElementById("timezonePreview").value;
if(isSingularity) {
PREVIEW += "\t"+ timezone + "\n";
nrow += 1;
}
else {
PREVIEW += "RUN " + timezone + "\n";
nrow += 1;
}
PREVIEW += "\n";
var locale = document.getElementById("localePreview").value;
if(isSingularity) {
PREVIEW += "\t"+ locale + "\n";
nrow += 1;
}
else {
PREVIEW += "RUN " + locale + "\n";
nrow += 1;
}
PREVIEW += "\n";
if(isSingularity) {
PREVIEW += "\t" + manager + " update\n";
}
else {
PREVIEW += "RUN " + manager + " update\n";
}
nrow += 1;
PREVIEW += "\n";
for(var i = 0; i < SELECTED_PACKAGES["Distribution"].length; i++) { for(var i = 0; i < SELECTED_PACKAGES["Distribution"].length; i++) {
if(isSingularity) { if(isSingularity) {
...@@ -281,6 +314,13 @@ function generate_container() { ...@@ -281,6 +314,13 @@ function generate_container() {
PREVIEW += "\n############### Install R ##############\n"; PREVIEW += "\n############### Install R ##############\n";
if(isSingularity) {
PREVIEW += "\t"+manager+" install -y " + "make" + "\n";
} else {
PREVIEW += "RUN "+manager+" install -y " + "make" + "\n";
}
if(isSingularity) { if(isSingularity) {
PREVIEW += '\tcd $HOME'; PREVIEW += '\tcd $HOME';
PREVIEW += '\n\twget https://cran.rstudio.com/src/base/R-3/R-'+ rversion+ '.tar.gz'; PREVIEW += '\n\twget https://cran.rstudio.com/src/base/R-3/R-'+ rversion+ '.tar.gz';
...@@ -299,6 +339,24 @@ function generate_container() { ...@@ -299,6 +339,24 @@ function generate_container() {
PREVIEW += "\t&& make install "+ "\n"; PREVIEW += "\t&& make install "+ "\n";
} }
nrow += 8; nrow += 8;
var localeR = document.getElementById("localeR").value;
if(localeR != "") {
localeR = "echo 'Sys.setlocale(\"LC_ALL\", \"" + localeR + "\")' | R --slave";
if(isSingularity) {
PREVIEW += "\t"+ localeR + "\n";
nrow += 1;
}
else {
PREVIEW += "RUN " + localeR + "\n";
nrow += 1;
}
PREVIEW += "\n";
}
} }
for(var i = 0; i < SELECTED_PACKAGES["CRAN"].length; i++) { for(var i = 0; i < SELECTED_PACKAGES["CRAN"].length; i++) {
...@@ -353,7 +411,10 @@ function generate_container() { ...@@ -353,7 +411,10 @@ function generate_container() {
PREVIEW += "\t"+manager+" -y install curl bzip2 \\" + "\n"; PREVIEW += "\t"+manager+" -y install curl bzip2 \\" + "\n";
PREVIEW += "\t&& curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \\" + "\n"; PREVIEW += "\t&& curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \\" + "\n";
PREVIEW += "\t&& bash /tmp/miniconda.sh -bfp /usr/local/ \\" + "\n"; PREVIEW += "\t&& bash /tmp/miniconda.sh -bfp /usr/local/ \\" + "\n";
PREVIEW += "\t&& conda install -y python=3 \\" + "\n"; //PREVIEW += "\t&& conda install -y python=3 \\" + "\n";
PREVIEW += "\t&& conda config --add channels bioconda \\" + "\n";
PREVIEW += "\t&& conda config --add channels anaconda \\" + "\n";
PREVIEW += "\t&& conda config --add channels conda-forge \\" + "\n";
PREVIEW += "\t&& conda update conda \\" + "\n"; PREVIEW += "\t&& conda update conda \\" + "\n";
PREVIEW += "\t&& conda clean --all --yes " + "\n"; PREVIEW += "\t&& conda clean --all --yes " + "\n";
...@@ -366,13 +427,16 @@ function generate_container() { ...@@ -366,13 +427,16 @@ function generate_container() {
PREVIEW += "&& "+manager+" -y install curl bzip2 \\" + "\n"; PREVIEW += "&& "+manager+" -y install curl bzip2 \\" + "\n";
PREVIEW += "&& curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \\" + "\n"; PREVIEW += "&& curl -sSL https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \\" + "\n";
PREVIEW += "&& bash /tmp/miniconda.sh -bfp /usr/local/ \\" + "\n"; PREVIEW += "&& bash /tmp/miniconda.sh -bfp /usr/local/ \\" + "\n";
PREVIEW += "&& conda install -y python=3 \\" + "\n"; //PREVIEW += "&& conda install -y python=3 \\" + "\n";
PREVIEW += "&& conda config --add channels bioconda \\" + "\n";
PREVIEW += "&& conda config --add channels anaconda \\" + "\n";
PREVIEW += "&& conda config --add channels conda-forge \\" + "\n";
PREVIEW += "&& conda update conda \\" + "\n"; PREVIEW += "&& conda update conda \\" + "\n";
PREVIEW += "&& conda clean --all --yes " + "\n"; PREVIEW += "&& conda clean --all --yes " + "\n";
} }
nrow += 10; nrow += 11;
for(var i = 0; i < SELECTED_PACKAGES["Conda"].length; i++) { for(var i = 0; i < SELECTED_PACKAGES["Conda"].length; i++) {
...@@ -511,13 +575,27 @@ function generate_container() { ...@@ -511,13 +575,27 @@ function generate_container() {
PREVIEW += "\nRUN curl -L https://cpanmin.us | perl - App::cpanminus\n"; PREVIEW += "\nRUN curl -L https://cpanmin.us | perl - App::cpanminus\n";
} }
var localePerl = document.getElementById("localePerl").value;
if(localePerl != "") {
if(isSingularity) {
PREVIEW += "\t"+ localePerl + "\n";
nrow += 1;
}
else {
PREVIEW += "RUN " + localePerl + "\n";
nrow += 1;
}
PREVIEW += "\n";
}
nrow += 3; nrow += 3;
for(var i = 0; i < SELECTED_PACKAGES["CPAN"].length; i++) { for(var i = 0; i < SELECTED_PACKAGES["CPAN"].length; i++) {
var version = "@"+SELECTED_PACKAGES["CPAN"][i][1]; //var version = "@"+SELECTED_PACKAGES["CPAN"][i][1];
var version = "";
if(version === "@undef") { if(version === "@undef") {
version = "" version = ""
...@@ -694,7 +772,8 @@ function showPackage(distribName) { ...@@ -694,7 +772,8 @@ function showPackage(distribName) {
var str = document.getElementById("find"+distribName+"Packages").value; var str = document.getElementById("find"+distribName+"Packages").value;
var limit = document.getElementById("limit"+distribName).value; //var limit = document.getElementById("limit"+distribName).value;
var limit = 30;
if (str == "") { if (str == "") {
document.getElementById("containPackages"+distribName).innerHTML = ""; document.getElementById("containPackages"+distribName).innerHTML = "";
...@@ -711,11 +790,15 @@ function showPackage(distribName) { ...@@ -711,11 +790,15 @@ function showPackage(distribName) {
} }
}; };
var patternName = document.getElementById("pattern"+distribName+"Name").checked; //var patternName = document.getElementById("pattern"+distribName+"Name").checked;
var patternDescription = document.getElementById("pattern"+distribName+"Description").checked; //var patternDescription = document.getElementById("pattern"+distribName+"Description").checked;
var patternName = true;
var patternDescription = true;
//xmlhttp.open("GET","get"+distribName+"Packages.php?distrib="+distrib+"&filter="+str+"&patternName="+patternName+"&patternDescription="+patternDescription+"&limit="+limit,true); //xmlhttp.open("GET","get"+distribName+"Packages.php?distrib="+distrib+"&filter="+str+"&patternName="+patternName+"&patternDescription="+patternDescription+"&limit="+limit,true);
xmlhttp.open("GET","getPackages.php?distrib="+distrib+"&filter="+str+"&patternName="+patternName+"&patternDescription="+patternDescription+"&limit="+limit,true); xmlhttp.open("GET","getPackages.php?distrib="+distrib+"&filter="+str+"&patternName="+patternName+"&patternDescription="+patternDescription+"&limit="+limit,true);
console.log("getPackages.php?distrib="+distrib+"&filter="+str+"&patternName="+patternName+"&patternDescription="+patternDescription+"&limit="+limit);
xmlhttp.send(); xmlhttp.send();
} }
} }
\ No newline at end of file
...@@ -25,7 +25,7 @@ echo ' ...@@ -25,7 +25,7 @@ echo '
<nav class="navbar navbar-expand-md navbar-dark navbar-custom p-1"> <nav class="navbar navbar-expand-md navbar-dark navbar-custom p-1">
<a class="navbar-brand" href="#">WICOPA</a> <div class="navbar-brand">WICOPA</div>
<div class="collapse navbar-collapse justify-content-between" id="navbar"> <div class="collapse navbar-collapse justify-content-between" id="navbar">
<div class="navbar-nav"> <div class="navbar-nav">
'; ';
...@@ -34,7 +34,7 @@ echo ' ...@@ -34,7 +34,7 @@ echo '
echo ' <a class="nav-item nav-link" href="./index.php"> Home </a>'; echo ' <a class="nav-item nav-link" href="./index.php"> Home </a>';
echo ' <a class="nav-item nav-link" href="./container.php"> Containers </a>'; echo ' <a class="nav-item nav-link" href="./container.php"> Contributed Containers </a>';
if(isset($_SESSION['username']) && !empty($_SESSION['username'])) if(isset($_SESSION['username']) && !empty($_SESSION['username']))
{ {
...@@ -46,6 +46,9 @@ echo ' ...@@ -46,6 +46,9 @@ echo '
} }
} }
echo ' <a class="nav-item nav-link" href="./faq.php"> FAQ </a>';
echo ' echo '
</div> </div>
......
...@@ -16,6 +16,15 @@ function printSection($name, $db) { ...@@ -16,6 +16,15 @@ function printSection($name, $db) {
</div> </div>
'; ';
printPanel($name);
} else if($name == "CPAN") {
echo '
<div class="form-group">
<label for="localePerl" class="font-weight-bold">Perl locale :</label>
<input type="text" class="form-control" id="localePerl" value="locale-gen en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US:en">
</div>
';
printPanel($name); printPanel($name);
} else if($name == "R") { } else if($name == "R") {
$subsection = $db->getNameSectionWhithParent("R"); $subsection = $db->getNameSectionWhithParent("R");
...@@ -24,11 +33,17 @@ function printSection($name, $db) { ...@@ -24,11 +33,17 @@ function printSection($name, $db) {
<div class="form-group"> <div class="form-group">
<label for="selectedR" class="font-weight-bold">R version :</label> <label for="selectedR" class="font-weight-bold">R version :</label>
<select class="custom-select" id="selectedR"> <select class="custom-select" id="selectedR">
<option value="0" >None</option> <option value="0" selected="selected" >None</option>
<option value="3.5" selected="selected">3.5</option> <option value="3.6.3">3.6.3</option>
<option value="3.5">3.5</option>
</select> </select>
</div> </div>
<div class="form-group">
<label for="localeR" class="font-weight-bold">R locale :</label>
<input type="text" class="form-control" id="localeR" value="en_US.UTF-8">
</div>
<nav> <nav>
<div class="nav nav-tabs" id="nav-tab-R" role="tablist"> <div class="nav nav-tabs" id="nav-tab-R" role="tablist">
'; ';
...@@ -69,9 +84,36 @@ function printSection($name, $db) { ...@@ -69,9 +84,36 @@ function printSection($name, $db) {
function printPanel($name) { function printPanel($name) {
echo ' echo '
<label for="find'.$name.'Packages">Find packages with pattern :</label> <label for="find'.$name.'Packages">Find packages containing substring :</label>
<input type="email" class="form-control" id="find'.$name.'Packages"> <input type="email" class="form-control" id="find'.$name.'Packages">';
if($name == "CRAN") {
echo '<small class="form-text text-muted">exemple: genepop</small>';
}
else if($name == "Bioconductor") {
echo '<small class="form-text text-muted">exemple: GenomicFeatures</small>';
}
else if($name == "CPAN") {
echo '<small class="form-text text-muted">exemple: cpanminus</small>';
}
else if ($name == "Rubygems") {
echo '<small class="form-text text-muted">exemple: math-api</small>';
}
else if ($name == "Python") {
echo '<small class="form-text text-muted">exemple: math3d</small>';
}
else if ($name == "NPM") {
echo '<small class="form-text text-muted">exemple: math</small>';
}
else {
echo '<small class="form-text text-muted">exemple: python</small>';
}
echo '
<!--
<div class="form-check"> <div class="form-check">
<input type="checkbox" class="form-check-input" id="pattern'.$name.'Name" checked> <input type="checkbox" class="form-check-input" id="pattern'.$name.'Name" checked>
<label class="form-check-label" for="pattern'.$name.'Name">Pattern on name</label> <label class="form-check-label" for="pattern'.$name.'Name">Pattern on name</label>
...@@ -80,10 +122,11 @@ function printPanel($name) { ...@@ -80,10 +122,11 @@ function printPanel($name) {
<div class="form-check"> <div class="form-check">
<input type="checkbox" class="form-check-input" id="pattern'.$name.'Description" checked> <input type="checkbox" class="form-check-input" id="pattern'.$name.'Description" checked>
<label class="form-check-label" for="pattern'.$name.'Description">Pattern on description</label> <label class="form-check-label" for="pattern'.$name.'Description">Pattern on description</label>
</div> </div> -->
<br/> <br/>
<!--
<div class="form-group"> <div class="form-group">
<label for="limit'.$name.'" class="font-check-label">Max found :</label> <label for="limit'.$name.'" class="font-check-label">Max found :</label>
<select class="custom-select" id="limit'.$name.'"> <select class="custom-select" id="limit'.$name.'">
...@@ -95,7 +138,7 @@ function printPanel($name) { ...@@ -95,7 +138,7 @@ function printPanel($name) {
<option value="100">200</option> <option value="100">200</option>
<option value="1000000000">all</option> <option value="1000000000">all</option>
</select> </select>
</div> </div> -->
<div class="form-group"> <div class="form-group">
<button type="button" class="btn btn-primary" onclick="showPackage(\''.$name.'\')">Search</button> <button type="button" class="btn btn-primary" onclick="showPackage(\''.$name.'\')">Search</button>
......
...@@ -31,30 +31,44 @@ require_once "./inc/php/buildHeader.php"; ...@@ -31,30 +31,44 @@ require_once "./inc/php/buildHeader.php";
<input type="text" class="form-control" id="imageNameInput"> <input type="text" class="form-control" id="imageNameInput">
</div> </div>
<div class="form-group">
<label for="baseNameInput" class="font-weight-bold">From :</label>
<input type="text" class="form-control" id="baseNameInput">
<small id="help0" class="form-text text-muted">You can find images name on <a href="https://hub.docker.com/search?q=&type=image" >docker hub </a>.</small>
<small id="help1" class="form-text text-muted">If the above "From" field is empty, then <a href="https://docs.docker.com/engine/reference/builder/#from">"From"</a> is chosen from distribution bellow. </small>
<small id="help2" class="form-text text-muted">You must make sure that the OS of your base container is compatible with the chosen distribution. </small>
</div>
<div class="form-group"> <div class="form-group">
<label for="selectedOS" class="font-weight-bold">Distribution <span style="font-size:20px;" class="status text-danger">*</span>:</label> <label for="selectedOS" class="font-weight-bold">From Distribution <span style="font-size:20px;" class="status text-danger">*</span>:</label>
<select class="custom-select" id="selectedOS" onchange="hide_os_rows()"> <select class="custom-select" id="selectedOS" onchange="hide_os_rows()">
<?php <?php
foreach ($db->getActiveDistributionsFullName() as $name){ foreach ($db->getActiveDistributionsFullName() as $name){
if(strpos($name, "ubuntu") !== false) {
echo ' <option value="'.$name.'" selected="selected">'.$name.'</option>';
}
else {
echo ' <option value="'.$name.'">'.$name.'</option>'; echo ' <option value="'.$name.'">'.$name.'</option>';
} }
}
?> ?>
</select> </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="selectedOS" class="font-weight-bold">Package manager :</label>
<select class="custom-select"