Codestyle.

This commit is contained in:
Patrick Jentsch 2019-09-03 09:07:09 +02:00
parent b904ee1e1c
commit 633bd58087
2 changed files with 37 additions and 17 deletions

View File

@ -41,8 +41,10 @@ class JobList extends List {
case "status": case "status":
jobStatusElement = item.elm.querySelector(".status"); jobStatusElement = item.elm.querySelector(".status");
status = jobStatusElement.innerHTML; status = jobStatusElement.innerHTML;
statusColor = JobList.STATUS_COLORS[status] || JobList.STATUS_COLORS['default']; statusColor = JobList.STATUS_COLORS[status]
newStatusColor = JobList.STATUS_COLORS[operation.value] || JobList.STATUS_COLORS['default']; || JobList.STATUS_COLORS['default'];
newStatusColor = JobList.STATUS_COLORS[operation.value]
|| JobList.STATUS_COLORS['default'];
jobStatusElement.classList.remove(statusColor); jobStatusElement.classList.remove(statusColor);
jobStatusElement.classList.add(newStatusColor); jobStatusElement.classList.add(newStatusColor);
jobStatusElement.innerHTML = operation.value; jobStatusElement.innerHTML = operation.value;
@ -71,12 +73,20 @@ class JobList extends List {
jobElement.classList.add("avatar", "collection-item"); jobElement.classList.add("avatar", "collection-item");
jobElement.dataset.id = job.id; jobElement.dataset.id = job.id;
jobElement.href = `/jobs/${job.id}`; jobElement.href = `/jobs/${job.id}`;
serviceColor = JobList.SERVICE_COLORS[job.service] || JobList.SERVICE_COLORS['default']; serviceColor = JobList.SERVICE_COLORS[job.service]
serviceIcon = JobList.SERVICE_ICONS[job.service] || JobList.SERVICE_ICONS['default']; || JobList.SERVICE_COLORS['default'];
serviceIcon = JobList.SERVICE_ICONS[job.service]
|| JobList.SERVICE_ICONS['default'];
jobServiceElement = document.createElement("i"); jobServiceElement = document.createElement("i");
jobServiceElement.classList.add("circle", "material-icons", "service-icon", serviceColor); jobServiceElement.classList.add(
"circle",
"material-icons",
"service-icon",
serviceColor
);
jobServiceElement.innerText = serviceIcon; jobServiceElement.innerText = serviceIcon;
statusColor = JobList.STATUS_COLORS[job.status] || JobList.STATUS_COLORS['default']; statusColor = JobList.STATUS_COLORS[job.status]
|| JobList.STATUS_COLORS['default'];
jobStatusElement = document.createElement("span"); jobStatusElement = document.createElement("span");
jobStatusElement.classList.add("badge", "new", "status", statusColor); jobStatusElement.classList.add("badge", "new", "status", statusColor);
jobStatusElement.dataset.badgeCaption = ""; jobStatusElement.dataset.badgeCaption = "";

View File

@ -33,7 +33,8 @@
serviceArgsElement.value = this.job.service_args; serviceArgsElement.value = this.job.service_args;
serviceVersionElement = document.getElementById("service-version"); serviceVersionElement = document.getElementById("service-version");
serviceVersionElement.value = this.job.service_version; serviceVersionElement.value = this.job.service_version;
statusColor = JobList.STATUS_COLORS[this.job.status] || JobList.STATUS_COLORS['default']; statusColor = JobList.STATUS_COLORS[this.job.status]
|| JobList.STATUS_COLORS['default'];
statusElement = document.getElementById("status"); statusElement = document.getElementById("status");
statusElement.classList.add(statusColor); statusElement.classList.add(statusColor);
statusElement.innerHTML = this.job.status; statusElement.innerHTML = this.job.status;
@ -69,10 +70,15 @@
M.updateTextFields(); M.updateTextFields();
break; break;
case "status": case "status":
if (operation.value == "complete") {
location.reload();
}
updatedElement = document.getElementById("status"); updatedElement = document.getElementById("status");
status = updatedElement.innerHTML; status = updatedElement.innerHTML;
statusColor = JobList.STATUS_COLORS[status] || JobList.STATUS_COLORS['default']; statusColor = JobList.STATUS_COLORS[status]
newStatusColor = JobList.STATUS_COLORS[operation.value] || JobList.STATUS_COLORS['default']; || JobList.STATUS_COLORS['default'];
newStatusColor = JobList.STATUS_COLORS[operation.value]
|| JobList.STATUS_COLORS['default'];
updatedElement.classList.remove(statusColor); updatedElement.classList.remove(statusColor);
updatedElement.classList.add(newStatusColor); updatedElement.classList.add(newStatusColor);
updatedElement.innerHTML = operation.value; updatedElement.innerHTML = operation.value;
@ -119,6 +125,7 @@
</div> </div>
</div> </div>
</div> </div>
<span class="card-title">Ressource allocations</span> <span class="card-title">Ressource allocations</span>
<div class="row"> <div class="row">
<div class="col s12 m6"> <div class="col s12 m6">
@ -134,6 +141,7 @@
</div> </div>
</div> </div>
</div> </div>
<span class="card-title">Service informations</span> <span class="card-title">Service informations</span>
<div class="row"> <div class="row">
<div class="col s12 m4"> <div class="col s12 m4">
@ -155,6 +163,8 @@
</div> </div>
</div> </div>
</div> </div>
<span class="card-title">Input files</span>
<p> <p>
{% for file in files %} {% for file in files %}
<a href="{{ url_for('main.job_download', job_id=job.id, file=files[file]['path']) }}" class="waves-effect waves-light btn-small"> <a href="{{ url_for('main.job_download', job_id=job.id, file=files[file]['path']) }}" class="waves-effect waves-light btn-small">