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

initial - temp checkin 2

parent 583a8b40
No related branches found
No related tags found
No related merge requests found
......@@ -3,124 +3,10 @@
Ansicht aller Projekte und Versionen auf den einzelnen Deployment-Phasen
</p>
<style>
.versioninfo{
border: 1px solid #ccc;
padding: 5px;
border-radius: 5px;
margin-bottom: 10px;
/*
border: 2px solid #aaa;
box-shadow: 0 0 10px rgba(0,0,0,0.3);
background: #fff8e0;
*/
}
</style>
[[PHPOUT]]
<hr>
<br><br>
<select>
<option>alle Projekte</option>
<option>Projekt 1</option>
<option>Projekt 2</option>
</select>
<table class="table ">
<thead>
<tr>
<th>Projekt</th>
<th>DEV</th>
<th></th>
<th colspan="2" class="tdstage">STAGE</th>
<th></th>
<th colspan="2" class="tdlive">LIVE</th>
</tr>
<tr>
<td>Name</td>
<td>Git-Version</td>
<td> </td>
<td class="tdstage">queued</td>
<td class="tdstage">in use</td>
<td> </td>
<td class="tdlive">queued</td>
<td class="tdlive">in use</td>
</tr>
</thead>
<tbody>
<!-- Projekt 1 -->
<tr>
<td>Projekt 1</td>
<td>
<div class="versioninfo">
<i class="icon-tag"></i> 234912351345612346<br>
vom 05.08.2013 - 16:35<br>
Axel: hab nochwas verbessert<br>
</div>
<a href="#" class="btn btn-info"><i class=" icon-forward"></i> Deploy to STAGE</a>
</td>
<td>
</td>
<td class="tdstage">
<div class="versioninfo">
keine
</div>
</td>
<td class="tdstage">
<div class="versioninfo">
<i class="icon-tag"></i> 234912351345612346<br>
vom 05.08.2013<br>
Axel: Test-Deployment 2<br>
</div>
<a href="#" class="btn btn-success"><i class=" icon-forward"></i> Deploy to LIVE</a>
</td>
<td>
</td>
<td class="tdlive">keine</td>
<td class="tdlive">
<div class="versioninfo">
<i class="icon-tag"></i> 853624635895706804<br>
vom 29.07.2013<br>
Axel: Test-Deployment 1
</div>
</td>
</tr>
<!-- Projekt 2 -->
<tr>
<td>Projekt 2</td>
<td>
<div class="versioninfo">
<i class="icon-tag"></i> 845635825624355602<br>
</div>
<a href="#" class="btn btn-info"><i class=" icon-forward"></i> Deploy to STAGE</a>
</td>
<td>
</td>
<td class="tdstage">keine</td>
<td class="tdstage">
<div class="versioninfo">
<i class="icon-tag"></i> 920613457963586578<br>
vom 02.08.2013<br>
Markus: Test-Deployment 2<br>
</div>
<a href="#" class="btn btn-success"><i class=" icon-forward"></i> Deploy to LIVE</a>
</td>
<td>
</td>
<td class="tdlive">keine</td>
<td class="tdlive">
<div class="versioninfo">
<i class="icon-tag"></i> 597364579945640982<br>
vom 30.07.2013<br>
Axel: Test-Deployment 1
</div>
</td>
</tr>
</tbody>
</table>
......@@ -117,22 +117,50 @@ class project {
$this->_aData["phases"][$sPhase]=array();
$aTmp=array();
// package for puppet
$sKey="queued";
$sBaseFilename=$this->_sPackageDir."/".$sPhase."/".$this->_aConfig["fileprefix"];
$sJsonfile=$sBaseFilename.".json";
$aTmp[$sKey]=array();
if (file_exists($sJsonfile)){
$sPkgfile=$sBaseFilename.".tgz";
if (file_exists($sPkgfile)){
$aTmp["queued"]=array();
$aTmp["queued"]=json_decode(file_get_contents($sJsonfile), true);
$aTmp["queued"]["infofile"]=$sJsonfile;
$aTmp["queued"]["packagefile"]=$sPkgfile;
$aJson=json_decode(file_get_contents($sJsonfile), true);
if (array_key_exists("date", $aJson)){
$aTmp[$sKey]=json_decode(file_get_contents($sJsonfile), true);
$aTmp[$sKey]["infofile"]=$sJsonfile;
$aTmp[$sKey]["packagefile"]=$sPkgfile;
$aTmp[$sKey]["ok"]=1;
} else {
$aTmp[$sKey]["error"]="info file $sJsonfile exists but is corrupt.";
}
} else {
$aTmp[$sKey]["error"]="package file was not found: $sPkgfile";
}
} else {
$aTmp[$sKey]["error"]="info file was not found: $sJsonfile";
}
// published data
$sKey="deployed";
$aTmp[$sKey]=array();
if ($this->isActivePhase($sPhase)){
$aTmp["deployed"]=array();
// TODO: http Request to json url
$sJsonUrl=$this->_aConfig["phases"][$sPhase]["url"].$this->_aConfig["fileprefix"].".json";
$sJsonData=@file_get_contents($sJsonUrl);
if ($sJsonData){
$aJson=json_decode($sJsonData, true);
if (array_key_exists("date", $aJson)){
$aTmp[$sKey]=$aJson;
$aTmp[$sKey]["infofile"]=$sJsonUrl;
$aTmp[$sKey]["ok"]=1;
} else {
$aTmp[$sKey]["error"]="json url was readable <a href=$sJsonUrl>$sJsonUrl</a> but is corrupt";
}
} else {
$aTmp[$sKey]["error"]="json url not readable <a href=$sJsonUrl>$sJsonUrl</a>";
}
} else {
$aTmp[$sKey]["warning"]="this phase is not active or has no url";
}
$this->_aData["phases"][$sPhase]=$aTmp;
......@@ -147,7 +175,11 @@ class project {
* @return type
*/
public function isActivePhase($sPhase){
return array_key_exists($sPhase, $this->_aConfig["phases"]);
return (
array_key_exists($sPhase, $this->_aConfig["phases"])
&& array_key_exists("url", $this->_aConfig["phases"][$sPhase])
&& $this->_aConfig["phases"][$sPhase]["url"]
);
}
......
......@@ -84,7 +84,6 @@ class projectlist {
return true;
}
// ----------------------------------------------------------------------
// ACTIONS
// ----------------------------------------------------------------------
......@@ -101,62 +100,90 @@ class projectlist {
foreach ($this->_aProjects as $sPrj => $aData) {
$oPrj = new project($aData);
echo "<pre>" . print_r($oPrj->getAllPhaseInfos(), true) . "</pre>";
$aPrjData = $oPrj->getAllPhaseInfos();
echo "<pre>" . print_r($aPrjData, true) . "</pre>";
$sOutPhases = '';
// loop over phases ...
foreach ($this->_aPhases as $sPhase) {
$aTmp = $aPrjData[$sPhase];
$q = "queued";
$d = "deployed";
if (!$oPrj->isActivePhase($sPhase)) {
$sOutPhases.='
<td class="' . $sPhase . '" colspan="2">
<div class="versioninfo">inactive</div>
</td>';
} else {
// (1) queue and deployment have the same version?
$sInfoQ = '';
if (array_key_exists("ok", $aTmp[$q]) && array_key_exists("ok", $aTmp[$d]) && $aTmp[$q]["date"] > " " && $aTmp[$q]["date"] == $aTmp[$d]["date"]) {
$sInfoQ = "deployed";
} else {
if (array_key_exists("ok", $aTmp[$q])) {
$sInfoQ = '<div class="versioninfo">
<i class="icon-calendar"></i> ' . $aTmp[$q]["date"] . '<br>
<i class="icon-tag"></i> ' . $aTmp[$q]["revision"] . '<br>
Anm.: ' . $aTmp[$q]["remark"] . '
</div>';
} else {
if (array_key_exists("error", $aTmp[$q])) {
$sInfoQ = '<div class="error">FEHLER:<br>' . $aTmp[$q]["error"] . '</div>';
}
}
}
// render output
$sOut.='
<tr>
<td class="prj">
<strong>' . $oPrj->getLabel() . '</strong><br>
' . $oPrj->getDescription() . '<br>
<a href="#" class="btn"><i class=" icon-forward"></i> build PREVIEW</a>
</td>
// (2) deployment infos
$sInfoD = '';
if (array_key_exists("ok", $aTmp[$d])){
$sInfoD = '
<i class="icon-calendar"></i> ' . $aTmp[$d]["date"] . '<br>
<i class="icon-tag"></i> ' . $aTmp[$d]["revision"] . '<br>
Anm.: ' . $aTmp[$d]["remark"] . '
';
}
if (array_key_exists("warning", $aTmp[$d])) {
$sInfoD = '<div class="warning">WARNUNG:<br>' . $aTmp[$d]["warning"] . '</div>';
}
if (array_key_exists("error", $aTmp[$d])) {
$sInfoD = '<div class="error">FEHLER:<br>' . $aTmp[$d]["error"] . '</div>';
}
<td class="preview">
// output
$sOutPhases.='
<td class="' . $sPhase . '">
<div class="versioninfo">
' . $sInfoQ . '
</div>
</td>
<td class="preview">
<td class="' . $sPhase . '">
<div class="versioninfo">
<i class="icon-tag"></i> 234912351345612346<br>
vom 05.08.2013 - 16:35<br>
Axel: hab nochwas verbessert<br>
' . $sInfoD . '
</div>
<a href="#" class="btn"><i class=" icon-forward"></i> Deploy to STAGE</a>
</td>
';
}
}
<td class="stage">
<div class="versioninfo">
</div>
</td>
<td class="stage">
<div class="versioninfo">
<i class="icon-tag"></i> ??<br>
vom <br>
[]<br>
</div>
<a href="#" class="btn"><i class=" icon-forward"></i> Deploy to LIVE</a>
</td>
<td class="live">
<div class="versioninfo">
</div>
</td>
<td class="live">
<div class="versioninfo">
<i class="icon-tag"></i> ??<br>
vom <br>
[]<br>
</div>
// render output
$sOut.='
<tr>
<td class="prj">
<strong>' . $oPrj->getLabel() . '</strong><br>
' . $oPrj->getDescription() . '<br>
<a href="#" class="btn"><i class=" icon-forward"></i> build PREVIEW</a>
</td>
</tr>
';
' . $sOutPhases . '
</tr>';
}
if ($sOut)
$sOut = '
<table class="table">
<table class="table" id="tbloverview">
<thead>
<tr>
<th class="prj">Projekt</th>
......@@ -164,6 +191,15 @@ class projectlist {
<th class="stage" colspan="2" >Stage</th>
<th class="live" colspan="2" >Live</th>
</tr>
<tr>
<td></td>
<td class="preview">queue</td>
<td class="preview">deployed</td>
<td class="stage">queue</td>
<td class="stage">deployed</td>
<td class="live">queue</td>
<td class="live">deployed</td>
</tr>
</thead>
<tbody>
' . $sOut . '</tbody></table>';
......
......@@ -14,7 +14,7 @@ $sPackageDir=$sWorkDir."/packages"; // darunter ist je Projekt 1 Verzeichnis - d
// ----------------------------------------------------------------------
$aPhases = array("preview", "stage", "live");
$sUrlStatus="http://[projecturl]/__versioninfo.json";
$sUrlStatus="http://[projecturl]/[project].json";
// ----------------------------------------------------------------------
......@@ -49,7 +49,8 @@ $aProjects=array(
"phases"=>array(
"preview"=>array(
"url"=>"http://preview.scrudu.iml.unibe.ch/"
// "url"=>"http://preview.scrudu.iml.unibe.ch/",
"url"=>"http://localhost/deployment/",
),
"stage"=>array(
"url"=>"http://stage.scrudu.iml.unibe.ch/"
......
{
// Angaben zur Paketierung
"date": "2013-10-09 09:34:12",
"revision": "optional: ausgecheckte Version aus dem Repo/ den Repos",
"remark": "Hinweise in diesem Release: wer hat was aktualisiert/ gefixt o.ä.",
"remark": "Hinweise in diesem Release: wer hat was aktualisiert/ gefixt o.ä."
}
\ No newline at end of file
......@@ -46,6 +46,8 @@
thead{background:#444; color:#eee; font-size: 130%;}
#tbloverview th{width: 25%;}
#tbloverview td{border-left: 1px solid #ccc;}
th.preview{background:#358; color:#eee;}
th.stage{background:#388; color:#eee;}
th.live{background:#383; color: #eee; }
......@@ -53,12 +55,18 @@
.stage{background:#f4ffff; color:#333; background: rgba(230,255,255, 0.7);}
.live{background:#f0fff0; color:#333; background: rgba(240,255,240, 0.7);}
th.tdstage{background:#358; color:#eee;}
th.tdlive{background:#383; color: #eee; }
.tdstage{background:#f4f8ff; color:#333; background: rgba(230,240,255, 0.7);}
.tdlive{background:#f0fff0; color:#333; background: rgba(240,255,240, 0.7);}
.btn-buildpreview{color: #fff; background: #358;background: linear-gradient(#79c,#358);}
.warning{background: #fe8;}
.error{background: #fcc;}
.versioninfo{
border: 0px solid #ccc;
padding: 0px;
border-radius: 5px;
margin-bottom: 10px;
}
body, label, input, button, select, textarea, p, .btn {
font-size: 12px;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment