Add more old functionality

This commit is contained in:
Stephan Porada
2020-08-27 16:12:21 +02:00
parent 64f8f82fe8
commit 73160c8210
9 changed files with 153 additions and 68 deletions

View File

@ -213,8 +213,11 @@ document.addEventListener("DOMContentLoaded", () => {
'#show-meta-data',
'#meta-data-modal',
'#meta-data-modal-content',
'#query-results-create'
'#full-results-create',
'#sub-results-create',
'#full-results-export',
'#sub-results-export',
'#download-results-json'
]);
/**
* Display events: Following event listeners are handleing the
@ -255,19 +258,57 @@ document.addEventListener("DOMContentLoaded", () => {
}
}
};
resultsList.addToSubResults.on
/**
* The following event listeners are handeling the data export.
* 1. Create full-results
* 2. Create sub-results
* 3. Download full-results
* 4. Download sub-results
*/
resultsList.queryResultsCreate.onclick = () => {
resultsList.queryResultsCreate.querySelector('i').classList.toggle('hide');
resultsList.queryResultsCreate.innerText = 'Creating...';
resultsList.queryResultsCreate.insertAdjacentHTML('afterbegin',
resultsList.fullResultsCreate.onclick = () => {
resultsList.fullResultsCreate.querySelector('i').classList.toggle('hide');
resultsList.fullResultsCreate.innerText = 'Creating...';
resultsList.fullResultsCreate.insertAdjacentHTML('afterbegin',
loadingSpinnerHTML);
let dataIndexes = [...Array(results.data.match_count).keys()];
resultsList.notifyClient('get-results', { resultsType: 'full-results',
dataIndexes: [...Array(results.data.match_count).keys()]});
dataIndexes: dataIndexes});
}
resultsList.subResultsCreate.onclick = () => {
let dataIndexes = [];
resultsList.addToSubResultsIdsToShow.forEach((id) => {
dataIndexes.push(id - 1);
});
resultsList.subResultsCreate.querySelector('i').classList.toggle('hide');
resultsList.subResultsCreate.innerText = 'Creating...';
resultsList.subResultsCreate.insertAdjacentHTML('afterbegin',
loadingSpinnerHTML);
resultsList.notifyClient('get-results', { resultsType: 'sub-results',
dataIndexes: dataIndexes});
}
// Open download modal when full results export button is pressed
resultsList.fullResultsExport.onclick = () => {
exportModal.open();
// add onclick to download JSON button and download the file
let downloadResultsJSONElement = document.querySelector('#download-results-json')
downloadResultsJSONElement.onclick = () => {
let filename = results.fullResultsData.createDownloadFilename('matches-results');
results.fullResultsData.addData(results.metaData);
results.fullResultsData.downloadJSONRessource(filename, results.resultsData,
downloadResultsJSONElement)};
}
// Open download modal when sub results export button is pressed
resultsList.fullResultsExport.onclick = () => {
exportModal.open();
// add onclick to download JSON button and download the file
let downloadResultsJSONElement = document.querySelector('#download-results-json')
downloadResultsJSONElement.onclick = () => {
let filename = results.subResultsData.createDownloadFilename('matches-results');
results.subResultsData.addData(results.metaData);
results.subResultsData.downloadJSONRessource(filename, results.resultsData,
downloadResultsJSONElement)};
}
// enable scroll to Top
scrollToTop('.headline', '#menu-scroll-to-top-div');

View File

@ -6,21 +6,14 @@ results.-->
<div class="divider" style="margin-bottom: 10px;"></div>
<div class="row">
<div class="col s12">
<div class="switch">
Sub-Results:
<label>
Off
<input type="checkbox"
id="add-to-sub-results">
<span class="lever"></span>
On
</label>
</div>
<p>Add matches to Sub-Results with the
<i class="material-icons tiny">add</i>
button in the list or inspect view.
</p>
</div>
<div class="col s12 hide" id="sub-results-match-ids-div">
<div class="col s12" id="sub-results-match-ids-div">
<div class="input-field">
<p><span id="nr-marked-matches"></span> matches marked
for Sub-Results:</p>
<p><span id="nr-marked-matches"></span> Added matches:</p>
<textarea id="sub-results-match-ids"
class="materialize-textarea"
disabled>

View File

@ -9,12 +9,13 @@ the selected sub results.-->
<button class="waves-effect
waves-light
btn-flat
disabled
flat-interaction"
type="submit"
id="query-results-create">Create Results
id="full-results-create">Create Results
<i class="material-icons left">build</i>
</button>
<button id="query-results-export"
<button id="full-results-export"
class="waves-effect
waves-light
btn-flat
@ -28,7 +29,7 @@ the selected sub results.-->
<button class="waves-effect
waves-light
btn-flat
hide
disabled
flat-interaction"
type="submit"
id="sub-results-create">Create Sub-Results