2650 |
10 Sep 14 |
nicklas |
var FlowCell = function() |
2650 |
10 Sep 14 |
nicklas |
2 |
{ |
2650 |
10 Sep 14 |
nicklas |
var flowcell = {}; |
2656 |
11 Sep 14 |
nicklas |
var debug = 0; |
2650 |
10 Sep 14 |
nicklas |
var idField; |
2650 |
10 Sep 14 |
nicklas |
var flowCellsAreValid = false; |
2650 |
10 Sep 14 |
nicklas |
7 |
|
3629 |
26 Nov 15 |
nicklas |
var commentsIsValid = false; |
3629 |
26 Nov 15 |
nicklas |
var flowCellIdIsValid = false; |
3691 |
13 Jan 16 |
nicklas |
var autoAnalyzeIsValid = false; |
2650 |
10 Sep 14 |
nicklas |
11 |
|
2650 |
10 Sep 14 |
nicklas |
// Page initialization |
2650 |
10 Sep 14 |
nicklas |
flowcell.initPage = function() |
2650 |
10 Sep 14 |
nicklas |
14 |
{ |
2650 |
10 Sep 14 |
nicklas |
// Step 1 |
2650 |
10 Sep 14 |
nicklas |
Events.addEventHandler('flowcells', 'change', flowcell.flowCellsOnChange); |
2650 |
10 Sep 14 |
nicklas |
Events.addEventHandler('step-1', 'wizard-validate', flowcell.validateStep1); |
2650 |
10 Sep 14 |
nicklas |
Events.addEventHandler('outcomeSuccess', 'click', flowcell.outcomeOnChange); |
2650 |
10 Sep 14 |
nicklas |
Events.addEventHandler('outcomeFailed', 'click', flowcell.outcomeOnChange); |
2650 |
10 Sep 14 |
nicklas |
20 |
|
2650 |
10 Sep 14 |
nicklas |
// Step 2 |
2650 |
10 Sep 14 |
nicklas |
Events.addEventHandler('step-2', 'wizard-initialize', flowcell.initializeStep2); |
2650 |
10 Sep 14 |
nicklas |
Events.addEventHandler('step-2', 'wizard-validate', flowcell.validateStep2); |
4293 |
11 Jan 17 |
nicklas |
Events.addEventHandler('startDate', 'change', Wizard.validateDate); |
3629 |
26 Nov 15 |
nicklas |
Events.addEventHandler('externalId', 'change', flowcell.flowCellIdOnChange); |
3629 |
26 Nov 15 |
nicklas |
Events.addEventHandler('comments', 'change', flowcell.commentsOnChange); |
3691 |
13 Jan 16 |
nicklas |
27 |
|
3691 |
13 Jan 16 |
nicklas |
Events.addEventHandler('autoAnalyzeYes', 'click', flowcell.autoAnalyzeOnChange); |
3691 |
13 Jan 16 |
nicklas |
Events.addEventHandler('autoAnalyzeNo', 'click', flowcell.autoAnalyzeOnChange); |
3691 |
13 Jan 16 |
nicklas |
Events.addEventHandler('clusters', 'change', flowcell.clusterOnChange); |
2650 |
10 Sep 14 |
nicklas |
31 |
|
2650 |
10 Sep 14 |
nicklas |
// Navigation |
2650 |
10 Sep 14 |
nicklas |
Buttons.addClickHandler('gocancel', Wizard.cancelWizard); |
2650 |
10 Sep 14 |
nicklas |
Buttons.addClickHandler('gorestart', Wizard.restartWizard); |
2650 |
10 Sep 14 |
nicklas |
Buttons.addClickHandler('gonext', Wizard.goNextOnClick); |
2650 |
10 Sep 14 |
nicklas |
Buttons.addClickHandler('goregister', Wizard.goRegister); |
2650 |
10 Sep 14 |
nicklas |
37 |
|
2650 |
10 Sep 14 |
nicklas |
// Final registration |
2650 |
10 Sep 14 |
nicklas |
Events.addEventHandler('wizard', 'wizard-submit', flowcell.submit); |
2650 |
10 Sep 14 |
nicklas |
40 |
|
2650 |
10 Sep 14 |
nicklas |
var url = '../FlowCell.servlet?ID='+App.getSessionId(); |
5470 |
05 Jun 19 |
nicklas |
url += '&cmd=GetUnprocessedFlowCells&pipeline='+encodeURIComponent(Data.get('page-data', 'pipeline')); |
2650 |
10 Sep 14 |
nicklas |
Wizard.showLoadingAnimation('Loading flow cells...'); |
2650 |
10 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, flowcell.initializeStep1); |
2650 |
10 Sep 14 |
nicklas |
45 |
} |
2650 |
10 Sep 14 |
nicklas |
46 |
|
2650 |
10 Sep 14 |
nicklas |
47 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.initializeStep1 = function(response) |
2650 |
10 Sep 14 |
nicklas |
49 |
{ |
2650 |
10 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2650 |
10 Sep 14 |
nicklas |
var flowCells = response.flowCells; |
2650 |
10 Sep 14 |
nicklas |
52 |
|
2650 |
10 Sep 14 |
nicklas |
if (flowCells.length > 0) |
2650 |
10 Sep 14 |
nicklas |
54 |
{ |
2650 |
10 Sep 14 |
nicklas |
for (var fcNo=0; fcNo < flowCells.length; fcNo++) |
2650 |
10 Sep 14 |
nicklas |
56 |
{ |
2650 |
10 Sep 14 |
nicklas |
var fc = flowCells[fcNo]; |
2650 |
10 Sep 14 |
nicklas |
var option = flowcell.getOptionForFlowCell(fc, fcNo); |
2650 |
10 Sep 14 |
nicklas |
frm.flowcells[frm.flowcells.length] = option; |
2650 |
10 Sep 14 |
nicklas |
60 |
} |
2650 |
10 Sep 14 |
nicklas |
61 |
} |
2650 |
10 Sep 14 |
nicklas |
else |
2650 |
10 Sep 14 |
nicklas |
63 |
{ |
2650 |
10 Sep 14 |
nicklas |
Wizard.setFatalError('No flow cells available for processing.'); |
2650 |
10 Sep 14 |
nicklas |
return; |
2650 |
10 Sep 14 |
nicklas |
66 |
} |
2650 |
10 Sep 14 |
nicklas |
67 |
|
2650 |
10 Sep 14 |
nicklas |
Doc.show('step-1'); |
2650 |
10 Sep 14 |
nicklas |
Doc.show('gonext'); |
2650 |
10 Sep 14 |
nicklas |
70 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.flowCellsOnChange(); |
2650 |
10 Sep 14 |
nicklas |
flowcell.outcomeOnChange(); |
2650 |
10 Sep 14 |
nicklas |
frm.flowcells.focus(); |
2650 |
10 Sep 14 |
nicklas |
74 |
} |
2650 |
10 Sep 14 |
nicklas |
75 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.getOptionForFlowCell = function(fc, fcNo) |
2650 |
10 Sep 14 |
nicklas |
77 |
{ |
2650 |
10 Sep 14 |
nicklas |
var name = fc.name +': '; |
2650 |
10 Sep 14 |
nicklas |
79 |
|
2650 |
10 Sep 14 |
nicklas |
var numPools = fc.pools.length; |
2650 |
10 Sep 14 |
nicklas |
var firstPoolNum = flowcell.getPoolNum(fc.pools[0].name); |
2650 |
10 Sep 14 |
nicklas |
var lastPoolNum = flowcell.getPoolNum(fc.pools[fc.pools.length-1].name); |
2650 |
10 Sep 14 |
nicklas |
83 |
|
2650 |
10 Sep 14 |
nicklas |
if (lastPoolNum - firstPoolNum == numPools - 1) |
2650 |
10 Sep 14 |
nicklas |
85 |
{ |
2650 |
10 Sep 14 |
nicklas |
if (numPools > 1) |
2650 |
10 Sep 14 |
nicklas |
87 |
{ |
2650 |
10 Sep 14 |
nicklas |
// Display: PoolN -- PoolY |
2650 |
10 Sep 14 |
nicklas |
name += fc.pools[0].name + ' — ' + fc.pools[fc.pools.length-1].name; |
2650 |
10 Sep 14 |
nicklas |
90 |
} |
2650 |
10 Sep 14 |
nicklas |
else |
2650 |
10 Sep 14 |
nicklas |
92 |
{ |
2650 |
10 Sep 14 |
nicklas |
name += fc.pools[0].name; |
2650 |
10 Sep 14 |
nicklas |
94 |
} |
2650 |
10 Sep 14 |
nicklas |
95 |
} |
2650 |
10 Sep 14 |
nicklas |
else |
2650 |
10 Sep 14 |
nicklas |
97 |
{ |
2650 |
10 Sep 14 |
nicklas |
// Display: PoolN + x more... |
2650 |
10 Sep 14 |
nicklas |
name += fc.pools[0].name + ' + ' + (numPools-1) + ' more...'; |
2650 |
10 Sep 14 |
nicklas |
100 |
} |
2650 |
10 Sep 14 |
nicklas |
101 |
|
5470 |
05 Jun 19 |
nicklas |
name += ' ['; |
5470 |
05 Jun 19 |
nicklas |
if (fc.FlowCellType) name += fc.FlowCellType + '; '; |
5470 |
05 Jun 19 |
nicklas |
name += fc.pipeline + ']'; |
2650 |
10 Sep 14 |
nicklas |
105 |
|
2650 |
10 Sep 14 |
nicklas |
// Tooltip is always all pools |
2650 |
10 Sep 14 |
nicklas |
var title = ''; |
2650 |
10 Sep 14 |
nicklas |
for (var poolNo=0; poolNo < numPools; poolNo++) |
2650 |
10 Sep 14 |
nicklas |
109 |
{ |
2650 |
10 Sep 14 |
nicklas |
var pool = fc.pools[poolNo]; |
2650 |
10 Sep 14 |
nicklas |
if (poolNo > 0) title += ', '; |
2650 |
10 Sep 14 |
nicklas |
title += pool.name; |
2650 |
10 Sep 14 |
nicklas |
113 |
} |
2650 |
10 Sep 14 |
nicklas |
114 |
|
4583 |
21 Sep 17 |
nicklas |
var option = new Option(name, fc.id, false, fcNo < 1); |
2650 |
10 Sep 14 |
nicklas |
option.title = title; |
2650 |
10 Sep 14 |
nicklas |
option.flowCell = fc; |
2650 |
10 Sep 14 |
nicklas |
118 |
|
2650 |
10 Sep 14 |
nicklas |
return option; |
2650 |
10 Sep 14 |
nicklas |
120 |
} |
2650 |
10 Sep 14 |
nicklas |
121 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.getPoolNum = function(poolName) |
2650 |
10 Sep 14 |
nicklas |
123 |
{ |
2650 |
10 Sep 14 |
nicklas |
var num = poolName.match(/Pool(\d+)/); |
2650 |
10 Sep 14 |
nicklas |
return num ? parseInt(num[1], 10) : null; |
2650 |
10 Sep 14 |
nicklas |
126 |
} |
2650 |
10 Sep 14 |
nicklas |
127 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.flowCellsOnChange = function() |
2650 |
10 Sep 14 |
nicklas |
129 |
{ |
2650 |
10 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2650 |
10 Sep 14 |
nicklas |
flowCellsAreValid = false; |
2650 |
10 Sep 14 |
nicklas |
132 |
|
2650 |
10 Sep 14 |
nicklas |
var numSelected = 0; |
2650 |
10 Sep 14 |
nicklas |
for (var i = 0; i < frm.flowcells.length; i++) |
2650 |
10 Sep 14 |
nicklas |
135 |
{ |
2650 |
10 Sep 14 |
nicklas |
if (frm.flowcells[i].selected) numSelected++; |
2650 |
10 Sep 14 |
nicklas |
137 |
} |
2650 |
10 Sep 14 |
nicklas |
138 |
|
2650 |
10 Sep 14 |
nicklas |
if (numSelected < 1 || numSelected > 2) |
2650 |
10 Sep 14 |
nicklas |
140 |
{ |
3629 |
26 Nov 15 |
nicklas |
Wizard.setInputStatus('flowcells', 'invalid', 'Select 1 flow cell'); |
2650 |
10 Sep 14 |
nicklas |
return false; |
2650 |
10 Sep 14 |
nicklas |
143 |
} |
2650 |
10 Sep 14 |
nicklas |
144 |
|
2650 |
10 Sep 14 |
nicklas |
Wizard.setInputStatus('flowcells', 'valid'); |
2650 |
10 Sep 14 |
nicklas |
flowCellsAreValid = true; |
2650 |
10 Sep 14 |
nicklas |
147 |
} |
2650 |
10 Sep 14 |
nicklas |
148 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.outcomeOnChange = function() |
2650 |
10 Sep 14 |
nicklas |
150 |
{ |
2650 |
10 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2650 |
10 Sep 14 |
nicklas |
var failed = Doc.element('outcomeFailed').checked; |
3629 |
26 Nov 15 |
nicklas |
Doc.addOrRemoveClass(frm['comments'], 'required', failed); |
2650 |
10 Sep 14 |
nicklas |
154 |
} |
2650 |
10 Sep 14 |
nicklas |
155 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.validateStep1 = function(event) |
2650 |
10 Sep 14 |
nicklas |
157 |
{ |
2650 |
10 Sep 14 |
nicklas |
if (!flowCellsAreValid) event.preventDefault(); |
2650 |
10 Sep 14 |
nicklas |
159 |
} |
2650 |
10 Sep 14 |
nicklas |
160 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.initializeStep2 = function() |
2650 |
10 Sep 14 |
nicklas |
162 |
{ |
2650 |
10 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2650 |
10 Sep 14 |
nicklas |
164 |
|
2650 |
10 Sep 14 |
nicklas |
var failed = frm.outcome[1].checked; |
2650 |
10 Sep 14 |
nicklas |
if (failed) |
2650 |
10 Sep 14 |
nicklas |
167 |
{ |
2650 |
10 Sep 14 |
nicklas |
Wizard.showGoNextConfirmation(true, 'Check to verify registration of failure'); |
2650 |
10 Sep 14 |
nicklas |
169 |
} |
2650 |
10 Sep 14 |
nicklas |
170 |
|
2650 |
10 Sep 14 |
nicklas |
Wizard.setCurrentStep(2); |
2650 |
10 Sep 14 |
nicklas |
Doc.show('gocancel'); |
2650 |
10 Sep 14 |
nicklas |
Doc.show('goregister'); |
2650 |
10 Sep 14 |
nicklas |
174 |
|
3629 |
26 Nov 15 |
nicklas |
var fc = frm.flowcells[frm.flowcells.selectedIndex].flowCell; |
3629 |
26 Nov 15 |
nicklas |
frm.comments.value = fc.comments; |
3629 |
26 Nov 15 |
nicklas |
frm.externalId.value = fc.externalId; |
3629 |
26 Nov 15 |
nicklas |
Events.sendChangeEvent('comments'); |
3629 |
26 Nov 15 |
nicklas |
Events.sendChangeEvent('externalId'); |
4293 |
11 Jan 17 |
nicklas |
Events.sendChangeEvent('startDate'); |
3629 |
26 Nov 15 |
nicklas |
181 |
|
4293 |
11 Jan 17 |
nicklas |
frm.externalId.focus(); |
4293 |
11 Jan 17 |
nicklas |
183 |
|
2650 |
10 Sep 14 |
nicklas |
// Load clustering protocols |
3629 |
26 Nov 15 |
nicklas |
Reggie.loadProtocols('SEQUENCING_PROTOCOL', 'sequencingProtocol'); |
5469 |
04 Jun 19 |
nicklas |
Reggie.loadHardware('SEQUENCER', 'sequencer', 'FLOWCELL_TYPE', fc.FlowCellType); |
3691 |
13 Jan 16 |
nicklas |
187 |
|
3691 |
13 Jan 16 |
nicklas |
if (!failed) |
3691 |
13 Jan 16 |
nicklas |
189 |
{ |
6735 |
09 May 22 |
nicklas |
// Load clusters |
6633 |
08 Mar 22 |
nicklas |
var url = '../OpenGrid.servlet?ID='+App.getSessionId() + '&cmd=GetHostInfo&config=demux'; |
3691 |
13 Jan 16 |
nicklas |
Doc.addClass('clusters', 'list-loading'); |
3691 |
13 Jan 16 |
nicklas |
frm.clusters[0] = new Option('loading...'); |
3691 |
13 Jan 16 |
nicklas |
Wizard.asyncJsonRequest(url, flowcell.clustersLoaded); |
3691 |
13 Jan 16 |
nicklas |
Doc.show('auto-analyze-section'); |
3717 |
22 Jan 16 |
nicklas |
196 |
|
3717 |
22 Jan 16 |
nicklas |
// Check debug by default if debug is set or not on a secure server (=production server) |
3717 |
22 Jan 16 |
nicklas |
frm.debug.checked = debug || location.protocol != 'https:'; |
3691 |
13 Jan 16 |
nicklas |
199 |
} |
3691 |
13 Jan 16 |
nicklas |
200 |
|
2650 |
10 Sep 14 |
nicklas |
201 |
} |
2650 |
10 Sep 14 |
nicklas |
202 |
|
3691 |
13 Jan 16 |
nicklas |
flowcell.clustersLoaded = function(response) |
3691 |
13 Jan 16 |
nicklas |
204 |
{ |
3691 |
13 Jan 16 |
nicklas |
Doc.removeClass('clusters', 'list-loading'); |
3691 |
13 Jan 16 |
nicklas |
var frm = document.forms['reggie']; |
3691 |
13 Jan 16 |
nicklas |
frm.clusters.length = 0; |
4306 |
17 Jan 17 |
nicklas |
var clusters = response.hosts; |
3691 |
13 Jan 16 |
nicklas |
if (clusters.length == 0) |
3691 |
13 Jan 16 |
nicklas |
210 |
{ |
3691 |
13 Jan 16 |
nicklas |
Doc.element('autoAnalyzeNo').checked = true; |
4292 |
11 Jan 17 |
nicklas |
autoAnalyzeIsValid = true; |
6735 |
09 May 22 |
nicklas |
Wizard.setInputStatus('autoAnalyze', 'warning', 'No available clusters'); |
3691 |
13 Jan 16 |
nicklas |
return; |
3691 |
13 Jan 16 |
nicklas |
215 |
} |
3691 |
13 Jan 16 |
nicklas |
216 |
|
3691 |
13 Jan 16 |
nicklas |
Doc.element('autoAnalyzeNo').disabled = false; |
3691 |
13 Jan 16 |
nicklas |
Doc.element('autoAnalyzeYes').disabled = false; |
3691 |
13 Jan 16 |
nicklas |
for (var i = 0; i < clusters.length; i++) |
3691 |
13 Jan 16 |
nicklas |
220 |
{ |
3691 |
13 Jan 16 |
nicklas |
var cl = clusters[i]; |
4306 |
17 Jan 17 |
nicklas |
var option = new Option(cl.connection.name, cl.id); |
3691 |
13 Jan 16 |
nicklas |
option.cluster = cl; |
3691 |
13 Jan 16 |
nicklas |
frm.clusters[frm.clusters.length] = option; |
3691 |
13 Jan 16 |
nicklas |
225 |
} |
3691 |
13 Jan 16 |
nicklas |
flowcell.autoAnalyzeOnChange(); |
3691 |
13 Jan 16 |
nicklas |
227 |
} |
3691 |
13 Jan 16 |
nicklas |
228 |
|
3691 |
13 Jan 16 |
nicklas |
flowcell.clusterOnChange = function() |
3691 |
13 Jan 16 |
nicklas |
230 |
{ |
3691 |
13 Jan 16 |
nicklas |
var frm = document.forms['reggie']; |
3691 |
13 Jan 16 |
nicklas |
var cluster = frm.clusters[frm.clusters.selectedIndex].cluster; |
6980 |
17 Jan 23 |
nicklas |
if (cluster.priorities && cluster.priorities.length > 0) |
3691 |
13 Jan 16 |
nicklas |
234 |
{ |
6980 |
17 Jan 23 |
nicklas |
frm.priority.length = 0; |
3691 |
13 Jan 16 |
nicklas |
for (var pNo = 0; pNo < cluster.priorities.length; pNo++) |
3691 |
13 Jan 16 |
nicklas |
237 |
{ |
3691 |
13 Jan 16 |
nicklas |
var p = cluster.priorities[pNo]; |
4583 |
21 Sep 17 |
nicklas |
frm.priority[frm.priority.length] = new Option(p.name + ' ('+p.value+')', p.value, p['default'], p['default']); |
3691 |
13 Jan 16 |
nicklas |
240 |
} |
6980 |
17 Jan 23 |
nicklas |
Doc.show('job-priority'); |
3691 |
13 Jan 16 |
nicklas |
242 |
} |
3691 |
13 Jan 16 |
nicklas |
else |
3691 |
13 Jan 16 |
nicklas |
244 |
{ |
6980 |
17 Jan 23 |
nicklas |
Doc.hide('job-priority'); |
3691 |
13 Jan 16 |
nicklas |
246 |
} |
6980 |
17 Jan 23 |
nicklas |
if (cluster.partitions && cluster.partitions.length > 0) |
6980 |
17 Jan 23 |
nicklas |
248 |
{ |
6980 |
17 Jan 23 |
nicklas |
frm.partition.length = 0; |
6980 |
17 Jan 23 |
nicklas |
for (var pNo = 0; pNo < cluster.partitions.length; pNo++) |
6980 |
17 Jan 23 |
nicklas |
251 |
{ |
6980 |
17 Jan 23 |
nicklas |
var p = cluster.partitions[pNo]; |
6980 |
17 Jan 23 |
nicklas |
var title = p.name; |
6980 |
17 Jan 23 |
nicklas |
if (p.description) title += ' ('+p.description+')'; |
6980 |
17 Jan 23 |
nicklas |
frm.partition[frm.partition.length] = new Option(title, p.value, p['default'], p['default']); |
6980 |
17 Jan 23 |
nicklas |
256 |
} |
6980 |
17 Jan 23 |
nicklas |
Doc.show('job-partition'); |
6980 |
17 Jan 23 |
nicklas |
258 |
} |
6980 |
17 Jan 23 |
nicklas |
else |
6980 |
17 Jan 23 |
nicklas |
260 |
{ |
6980 |
17 Jan 23 |
nicklas |
Doc.hide('job-partition'); |
6980 |
17 Jan 23 |
nicklas |
262 |
} |
3691 |
13 Jan 16 |
nicklas |
263 |
} |
3691 |
13 Jan 16 |
nicklas |
264 |
|
3691 |
13 Jan 16 |
nicklas |
flowcell.autoAnalyzeOnChange = function() |
3691 |
13 Jan 16 |
nicklas |
266 |
{ |
3691 |
13 Jan 16 |
nicklas |
Wizard.setInputStatus('autoAnalyze'); |
3691 |
13 Jan 16 |
nicklas |
autoAnalyzeIsValid = false; |
3691 |
13 Jan 16 |
nicklas |
269 |
|
3691 |
13 Jan 16 |
nicklas |
var frm = document.forms['reggie']; |
3691 |
13 Jan 16 |
nicklas |
var yesChecked = Doc.element('autoAnalyzeYes').checked; |
3691 |
13 Jan 16 |
nicklas |
var noChecked = Doc.element('autoAnalyzeNo').checked; |
3691 |
13 Jan 16 |
nicklas |
273 |
|
3691 |
13 Jan 16 |
nicklas |
frm.clusters.disabled = !yesChecked; |
3691 |
13 Jan 16 |
nicklas |
frm.priority.disabled = !yesChecked; |
6980 |
17 Jan 23 |
nicklas |
frm.partition.disabled = !yesChecked; |
3691 |
13 Jan 16 |
nicklas |
frm.debug.disabled = !yesChecked; |
3691 |
13 Jan 16 |
nicklas |
278 |
|
3691 |
13 Jan 16 |
nicklas |
if (!yesChecked && !noChecked) |
3691 |
13 Jan 16 |
nicklas |
280 |
{ |
3691 |
13 Jan 16 |
nicklas |
Wizard.setInputStatus('autoAnalyze', 'invalid', 'Must select Yes or No'); |
3691 |
13 Jan 16 |
nicklas |
return; |
3691 |
13 Jan 16 |
nicklas |
283 |
} |
3691 |
13 Jan 16 |
nicklas |
284 |
|
3691 |
13 Jan 16 |
nicklas |
autoAnalyzeIsValid = true; |
3691 |
13 Jan 16 |
nicklas |
Wizard.setInputStatus('autoAnalyze', 'valid'); |
3691 |
13 Jan 16 |
nicklas |
287 |
|
3691 |
13 Jan 16 |
nicklas |
if (yesChecked) flowcell.clusterOnChange(); |
3691 |
13 Jan 16 |
nicklas |
289 |
} |
3691 |
13 Jan 16 |
nicklas |
290 |
|
3629 |
26 Nov 15 |
nicklas |
// Comments are required when 'Failure' has been selected |
6824 |
30 Aug 22 |
nicklas |
flowcell.commentsOnChange = function() |
2650 |
10 Sep 14 |
nicklas |
293 |
{ |
2650 |
10 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2650 |
10 Sep 14 |
nicklas |
295 |
|
3629 |
26 Nov 15 |
nicklas |
commentsIsValid = false; |
3629 |
26 Nov 15 |
nicklas |
Wizard.setInputStatus('comments'); |
2650 |
10 Sep 14 |
nicklas |
298 |
|
3629 |
26 Nov 15 |
nicklas |
var comments = frm.comments.value; |
2650 |
10 Sep 14 |
nicklas |
if (comments == '') |
2650 |
10 Sep 14 |
nicklas |
301 |
{ |
3629 |
26 Nov 15 |
nicklas |
var required = frm.comments.className.indexOf('required') != -1; |
2650 |
10 Sep 14 |
nicklas |
if (required) |
2650 |
10 Sep 14 |
nicklas |
304 |
{ |
3629 |
26 Nov 15 |
nicklas |
Wizard.setInputStatus('comments', 'invalid', 'Missing'); |
2650 |
10 Sep 14 |
nicklas |
return; |
2650 |
10 Sep 14 |
nicklas |
307 |
} |
2650 |
10 Sep 14 |
nicklas |
308 |
} |
2650 |
10 Sep 14 |
nicklas |
309 |
|
3629 |
26 Nov 15 |
nicklas |
Wizard.setInputStatus('comments', 'valid'); |
3629 |
26 Nov 15 |
nicklas |
commentsIsValid = true; |
2650 |
10 Sep 14 |
nicklas |
312 |
} |
2650 |
10 Sep 14 |
nicklas |
313 |
|
6824 |
30 Aug 22 |
nicklas |
flowcell.flowCellIdOnChange = function() |
2650 |
10 Sep 14 |
nicklas |
315 |
{ |
2650 |
10 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2650 |
10 Sep 14 |
nicklas |
317 |
|
3629 |
26 Nov 15 |
nicklas |
Wizard.setInputStatus('externalId'); |
3629 |
26 Nov 15 |
nicklas |
flowCellIdIsValid = false; |
2650 |
10 Sep 14 |
nicklas |
320 |
|
3629 |
26 Nov 15 |
nicklas |
var id = frm.externalId.value; |
2650 |
10 Sep 14 |
nicklas |
if (id == '') |
2650 |
10 Sep 14 |
nicklas |
323 |
{ |
3629 |
26 Nov 15 |
nicklas |
Wizard.setInputStatus('externalId', 'invalid', 'ID is a required value'); |
2650 |
10 Sep 14 |
nicklas |
return; |
2650 |
10 Sep 14 |
nicklas |
326 |
} |
2650 |
10 Sep 14 |
nicklas |
327 |
|
2650 |
10 Sep 14 |
nicklas |
// Check if ID already exists in DB |
2650 |
10 Sep 14 |
nicklas |
var url = '../FlowCell.servlet?ID='+App.getSessionId(); |
2650 |
10 Sep 14 |
nicklas |
url += '&cmd=GetFlowCellByBarcode'; |
2650 |
10 Sep 14 |
nicklas |
url += '&barcode='+encodeURIComponent(id); |
2650 |
10 Sep 14 |
nicklas |
Wizard.showLoadingAnimation('Checking flow cell id...'); |
2650 |
10 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, flowcell.flowCellIdChecked); |
2650 |
10 Sep 14 |
nicklas |
334 |
} |
2650 |
10 Sep 14 |
nicklas |
335 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.flowCellIdChecked = function(response) |
2650 |
10 Sep 14 |
nicklas |
337 |
{ |
2650 |
10 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2650 |
10 Sep 14 |
nicklas |
var existing = response.flowCell; |
2650 |
10 Sep 14 |
nicklas |
if (existing != null) |
2650 |
10 Sep 14 |
nicklas |
341 |
{ |
3629 |
26 Nov 15 |
nicklas |
var id = frm.externalId.value; |
3629 |
26 Nov 15 |
nicklas |
Wizard.setInputStatus('externalId', 'invalid', 'Flow cell with ID='+Strings.encodeTags(id)+' already exists: ' + Strings.encodeTags(existing.name)); |
2650 |
10 Sep 14 |
nicklas |
return; |
2650 |
10 Sep 14 |
nicklas |
345 |
} |
3629 |
26 Nov 15 |
nicklas |
Wizard.setInputStatus('externalId', 'valid'); |
3629 |
26 Nov 15 |
nicklas |
flowCellIdIsValid = true; |
2650 |
10 Sep 14 |
nicklas |
348 |
} |
2650 |
10 Sep 14 |
nicklas |
349 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.validateStep2 = function(event) |
2650 |
10 Sep 14 |
nicklas |
351 |
{ |
3629 |
26 Nov 15 |
nicklas |
var valid = Wizard.isValid('startDate'); |
3691 |
13 Jan 16 |
nicklas |
valid &= flowCellIdIsValid && commentsIsValid && autoAnalyzeIsValid; |
3629 |
26 Nov 15 |
nicklas |
if (!valid) |
2650 |
10 Sep 14 |
nicklas |
355 |
{ |
2650 |
10 Sep 14 |
nicklas |
event.preventDefault(); |
2650 |
10 Sep 14 |
nicklas |
357 |
} |
2650 |
10 Sep 14 |
nicklas |
358 |
} |
2650 |
10 Sep 14 |
nicklas |
359 |
|
2650 |
10 Sep 14 |
nicklas |
360 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.submit = function() |
2650 |
10 Sep 14 |
nicklas |
362 |
{ |
2650 |
10 Sep 14 |
nicklas |
var frm = document.forms['reggie']; |
2650 |
10 Sep 14 |
nicklas |
var failed = Doc.element('outcomeFailed').checked; |
3629 |
26 Nov 15 |
nicklas |
365 |
|
2650 |
10 Sep 14 |
nicklas |
var submitInfo = {}; |
2650 |
10 Sep 14 |
nicklas |
submitInfo.failed = failed; |
2650 |
10 Sep 14 |
nicklas |
368 |
|
3629 |
26 Nov 15 |
nicklas |
var seqRun = {}; |
3629 |
26 Nov 15 |
nicklas |
seqRun.startDate = frm.startDate.value; |
3629 |
26 Nov 15 |
nicklas |
seqRun.operator = frm.sequencingOperator.value; |
3629 |
26 Nov 15 |
nicklas |
seqRun.sequencer = parseInt(frm.sequencer.value, 10); |
3629 |
26 Nov 15 |
nicklas |
seqRun.position = frm.sequencerPosition.value; |
3629 |
26 Nov 15 |
nicklas |
seqRun.protocol = parseInt(frm.sequencingProtocol.value, 10); |
3629 |
26 Nov 15 |
nicklas |
seqRun.comments = frm.comments.value; |
3629 |
26 Nov 15 |
nicklas |
submitInfo.sequencingRun = seqRun; |
2650 |
10 Sep 14 |
nicklas |
377 |
|
3629 |
26 Nov 15 |
nicklas |
var fc = frm.flowcells[frm.flowcells.selectedIndex].flowCell; |
3629 |
26 Nov 15 |
nicklas |
fc.FlowCellID = frm.externalId.value; |
3629 |
26 Nov 15 |
nicklas |
submitInfo.flowCell = fc; |
2650 |
10 Sep 14 |
nicklas |
381 |
|
3691 |
13 Jan 16 |
nicklas |
if (!failed && Doc.element('autoAnalyzeYes').checked) |
3691 |
13 Jan 16 |
nicklas |
383 |
{ |
3691 |
13 Jan 16 |
nicklas |
var autoAnalyze = {}; |
3691 |
13 Jan 16 |
nicklas |
autoAnalyze.cluster = frm.clusters.value; |
3691 |
13 Jan 16 |
nicklas |
autoAnalyze.priority = parseInt(frm.priority.value); |
6980 |
17 Jan 23 |
nicklas |
if (frm.partition.selectedIndex >= 0) |
6980 |
17 Jan 23 |
nicklas |
388 |
{ |
6980 |
17 Jan 23 |
nicklas |
autoAnalyze.partition = frm.partition.value; |
6980 |
17 Jan 23 |
nicklas |
390 |
} |
3691 |
13 Jan 16 |
nicklas |
autoAnalyze.debug = frm.debug.checked; |
3691 |
13 Jan 16 |
nicklas |
submitInfo.autoAnalyze = autoAnalyze; |
3691 |
13 Jan 16 |
nicklas |
393 |
} |
3691 |
13 Jan 16 |
nicklas |
394 |
|
3629 |
26 Nov 15 |
nicklas |
var url = '../SequencingRun.servlet?ID='+App.getSessionId(); |
5488 |
12 Jun 19 |
nicklas |
url += '&cmd=RegisterSequencingStarted&pipeline='+encodeURIComponent(Data.get('page-data', 'pipeline')); |
3629 |
26 Nov 15 |
nicklas |
397 |
|
2650 |
10 Sep 14 |
nicklas |
Wizard.showLoadingAnimation('Performing registration...'); |
2650 |
10 Sep 14 |
nicklas |
Wizard.asyncJsonRequest(url, flowcell.submissionResults, 'POST', JSON.stringify(submitInfo)); |
2650 |
10 Sep 14 |
nicklas |
400 |
} |
2650 |
10 Sep 14 |
nicklas |
401 |
|
2650 |
10 Sep 14 |
nicklas |
flowcell.submissionResults = function(response) |
2650 |
10 Sep 14 |
nicklas |
403 |
{ |
2650 |
10 Sep 14 |
nicklas |
Wizard.showFinalMessage(response.messages); |
2650 |
10 Sep 14 |
nicklas |
Doc.show('gorestart'); |
2650 |
10 Sep 14 |
nicklas |
406 |
} |
2650 |
10 Sep 14 |
nicklas |
407 |
|
2650 |
10 Sep 14 |
nicklas |
return flowcell; |
2650 |
10 Sep 14 |
nicklas |
409 |
}(); |
2650 |
10 Sep 14 |
nicklas |
410 |
|
2650 |
10 Sep 14 |
nicklas |
Doc.onLoad(FlowCell.initPage); |
2650 |
10 Sep 14 |
nicklas |
412 |
|