mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Add comment and remove debug code.
This commit is contained in:
		@@ -19,6 +19,7 @@ class CorpusList extends List {
 | 
			
		||||
    var item, operation, pathArray, valueName;
 | 
			
		||||
 | 
			
		||||
    for (operation of patch) {
 | 
			
		||||
      /* "/corpusId/valueName" -> ["corpusId", "valueName"] */
 | 
			
		||||
      pathArray = operation.path.split("/").slice(1);
 | 
			
		||||
      switch(operation.op) {
 | 
			
		||||
        case "add":
 | 
			
		||||
@@ -27,12 +28,10 @@ class CorpusList extends List {
 | 
			
		||||
          List.updatePagination(this);
 | 
			
		||||
          break;
 | 
			
		||||
        case "remove":
 | 
			
		||||
          if (pathArray.length != 1) {break;}
 | 
			
		||||
          this.remove("id", pathArray[0]);
 | 
			
		||||
          List.updatePagination(this);
 | 
			
		||||
          break;
 | 
			
		||||
        case "replace":
 | 
			
		||||
          if (pathArray.length != 2) {break;}
 | 
			
		||||
          item = this.get("id", pathArray[0])[0];
 | 
			
		||||
          valueName = pathArray[1];
 | 
			
		||||
          switch(valueName) {
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,7 @@ class JobList extends List {
 | 
			
		||||
        statusColor, valueName;
 | 
			
		||||
 | 
			
		||||
    for (operation of patch) {
 | 
			
		||||
      /* "/jobId/valueName" -> ["jobId", "valueName"] */
 | 
			
		||||
      pathArray = operation.path.split("/").slice(1);
 | 
			
		||||
      switch(operation.op) {
 | 
			
		||||
        case "add":
 | 
			
		||||
@@ -28,12 +29,10 @@ class JobList extends List {
 | 
			
		||||
          List.updatePagination(this);
 | 
			
		||||
          break;
 | 
			
		||||
        case "remove":
 | 
			
		||||
          if (pathArray.length != 1) {break;}
 | 
			
		||||
          this.remove("id", pathArray[0]);
 | 
			
		||||
          List.updatePagination(this);
 | 
			
		||||
          break;
 | 
			
		||||
        case "replace":
 | 
			
		||||
          if (pathArray.length != 2) {break;}
 | 
			
		||||
          item = this.get("id", pathArray[0])[0];
 | 
			
		||||
          valueName = pathArray[1];
 | 
			
		||||
          switch(valueName) {
 | 
			
		||||
@@ -43,16 +42,8 @@ class JobList extends List {
 | 
			
		||||
            case "status":
 | 
			
		||||
              jobStatusElement = item.elm.querySelector(".status");
 | 
			
		||||
              status = jobStatusElement.innerHTML;
 | 
			
		||||
              if (JobList.STATUS_COLORS.hasOwnProperty(status)) {
 | 
			
		||||
                statusColor = JobList.STATUS_COLORS[status];
 | 
			
		||||
              } 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'];
 | 
			
		||||
              }
 | 
			
		||||
              statusColor = JobList.STATUS_COLORS[status] || JobList.STATUS_COLORS['default'];
 | 
			
		||||
              newStatusColor = JobList.STATUS_COLORS[operation.value] || JobList.STATUS_COLORS['default'];
 | 
			
		||||
              jobStatusElement.classList.remove(statusColor);
 | 
			
		||||
              jobStatusElement.classList.add(newStatusColor);
 | 
			
		||||
              jobStatusElement.innerHTML = operation.value;
 | 
			
		||||
@@ -81,24 +72,12 @@ class JobList extends List {
 | 
			
		||||
    jobElement.classList.add("avatar", "collection-item");
 | 
			
		||||
    jobElement.dataset.id = job.id;
 | 
			
		||||
    jobElement.href = `/jobs/${job.id}`;
 | 
			
		||||
    if (JobList.SERVICE_COLORS.hasOwnProperty(job.service)) {
 | 
			
		||||
      serviceColor = JobList.SERVICE_COLORS[job.service];
 | 
			
		||||
    } 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'];
 | 
			
		||||
    }
 | 
			
		||||
    serviceColor = JobList.SERVICE_COLORS[job.service] || JobList.SERVICE_COLORS['default'];
 | 
			
		||||
    serviceIcon = JobList.SERVICE_ICONS[job.service] || JobList.SERVICE_ICONS['default'];
 | 
			
		||||
    jobServiceElement = document.createElement("i");
 | 
			
		||||
    jobServiceElement.classList.add("circle", "material-icons", "service-icon", serviceColor);
 | 
			
		||||
    jobServiceElement.innerText = serviceIcon;
 | 
			
		||||
    if (JobList.STATUS_COLORS.hasOwnProperty(job.status)) {
 | 
			
		||||
      statusColor = JobList.STATUS_COLORS[job.status];
 | 
			
		||||
    } else {
 | 
			
		||||
      statusColor = JobList.STATUS_COLORS['default'];
 | 
			
		||||
    }
 | 
			
		||||
    statusColor = JobList.STATUS_COLORS[job.status] || JobList.STATUS_COLORS['default'];
 | 
			
		||||
    jobStatusElement = document.createElement("span");
 | 
			
		||||
    jobStatusElement.classList.add("badge", "new", "status", statusColor);
 | 
			
		||||
    jobStatusElement.dataset.badgeCaption = "";
 | 
			
		||||
@@ -114,9 +93,7 @@ class JobList extends List {
 | 
			
		||||
 | 
			
		||||
    this.add(
 | 
			
		||||
      [{description: job.description, id: job.id, title: job.title}],
 | 
			
		||||
      (items) => {
 | 
			
		||||
        items[0].elm = jobElement;
 | 
			
		||||
      }
 | 
			
		||||
      function(items) {items[0].elm = jobElement;}
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user