mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	A lot of database changes and add options to change notification level
This commit is contained in:
		@@ -43,13 +43,6 @@ nopaque.socket.init = function() {
 | 
			
		||||
    var patch;
 | 
			
		||||
 | 
			
		||||
    patch = JSON.parse(msg);
 | 
			
		||||
    for (operation of patch) {
 | 
			
		||||
      /* "/corpusId/valueName" -> ["corpusId", "valueName"] */
 | 
			
		||||
      pathArray = operation.path.split("/").slice(1);
 | 
			
		||||
      if (operation.op === "replace" && pathArray[1] === "status") {
 | 
			
		||||
        nopaque.flash(`<i class="left material-icons">book</i>[<a href="/jobs/${pathArray[0]}">${nopaque.corpora[pathArray[0]].title}</a>] New status: ${operation.value}`);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    nopaque.corpora = jsonpatch.apply_patch(nopaque.corpora, patch);
 | 
			
		||||
    for (let subscriber of nopaque.corporaSubscribers) {subscriber._update(patch);}
 | 
			
		||||
  });
 | 
			
		||||
@@ -58,14 +51,17 @@ nopaque.socket.init = function() {
 | 
			
		||||
    var patch;
 | 
			
		||||
 | 
			
		||||
    patch = JSON.parse(msg);
 | 
			
		||||
    for (operation of patch) {
 | 
			
		||||
      /* "/jobId/valueName" -> ["jobId", "valueName"] */
 | 
			
		||||
      pathArray = operation.path.split("/").slice(1);
 | 
			
		||||
      if (operation.op === "replace" && pathArray[1] === "status") {
 | 
			
		||||
        nopaque.flash(`<i class="left material-icons">work</i>[<a href="/jobs/${pathArray[0]}">${nopaque.jobs[pathArray[0]].title}</a>] New status: ${operation.value}`);
 | 
			
		||||
    nopaque.jobs = jsonpatch.apply_patch(nopaque.jobs, patch);
 | 
			
		||||
    if (["all", "end"].includes(nopaque.user.settings.jobStatusSiteNotifications)) {
 | 
			
		||||
      for (operation of patch) {
 | 
			
		||||
        /* "/jobId/valueName" -> ["jobId", "valueName"] */
 | 
			
		||||
        pathArray = operation.path.split("/").slice(1);
 | 
			
		||||
        if (operation.op === "replace" && pathArray[1] === "status") {
 | 
			
		||||
          if (nopaque.user.settings.jobStatusSiteNotifications === "end" && !["complete", "failed"].includes(operation.value)) {continue;}
 | 
			
		||||
          nopaque.flash(`<i class="left material-icons">work</i>[<a href="/jobs/${pathArray[0]}">${nopaque.jobs[pathArray[0]].title}</a>] New status: ${operation.value}`);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    nopaque.jobs = jsonpatch.apply_patch(nopaque.jobs, patch);
 | 
			
		||||
    for (let subscriber of nopaque.jobsSubscribers) {subscriber._update(patch);}
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user