From 203faa4257447f4c27d1b959a8228f7f5c88e3e4 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch
Date: Wed, 12 Jul 2023 11:11:15 +0200
Subject: [PATCH] Remove debug messages and move data inflation into api fn
---
app/static/js/cqi/api/client.js | 6 +++++-
app/static/js/cqi/models/corpora.js | 10 +---------
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/app/static/js/cqi/api/client.js b/app/static/js/cqi/api/client.js
index daf2a401..9b84336d 100644
--- a/app/static/js/cqi/api/client.js
+++ b/app/static/js/cqi/api/client.js
@@ -630,7 +630,11 @@ cqi.api.APIClient = class APIClient {
async ext_corpus_static_data(corpus) {
const fn_name = 'ext_corpus_static_data';
const fn_args = {corpus: corpus};
- return await this.#request(fn_name, fn_args);
+ let compressedEncodedData = await this.#request(fn_name, fn_args);
+ let encodedData = pako.inflate(compressedEncodedData);
+ let textDecoder = new TextDecoder();
+ let data = textDecoder.decode(encodedData);
+ return JSON.parse(data);
}
/**
diff --git a/app/static/js/cqi/models/corpora.js b/app/static/js/cqi/models/corpora.js
index 2b271811..8128c47f 100644
--- a/app/static/js/cqi/models/corpora.js
+++ b/app/static/js/cqi/models/corpora.js
@@ -138,15 +138,7 @@ cqi.models.corpora.CorpusCollection = class CorpusCollection extends cqi.models.
/************************************************************************
* Custom additions for nopaque *
************************************************************************/
- // returnValue.static_data = await this.client.api.ext_corpus_static_data(corpusName);
- let tmp = await this.client.api.ext_corpus_static_data(corpusName);
- console.log(tmp);
- let inflated = pako.inflate(tmp);
- console.log(inflated);
- let decoder = new TextDecoder('utf-8');
- console.log(decoder);
- let decoded = decoder.decode(inflated);
- returnValue.static_data = JSON.parse(decoded);
+ returnValue.static_data = await this.client.api.ext_corpus_static_data(corpusName);
return returnValue;
}