mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Merge branch 'visualizations-update' of gitlab.ub.uni-bielefeld.de:sfb1288inf/nopaque into visualizations-update
This commit is contained in:
		@@ -25,22 +25,21 @@ class CorpusAnalysisApp {
 | 
				
			|||||||
  async init() {
 | 
					  async init() {
 | 
				
			||||||
    this.disableActionElements();
 | 
					    this.disableActionElements();
 | 
				
			||||||
    this.elements.m.initModal.open();
 | 
					    this.elements.m.initModal.open();
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
    const statusTextElement = this.elements.initModal.querySelector('.status-text');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Setup CQi over SocketIO connection and gather data from the CQPServer
 | 
					 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
 | 
					      // Setup CQi over SocketIO connection and gather data from the CQPServer
 | 
				
			||||||
 | 
					      const statusTextElement = this.elements.initModal.querySelector('.status-text');
 | 
				
			||||||
      statusTextElement.innerText = 'Creating CQi over SocketIO client...';
 | 
					      statusTextElement.innerText = 'Creating CQi over SocketIO client...';
 | 
				
			||||||
      const cqiClient = new cqi.CQiClient('/cqi_over_sio');
 | 
					      const cqiClient = new cqi.CQiClient('/cqi_over_sio');
 | 
				
			||||||
      statusTextElement.innerText += ' Done';
 | 
					      statusTextElement.innerText += ' Done';
 | 
				
			||||||
      statusTextElement.innerHTML += '<br>Waiting for the CQP server...';
 | 
					      statusTextElement.innerHTML = 'Waiting for the CQP server...';
 | 
				
			||||||
      const response = await cqiClient.api.socket.emitWithAck('init', this.corpusId);
 | 
					      const response = await cqiClient.api.socket.emitWithAck('init', this.corpusId);
 | 
				
			||||||
      if (response.code !== 200) {throw new Error();}
 | 
					      if (response.code !== 200) {throw new Error();}
 | 
				
			||||||
      statusTextElement.innerText += ' Done';
 | 
					      statusTextElement.innerText += ' Done';
 | 
				
			||||||
      statusTextElement.innerHTML += '<br>Connecting to the CQP server...';
 | 
					      statusTextElement.innerHTML = 'Connecting to the CQP server...';
 | 
				
			||||||
      await cqiClient.connect('anonymous', '');
 | 
					      await cqiClient.connect('anonymous', '');
 | 
				
			||||||
      statusTextElement.innerText += ' Done';
 | 
					      statusTextElement.innerText += ' Done';
 | 
				
			||||||
      statusTextElement.innerHTML += '<br>Building and receiving corpus data cache from the server (This may take a while)...';
 | 
					      statusTextElement.innerHTML = 'Building and receiving corpus data cache from the server (This may take a while)...';
 | 
				
			||||||
      const cqiCorpus = await cqiClient.corpora.get(`NOPAQUE-${this.corpusId.toUpperCase()}`);
 | 
					      const cqiCorpus = await cqiClient.corpora.get(`NOPAQUE-${this.corpusId.toUpperCase()}`);
 | 
				
			||||||
      statusTextElement.innerText += ' Done';
 | 
					      statusTextElement.innerText += ' Done';
 | 
				
			||||||
      // TODO: Don't do this hgere
 | 
					      // TODO: Don't do this hgere
 | 
				
			||||||
@@ -48,11 +47,21 @@ class CorpusAnalysisApp {
 | 
				
			|||||||
      this.data.cqiClient = cqiClient;
 | 
					      this.data.cqiClient = cqiClient;
 | 
				
			||||||
      this.data.cqiCorpus = cqiCorpus;
 | 
					      this.data.cqiCorpus = cqiCorpus;
 | 
				
			||||||
      this.data.corpus = {o: cqiCorpus};  // legacy
 | 
					      this.data.corpus = {o: cqiCorpus};  // legacy
 | 
				
			||||||
 | 
					      // Initialize extensions
 | 
				
			||||||
 | 
					      for (const extension of Object.values(this.extensions)) {
 | 
				
			||||||
 | 
					        statusTextElement.innerHTML = `Initializing ${extension.name} extension...`;
 | 
				
			||||||
 | 
					        await extension.init();
 | 
				
			||||||
 | 
					        statusTextElement.innerText += ' Done'
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    } catch (error) {
 | 
					    } catch (error) {
 | 
				
			||||||
      let errorString = '';
 | 
					      let errorString = '';
 | 
				
			||||||
      if ('code' in error) {errorString += `[${error.code}] `;}
 | 
					      if ('code' in error && error.code !== undefined && error.code !== null) {
 | 
				
			||||||
 | 
					        errorString += `[${error.code}] `;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      errorString += `${error.constructor.name}`;
 | 
					      errorString += `${error.constructor.name}`;
 | 
				
			||||||
      if ('description' in error) {errorString += `: ${error.description}`;}
 | 
					      if ('description' in error && error.description !== undefined && error.description !== null) {
 | 
				
			||||||
 | 
					        errorString += `: ${error.description}`;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      const errorsElement = this.elements.initModal.querySelector('.errors');
 | 
					      const errorsElement = this.elements.initModal.querySelector('.errors');
 | 
				
			||||||
      const progressElement = this.elements.initModal.querySelector('.progress');
 | 
					      const progressElement = this.elements.initModal.querySelector('.progress');
 | 
				
			||||||
      errorsElement.innerText = errorString;
 | 
					      errorsElement.innerText = errorString;
 | 
				
			||||||
@@ -61,12 +70,6 @@ class CorpusAnalysisApp {
 | 
				
			|||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Initialize extensions
 | 
					 | 
				
			||||||
    for (const extension of Object.values(this.extensions)) {
 | 
					 | 
				
			||||||
      statusTextElement.innerHTML += `<br>Initializing ${extension.name} extension...`;
 | 
					 | 
				
			||||||
      await extension.init();
 | 
					 | 
				
			||||||
      statusTextElement.innerText += ' Done'
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    for (const extensionSelectorElement of this.elements.extensionCards.querySelectorAll('.extension-selector')) {
 | 
					    for (const extensionSelectorElement of this.elements.extensionCards.querySelectorAll('.extension-selector')) {
 | 
				
			||||||
      extensionSelectorElement.addEventListener('click', () => {
 | 
					      extensionSelectorElement.addEventListener('click', () => {
 | 
				
			||||||
        this.elements.m.extensionTabs.select(extensionSelectorElement.dataset.target);
 | 
					        this.elements.m.extensionTabs.select(extensionSelectorElement.dataset.target);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,7 +30,11 @@ cqi.api.APIClient = class APIClient {
 | 
				
			|||||||
    } else if (response.code === 500) {
 | 
					    } else if (response.code === 500) {
 | 
				
			||||||
      throw new Error(`[${response.code}] ${response.msg}`);
 | 
					      throw new Error(`[${response.code}] ${response.msg}`);
 | 
				
			||||||
    } else if (response.code === 502) {
 | 
					    } else if (response.code === 502) {
 | 
				
			||||||
      throw new cqi.errors.lookup[response.payload.code]();
 | 
					      if (response.payload.code in cqi.errors.lookup) {
 | 
				
			||||||
 | 
					        throw new cqi.errors.lookup[response.payload.code]();
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        throw new cqi.errors.CQiError();
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,8 +48,9 @@
 | 
				
			|||||||
{{ super() }}
 | 
					{{ super() }}
 | 
				
			||||||
<div class="modal no-autoinit" id="corpus-analysis-app-init-modal">
 | 
					<div class="modal no-autoinit" id="corpus-analysis-app-init-modal">
 | 
				
			||||||
  <div class="modal-content">
 | 
					  <div class="modal-content">
 | 
				
			||||||
    <h4>Initializing session</h4>
 | 
					    <h4>We are preparing your analysis session</h4>
 | 
				
			||||||
    <p>
 | 
					    <p>
 | 
				
			||||||
 | 
					      Our server works as hard as it can to prepare your analysis session. Please be patient and give it some time.<br>
 | 
				
			||||||
      If initialization takes longer than usual or an error occurs, <a onclick="window.location.reload()" href="#">reload the page</a>.
 | 
					      If initialization takes longer than usual or an error occurs, <a onclick="window.location.reload()" href="#">reload the page</a>.
 | 
				
			||||||
    </p>
 | 
					    </p>
 | 
				
			||||||
    <div class="progress">
 | 
					    <div class="progress">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ Flask==2.1.3
 | 
				
			|||||||
Flask-APScheduler
 | 
					Flask-APScheduler
 | 
				
			||||||
Flask-Assets
 | 
					Flask-Assets
 | 
				
			||||||
Flask-Breadcrumbs
 | 
					Flask-Breadcrumbs
 | 
				
			||||||
Flask-Hashids==1.0.1
 | 
					Flask-Hashids>=1.0.1
 | 
				
			||||||
Flask-HTTPAuth
 | 
					Flask-HTTPAuth
 | 
				
			||||||
Flask-Login
 | 
					Flask-Login
 | 
				
			||||||
Flask-Mail
 | 
					Flask-Mail
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user