Skip to content

Commit 332bf00

Browse files
labkey-jeckelsbrentloganOhsudev
authored
Improve SSRS session ID handoff (#1294)
* Improve SSRS session ID handoff * Consolidate more SSRS code, add test coverage * Comments and consistency * Make new test Firefox compatible * SessionID -> SessionId for the SSRS URL parameter * Update check for sessionId * Add missing import to fix build * Clean up imports --------- Co-authored-by: Brent Logan <loganb@ohsu.edu> Co-authored-by: Ohsudev <76500320+Ohsudev@users.noreply.github.com>
1 parent cff629c commit 332bf00

10 files changed

Lines changed: 240 additions & 862 deletions

File tree

ONPRC_EHR_ComplianceDB/resources/views/printableComplianceReports.html

Lines changed: 8 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
Ext4.onReady(function(){
66
var webpart = <%=webpartContext%>;
77

8+
ONPRC.Utils.preloadSession();
9+
810
Ext4.define('ONPRC.panel.PrintableComplianceReportsPanel', {
911
itemId: 'sheetPanel',
1012
extend: 'Ext.panel.Panel',
@@ -28,44 +30,6 @@
2830
html: 'NOTE:' +
2931
'<br>Click the button below to display the Employee\'s Summary Report. The program will display a report of all training requirements for each employee.</b>',
3032
style: 'padding-bottom: 20px;'
31-
// },{
32-
// xtype: 'checkcombo', //Added: 10-18-2017 R.Blasa
33-
// itemId: 'employeeNames',
34-
// displayField: 'FullName',
35-
// valueField: 'employeeid',
36-
// width: 400,
37-
// multiSelect: true,
38-
// fieldLabel: 'Employee Name(s)',
39-
// store: {
40-
// type: 'labkey-store',
41-
// containerPath: container,
42-
// schemaName: 'ehr_compliancedb',
43-
// queryName: 'EmployeeActiveList',
44-
// columns: 'employeeid, FullName',
45-
// sort: 'lastName',
46-
// filterArray: [LABKEY.Filter.create('isActive', true, LABKEY.Filter.Types.EQUAL)],
47-
// autoLoad: true
48-
// }
49-
//
50-
// },{
51-
// xtype: 'combobox', //Added: 10-18-2017 R.Blasa
52-
// itemId: 'supervisorNames',
53-
// displayField: 'name',
54-
// valueField: 'supervisor',
55-
// width: 400,
56-
// multiSelect: true,
57-
// fieldLabel: 'Supervisor Name(s)',
58-
// store: {
59-
// type: 'labkey-store',
60-
// containerPath: container,
61-
// schemaName: 'ehr_compliancedb',
62-
// queryName: 'SupervisorActiveList',
63-
// columns: 'employeeid, supervisor, name',
64-
// sort: 'supervisor',
65-
// autoLoad: true
66-
//
67-
// }
68-
6933
}];
7034
items.push({
7135
layout: {
@@ -90,33 +54,8 @@
9054
border: true,
9155
getUrlString: function ()
9256
{
93-
// var panel = this.up('#sheetPanel');
94-
// var field = panel.down('#employeeNames');
95-
//
96-
// var value = field.getValue() || [];
97-
// value = Ext4.isArray(value) ? value: [value];
98-
99-
var params = {
100-
SessionId: LABKEY.Utils.getSessionID(),
101-
HostName: location.hostname
102-
103-
};
104-
// if (!value)
105-
// return;
106-
107-
108-
Ext4.apply(params, {
109-
'rs:ClearSession': true,
110-
'rs:Command': 'render'
111-
});
112-
113-
var url = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL');
114-
var ssrsFolder = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSReportFolder');
115-
ssrsFolder = '/' + ssrsFolder + '/' + 'Compliance/EmployeeComplianceSuperXMLReport';
116-
117-
url += ssrsFolder + '&' + LABKEY.ActionURL.queryString(params);
118-
119-
return url;
57+
const params = ONPRC.Utils.getSsrsParams({}, true, true);
58+
return ONPRC.Utils.getSsrsReportUrl('Compliance/EmployeeComplianceSuperXMLReport', params);
12059
},
12160
menu: [{
12261
text: 'Print',
@@ -128,22 +67,8 @@
12867

12968
window.open(url);
13069
}
131-
// },{
132-
// text: 'Print To PDF',
133-
// handler: function(menu){
134-
// var btn = menu.up('button');
135-
// var url = btn.getUrlString();
136-
// if (!url)
137-
// return;
138-
//
139-
// url += '&rs:Format=PDF';
140-
// window.open(url);
141-
// }
14270
}]
143-
14471
}]
145-
146-
14772
},{
14873

14974
html: '<i>Report by Employee(s):</i>' //Added: 10-17-2019 R.Blasa
@@ -155,43 +80,9 @@
15580
style: 'margin-left: 150px;',
15681
text: 'Print Version',
15782
border: true,
158-
getUrlString: function(){
159-
// var panel = this.up('#sheetPanel');
160-
// var field = panel.down('#supervisorNames');
161-
//
162-
// var value = field.getValue() || [];
163-
// value = Ext4.isArray(value) ? value: [value];
164-
165-
var params = {
166-
SessionId: LABKEY.Utils.getSessionID(),
167-
HostName: location.hostname
168-
169-
};
170-
// if (!value)
171-
// return;
172-
//
173-
//
174-
// if (!Ext4.isEmpty(value))
175-
// params.supervisor = value;
176-
//
177-
// if (params.EmployeeID){
178-
// delete params.EmployeeID
179-
// }
180-
181-
182-
183-
Ext4.apply(params, {
184-
'rs:ClearSession': true,
185-
'rs:Command': 'render'
186-
});
187-
188-
var url = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL');
189-
var ssrsFolder = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSReportFolder');
190-
ssrsFolder = '/' + ssrsFolder + '/' + 'Compliance/EmployeeComplianceEmpXMLReport';
191-
192-
url += ssrsFolder + '&' + LABKEY.ActionURL.queryString(params);
193-
194-
return url;
83+
getUrlString: function() {
84+
const params = ONPRC.Utils.getSsrsParams({}, true, true);
85+
return ONPRC.Utils.getSsrsReportUrl('Compliance/EmployeeComplianceEmpXMLReport', params);
19586
},
19687
menu: [{
19788
text: 'Print',
@@ -203,59 +94,11 @@
20394

20495
window.open(url);
20596
}
206-
// },{
207-
// text: 'Print To PDF',
208-
// handler: function(menu){
209-
// var btn = menu.up('button');
210-
// var url = btn.getUrlString();
211-
// if (!url)
212-
// return;
213-
//
214-
// url += '&rs:Format=PDF';
215-
// window.open(url);
216-
// }
21797
}]
21898

21999
});
220100
return items;
221-
},
222-
getParamsgroup: function(supressErrors, skipRoomsIfAllSelected){
223-
var params = {
224-
SessionId: LABKEY.Utils.getSessionID(),
225-
HostName: location.hostname
226-
227-
};
228-
229-
230-
231-
var roomFields = this.down('#animal_groups');
232-
var rooms = roomFields.getValue() || [];
233-
rooms = Ext4.isArray(rooms) ? rooms: [rooms];
234-
235-
params.rooms =rooms;
236-
237-
if (!rooms.length && !supressErrors){
238-
Ext4.Msg.alert('Error', 'Must select an Animal Group name');
239-
return;
240-
}
241-
242-
return params;
243-
},
244-
245-
246-
getParams: function(supressErrors, skipRoomsIfAllSelected){
247-
var params = {
248-
SessionId: LABKEY.Utils.getSessionID(),
249-
HostName: location.hostname
250-
251-
};
252-
253-
254-
255-
return params;
256-
}
257-
258-
101+
}
259102
});
260103

