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