Ultimi ritocchi

This commit is contained in:
Claudio Maggioni 2016-05-25 12:56:37 +02:00
parent c8111bf0d5
commit 6b9c27df1a

View file

@ -68,6 +68,7 @@
};
Processo.prototype.rilasciaRisorsaDaIndice = function(index){
risorse.varie[this.risorseVarie[index].numero]=-1;
aggiornaRisorse(this.risorseVarie[index].numero, "#FF6666");
this.risorseVarie.allocata=false;
this.log("<span style=\"color: violet\">rilasciata</span> risorsa <span style=\"color: orange\">"+this.risorseVarie[index].numero+"</span>");
};
@ -85,6 +86,7 @@
risorse.varie[this.risorseVarie[j].numero] = this.pid;
this.risorseVarie[j].allocata = true;
this.log("<span style=\"color: violet\">allocata</span> risorsa <span style=\"color: orange\">"+this.risorseVarie[j].numero+"</span>");
aggiornaRisorse(this.risorseVarie[j].numero, "#CCFF66");
return true;
}
return false;
@ -279,6 +281,7 @@
}
else if(!vuoto){
scriviLog("<span style=\"color: white\">Coda dei processi pronti vuota.<span>");
aggiornaRisorse(11,"");
vuoto=true;
}
if(interrompi){
@ -333,6 +336,17 @@
cella.innerHTML= risorse.mem[i].pid!=0 ? risorse.mem[i].pid : "";
}
}
function aggiornaRisorse(eseguita, colore){
for(var i=0; i<10; i++){
var cella = document.getElementById("risorse"+i);
if(eseguita==i) cella.style.background=colore;
else if(i==risorse.varie[eseguita])
cella.style.background="lightblue";
else if(risorse.varie[i]!=-1) cella.style.background="orange";
else cella.style.background="white";
cella.innerHTML= risorse.varie[i]!=-1 ? risorse.varie[i] : "";
}
}
function trovaProcessoDaPid(pid){
if(pid===0) window.open(processi[pid].pagine,"","width=600,height=450");
return $.grep(processi, function(e){ return e.pid == pid; })[0];
@ -360,11 +374,18 @@
var tmp="";
for(var i=0;i<processi.length; i++){
tmp+="<option value=\""+processi[i].pid+"\" ";
if($('#listaProc :selected').text()=="Processo "+processi[i].pid)
if(document.getElementById('#proc-pid')!=undefined && parseInt(document.getElementById('#proc-pid').innerHTML)==processi[i].pid)
tmp+="selected=\"selected\"";
tmp+=">Processo "+processi[i].pid+"</option>";
else if(processi[i].pid>0){
tmp+=">Processo "+processi[i].pid
}
else tmp+=">SELEZIONA";
tmp+="</option>";
}
document.getElementById("listaProc").innerHTML=tmp;
aggiornaDettagliProcesso();
}
function aggiornaDettagliProcesso(){
if($('#listaProc :selected').text()!=""&&parseInt($('#listaProc :selected').attr("value"))>0){
var pid=parseInt($('#listaProc :selected').attr("value"));
document.getElementById("proc-pid").innerHTML=pid;
@ -563,6 +584,9 @@
}
.dettagliProc{
background-color: yellow;
}
.risorse{
background: #ccc;
}
@media screen and (max-width: 600px) {
.nav{
@ -598,6 +622,7 @@
<p><a href="#log">LOG</a></p>
<p><a href="#memoria">MEMORIA</a></p>
<p><a href="#dettagliP">DETTAGLI PROC.</a></p>
<p><a href="#risorse">RISORSE</a></p>
</div>
<div class="sections">
<div class="section card teoria">
@ -639,8 +664,8 @@
</div>
<div class="section card dettagliProc">
<a id="dettagliP"><h2>
Seleziona il processo:<br/>
<select id="listaProc">
Dettagli processo<br/>
<select id="listaProc" onchange="aggiornaDettagliProcesso()">
</select>
</h2></a>
<table class="proc">
@ -648,16 +673,26 @@
<th>PID:</th>
<td id="proc-pid"></td>
</tr>
<tr>
<tr>
<th>Stato:</th>
<td id="proc-stato"></td>
</tr>
<tr>
<th>Numero pagine:</th>
<td id="proc-numpagine"></td>
</tr>
<tr>
<th>Numero pagine:</th>
<td id="proc-numpagine"></td>
</tr>
</table>
</div>
<div class="section card risorse" style="text-align: center">
<a id="risorse"><h2>Risorse</h2></a>
<table class="memTable"><tr>
<script>
for(i=0; i<10; i++){
document.write("<td style=\"display: table-cell\" class=\"card memCell\" id=\"risorse"+i+"\">"+i+"</td>")
}
</script>
</tr></table>
</div>
</div>
<div class="footer">
Creato da Claudio Maggioni, Federico Mainetti, Pamela Dardano, Fabio Brambilla