Skip to content

Commit

Permalink
updated equipment list heading 'update' to 'parse', made parser confi…
Browse files Browse the repository at this point in the history
…g saving characteristics more robust with respect to entering and exiting parseOnlyMode
  • Loading branch information
zachmart committed May 7, 2015
1 parent 6cc11e3 commit e4bcabe
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 15 deletions.
32 changes: 24 additions & 8 deletions grails-app/assets/javascripts/parser/ParserUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ function ParserUI(parsingController){
this.handleFirstPlateCellRangeChange = function(){
var selectedCellRange = _self.getFirstPlateCellRange();


try {
_self.parsingController.selectCells(selectedCellRange);
} catch (error){
Expand Down Expand Up @@ -1034,13 +1035,25 @@ function ParserUI(parsingController){
};

this.handleSaveAsConfig = function(){
try {
_self.parsingController.saveAsParsingConfigToServer();
} catch (error){
_self.displayError(error);
if (_self.parseOnlyModeOn){
_self.switchOutOfParseOnlyMode();
} else {
try {
_self.parsingController.saveAsParsingConfigToServer();
} catch (error){
_self.displayError(error);
}
}
};

this.switchSaveAsButtonToModifyAsNewParsingConfig = function(){
saveAsConfigButton.innerHTML = "Modify as new Parsing Configuration";
};

this.switchSaveAsButtonBackToSaveAs = function(){
saveAsConfigButton.innerHTML = "Save As";
};



this.switchToParseOnlyMode = function(){
Expand All @@ -1056,6 +1069,7 @@ function ParserUI(parsingController){
addFeatureButton.style.display = "none";
deleteFeatureButton.style.display = "none";

_self.switchSaveAsButtonToModifyAsNewParsingConfig();
_self.parseOnlyModeOn = true;
};

Expand All @@ -1067,11 +1081,12 @@ function ParserUI(parsingController){
firstPlateCellRangeElement = switchSpanToTextInput(firstPlateCellRangeElement);
featureCellRangeElement = switchSpanToTextInput(featureCellRangeElement);
featureCategoryElement = switchSpanToTextInput(featureCategoryElement);
applyFirstPlateButton.style.display = "block";
newFeatureButton.style.display = "block";
addFeatureButton.style.display = "block";
deleteFeatureButton.style.display = "block";
applyFirstPlateButton.style.display = "inline";
newFeatureButton.style.display = "inline";
addFeatureButton.style.display = "inline";
deleteFeatureButton.style.display = "inline";

_self.switchSaveAsButtonBackToSaveAs();
_self.parseOnlyModeOn = false;
};

Expand All @@ -1080,6 +1095,7 @@ function ParserUI(parsingController){
function switchTextInputToSpan(element){
var span = document.createElement("span");
span.innerHTML = element.value;
span.id = element.id;
$(element).replaceWith(span);
return span;
}
Expand Down
24 changes: 18 additions & 6 deletions grails-app/assets/javascripts/parser/ParsingController.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,7 @@ function ParsingController(){

_self.createOrUpdateParsingConfig();
} else if (oldStage === ParsingController.PLATE){
if (!_self.parsingConfig.plate){
throw new ParsingControllerError(ParsingControllerError.PLATE_NOT_DEFINED,
"leave plate stage",
"general",
"change stages");
}

} else if (oldStage === ParsingController.FEATURES){

} else if (oldStage === ParsingController.EXPERIMENT) {
Expand Down Expand Up @@ -140,6 +135,13 @@ function ParsingController(){

_self.selectCells = selectCellsPlates;
} else if (newStage === ParsingController.FEATURES){
if (!_self.parsingConfig.plate){
throw new ParsingControllerError(ParsingControllerError.PLATE_NOT_DEFINED,
"leave plate stage",
"general",
"change stages");
}

// fill the listing of features in the UI and clear fields like for new
// feature
if (_self.parsingConfig){
Expand All @@ -158,6 +160,13 @@ function ParsingController(){
_self.parserUI.loadFeatureList(_self.parsingConfig.getFeatureNames());
_self.selectCells = selectCellsFeatures;
} else if (newStage === ParsingController.EXPERIMENT) {
if (!_self.parsingConfig.plate){
throw new ParsingControllerError(ParsingControllerError.PLATE_NOT_DEFINED,
"leave plate stage",
"general",
"change stages");
}

if (!_self.parserUI.getParsingID()){
throw new ParsingControllerError(
ParsingControllerError.PARSING_CONFIG_NOT_SAVED_TO_SERVER,
Expand Down Expand Up @@ -437,6 +446,7 @@ function ParsingController(){
_self.parserUI.displayMessage("Your assay machine output file data was "+
"successfully stored on server.");
_self.parserUI.disableSaveButton();
_self.parserUI.switchToParseOnlyMode();
}
});

Expand Down Expand Up @@ -558,6 +568,8 @@ function ParsingController(){
serverCommunicator.saveParsingConfigToServer(_self.parsingConfig,
ServerCommunicator.SAVE_NEW,
null);
_self.parserUI.enableSaveButton();
window.canUpdate = true;
};

_self.saveConfigToServerCallback = function(response){
Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/equipment/index.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

<g:sortableColumn property="dateCreated" title="${message(code: 'equipment.date.label', default: 'Date')}" />

<th>Update</th>
<th>Parse</th>
<th>Delete</th>

</tr>
Expand Down

0 comments on commit e4bcabe

Please sign in to comment.