Skip to content

Commit

Permalink
setup mongodb docker connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Prom committed Dec 12, 2024
1 parent 9beab2a commit 42a6633
Show file tree
Hide file tree
Showing 10 changed files with 477 additions and 4 deletions.
8 changes: 8 additions & 0 deletions tools/grin/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:

Check warning on line 1 in tools/grin/compose.yml

View workflow job for this annotation

GitHub Actions / yamllint

1:1 [document-start] missing document start "---"
mongo:
image: docker.io/library/mongo
ports:
- '27017:27017'
volumes:
- ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- /data/db

Check failure on line 8 in tools/grin/compose.yml

View workflow job for this annotation

GitHub Actions / yamllint

8:17 [new-line-at-end-of-file] no new line character at the end of file
1 change: 1 addition & 0 deletions tools/grin/docker-entrypoint-initdb.d/load.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gzip -dc /docker/entrypoint-initdb.d/observations-Glycine.json.gz | mongoimport -c observations --jsonArray
Binary file not shown.
5 changes: 3 additions & 2 deletions tools/grin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
</script>

<script src="/assets/js/utils.js"></script>
<script src="./script/db.js"></script>
<div id='menu'>
<div id='item' onmouseout='flattenMenu();' onmouseover='clearTimeout(x);'></div>
</div>
Expand Down Expand Up @@ -143,7 +144,7 @@ <h1 class="uk-margin-remove-top">GRIN Data Explorer</h1>
<button class="uk-button uk-button-primary uk-width-1-1@s uk-width-1-6@l" onclick="collapseAllAccordion()">collapse all</button>
</div>

<form action="results.php" method="post" id="frmGrin" name="frmGrin" onsubmit="return funFormSubmit()">
<form action="./results.html" method="post" id="frmGrin" name="frmGrin" onsubmit="return funFormSubmit()">

<!-- Buttons -->
<!-- <div class="uk-flex uk-flex-center uk-flex -left@s uk-margin-bottom">
Expand Down Expand Up @@ -3267,7 +3268,7 @@ <h1 class="uk-margin-remove-top">GRIN Data Explorer</h1>

<!-- Buttons -->
</form>
<button id="btnTopSubmitMainForm_test" class="uk-button uk-button-primary uk-width-1-1@s uk-width-1-6@l" onclick="funFormSubmit()">Test</button>
<button id="btnTopSubmitMainForm_test" class="uk-button uk-button-primary uk-width-1-1@s uk-width-1-6@l" onclick="fetchData()">Test</button>



Expand Down
109 changes: 109 additions & 0 deletions tools/grin/results.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="../../include/sb_styles.css">
<link rel="stylesheet" type="text/css" href="styles.css">
<script type="text/javascript" src="scripts.js"></script>
<title>GRIN Data Explorer - Results</title>
</head>
<body id="bdyBody">
<div class="sb_middle2">
<div class="sb_main2">
<div id="divGrin">
<div id="divMainFormContainer">
<form action="results_download.php" method="post" id="frmGrin" name="frmGrin">
<input type="hidden" name="inpCultivarsRadio" id="inpCultivarsRadio" value="">
<input type="hidden" name="tareaCultivarsList" id="tareaCultivarsList" value="">

<script>
// Dynamic content rendering based on JavaScript data
const arrRequestSpecifics = [
// Example of request specifics data
{ descriptor_category: 'category1', selected: 'yes', id: 1, descriptor_distincts: '', selected_option: 'Option1', selected_min: 10, selected_max: 20 },
{ descriptor_category: 'category2', selected: 'no', id: 2, descriptor_distincts: '', selected_option: '', selected_min: '', selected_max: '' }
];

arrRequestSpecifics.forEach((item) => {
if (item.selected === 'yes') {
const hiddenInput = document.createElement('input');
hiddenInput.type = 'hidden';
hiddenInput.name = `inpDescriptorCheckbox_${item.descriptor_category}_${item.id}`;
hiddenInput.value = 'yes';
document.getElementById('frmGrin').appendChild(hiddenInput);

if (item.descriptor_distincts) {
const optionInput = document.createElement('input');
optionInput.type = 'hidden';
optionInput.name = `selDescriptorValue_${item.id}`;
optionInput.value = item.selected_option;
document.getElementById('frmGrin').appendChild(optionInput);
} else {
const minInput = document.createElement('input');
minInput.type = 'hidden';
minInput.name = `inpDescriptorValueMin_${item.id}`;
minInput.value = item.selected_min;
document.getElementById('frmGrin').appendChild(minInput);

const maxInput = document.createElement('input');
maxInput.type = 'hidden';
maxInput.name = `inpDescriptorValueMax_${item.id}`;
maxInput.value = item.selected_max;
document.getElementById('frmGrin').appendChild(maxInput);
}
}
});
</script>

<div id="divTitleText" class="top_bar">
GRIN Data Explorer - Results
</div>

<div id="divHelpContainer">
<script>
const resultsFound = 10; // Replace with actual results count
const missingCultivars = '';

if (resultsFound === 0) {
document.write("<p class='clsHelpText'>Sorry, we could not find any results that match your request. Please, <a href='javascript:window.history.back();'>go back</a> and try a different search.</p>");
} else {
document.write(`<p class='clsHelpText'>We found <strong>${resultsFound}</strong> result(s) that match your request.</p>`);

if (missingCultivars) {
document.write(`<p class='clsHelpText'>Sorry, the following cultivars you submitted were not found in our database: ${missingCultivars}</p>`);
}

document.write(`<p class='clsHelpText'>Please note, some traits may contain multiple values.</p>`);
document.write(`<div id='divTopButtonsContainer'><button id='btnTopSubmitMainForm' class='clsButton' type='submit'>Download All Results</button></div>`);

// Generate the results table dynamically
const table = `<table id='tblGRINResults'>
<thead>
<tr>
<th>GRIN Accession</th>
<th>Descriptor</th>
<th>Value</th>
</tr>
</thead>
<tbody>
${Array(resultsFound).fill().map((_, i) => `<tr><td>Accession ${i + 1}</td><td>Descriptor ${i + 1}</td><td>Value ${i + 1}</td></tr>`).join('')}
</tbody>
</table>`;

document.write(table);
document.write(`<div id='divMainButtonsContainer'><button id='btnSubmitMainForm' class='clsButton' type='submit'>Download All Results</button></div>`);
}
</script>
</div>
</form>
</div>
</div>

<div class="sb_bottom" style="position:relative;bottom:0;left:0;z-index:-10000;padding-top:5em;">
<!-- Footer content -->
</div>
</div>
</div>
</body>
</html>
Loading

0 comments on commit 42a6633

Please sign in to comment.