mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Add comment and remove debug code.
This commit is contained in:
parent
6f4b9efa25
commit
565d273dd4
@ -19,6 +19,7 @@ class CorpusList extends List {
|
|||||||
var item, operation, pathArray, valueName;
|
var item, operation, pathArray, valueName;
|
||||||
|
|
||||||
for (operation of patch) {
|
for (operation of patch) {
|
||||||
|
/* "/corpusId/valueName" -> ["corpusId", "valueName"] */
|
||||||
pathArray = operation.path.split("/").slice(1);
|
pathArray = operation.path.split("/").slice(1);
|
||||||
switch(operation.op) {
|
switch(operation.op) {
|
||||||
case "add":
|
case "add":
|
||||||
@ -27,12 +28,10 @@ class CorpusList extends List {
|
|||||||
List.updatePagination(this);
|
List.updatePagination(this);
|
||||||
break;
|
break;
|
||||||
case "remove":
|
case "remove":
|
||||||
if (pathArray.length != 1) {break;}
|
|
||||||
this.remove("id", pathArray[0]);
|
this.remove("id", pathArray[0]);
|
||||||
List.updatePagination(this);
|
List.updatePagination(this);
|
||||||
break;
|
break;
|
||||||
case "replace":
|
case "replace":
|
||||||
if (pathArray.length != 2) {break;}
|
|
||||||
item = this.get("id", pathArray[0])[0];
|
item = this.get("id", pathArray[0])[0];
|
||||||
valueName = pathArray[1];
|
valueName = pathArray[1];
|
||||||
switch(valueName) {
|
switch(valueName) {
|
||||||
|
@ -20,6 +20,7 @@ class JobList extends List {
|
|||||||
statusColor, valueName;
|
statusColor, valueName;
|
||||||
|
|
||||||
for (operation of patch) {
|
for (operation of patch) {
|
||||||
|
/* "/jobId/valueName" -> ["jobId", "valueName"] */
|
||||||
pathArray = operation.path.split("/").slice(1);
|
pathArray = operation.path.split("/").slice(1);
|
||||||
switch(operation.op) {
|
switch(operation.op) {
|
||||||
case "add":
|
case "add":
|
||||||
@ -28,12 +29,10 @@ class JobList extends List {
|
|||||||
List.updatePagination(this);
|
List.updatePagination(this);
|
||||||
break;
|
break;
|
||||||
case "remove":
|
case "remove":
|
||||||
if (pathArray.length != 1) {break;}
|
|
||||||
this.remove("id", pathArray[0]);
|
this.remove("id", pathArray[0]);
|
||||||
List.updatePagination(this);
|
List.updatePagination(this);
|
||||||
break;
|
break;
|
||||||
case "replace":
|
case "replace":
|
||||||
if (pathArray.length != 2) {break;}
|
|
||||||
item = this.get("id", pathArray[0])[0];
|
item = this.get("id", pathArray[0])[0];
|
||||||
valueName = pathArray[1];
|
valueName = pathArray[1];
|
||||||
switch(valueName) {
|
switch(valueName) {
|
||||||
@ -43,16 +42,8 @@ class JobList extends List {
|
|||||||
case "status":
|
case "status":
|
||||||
jobStatusElement = item.elm.querySelector(".status");
|
jobStatusElement = item.elm.querySelector(".status");
|
||||||
status = jobStatusElement.innerHTML;
|
status = jobStatusElement.innerHTML;
|
||||||
if (JobList.STATUS_COLORS.hasOwnProperty(status)) {
|
statusColor = JobList.STATUS_COLORS[status] || JobList.STATUS_COLORS['default'];
|
||||||
statusColor = JobList.STATUS_COLORS[status];
|
newStatusColor = JobList.STATUS_COLORS[operation.value] || JobList.STATUS_COLORS['default'];
|
||||||
} else {
|
|
||||||
statusColor = JobList.STATUS_COLORS['default'];
|
|
||||||
}
|
|
||||||
if (JobList.STATUS_COLORS.hasOwnProperty(operation.value)) {
|
|
||||||
newStatusColor = JobList.STATUS_COLORS[operation.value];
|
|
||||||
} else {
|
|
||||||
newStatusColor = 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;
|
||||||
@ -81,24 +72,12 @@ 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}`;
|
||||||
if (JobList.SERVICE_COLORS.hasOwnProperty(job.service)) {
|
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'];
|
||||||
} else {
|
|
||||||
serviceColor = JobList.SERVICE_COLORS['default'];
|
|
||||||
}
|
|
||||||
if (JobList.SERVICE_ICONS.hasOwnProperty(job.service)) {
|
|
||||||
serviceIcon = JobList.SERVICE_ICONS[job.service];
|
|
||||||
} else {
|
|
||||||
serviceIcon = 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;
|
||||||
if (JobList.STATUS_COLORS.hasOwnProperty(job.status)) {
|
statusColor = JobList.STATUS_COLORS[job.status] || JobList.STATUS_COLORS['default'];
|
||||||
statusColor = JobList.STATUS_COLORS[job.status];
|
|
||||||
} else {
|
|
||||||
statusColor = 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 = "";
|
||||||
@ -114,9 +93,7 @@ class JobList extends List {
|
|||||||
|
|
||||||
this.add(
|
this.add(
|
||||||
[{description: job.description, id: job.id, title: job.title}],
|
[{description: job.description, id: job.id, title: job.title}],
|
||||||
(items) => {
|
function(items) {items[0].elm = jobElement;}
|
||||||
items[0].elm = jobElement;
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user