Skip to content

Commit 987fa29

Browse files
committed
Favor DataRegion getChecked over getSelected
1 parent e5072b5 commit 987fa29

File tree

2 files changed

+36
-54
lines changed

2 files changed

+36
-54
lines changed

SequenceAnalysis/resources/web/SequenceAnalysis/window/AddFileSetsWindow.js

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,18 @@ Ext4.define('SequenceAnalysis.window.AddFileSetsWindow', {
88

99
statics: {
1010
buttonHandlerForOutputFiles: function(dataRegionName){
11-
var dr = LABKEY.DataRegions[dataRegionName];
12-
Ext4.Msg.wait('Loading...');
13-
dr.getSelected({
14-
scope: this,
15-
success: function(results, response) {
16-
Ext4.Msg.hide();
17-
18-
if (!results || !results.selected || !results.selected.length) {
19-
Ext4.Msg.alert('Error', 'No rows selected');
20-
return;
21-
}
11+
var checked = LABKEY.DataRegions[dataRegionName].getChecked();
12+
if (!checked.length) {
13+
Ext4.Msg.alert('Error', 'No rows selected');
14+
return;
15+
}
2216

23-
var checked = LABKEY.DataRegions[dataRegionName].getChecked();
24-
Ext4.create('SequenceAnalysis.window.AddFileSetsWindow', {
25-
targetTable: 'outputfiles',
26-
targetField: 'outputFileId',
27-
dataRegionName: dataRegionName,
28-
pks: checked
29-
}).show();
30-
},
31-
failure: LDK.Utils.getErrorCallback()
32-
});
17+
Ext4.create('SequenceAnalysis.window.AddFileSetsWindow', {
18+
targetTable: 'outputfiles',
19+
targetField: 'outputFileId',
20+
dataRegionName: dataRegionName,
21+
pks: checked
22+
}).show();
3323
}
3424
},
3525

SequenceAnalysis/resources/web/SequenceAnalysis/window/VisualizeDataWindow.js

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,32 @@ Ext4.define('SequenceAnalysis.window.VisualizeDataWindow', {
22
extend: 'Ext.window.Window',
33
statics: {
44
buttonHandler: function(dataRegionName){
5-
var dataRegion = LABKEY.DataRegions[dataRegionName];
6-
dataRegion.getSelected({
7-
scope: this,
8-
success: function (results, response) {
9-
if (!results || !results.selected || !results.selected.length) {
10-
Ext4.Msg.alert('Error', 'No rows selected');
11-
return;
12-
}
13-
14-
var checked = LABKEY.DataRegions[dataRegionName].getChecked();
15-
16-
Ext4.Msg.wait('Loading...');
17-
LABKEY.Ajax.request({
18-
method: 'POST',
19-
url: LABKEY.ActionURL.buildURL('sequenceanalysis', 'getAvailableHandlers', null),
20-
params: {
21-
handlerType: 'OutputFile',
22-
outputFileIds: checked
23-
},
24-
scope: this,
25-
failure: LDK.Utils.getErrorCallback(),
26-
success: LABKEY.Utils.getCallbackWrapper(function (results) {
27-
Ext4.Msg.hide();
28-
29-
Ext4.create('SequenceAnalysis.window.VisualizeDataWindow', {
30-
dataRegionName: dataRegionName,
31-
handlers: results.handlers,
32-
partialHandlers: results.partialHandlers,
33-
outputFileIds: checked
34-
}).show();
35-
}, this)
36-
});
5+
var checked = LABKEY.DataRegions[dataRegionName].getChecked();
6+
if (!checked.length) {
7+
Ext4.Msg.alert('Error', 'No rows selected');
8+
return;
9+
}
10+
11+
Ext4.Msg.wait('Loading...');
12+
LABKEY.Ajax.request({
13+
method: 'POST',
14+
url: LABKEY.ActionURL.buildURL('sequenceanalysis', 'getAvailableHandlers', null),
15+
params: {
16+
handlerType: 'OutputFile',
17+
outputFileIds: checked
3718
},
38-
failure: LDK.Utils.getErrorCallback()
19+
scope: this,
20+
failure: LDK.Utils.getErrorCallback(),
21+
success: LABKEY.Utils.getCallbackWrapper(function (results) {
22+
Ext4.Msg.hide();
23+
24+
Ext4.create('SequenceAnalysis.window.VisualizeDataWindow', {
25+
dataRegionName: dataRegionName,
26+
handlers: results.handlers,
27+
partialHandlers: results.partialHandlers,
28+
outputFileIds: checked
29+
}).show();
30+
}, this)
3931
});
4032
}
4133
},

0 commit comments

Comments
 (0)