Skip to content

Commit 180aef3

Browse files
Pierce Chaffinhedgiejo
authored andcommitted
Adds GUI and such for fix
1 parent 38fd41e commit 180aef3

3 files changed

Lines changed: 214 additions & 142 deletions

File tree

pegr/grails-app/controllers/pegr/ReportController.groovy

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ import grails.util.Holders
44
import groovy.json.JsonSlurper
55

66
class ReportController {
7-
7+
88
def springSecurityService
99
def reportService
1010
def utilityService
11-
11+
1212
def createReportForCohortAjax(Long cohortId) {
1313
def cohort = SequencingCohort.get(cohortId)
1414
if (cohort && !cohort.report) {
1515
reportService.createReportForCohort(cohort)
1616
}
1717
render template: "/report/reportRow", model: [cohort: cohort]
1818
}
19-
19+
2020
def deleteReportForCohortAjax(Long cohortId) {
2121
def cohort = SequencingCohort.get(cohortId)
2222
reportService.deleteReportForCohort(cohort)
2323
render template: "/report/reportRow", model: [cohort: cohort]
2424
}
25-
25+
2626
def runStatus(Long runId) {
2727
def run = SequenceRun.get(runId)
2828
if (!run) {
@@ -40,7 +40,7 @@ class ReportController {
4040
def user = springSecurityService.currentUser
4141
if (user.isAdmin()) {
4242
admin = true
43-
}
43+
}
4444
if (qcSettings.yeast) {
4545
headers["yeast"] = []
4646
subheaders["yeast"] = []
@@ -58,8 +58,8 @@ class ReportController {
5858
}
5959
}
6060
}
61-
[runStatus: runStatus.results,
62-
noResultSamples: runStatus.noResultSamples,
61+
[runStatus: runStatus.results,
62+
noResultSamples: runStatus.noResultSamples,
6363
qcSettings: qcSettings,
6464
run: run,
6565
headers: headers,
@@ -70,18 +70,18 @@ class ReportController {
7070
} catch (ReportException e) {
7171
flash.message = e.message
7272
redirect(controller: "sequenceRun", action: "index")
73-
}
73+
}
7474
}
7575
}
76-
76+
7777
def updateRunStatusAjax(Long runId, String status) {
7878
reportService.updateRunStatus(runId, status)
79-
render status
79+
render status
8080
}
81-
81+
8282
def updateReportStatusAjax(Long reportId, String status) {
8383
reportService.updateReportStatus(reportId, status)
84-
render status
84+
render status
8585
}
8686
// axa677-180306: Added this function to handle the deletion of selected (multiple) alignments
8787
// This function is called in template report/_generalQc.gsp
@@ -103,7 +103,7 @@ class ReportController {
103103
}
104104
redirect(action: "runStatus", params: [runId: runId])
105105
}
106-
106+
107107
// axa677-180306: No need for this function since we have written the previous one to handle deletion using checkboxes
108108
def deleteAlignment(Long alignmentId, Long runId) {
109109
try {
@@ -114,7 +114,7 @@ class ReportController {
114114
}
115115
redirect(action: "runStatus", params: [runId: runId])
116116
}
117-
117+
118118
def show(Long id) {
119119
def report = SummaryReport.get(id)
120120
if (!report) {
@@ -127,26 +127,26 @@ class ReportController {
127127
def imageMap = report.cohort?.imageMap
128128
[project: currentProject, projectUsers: projectUsers, report: report, imageMap: imageMap]
129129
}
130-
130+
131131
def fetchDataForReportAjax(Long id) {
132132
def data = reportService.fetchDataForReport(id)
133-
render(template: 'details', model: [ sampleDTOs: data])
133+
render(template: 'details', model: [ sampleDTOs: data])
134134
}
135-
135+
136136
def fetchMemeDataAjax(String url) {
137137
def results = reportService.fetchMemeMotif(url) as JSON
138138
render results
139139
}
140-
140+
141141
def fetchMemERDataAjax(String url) {
142142
def results = reportService.fetchMemERMotif(url) as JSON
143143
render results
144144
}
145-
145+
146146
def composite(String url) {
147147
[url: url]
148148
}
149-
149+
150150
def fetchCompositeDataAjax(String url) {
151151
def result
152152
try {
@@ -156,29 +156,29 @@ class ReportController {
156156
}
157157
} catch(ReportException e) {
158158
result = [error: e.message] as JSON
159-
}
159+
}
160160
render result
161161
}
162-
162+
163163
def manage() {
164164
// get QC settings
165165
def results = reportService.getQcSettings()
166166
// get the purge alignments configs for the last time
167167
def purgeConfigStr = Chores.findByName(reportService.PURGE_ALIGNMENTS_CONFIG)?.value
168168
def purgeConfig = utilityService.parseJson(purgeConfigStr)
169-
[qcSettings: results.qcSettings, meta: results.meta, purgeConfig: purgeConfig]
169+
[qcSettings: results.qcSettings, meta: results.meta, purgeConfig: purgeConfig]
170170
}
171-
171+
172172
def saveQcSettings() {
173173
try {
174174
reportService.saveQcSettings(params)
175175
redirect(controller: "sequenceRun", action: "index")
176176
} catch (ReportException e) {
177177
flash.message = e.message
178-
redirect(action: "editQcSettings")
178+
redirect(action: "editQcSettings")
179179
}
180180
}
181-
181+
182182
def deletePurgedAlignments() {
183183
def message
184184
try {
@@ -193,12 +193,12 @@ class ReportController {
193193
def purgeConfig = utilityService.parseJson(purgeConfigStr)
194194
render(template: "purgeAlignments", model: [purgeConfig:purgeConfig, message: message])
195195
}
196-
196+
197197
def togglePreferredAlignment(Long alignmentId) {
198198
reportService.togglePreferredAlignment(alignmentId)
199199
render ""
200200
}
201-
201+
202202
def unknownIndex(Long runId) {
203203
def run = SequenceRun.get(runId)
204204
if (!run) {
@@ -207,24 +207,24 @@ class ReportController {
207207
try {
208208
def file = reportService.getUnknownIndex(run)
209209
def htmlContent = new File(file).text
210-
render text: htmlContent, contentType:"text/html", encoding:"UTF-8"
210+
render text: htmlContent, contentType:"text/html", encoding:"UTF-8"
211211
} catch (Exception e) {
212212
render(view: "/404")
213213
}
214214
}
215215
}
216-
216+
217217
def decisionTree(String type) {
218218
[type: type]
219219
}
220-
220+
221221
def getDecisionTreeAjax(String type) {
222222
def tree = reportService.getDecisionTree(type)
223223
def map = utilityService.parseJson(tree?.value)
224224
render (map as JSON)
225225
return
226226
}
227-
227+
228228
def saveDecisionTree(String json, String type) {
229229
try {
230230
reportService.saveDecisionTree(json, type)
@@ -233,19 +233,19 @@ class ReportController {
233233
}
234234
redirect(action: "decisionTree", params: [type: type])
235235
}
236-
236+
237237
def saveNotesAjax(Long cohortId, String notes) {
238238
reportService.saveNotes(cohortId, notes)
239239
render ""
240240
return
241241
}
242-
242+
243243
def updateAnalysisCodeAjax(Long analysisId, String code, String message) {
244244
reportService.updateAnalysisCode(analysisId, code, message)
245245
render ""
246246
return
247247
}
248-
248+
249249
def print(Long id) {
250250
def report = SummaryReport.get(id)
251251
if (!report) {
@@ -256,7 +256,7 @@ class ReportController {
256256
def imageMap = report.cohort?.imageMap
257257
[report: report, imageMap: imageMap, sampleList: data]
258258
}
259-
259+
260260
def listFiles(Long id) {
261261
def samples = reportService.fetchDataForReport(id)
262262
[samples: samples]
@@ -304,15 +304,15 @@ class AlignmentDTO {
304304
Long mappedReads
305305
Long uniquelyMappedReads
306306
Long dedupUniquelyMappedReads
307-
307+
308308
Float mappedReadPct
309309
Float uniquelyMappedPct
310310
Float deduplicatedPct
311311

312312
Integer avgInsertSize
313313
Float stdInsertSize
314314
Float genomeCoverage
315-
315+
316316
String peakCallingParam
317317
Long peaks
318318
Long singletons

pegr/grails-app/controllers/pegr/admin/UserAdminController.groovy

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,45 @@ import pegr.UserException
77

88
class UserAdminController {
99
public static AdminCategory category = AdminCategory.OTHER
10-
10+
1111
def userService
12-
12+
1313
def index(Integer max, Long affiliationId, Long groupId, String isEnabled) {
14-
params.max = Math.min(max ?: 25, 100)
15-
14+
//Removed max parameter as to allow for all entries to populate datatable
15+
1616
def affiliations = User.where{}.collect { it.affiliation }.unique()
1717

18-
def users
18+
def users
1919
def totalCount
20-
21-
if (groupId) {
22-
def sort = params.sort ? ("user."+params.sort) : "user.fullName"
23-
users = UserRoleGroup.createCriteria().list(max: params.max, offset: params.offset, sort: sort, order: params.order) {
24-
eq("roleGroup.id", groupId)
25-
}.collect { it.user }
26-
27-
totalCount = UserRoleGroup.where { roleGroup.id == groupId }.count()
28-
} else {
29-
def query
30-
if (affiliationId) {
31-
query = User.where { affiliation.id == affiliationId }
32-
} else if (isEnabled != null && isEnabled != "") {
33-
query = User.where { enabled == isEnabled }
34-
} else {
35-
query = User.where{}
36-
}
37-
users = query.list(params)
38-
totalCount = query.count()
39-
}
4020

41-
[users: users,
42-
totalCount: totalCount,
21+
// if (groupId) {
22+
// def sort = params.sort ? ("user."+params.sort) : "user.fullName"
23+
// users = UserRoleGroup.createCriteria().list(max: params.max, offset: params.offset, sort: sort, order: params.order) {
24+
// eq("roleGroup.id", groupId)
25+
// }.collect { it.user }
26+
//
27+
// totalCount = UserRoleGroup.where { roleGroup.id == groupId }.count()
28+
// } else {
29+
// def query
30+
// if (affiliationId) {
31+
// query = User.where { affiliation.id == affiliationId }
32+
// } else if (isEnabled != null && isEnabled != "") {
33+
// query = User.where { enabled == isEnabled }
34+
// } else {
35+
// query = User.where{}
36+
// }
37+
// users = query.list(params)
38+
// totalCount = query.count()
39+
// }
40+
41+
[users: users,
42+
totalCount: totalCount,
4343
affiliations: affiliations,
4444
affiliationId: affiliationId,
4545
groupId: groupId,
4646
isEnabled: isEnabled]
4747
}
48-
48+
4949
def search(String username, String email) {
5050
def users = []
5151
if (username && username != "") {
@@ -58,22 +58,22 @@ class UserAdminController {
5858
}
5959
render(view: "index", model: [users: users])
6060
}
61-
61+
6262
def edit(Long userId) {
6363
def user = User.get(userId)
6464
if (!user) {
6565
render(view: "/404")
6666
return
67-
}
67+
}
6868
[user: user]
6969
}
70-
70+
7171
def update(Long userId) {
7272
def user = User.get(userId)
7373
if (!user) {
7474
render(view: "/404")
7575
return
76-
}
76+
}
7777
user.properties = params
7878
def groups = params.list("groups")
7979
try {
@@ -83,9 +83,9 @@ class UserAdminController {
8383
flash.message = e.message
8484
}
8585
redirect(action:"index")
86-
87-
}
88-
86+
87+
}
88+
8989
def createUser(CreateUserCommand cmd) {
9090
def groupIds = []
9191
if (params.groupIds) {
@@ -96,7 +96,7 @@ class UserAdminController {
9696
render(view: "index", model: [users: [], cmd: cmd])
9797
return
9898
}
99-
try {
99+
try {
100100
def user = userService.create(cmd.email,
101101
groupIds,
102102
cmd.sendEmail
@@ -114,7 +114,7 @@ class UserAdminController {
114114
class CreateUserCommand {
115115
String email
116116
Boolean sendEmail
117-
117+
118118
static constraints = {
119119
email email: true, nullable: false, blank: false
120120
}

0 commit comments

Comments
 (0)