Skip to content

Commit

Permalink
Think I got most of the bugs which could mess with live demo
Browse files Browse the repository at this point in the history
  • Loading branch information
cscully-allison committed Nov 14, 2019
1 parent f25f3d0 commit 547d647
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 58 deletions.
14 changes: 10 additions & 4 deletions Frontend/HQ_Frontend/src/ConfigParentView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ConfigParentView extends React.Component {
this.addTest = this.addTest.bind(this);
this.deleteTest = this.deleteTest.bind(this);
this.gotoNextPage = this.gotoNextPage.bind(this);
this.gotoPreviousPage = this.gotoPreviousPage.bind(this);
this.postTestConfigs = this.postTestConfigs.bind(this);
this.pullMetadata = this.pullMetadata.bind(this);

Expand Down Expand Up @@ -164,7 +165,7 @@ class ConfigParentView extends React.Component {
}
).then((json) => {
var data = json[selectedDataStream].map((x) => {
if( x['y'] === 'null'){
if( x['y'] === 'null' || x['y'] == -9999){
x['y'] = null;
}
x['x'] = new Date(Date.parse(x['x']))
Expand Down Expand Up @@ -282,10 +283,11 @@ class ConfigParentView extends React.Component {
//store what tests have tests configured
let testedCols = [];
for(var key in this.allTests){
testedCols.push(key);
if(this.allTests[key].length !== 0){
testedCols.push(key);
}
}

console.log(testedCols);

sessionStorage.setItem('testedCols', JSON.stringify(testedCols));

Expand All @@ -311,6 +313,10 @@ class ConfigParentView extends React.Component {
/*PreviousProgressBar(2);*/
}

gotoPreviousPage(){
window.PreviousProgressBar(2);
}

render() {

return (
Expand Down Expand Up @@ -343,7 +349,7 @@ class ConfigParentView extends React.Component {
</div>
<div className="row p-3 text-center">
<div className="col-sm">
<button className="btn btn-secondary" onClick={() => {}}> Previous </button>
<button className="btn btn-secondary" onClick={this.gotoPreviousPage}> Previous </button>
</div>
<div className="col-sm">
<button className="btn btn-success" disabled={this.state.continueDisabled} id="nextTaskStep3" onClick={this.gotoNextPage}> Continue > </button>
Expand Down
1 change: 1 addition & 0 deletions Frontend/HQ_Frontend/src/ReusableChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ReusableChart extends React.Component {
this.colors = ["#c43a31","#b47631","#1F7077","#269834"]
}


render(){
let charts = this.props.data.map((datastream, index) => {
let color = index % 4;
Expand Down
6 changes: 5 additions & 1 deletion Frontend/HQ_Frontend/static/js/MultiStepController.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ window.NextProgressBar = function(NextStep) {
}

else{
console.log(NextStep)
$('#StepPlaceholder').load("/view/SetStep/Step_" + NextStep, function(){
if(NextStep === 3){
loadTestConfigComponents();
Expand Down Expand Up @@ -60,7 +61,10 @@ function PreviousProgressBar(PreviousStep) {
currentTask.removeClass("active");
}

if(NextStep === 5){
if(PreviousStep === 1){
window.location.href = '/';
}
else if(PreviousStep === 5){
$('#StepPlaceholder').load(`/view/flagReview/${sessionStorage.sessionId}?colName=${encodeURIComponent(JSON.parse(sessionStorage.testedCols)[0])}&indexCol=${encodeURIComponent(sessionStorage.indexCol)}`);
}
else{
Expand Down
46 changes: 2 additions & 44 deletions Frontend/HQ_Frontend/static/js/Script.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,49 +103,6 @@ function stepThreeCleanup(){
//upload selected data cols for stats analysis
}

function SetMeta(name, item1, item2) {
$('#btnMeta').prop('disabled', false);
$('#btnAddTest').prop('disabled', false);
$('#metaTitle').text(name);
lower = item1;
upper = item2;
$('#tbMeta1').val(item1);
$('#tbMeta2').val(item2);
var item = "Name : " + name + "\nTempLower : " + item1 + "\nTempUpper : " + item2;
var $meta = $("#tbMeta");
$meta.val(item);
setTest();
$.get('/api/save/' + lower + '/' + upper);
$('#modalMeta').modal('hide');
}

function AddTest() {
var $test = $('#selectTest');
var num = $test.children().length;
num++;
var item = "<option value=\"Test_" + num + "\">Test_" + num + "</option>";
$test.append(item);
setValues();
$('#modalTest').modal('hide');
$('#btnModTest').prop('disabled', false);
$('#btnRmvTest').prop('disabled', false);
$('#nextTaskStep3').prop('disabled', false);
}

function RemoveTest() {
var $test = $('#selectTest');
var selectedItems = $test.val() || [];

for (var i = 0; i < selectedItems.length; i++) {
$test.find('[value="' + selectedItems[i] + '"]').remove();
}

if ($test.children().length === 0) {
$('#btnModTest').prop('disabled', true);
$('#btnRmvTest').prop('disabled', true);
$('#nextTaskStep3').prop('disabled', true);
}
}

function queryStatus() {
let endpoint = "http://localhost:8085/test/result/"
Expand All @@ -161,7 +118,8 @@ function queryStatus() {
else{
window.csv = data['csv'];
$('#headerTest').text("Test Complete!");
$('#csv-btn').prop('disabled', false);
$('#nextTask').prop('disabled', false);

}
})
}, 1000);
Expand Down
2 changes: 1 addition & 1 deletion Frontend/HQ_Frontend/static/js/bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Frontend/HQ_Frontend/static/js/flagReview.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $('#right').on('click', function(){

//construct the endpoint of our next column
//and reload page
let endpoint = `/view/flagReview/${sessionStorage.sessionId}?colName=${encodeURIComponent(JSON.parse(sessionStorage.dataCols)[col])}&indexCol=${encodeURIComponent(sessionStorage.indexCol)}`
let endpoint = `/view/flagReview/${sessionStorage.sessionId}?colName=${encodeURIComponent(JSON.parse(sessionStorage.testedCols)[col])}&indexCol=${encodeURIComponent(sessionStorage.indexCol)}`
$('#StepPlaceholder').load(endpoint);

//update our current column in persistent memory
Expand All @@ -57,7 +57,7 @@ $('#right').on('click', function(){
//bind new subpage to go back to previous
$('#left').on('click', function(){
col = manageViewCol(FRConst.PREVIOUS, parseInt(sessionStorage.getItem('currentCol')));
let endpoint = `/view/flagReview/${sessionStorage.sessionId}?colName=${encodeURIComponent(JSON.parse(sessionStorage.dataCols)[col])}&indexCol=${encodeURIComponent(sessionStorage.indexCol)}`
let endpoint = `/view/flagReview/${sessionStorage.sessionId}?colName=${encodeURIComponent(JSON.parse(sessionStorage.testedCols)[col])}&indexCol=${encodeURIComponent(sessionStorage.indexCol)}`
$('#StepPlaceholder').load(endpoint);

sessionStorage.setItem('currentCol', col);
Expand Down
3 changes: 1 addition & 2 deletions Frontend/HQ_Frontend/templates/Step_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<div class="card-body">
<div class="text-center"><h4>Welcome to the CUAHSI HYDROQUALITY client</h4></div>
<p>This tool will guide you through the steps required to quickly and easily create, configure and run common quality control tests on your data.
Please begin double clicking the file drop area below to upload a .csv file containing your data. This tool will guide you throught the following
steps.</p>
Please begin double clicking the file drop area below to upload a .csv file containing your data. Please note that the system, at present only supports CSV files with a single header column.</p>


<form id="my_dropzone" action="http://127.0.0.1:5000/upload/" method='post' class="dropzone">
Expand Down
6 changes: 3 additions & 3 deletions Frontend/HQ_Frontend/templates/Step_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ <h6>Select Date Time Column</h6>
<button class="btn btn-secondary" onclick="PreviousProgressBar(1);">Previous</button>
</div>
<div class="col-sm">
<button class="btn btn-success" disabled id="nextTaskStep2" onclick="manageDataForStep(3);NextProgressBar(3);">Continue ></button>
<button class="btn btn-success" disabled id="nextTaskStep2" onclick="manageDataForStep(3); NextProgressBar(3);">Continue ></button>
</div>


<div class="col-sm">
<!-- <div class="col-sm">
<button class="btn btn-secondary" onclick="NextProgressBar(5);">DEBUG: GO TO END</button>
</div>
</div> -->
</div>
2 changes: 1 addition & 1 deletion Frontend/HQ_Frontend/templates/Step_4.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h4 id="headerTest">Not Running</h4>
<div class="button-group">
<button class="btn btn-success" onclick="RunTest();">Run Tests</button>
<button class="btn btn-secondary" id="previousTask" onclick="PreviousProgressBar(3);">Previous</button>
<button class="btn btn-secondary" id="previousTask" onclick="NextProgressBar(5);">Next</button>
<button class="btn btn-secondary" id="nextTask" disabled onclick="NextProgressBar(5);">Next</button>
</div>
</div>
</div>

0 comments on commit 547d647

Please sign in to comment.