261104

onprc_ehr/resources/views/citesReport.html

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
if(!ctx)
66
return;
77

8-
/* get the participant id from the request URL: this parameter is required. */
9-
var subjectIds = LABKEY.ActionURL.getParameter('subjectIds');
10-
subjectIds = subjectIds ? subjectIds.split(';') : [];
8+
ONPRC.Utils.preloadSession();
119

1210
Ext4.create('Ext.panel.Panel', {
1311
width: 400,
@@ -20,7 +18,8 @@
2018
width: 400,
2119
height: 200,
2220
fieldLabel: 'Enter Animal Id(s)',
23-
itemId: 'animalField'
21+
itemId: 'animalField',
22+
name: 'animalField'
2423
}],
2524
buttons: [{
2625
text: 'Submit',
@@ -40,19 +39,9 @@
4039
return;
4140
}
4241
//Modified: 1-17-2019 R.Blasa
43-
var url = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL');
44-
var ssrsFolder = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSReportFolder');
45-
ssrsFolder = '/' + ssrsFolder + '/' + 'Clinical/CITESReport';
46-
47-
url += ssrsFolder + '&' + LABKEY.ActionURL.queryString({
48-
SessionID: LABKEY.Utils.getSessionID(),
49-
HostName: location.hostname,
42+
window.location = ONPRC.Utils.getSsrsReportUrl('Clinical/CITESReport', ONPRC.Utils.getSsrsParams({
5043
AnimalID: val
51-
});
52-
53-
//url += '&rs:Format=PDF'
54-
console.log(url)
55-
window.location = url;
44+
}));
5645
}
5746
}]
5847
}).render(webpart.wrapperDivId);

