Skip to content

Commit 47009cf

Browse files
committed
Enable filtering of selected user requirements.
1 parent 0311cf3 commit 47009cf

1,221 files changed

Lines changed: 86805 additions & 35 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 100 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,118 @@
11
package pegr.admin
22
import pegr.AdminCategory
3+
import pegr.Organization
4+
import pegr.RoleGroup
35
import pegr.UserRoleGroup
46
import pegr.User
57
import pegr.UserService
68
import pegr.UserException
9+
import grails.converters.*
10+
import grails.util.Holders
11+
import groovy.json.*
712

813
class UserAdminController {
914
public static AdminCategory category = AdminCategory.OTHER
1015

1116
def userService
1217

13-
def index(Integer max, Long affiliationId, Long groupId, String isEnabled) {
14-
//Removed max parameter as to allow for all entries to populate datatable
15-
16-
def affiliations = User.where{}.collect { it.affiliation }.unique()
17-
18-
def users
19-
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()
18+
def index(Long affiliationId, Long groupId, String isEnabled) {
19+
20+
def query
21+
def users
22+
def affiliations = User.where{}.collect { it.affiliation }.unique()
23+
24+
if (params.groupLoad != null && params.affiliateLoad != null && params.activityLoad != null){
25+
def groupList = JSON.parse(params.groupLoad)
26+
def affiliateList = JSON.parse(params.affiliateLoad)
27+
def activityList = JSON.parse(params.activityLoad)
28+
def c
29+
if (groupList.size() != 0 || affiliateList.size() != 0 || activityList.size() != 0){
30+
// def a = RoleGroup.where{name == "Admin"}.collect { it.id }.unique()
31+
32+
// groupList start
33+
def i = 0;
34+
def a = RoleGroup.createCriteria().list{
35+
if (groupList.size() != 0){
36+
or{
37+
for (i=0; i<groupList.size(); i++){
38+
eq("name", groupList[i])
39+
}
40+
}
41+
}
42+
}.collect { it.id }
43+
// get username of users who meet group criteria
44+
c = UserRoleGroup.createCriteria().list{
45+
if (groupList.size() != 0){
46+
or{
47+
for (i=0; i<a.size(); i++){
48+
eq("roleGroup.id", a[i])
49+
}
50+
}
51+
}
52+
}.collect { it.user }
53+
// groupList end
54+
55+
// affiliateList start
56+
def b = Organization.createCriteria().list{
57+
if (affiliateList.size() != 0) {
58+
or{
59+
for (i=0; i<affiliateList.size(); i++){
60+
eq("name", affiliateList[i])
61+
}
62+
}
63+
}
64+
}.collect { it.id }
65+
66+
// activityList start
67+
Boolean status = true;
68+
def e = User.createCriteria().list{
69+
if (activityList.size() != 0){
70+
or{
71+
for (i=0; i<activityList.size(); i++){
72+
if (activityList[i] == "Active"){
73+
status = true;
74+
} else{
75+
status = false;
76+
}
77+
eq("enabled", status)
78+
}
79+
}
80+
}
81+
}.collect { it.id }
82+
83+
// get members by status
84+
def f = User.createCriteria().list{
85+
if (groupList.size() != 0){
86+
or{
87+
for (i=0; i<c.size(); i++){
88+
eq("username", c[i].username)
89+
}
90+
}
91+
}
92+
if (affiliateList.size() != 0){
93+
or{
94+
for (i=0; i<b.size(); i++){
95+
eq("affiliation.id", b[i])
96+
}
97+
}
98+
}
99+
if (activityList.size() != 0){
100+
or{
101+
for (i=0; i<e.size(); i++){
102+
eq("id", e[i])
103+
}
104+
}
105+
}
106+
}
107+
users = f
108+
}
109+
}
110+
else {
111+
query = User.where{}
112+
users = query.list(params)
39113
}
40114

41115
[users: users,
42-
totalCount: totalCount,
43116
affiliations: affiliations,
44117
affiliationId: affiliationId,
45118
groupId: groupId,

pegr/grails-app/views/userAdmin/index.gsp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
</table>
7575
</div>
7676

77-
7877
<div class="col-sm-2 sidenav filter text-center">
7978
<h5 id="all"><g:link controller="userAdmin" action="index">All</g:link></h5>
8079
<h4>Group</h4>
@@ -87,7 +86,6 @@
8786
<td>
8887
<input type="checkbox" id="group" value="${group.name}">
8988
</td>
90-
9189
</tr>
9290
</g:each>
9391
</table>
@@ -125,7 +123,7 @@
125123
</td>
126124
</tr>
127125
</table>
128-
<button type="button" class="btn btn-warning btn-lg"><i class="fab fa-empire"></i> Filter Table <i class="fab fa-empire"></i></button>
126+
<button type="button" id="filter" class="btn btn-warning btn-lg"><i class="fab fa-empire"></i> Filter Table <i class="fab fa-empire"></i></button>
129127
<div class="spacer"></div>
130128
</div>
131129
<br/>
@@ -134,15 +132,15 @@
134132
135133
$(document).ready(function() {
136134
$('#example').DataTable({
137-
// scrollY: '50vh',
138-
// scrollCollapse: true,
139-
// paging: false
135+
scrollY: '50vh',
136+
scrollCollapse: true,
137+
paging: true
140138
});
141139
});
142140
143141
144142
// User Filter JQuery and AJAX | git:pjchaffin || Gucci Gang Gang Got Dah Code Working Yeet Yeet
145-
$('input[type="checkbox"]').click(function(){
143+
$('#filter').click(function(){
146144
147145
// initialize 3 lists for groups, activities, and affiliations
148146
let groups = [];
@@ -169,7 +167,6 @@
169167
affiliations.push(this.value);
170168
}
171169
});
172-
173170
// logging for debugging purposes
174171
console.log(groups);
175172
console.log(activities);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Please fill out one of the templates on: https://github.com/Homebrew/brew/issues/new/choose
2+
3+
If you want to ask a question please do so on our Discourse: https://discourse.brew.sh
4+
5+
We will close issues asking questions without comment.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: New Feature Suggestion
3+
about: Request a new feature for Homebrew/brew
4+
5+
---
6+
7+
Please replace this section with:
8+
- a detailed description of your proposed feature
9+
- the motivation for the feature
10+
- how the feature would be relevant to at least 90% of Homebrew users (if it's not: do not open a feature request)
11+
- what alternatives to the feature you have considered
12+
13+
We will close this issue or ask you to create a pull-request if it's something the maintainers are not actively planning to work on.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Reproducible Bug Report
3+
about: Submit an issue so we can investigate
4+
5+
---
6+
7+
**Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.**
8+
9+
- [ ] are reporting a bug others will be able to reproduce and not asking a question. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh
10+
- [ ] ran a `brew` command and reproduced the problem with multiple formulae? If it's a problem with a single, official formula (not cask) please file this issue at Homebrew/homebrew-core: https://github.com/Homebrew/homebrew-core/issues/new/choose. If it's a `brew cask` problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
11+
- [ ] ran `brew update` and can still reproduce the problem?
12+
- [ ] ran `brew doctor`, fixed all issues and can still reproduce the problem?
13+
- [ ] ran `brew config` and `brew doctor` and included their output with your issue?
14+
15+
To help us debug your issue please explain:
16+
- What you were trying to do (and why)
17+
- What happened (include command output)
18+
- What you expected to happen
19+
- Step-by-step reproduction instructions (by running `brew` commands)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- [ ] Have you followed the guidelines in our [Contributing](https://github.com/Homebrew/brew/blob/master/CONTRIBUTING.md) document?
2+
- [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/Homebrew/brew/pulls) for the same change?
3+
- [ ] Have you added an explanation of what your changes do and why you'd like us to include them?
4+
- [ ] Have you written new tests for your changes? [Here's an example](https://github.com/Homebrew/brew/blob/master/Library/Homebrew/test/PATH_spec.rb).
5+
- [ ] Have you successfully run `brew style` with your changes locally?
6+
- [ ] Have you successfully run `brew tests` with your changes locally?
7+
8+
-----

pegr/homebrew/.github/lock.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Configuration for lock-threads - https://github.com/dessant/lock-threads
2+
3+
# Number of days of inactivity before a closed issue or pull request is locked
4+
daysUntilLock: 30
5+
# Comment to post before locking. Set to `false` to disable
6+
lockComment: false
7+
# Issues or pull requests with these labels will not be locked
8+
# exemptLabels:
9+
# - no-locking
10+
# Limit to only `issues` or `pulls`
11+
# only: issues
12+
# Add a label when locking. Set to `false` to disable
13+
lockLabel: outdated

pegr/homebrew/.github/move.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Configuration for move-issues - https://github.com/dessant/move-issues
2+
3+
# Delete the command comment. Ignored when the comment also contains other content
4+
deleteCommand: true
5+
# Close the source issue after moving
6+
closeSourceIssue: true
7+
# Lock the source issue after moving
8+
lockSourceIssue: true
9+
# Mention issue and comment authors
10+
mentionAuthors: true
11+
# Preserve mentions in the issue content
12+
keepContentMentions: true
13+
# Set custom aliases for targets
14+
aliases:
15+
core: Homebrew/homebrew-core
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Configuration for probot-no-response - https://github.com/probot/no-response
2+
3+
# Number of days of inactivity before an Issue is closed for lack of response
4+
daysUntilClose: 14
5+
# Label requiring a response
6+
responseRequiredLabel: needs response
7+
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
8+
closeComment: >
9+
This issue has been automatically closed because there has been no response
10+
to our request for more information from the original author. With only the
11+
information that is currently in the issue, we don't have enough information
12+
to take action. Please reach out if you have or find the answers we need so
13+
that we can investigate further.

pegr/homebrew/.github/stale.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Configuration for probot-stale - https://github.com/probot/stale
2+
3+
# Number of days of inactivity before an Issue or Pull Request becomes stale
4+
daysUntilStale: 21
5+
# Number of days of inactivity before a stale Issue or Pull Request is closed
6+
daysUntilClose: 7
7+
# Issues or Pull Requests with these labels will never be considered stale
8+
exemptLabels:
9+
- gsoc-outreachy
10+
- help wanted
11+
- in progress
12+
# Label to use when marking as stale
13+
staleLabel: stale
14+
# Comment to post when marking as stale. Set to `false` to disable
15+
markComment: >
16+
This issue has been automatically marked as stale because it has not had
17+
recent activity. It will be closed if no further activity occurs.

0 commit comments

Comments
 (0)