Skip to content

Commit

Permalink
Merge pull request #47 from ISISComputingGroup/Ticket5765_remove_EMU_…
Browse files Browse the repository at this point in the history
…unneeded_alarms

Display variable parameters on top of list, Remove duplicates and empty blocks
  • Loading branch information
DominicOram authored Mar 18, 2021
2 parents 1d2cd1d + 5c32f74 commit 21612b3
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions front_end/display_blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ var instrumentState;
var showHidden;
var timeout = 4000;

dictInstPV = {
dictDisplayFirstInstPVs = {
RUNSTATE: 'Run Status',
RUNNUMBER: 'Run Number',
_RBNUMBER: 'RB Number',
_USERNAME: 'User(s)',
TITLE: 'Title',
TITLE: 'Title'
}

dictInstPV = {
TITLEDISP: 'Show Title',
STARTTIME: 'Start Time',
RUNDURATION: 'Total Run Time',
Expand All @@ -22,22 +25,16 @@ dictInstPV = {
GOODFRAMES_PD: 'Good Frames (Period)',
RAWFRAMES: 'Raw Frames (Total)',
RAWFRAMES_PD: 'Raw Frames (Period)',
PERIOD: 'Current Period',
NUMPERIODS: 'Number of Periods',
PERIODSEQ: 'Period Sequence',
BEAMCURRENT: 'Beam Current',
TOTALUAMPS: 'Total Uamps',
COUNTRATE: 'Count Rate',
DAEMEMORYUSED: 'DAE Memory Used',
TOTALCOUNTS: 'Total DAE Counts',
DAETIMINGSOURCE: 'DAE Timing Source',
MONITORCOUNTS: 'Monitor Counts',
MONITORSPECTRUM: 'Monitor Spectrum',
MONITORFROM: 'Monitor From',
MONITORTO: 'Monitor To',
NUMTIMECHANNELS: 'Number of Time Channels',
NUMSPECTRA: 'Number of Spectra',
SHUTTER: 'Shutter Status',
SIM_MODE: 'DAE Simulation mode'
};

Expand All @@ -63,6 +60,8 @@ dictLongerInstPVs = {
function getTitle(title) {
if (title in dictInstPV){
return dictInstPV[title];
} else if (title in dictDisplayFirstInstPVs) {
return dictDisplayFirstInstPVs[title];
}
return title;
}
Expand Down Expand Up @@ -386,20 +385,29 @@ function displayOneBlock(node, block, blockName, linkGraph) {
}

/**
* Adds html elements for a list of block objects to a given node.
* Adds html elements from a list of block objects to a given node.
*
* @param node The parent node.
* @param blocks The list of block objects to display.
* @param linkGraph link to history graph.
* @return The updated node.
*/
function getDisplayBlocks(node, blocks, linkGraph) {
var ignore_pvs = ["1:1:VALUE", "2:1:VALUE", "3:1:VALUE", "1:2:VALUE", "2:2:VALUE", "3:2:VALUE", "BANNER:RIGHT:VALUE", "BANNER:LEFT:VALUE", "BANNER:MIDDLE:VALUE"];
ignore_pvs = [
"1:1:VALUE", "2:1:VALUE", "3:1:VALUE", "1:2:VALUE", "2:2:VALUE", "3:2:VALUE", "BANNER:RIGHT:VALUE", "BANNER:LEFT:VALUE", "BANNER:MIDDLE:VALUE",
"BEAMCURRENT", "PERIOD", "NUMPERIODS", "TOTALUAMPS", "MONITORCOUNTS", "SHUTTER", "RUNSTATE", "RUNNUMBER", "_RBNUMBER", "_USERNAME", "TITLE"
];

for (var key in blocks) {
if (key in dictInstPV) {
continue
}
if (key in dictLongerInstPVs) {
var block = blocks[key];
var label = block["value"] == "" ? "N/A" : block["value"].slice(0,-1);
displayOneBlock(node, blocks[dictLongerInstPVs[key]], label, linkGraph);
if (block["value"] != "") {
var label = block["value"].slice(0, -1);
displayOneBlock(node, blocks[dictLongerInstPVs[key]], label, linkGraph);
}
} else if (ignore_pvs.indexOf(key) >= 0) {
// Do nothing
} else {
Expand All @@ -419,17 +427,25 @@ function getDisplayBlocks(node, blocks, linkGraph) {
*/
function getDisplayRunInfo(node, blocks){
clear(node)
// Add all in order first
for (var key in dictInstPV) {

// Add display-first fixed parameters to the top of the list
for (var key in dictDisplayFirstInstPVs) {
if (key in blocks) {
var block = blocks[key];
displayOneBlock(node, block, getTitle(key), false);
delete blocks[key]
}
}

// Add any left over on to the end
// Add variable parameters
getDisplayBlocks(node, blocks, false);

// Add the rest of the fixed parameters
for (var key in dictInstPV) {
if (key in blocks) {
var block = blocks[key];
displayOneBlock(node, block, getTitle(key), false);
}
}
}

function writeStatus(nodeBlock, status_text) {
Expand Down

0 comments on commit 21612b3

Please sign in to comment.