onprc_ehr/resources/views/ehrAdmin.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
header: 'Logs',
3131
items: [
3232
{name: 'Labkey.log', url: '<%=contextPath%>' + '/admin-showPrimaryLog.view'},
33-
{name: 'Labkey-errors.log', url: '<%=contextPath%>' + '/admin-showAllErrors.view'},
34-
{name: 'ETL Log', url: '<%=contextPath%>' + '/onprc_ehr-showEtlLog.view'}
33+
{name: 'Labkey-errors.log', url: '<%=contextPath%>' + '/admin-showAllErrors.view'}
3534
]
3635
},{
3736
header: 'Notifications',

onprc_ehr/resources/views/historyExport.html

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
if(!ctx)
66
return;
77

8-
/* get the participant id from the request URL: this parameter is required. */
9-
var subjectIds = LABKEY.ActionURL.getParameter('subjectIds');
10-
subjectIds = subjectIds ? subjectIds.split(';') : [];
8+
ONPRC.Utils.preloadSession();
119

1210
Ext4.create('Ext.panel.Panel', {
1311
width: 400,
@@ -75,22 +73,13 @@
7573
}
7674
//Modified: 1-17-2019 R.Blasa
7775
if (!hideHistory){
78-
var url = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSServerURL');
79-
var ssrsFolder = LABKEY.getModuleProperty('ONPRC_EHR', 'SSRSReportFolder');
80-
ssrsFolder = '/' + ssrsFolder + '/' + 'Clinical/SalesMedicalHistoryReport';
81-
82-
url += ssrsFolder + '&' + LABKEY.ActionURL.queryString({
83-
SessionID: LABKEY.Utils.getSessionID(),
84-
HostName: location.hostname,
85-
'rs:ClearSession': true,
86-
Redacted: redacted ? 'true' : 'false',
87-
AnimalId: val,
88-
minDate: Ext4.Date.format(mindate1, 'Y-m-d'), //Added: 11-18-2016 R.Blasa
89-
maxDate: Ext4.Date.format(maxdate1, 'Y-m-d')
90-
});
91-
92-
//url += '&rs:Format=PDF'
93-
window.location = url;
76+
window.location = ONPRC.Utils.getSsrsReportUrl('Clinical/SalesMedicalHistoryReport',
77+
ONPRC.Utils.getSsrsParams({
78+
Redacted: redacted ? 'true' : 'false',
79+
AnimalId: val,
80+
minDate: Ext4.Date.format(mindate1, 'Y-m-d'), //Added: 11-18-2016 R.Blasa
81+
maxDate: Ext4.Date.format(maxdate1, 'Y-m-d')
82+
}, true));
9483
}
9584
else {
9685
window.location = LABKEY.ActionURL.buildURL('ehr', 'clinicalHistoryExport', null, {

0 commit comments

Comments
 (0)