mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Update
This commit is contained in:
		@@ -8,48 +8,46 @@ class CorpusAnalysisClient {
 | 
			
		||||
    socket.on("pj_corpus_analysis_init", (response) => {
 | 
			
		||||
      if (response.code === 200) {
 | 
			
		||||
        console.log(`pj_corpus_analysis_init: ${response.code} - ${response.msg}`);
 | 
			
		||||
        if (this.callbacks.init != undefined) {this.callbacks.init(response.msg);}
 | 
			
		||||
        if (this.callbacks.init != undefined) {this.callbacks.init(response.payload);}
 | 
			
		||||
        if (this.displays.init != undefined) {this.displays.init.setVisibilityByStatus("success");}
 | 
			
		||||
      } else {
 | 
			
		||||
        if (this.displays.init != undefined) {
 | 
			
		||||
          if (this.displays.init.errorContainer != undefined) {this.displays.init.errorContainer.innerHTML = `<p class="red-text"><i class="material-icons tiny">error</i> Error ${response.code}: ${response.msg}</p>`;}
 | 
			
		||||
          this.displays.init.setVisibilityByStatus("error");
 | 
			
		||||
        }
 | 
			
		||||
        console.error(`pj_corpus_analysis_init: ${response.code} - ${response.msg}`);
 | 
			
		||||
        errorText = `Error ${response.payload.code} - ${response.payload.msg}`;
 | 
			
		||||
        if (this.displays.init.errorContainer != undefined) {this.displays.init.errorContainer.innerHTML = `<p class="red-text"><i class="material-icons tiny">error</i> ${errorText}</p>`;}
 | 
			
		||||
        if (this.displays.init != undefined) {this.displays.init.setVisibilityByStatus("error");}
 | 
			
		||||
        console.error(`pj_corpus_analysis_init: ${errorText}`);
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    socket.on("pj_corpus_analysis_query", (response) => {
 | 
			
		||||
      var errorText;
 | 
			
		||||
 | 
			
		||||
      if (response.code === 200) {
 | 
			
		||||
        console.log(`pj_corpus_analysis_query: ${response.code} - ${response.msg}`);
 | 
			
		||||
        if (this.callbacks.query != undefined) {this.callbacks.query(response.data);}
 | 
			
		||||
        if (this.callbacks.query != undefined) {this.callbacks.query(response.payload);}
 | 
			
		||||
        if (this.displays.query != undefined) {this.displays.query.setVisibilityByStatus("success");}
 | 
			
		||||
      } else {
 | 
			
		||||
        nopaque.flash("error", `Error ${response.code}: ${response.msg}`);
 | 
			
		||||
        if (this.displays.query.errorContainer != undefined) {this.displays.query.errorContainer.innerHTML = `<p class="red-text"><i class="material-icons tiny">error</i> Error ${response.code}: ${response.msg}</p>`;}
 | 
			
		||||
        errorText = `Error ${response.payload.code} - ${response.payload.msg}`;
 | 
			
		||||
        nopaque.flash("error", errorText);
 | 
			
		||||
        if (this.displays.query.errorContainer != undefined) {this.displays.query.errorContainer.innerHTML = `<p class="red-text"><i class="material-icons tiny">error</i> ${errorText}</p>`;}
 | 
			
		||||
        if (this.displays.query != undefined) {this.displays.query.setVisibilityByStatus("error");}
 | 
			
		||||
        console.error(`pj_corpus_analysis_query: ${response.code} - ${response.msg}`)
 | 
			
		||||
        console.error(`pj_corpus_analysis_query: ${errorText}`);
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    socket.on("pj_corpus_analysis_query_results", (response) => {
 | 
			
		||||
        if (this.callbacks.query_results != undefined) {this.callbacks.query_results(response);}
 | 
			
		||||
        if (this.callbacks.query_results != undefined) {this.callbacks.query_results(response.payload);}
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  init() {
 | 
			
		||||
    if (this.displays.init) {
 | 
			
		||||
      if (this.displays.init.errorContainer != undefined) {this.displays.init.errorContainer.innerHTML == "";}
 | 
			
		||||
      this.displays.init.setVisibilityByStatus("waiting");
 | 
			
		||||
    }
 | 
			
		||||
    if (this.displays.init.errorContainer != undefined) {this.displays.init.errorContainer.innerHTML == "";}
 | 
			
		||||
    if (this.displays.init != undefined) {this.displays.init.setVisibilityByStatus("waiting");}
 | 
			
		||||
    this.socket.emit("pj_corpus_analysis_init", this.corpusId);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  query(query) {
 | 
			
		||||
    if (this.displays.query) {
 | 
			
		||||
      if (this.displays.query.errorContainer != undefined) {this.displays.query.errorContainer.innerHTML == "";}
 | 
			
		||||
      this.displays.query.setVisibilityByStatus("waiting");
 | 
			
		||||
    }
 | 
			
		||||
    if (this.displays.query.errorContainer != undefined) {this.displays.query.errorContainer.innerHTML == "";}
 | 
			
		||||
    if (this.displays.query != undefined) {this.displays.query.setVisibilityByStatus("waiting");}
 | 
			
		||||
    nopaque.socket.emit("pj_corpus_analysis_query", query);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user