mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 12:22:47 +00:00 
			
		
		
		
	Use enums where appropriate. This commit includes new migrations that are NOT compatible with older nopaque instances
This commit is contained in:
		@@ -67,30 +67,29 @@ class CorpusDisplay extends RessourceDisplay {
 | 
			
		||||
    let element;
 | 
			
		||||
    let elements;
 | 
			
		||||
 | 
			
		||||
    this.setElements(this.displayElement.querySelectorAll('.corpus-status'), status);
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.analyse-corpus-trigger')
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.corpus-analyse-trigger')
 | 
			
		||||
    for (element of elements) {
 | 
			
		||||
      if (['analysing', 'prepared', 'start analysis'].includes(status)) {
 | 
			
		||||
      if (['BUILT', 'STARTING_ANALYSIS_SESSION', 'RUNNING_ANALYSIS_SESSION', 'CANCELING_ANALYSIS_SESSION'].includes(status)) {
 | 
			
		||||
        element.classList.remove('disabled');
 | 
			
		||||
      } else {
 | 
			
		||||
        element.classList.add('disabled');
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.build-corpus-trigger');
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.corpus-build-trigger');
 | 
			
		||||
    for (element of elements) {
 | 
			
		||||
      if (status === 'unprepared' && Object.values(app.users[this.userId].corpora[this.corpusId].files).length > 0) {
 | 
			
		||||
      if (status === 'UNPREPARED' && Object.values(app.users[this.userId].corpora[this.corpusId].files).length > 0) {
 | 
			
		||||
        element.classList.remove('disabled');
 | 
			
		||||
      } else {
 | 
			
		||||
        element.classList.add('disabled');
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.status');
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.corpus-status');
 | 
			
		||||
    for (element of elements) {
 | 
			
		||||
      element.dataset.status = status;
 | 
			
		||||
      element.dataset.corpusStatus = status;
 | 
			
		||||
    }
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.status-spinner');
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.corpus-status-spinner');
 | 
			
		||||
    for (element of elements) {
 | 
			
		||||
      if (['submitted', 'queued', 'running', 'canceling', 'start analysis', 'stop analysis'].includes(status)) {
 | 
			
		||||
      if (['SUBMITTED', 'QUEUED', 'BUILDING', 'STARTING_ANALYSIS_SESSION', 'CANCELING_ANALYSIS_SESSION'].includes(status)) {
 | 
			
		||||
        element.classList.remove('hide');
 | 
			
		||||
      } else {
 | 
			
		||||
        element.classList.add('hide');
 | 
			
		||||
 
 | 
			
		||||
@@ -57,23 +57,21 @@ class JobDisplay extends RessourceDisplay {
 | 
			
		||||
    let element;
 | 
			
		||||
    let elements;
 | 
			
		||||
 | 
			
		||||
    this.setElements(this.displayElement.querySelectorAll('.job-status'), status);
 | 
			
		||||
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.status');
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.job-status');
 | 
			
		||||
    for (element of elements) {
 | 
			
		||||
      element.dataset.status = status;
 | 
			
		||||
      element.dataset.jobStatus = status;
 | 
			
		||||
    }
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.status-spinner');
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.job-status-spinner');
 | 
			
		||||
    for (element of elements) {
 | 
			
		||||
      if (['complete', 'failed'].includes(status)) {
 | 
			
		||||
      if (['COMPLETED', 'FAILED'].includes(status)) {
 | 
			
		||||
        element.classList.add('hide');
 | 
			
		||||
      } else {
 | 
			
		||||
        element.classList.remove('hide');
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.restart-job-trigger');
 | 
			
		||||
    elements = this.displayElement.querySelectorAll('.job-restart-trigger');
 | 
			
		||||
    for (element of elements) {
 | 
			
		||||
      if (['complete', 'failed'].includes(status)) {
 | 
			
		||||
      if (['COMPLETED', 'FAILED'].includes(status)) {
 | 
			
		||||
        element.classList.remove('hide');
 | 
			
		||||
      } else {
 | 
			
		||||
        element.classList.add('hide');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user