Skip to content
Snippets Groups Projects
Commit dbfca960 authored by hahn's avatar hahn
Browse files

- weiter GUI aufgeräumt und Roh-Daten im Pre "verschönert"

- Anzeige der Versionen und Verwendung in der Projekt-Startseite
- Startseite soll weniger Platz einnehmen, wenn mehr Projekte kommen
- Farbcodierung der Versionen mittels Checksumme über commit-Message
parent 04b74ae8
No related branches found
No related tags found
No related merge requests found
AuthUserFile /var/www/ci.iml.unibe.ch/public_html/deployment/.htusers AuthUserFile /var/www/ci.iml.unibe.ch/public_html/deployment/.htusers
AuthName "IML DEPLOYMENT-Passwort" AuthName "IML DEPLOYMENT GUI"
AuthType Basic AuthType Basic
#Allow any valid user #Allow any valid user
......
...@@ -86,7 +86,7 @@ if (array_key_exists("confirm", $aParams)) { ...@@ -86,7 +86,7 @@ if (array_key_exists("confirm", $aParams)) {
<form action="?" method="post" enctype="multipart/form-data"> <form action="?" method="post" enctype="multipart/form-data">
<input type="hidden" name="confirm" value="1"> <input type="hidden" name="confirm" value="1">
<input type="submit" class="btn btn-primary" value="Accept ['.$sPhase.'] and put to ['.$sNext.']"> <input type="submit" class="btn btn-primary btn-large" value="Accept ['.$sPhase.'] and put to ['.$sNext.']">
</form> </form>
'; ';
} }
......
...@@ -23,16 +23,16 @@ if (array_key_exists("confirm", $aParams)) { ...@@ -23,16 +23,16 @@ if (array_key_exists("confirm", $aParams)) {
<table> <table>
<thead> <thead>
<tr> <tr>
<th class="'.$sPhase.'">'.$sPhase.'</th> <th class="versioncontrol">Versionskontrolle</th>
<th> </th> <th> </th>
<th class="'.$sNext.'" colspan="2">'.$sNext.'</th> <th class="'.$sNext.'" colspan="2">'.$sNext.'</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td class="'.$sPhase.'"> <td class="">
HEAD ist:<br> HEAD ist:<br>
'.$oPrj->showRepoInfo().' '.$oPrj->renderRepoInfo().'
</td> </td>
<td style="vertical-align: middle;"> <td style="vertical-align: middle;">
<img src="/deployment/images/nuvola64x64/apps/noatun.png"> <img src="/deployment/images/nuvola64x64/apps/noatun.png">
...@@ -59,7 +59,7 @@ if (array_key_exists("confirm", $aParams)) { ...@@ -59,7 +59,7 @@ if (array_key_exists("confirm", $aParams)) {
<!-- ' . enterDeployinfos() . ' <!-- ' . enterDeployinfos() . '
<hr> <hr>
--> -->
<input type="submit" class="btn btn-primary" value="Paket f&uuml;r ['.$sNext.'] erstellen"> <input type="submit" class="btn btn-primary btn-large" value="Paket f&uuml;r ['.$sNext.'] erstellen">
</form> </form>
'; ';
} }
......
...@@ -35,7 +35,7 @@ if (array_key_exists("confirm", $aParams)) { ...@@ -35,7 +35,7 @@ if (array_key_exists("confirm", $aParams)) {
<form action="?" method="post" enctype="multipart/form-data"> <form action="?" method="post" enctype="multipart/form-data">
<input type="hidden" name="confirm" value="1"> <input type="hidden" name="confirm" value="1">
<input type="submit" class="btn btn-primary" value="Deploy"> <input type="submit" class="btn btn-primary btn-large" value="Deploy">
</form> </form>
'; ';
} else { } else {
......
...@@ -14,8 +14,10 @@ if (!array_key_exists("prj", $aParams)){ ...@@ -14,8 +14,10 @@ if (!array_key_exists("prj", $aParams)){
require_once("./classes/project.class.php"); require_once("./classes/project.class.php");
$oPrj=new project($aParams["prj"]); $oPrj=new project($aParams["prj"]);
$sPhpOut=' $sPhpOut='
<h3>Angaben zum Projekt</h3> <div class="infobox" style="float: right;">
<h3>Steckbrief</h3>
'.$oPrj->renderProjektInfos().' '.$oPrj->renderProjektInfos().'
</div>
<h3>Phasen</h3> <h3>Phasen</h3>
<p> <p>
F&uuml;r das Projekt sind folgende Phasen konfiguriert: F&uuml;r das Projekt sind folgende Phasen konfiguriert:
...@@ -25,9 +27,13 @@ if (!array_key_exists("prj", $aParams)){ ...@@ -25,9 +27,13 @@ if (!array_key_exists("prj", $aParams)){
'.$oPrj->renderLink("build").' '.$oPrj->renderLink("build").'
<br><br> <br><br>
<h3>Versionen</h3> <h3>Build-Versionen</h3>
'.$oPrj->renderVersionUsage().'
<!--
<br>
$oPrj->getVersions()<br> $oPrj->getVersions()<br>
<pre>'.print_r($oPrj->getVersions(), true).'</pre> <pre>'.print_r($oPrj->getVersions(), true).'</pre>
-->
'; ';
} }
?> ?>
......
...@@ -102,6 +102,7 @@ ...@@ -102,6 +102,7 @@
#tbloverview th{width: 25%;} #tbloverview th{width: 25%;}
#tbloverview td{} #tbloverview td{}
th.prj{background:#f8f8f8;} th.prj{background:#f8f8f8;}
th.versioncontrol{background: #ccc;}
th.preview{background:#358; color:#eee;} th.preview{background:#358; color:#eee;}
th.stage{background:#388; color:#eee;} th.stage{background:#388; color:#eee;}
th.live{background:#3a3; color: #eee; } th.live{background:#3a3; color: #eee; }
...@@ -119,11 +120,18 @@ ...@@ -119,11 +120,18 @@
padding: 4px; padding: 4px;
} }
a.info span{ display: none; position: absolute;}
a.info:hover span{ display: block; text-decoration: none;}
a.info:hover { text-decoration: none;}
.infobox{
background:#fea; background: linear-gradient(#fea,#fff8f0,#fea);
padding: 1em; border: 2px solid #fff; box-shadow: 0 0 10px #ccc;
}
.warning{background: #fe8;} .warning{background: #fe8;}
.error{background: #fcc;} .error{background: #fcc;}
.center{text-align: center;} .center{text-align: center;}
.inactive{color:#999; font-style: italic;} .inactive{color:#999; font-style: italic;}
.versioninfo{ .versioninfo{
border: 0px solid #ccc; border: 0px solid #ccc;
padding: 0px; padding: 0px;
......
<?php
/**
* Description of lang
*
* @author hahn
*/
class lang {
private $_aLangData=array();
public function __construct($s){
if ($s) return $this->l($s);
}
public function _readConfig(){
$this->_aLangData=array();
}
public function l($s){
if (array_key_exists($s, $this->_aLangData)){
return $this->_aLangData[$s];
}
return $s;
}
}
?>
...@@ -44,7 +44,7 @@ class project { ...@@ -44,7 +44,7 @@ class project {
*/ */
private $_aPlaces = array( private $_aPlaces = array(
"onhold" => "Queue", "onhold" => "Queue",
"ready4deployment" => "Repo", "ready4deployment" => "Puppet",
"deployed" => "Installiert", "deployed" => "Installiert",
); );
private $_iRcAll = 0; private $_iRcAll = 0;
...@@ -487,10 +487,10 @@ class project { ...@@ -487,10 +487,10 @@ class project {
$aTmp[$sKey]["version"] = $aJson["timestamp"]; $aTmp[$sKey]["version"] = $aJson["timestamp"];
$aTmp[$sKey]["ok"] = 1; $aTmp[$sKey]["ok"] = 1;
} else { } else {
$aTmp[$sKey]["error"] = "json url was readable <a href=$sJsonUrl>$sJsonUrl</a> but is corrupt (no timestamp)." . print_r($aJson, true); $aTmp[$sKey]["error"] = "json url was readable $sJsonUrl but is corrupt (no timestamp)." . print_r($aJson, true);
} }
} else { } else {
$aTmp[$sKey]["error"] = "json url not readable <a href=$sJsonUrl>$sJsonUrl</a>"; $aTmp[$sKey]["error"] = "json url not readable $sJsonUrl";
} }
} else { } else {
$aTmp[$sKey]["warning"] = "this phase is not active or has no url"; $aTmp[$sKey]["warning"] = "this phase is not active or has no url";
...@@ -514,6 +514,13 @@ class project { ...@@ -514,6 +514,13 @@ class project {
); );
} }
/**
* return array of all (active and inactive) phases
* @return type
*/
public function getPhases(){
return $this->_aConfig["phases"];
}
/** /**
* get a flat array with active phases of the project * get a flat array with active phases of the project
* @return array * @return array
...@@ -616,6 +623,7 @@ class project { ...@@ -616,6 +623,7 @@ class project {
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// ACTIONS // ACTIONS
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
/** /**
* get html code of a div around a message * get html code of a div around a message
* @param string $sWarnlevel one of error|success|info|warning to get a colored box * @param string $sWarnlevel one of error|success|info|warning to get a colored box
...@@ -643,34 +651,6 @@ class project { ...@@ -643,34 +651,6 @@ class project {
} }
/**
* TODO: fix or delete
* @return type
*/
public function showRepoInfo(){
// return "TODO: fix or delete project::showRepoInfo()<br>";
$sReturn="";
switch ($this->_aPrjConfig["build"]["type"]) {
case "git":
$sKeyfile = dirname(dirname(__file__)) . "/" . $this->_aPrjConfig["build"]["keyfile"];
$sWrapper = dirname(dirname(dirname(dirname(__file__)))) . "/shellscripts/gitsshwrapper.sh";
// $sReturn.=$this->_execAndSend("export GIT_SSH=$sWrapper ; export PKEY=$sKeyfile; git ls-remote --heads " . $this->_aPrjConfig["build"]["ssh"]);
$sGitCmd="git ls-remote --heads " . $this->_aPrjConfig["build"]["ssh"] . " master";
$sReturn.="$sGitCmd<br><pre>";
$sReturn.= shell_exec("export GIT_SSH=$sWrapper ; export PKEY=$sKeyfile; $sGitCmd");
$sReturn."</pre>";
// $sVersioninfo = str_replace("\n", "<br>", shell_exec("cd $sTempDir && git log -1"));
break;
default:
return $this->getBox("error", "Build Type not supported: " . $this->_aPrjConfig["build"]["type"]. $sReturn);
}
return $sReturn;
}
/** /**
* Build a new package for the deployment. It will be put to the queue * Build a new package for the deployment. It will be put to the queue
* of the first active phase (i.e. preview). * of the first active phase (i.e. preview).
...@@ -777,7 +757,8 @@ class project { ...@@ -777,7 +757,8 @@ class project {
// -------------------------------------------------- // --------------------------------------------------
$sReturn.="<h3>cleanup project</h3>"; $sReturn.="<h3>cleanup project</h3>";
$sReturn.=$this->_execAndSend("cd $sTempDir && rm -rf .git"); $sReturn.=$this->_execAndSend("cd $sTempDir && rm -rf .git");
$sReturn.=$this->_execAndSend("cd $sTempDir && rm -rf .svn"); // $sReturn.=$this->_execAndSend("cd $sTempDir && rm -rf .svn");
$sReturn.=$this->_execAndSend("find $sTempDir -type d -name '.svn' -exec rm -rf {} \;");
// public_html must exist // public_html must exist
...@@ -1017,6 +998,30 @@ class project { ...@@ -1017,6 +998,30 @@ class project {
return $sReturn; return $sReturn;
} }
// ----------------------------------------------------------------------
// RENDERING
// ----------------------------------------------------------------------
/**
* return html code for a div with background color based on a checksum of the given text
* @param string $sText text that is used for checksum
* @return string
*/
function getChecksumDiv($sText){
return '<div style="background: '.getChecksumColor($sText). '; height: 3px;"> </div>';
}
/**
* generate css color based on a checksum of the given text
* @param string $sText text that is used for checksum
* @return string
*/
function getChecksumColor($sText, $sFormat="hex"){
$sReturn='';
$s=md5($sText);
return "#" . substr($s, 0, 2) . substr($s, 2, 2) . substr($s, 4, 2);
}
/** /**
* render html for a colored link to any project action * render html for a colored link to any project action
* @param string $sFunction name of the action; one of accept|build|cleanup|deploy|phase * @param string $sFunction name of the action; one of accept|build|cleanup|deploy|phase
...@@ -1124,9 +1129,11 @@ class project { ...@@ -1124,9 +1129,11 @@ class project {
$aDataPhase = $this->getPhaseInfos($sPhase); $aDataPhase = $this->getPhaseInfos($sPhase);
$aData=$aDataPhase[$sPlace]; $aData=$aDataPhase[$sPlace];
if (array_key_exists("ok", $aData) && array_key_exists("version", $aData)) { if (array_key_exists("ok", $aData) && array_key_exists("version", $aData)) {
// TODO: getChecksumDiv anhand der Repo-Versionsnummer - dann kann man beim build auch die Farbe mit dem Repo HEAD vergleichen
$sReturn = ' $sReturn = '
<i class="icon-calendar"></i> Build vom ' . $aData["date"] . '<br> '.$this->getChecksumDiv($aData["version"]).'
<i class="icon-tag"></i> Revision:<br><em>' . $aData["revision"] . '</em><br> <i class="icon-calendar"></i> Build vom ' . date("d.m.Y H:i:s", strtotime($aData["date"])) . '<br>
<a href="#" class="info"><i class="icon-tag"></i> Revision:<span><pre>' . $aData["revision"] . '</pre></span></a><br>
<!-- Anm.: ' . $aTmp[$h]["remark"] . '<br> -->'; <!-- Anm.: ' . $aTmp[$h]["remark"] . '<br> -->';
...@@ -1154,7 +1161,9 @@ class project { ...@@ -1154,7 +1161,9 @@ class project {
</div>'; </div>';
} else { } else {
if (array_key_exists("error", $aData)) { if (array_key_exists("error", $aData)) {
$sReturn.= '<div class="error"><i class="icon-exclamation-sign"></i> FEHLER:<br>' . $aData["error"] . '</div>'; $sReturn.= '<div class="error">'
. '<a href="#" class="info"><i class="icon-exclamation-sign"></i> FEHLER:<span>' . $aData["error"] . '</span></a>'
. '</div>';
} else if (array_key_exists("warning", $aData)) { } else if (array_key_exists("warning", $aData)) {
$sReturn.= '<div class="warning"><i class="icon-info-sign"></i> WARNUNG:<br>' . $aData["warning"] . '</div>'; $sReturn.= '<div class="warning"><i class="icon-info-sign"></i> WARNUNG:<br>' . $aData["warning"] . '</div>';
} else { } else {
...@@ -1197,6 +1206,82 @@ class project { ...@@ -1197,6 +1206,82 @@ class project {
} }
return $sRow2; return $sRow2;
} }
/**
* return html code for the installed version in the repository
* @return string
*/
public function renderRepoInfo(){
// return "TODO: fix or delete project::showRepoInfo()<br>";
$sReturn="";
switch ($this->_aPrjConfig["build"]["type"]) {
case "git":
$sKeyfile = dirname(dirname(__file__)) . "/" . $this->_aPrjConfig["build"]["keyfile"];
$sWrapper = dirname(dirname(dirname(dirname(__file__)))) . "/shellscripts/gitsshwrapper.sh";
// $sReturn.=$this->_execAndSend("export GIT_SSH=$sWrapper ; export PKEY=$sKeyfile; git ls-remote --heads " . $this->_aPrjConfig["build"]["ssh"]);
$sGitCmd="git ls-remote --heads " . $this->_aPrjConfig["build"]["ssh"] . " master";
$sReturn.="$sGitCmd<br><pre>";
$sReturn.= shell_exec("export GIT_SSH=$sWrapper ; export PKEY=$sKeyfile; $sGitCmd");
$sReturn."</pre>";
// $sVersioninfo = str_replace("\n", "<br>", shell_exec("cd $sTempDir && git log -1"));
break;
default:
return $this->getBox("error", "Build Type not supported: " . $this->_aPrjConfig["build"]["type"]. $sReturn);
}
return $sReturn;
}
/**
* return html code for the puilt package and their usage
* @return string
*/
public function renderVersionUsage(){
$sReturn=false;
$sRowHead1=false;
$sRowHead2=false;
if (!count($this->getVersions())){
return $this->getBox("info", "Für dieses Projekt wurde noch kein Paket erzeugt.");
}
foreach ($this->getActivePhases() as $sPhase){
$sRowHead1.='<th class="'.$sPhase.'" colspan="'.count($this->_aPlaces).'">'.$sPhase.'</th>';
$sRowHead2.=$this->renderPlacesAsTd($sPhase);
}
foreach($this->getVersions() as $sVersion => $aData){
$sReturn.='<tr>';
$sReturn.='<td>'.$sVersion.'</td>';
foreach ($this->getActivePhases() as $sPhase){
foreach (array_keys($this->_aPlaces) as $sPlace){
$bFound=false;
foreach ($aData as $i=>$aPhaseUsage){
if ($aPhaseUsage["phase"]==$sPhase
&& $aPhaseUsage["place"]==$sPlace
) $bFound=true;
}
if ($bFound) {
$sReturn.='<td class="'.$sPhase.'" style="text-align: center;">X</td>';
} else {
$sReturn.='<td> </td>';
}
}
}
$sReturn.='</tr>';
}
$sReturn='Die nachfolgende Tabelle zeigt die bereits erzeugten Pakete an und wo diese verwendet werden.'
. '<table>'
. '<thead><tr><td>Version</td>'
. $sRowHead1
. '</tr><tr><td>'
. $sRowHead2
. '</tr></thead>'
. '<tbody>'
. $sReturn
. '</tbody>'
. '</table>';
return $sReturn;
}
} }
......
...@@ -113,7 +113,7 @@ class projectlist { ...@@ -113,7 +113,7 @@ class projectlist {
$oPrj = new project($sPrj); $oPrj = new project($sPrj);
$sPrjFilter.='<option value="'.$sPrj.'">'.$oPrj->getLabel().'</option>'; $sPrjFilter.='<option value="'.$sPrj.'">'.$oPrj->getLabel().'</option>';
$aPrjData = $oPrj->getAllPhaseInfos(); // $aPrjData = $oPrj->getAllPhaseInfos();
$sOutPhases = ''; $sOutPhases = '';
...@@ -139,6 +139,15 @@ class projectlist { ...@@ -139,6 +139,15 @@ class projectlist {
</tr>'; </tr>';
} }
if ($sOut) if ($sOut)
$sRowHead1='';
$sRowHead2='';
// $oPrj existiert noch ...
foreach (array_keys($oPrj->getPhases()) as $sPhase){
// Anzahl colspan ist hartcodiert :-/
$sRowHead1.='<th class="'.$sPhase.'" colspan="3">'.$sPhase.'</th>';
$sRowHead2.=$oPrj->renderPlacesAsTd($sPhase);
}
$sOut = ' $sOut = '
Projekt-Filter: Projekt-Filter:
<select onchange="$(\'.'.$sTrClass.'\').hide(); $(\'.\' + this.value).show();"> <select onchange="$(\'.'.$sTrClass.'\').hide(); $(\'.\' + this.value).show();">
...@@ -154,20 +163,10 @@ class projectlist { ...@@ -154,20 +163,10 @@ class projectlist {
<thead> <thead>
<tr> <tr>
<th class="prj" rowspan="2">Projekt<br><br></th> <th class="prj" rowspan="2">Projekt<br><br></th>
<th class="preview '.$sColClass.'" colspan="3" >Preview</th> '.$sRowHead1.'
<th class="stage '.$sColClass.'" colspan="3" >Stage</th>
<th class="live '.$sColClass.'" colspan="3" >Live</th>
</tr> </tr>
<tr> <tr>
<td class="preview '.$sColClass.'">Queue</td> '.$sRowHead2.'
<td class="preview '.$sColClass.'">Repo</td>
<td class="preview '.$sColClass.'">Installiert</td>
<td class="stage '.$sColClass.'">Queue</td>
<td class="stage '.$sColClass.'">Repo</td>
<td class="stage '.$sColClass.'">Installiert</td>
<td class="live '.$sColClass.'">Queue</td>
<td class="live '.$sColClass.'">Repo</td>
<td class="live '.$sColClass.'">Installiert</td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment