Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions WebGUI/js/SubsystemLaunch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@


var SubsystemLaunch = SubsystemLaunch || {}; //define SubsystemLaunch namespace
SubsystemLaunch._pendingWriteToEcl = false;

if (typeof Debug == 'undefined')
throw('ERROR: Debug is undefined! Must include Debug.js before SubsystemLaunch.js');
Expand Down Expand Up @@ -1533,7 +1534,7 @@ SubsystemLaunch.create = function() {
if (isFormControl) {
label.setAttribute('for', 'fsm-dropdown');
}
label.textContent = 'FSM:';
label.textContent = 'Run Type:';
label.style.cssText = 'float: left; margin: 3px 0 0 0;';
dropdownContainer.appendChild(label);

Expand Down Expand Up @@ -2599,17 +2600,25 @@ SubsystemLaunch.create = function() {
if(lastLogEntry && lastLogEntry != "")
lastLogEntry = decodeURIComponent(lastLogEntry);

var writeToEcl = false; // updated by checkbox onchange before popup is cleared
Comment thread
github-code-quality[bot] marked this conversation as resolved.
Fixed
SubsystemLaunch._pendingWriteToEcl = false; // reset each time popup opens
Comment on lines +2689 to +2690

DesktopContent.popUpVerification(
/* prompt */
"Please enter a logbook entry summarizing the run:"
"Please enter a logbook entry summarizing the run:" +
"<br><br><label style='cursor:pointer;'><input type='checkbox' " +
"id='SubsystemLaunch-writeToEcl' onchange='SubsystemLaunch._pendingWriteToEcl=this.checked;' /> Write end-of-run summary to ECL</label>"
,
/* continueFunc [optional] */
function (entry) {
Debug.log("User entered logbook entry " + entry);

var writeToEcl = SubsystemLaunch._pendingWriteToEcl || false;
Debug.log("writeToEcl = " + writeToEcl);

//save last entry
lastLogEntry = entry;
localStop(entry);
localStop(entry, writeToEcl);
} //end continueFunc handlere
,
/* val [optional] */ undefined,
Expand Down Expand Up @@ -2638,7 +2647,7 @@ SubsystemLaunch.create = function() {


//===========
function localStop(logEntry) {
function localStop(logEntry, writeToEcl) {
Debug.log("localStop()");
Debug.logv({logEntry});

Expand All @@ -2656,7 +2665,8 @@ SubsystemLaunch.create = function() {
DesktopContent.XMLHttpRequest("StateMachineXgiHandler?" +
"&fsmName=" + _fsmName +
"&StateMachine=Stop", //end get data
"logEntry=" + encodeURIComponent(logEntry), //end post data
"logEntry=" + encodeURIComponent(logEntry) +
"&writeToEcl=" + (writeToEcl ? "1" : "0"), //end post data
function(req) //start handler
{
Debug.log("stop() FSM handler");
Expand Down
27 changes: 18 additions & 9 deletions otsdaq-utilities/ECLWriter/ECLSupervisor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1048,11 +1048,13 @@ xoap::MessageReference ECLSupervisor::MakeSystemLogEntry(xoap::MessageReference
{
SOAPParameters parameters("EntryText");
parameters.addParameter("SubjectText");
parameters.addParameter("SkipFooter");
SOAPUtilities::receive(msg, parameters);
std::string EntryText =
StringMacros::decodeURIComponent(parameters.getValue("EntryText"));
std::string SubjectText =
StringMacros::decodeURIComponent(parameters.getValue("SubjectText"));
bool skipFooter = parameters.getValue("SkipFooter") == "1";

__COUT__ << "Received External Supervisor System Entry " << EntryText << std::endl;
__COUTV__(SubjectText);
Expand Down Expand Up @@ -1087,15 +1089,22 @@ xoap::MessageReference ECLSupervisor::MakeSystemLogEntry(xoap::MessageReference

{
std::stringstream ss;
ss << "Message: " << __E__ << EntryText << __E__ << __E__;
ss << "This was a System Generated Log Entry from '" << CategoryName_
<< "' at host '" << __ENV__("THIS_HOST") << "'" << __E__;
ss << "Active ots users: " << users << __E__;
ss << "USER_DATA: " << __ENV__("USER_DATA") << __E__;
ss << "Uptime: "
<< StringMacros::getTimeDurationString(
CorePropertySupervisorBase::getSupervisorUptime())
<< __E__;
if(skipFooter)
{
ss << EntryText;
}
else
{
ss << "Message: " << __E__ << EntryText << __E__ << __E__;
ss << "This was a System Generated Log Entry from '" << CategoryName_
<< "' at host '" << __ENV__("THIS_HOST") << "'" << __E__;
ss << "Active ots users: " << users << __E__;
ss << "USER_DATA: " << __ENV__("USER_DATA") << __E__;
ss << "Uptime: "
<< StringMacros::getTimeDurationString(
CorePropertySupervisorBase::getSupervisorUptime())
<< __E__;
}
field = Field_t(StringMacros::escapeString(ss.str(), true /* keep white space */),
"text");
fields.push_back(field);
Expand Down