Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ WORKDIR /opt/conditional

COPY package.json package-lock.json /opt/conditional/

RUN npm ci
RUN npm ci --ignore-scripts

COPY webpack.config.js /opt/conditional
COPY frontend /opt/conditional/frontend

RUN npm run webpack

FROM astral/uv:python3.13-trixie-slim
FROM docker.io/astral/uv:python3.13-trixie-slim
LABEL maintainer="Computer Science House <webmaster@csh.rit.edu>"

WORKDIR /opt/conditional
Expand Down
7 changes: 4 additions & 3 deletions conditional/blueprints/housing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from conditional.util.ldap import ldap_get_roomnumber
from conditional.util.ldap import ldap_is_eval_director
from conditional.util.ldap import ldap_set_active
from conditional.util.user_dict import user_dict_is_eval_director

logger = structlog.get_logger()

Expand Down Expand Up @@ -56,7 +57,7 @@ def display_housing(user_dict=None):
# return names in 'first last (username)' format
return render_template('housing.html',
username=user_dict['username'],
queue=get_housing_queue(ldap_is_eval_director(user_dict['account'])),
queue=get_housing_queue(user_dict_is_eval_director(user_dict)),
housing=housing,
room_list=sorted(list(room_list)))

Expand All @@ -67,7 +68,7 @@ def display_housing(user_dict=None):
def change_queue_state(user_dict=None):
log = logger.new(request=request, auth_dict=user_dict)

if not ldap_is_eval_director(user_dict['account']):
if not user_dict_is_eval_director(user_dict):
return "must be eval director", 403

post_data = request.get_json()
Expand Down Expand Up @@ -95,7 +96,7 @@ def change_room_numbers(rmnumber, user_dict=None):

update = request.get_json()

if not ldap_is_eval_director(user_dict['account']):
if not user_dict_is_eval_director(user_dict):
return "must be eval director", 403

# Get the current list of people living on-floor.
Expand Down
2 changes: 1 addition & 1 deletion conditional/templates/attendance_hm.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h3 class="panel-title">Attendees</h3>
<input class="form-control" type="text" placeholder="Quick Select" data-module="hmSearch" data-target="table.hm-attendance">
</div>
<div class="table-responsive">
<table class="table table-striped no-bottom-margin hm-attendance" data-module="table" data-sort-column="0" data-sort-order="asc" data-paginated="false">
<table class="table table-striped no-bottom-margin hm-attendance" data-module="table" data-order="[[ 0, &quot;asc&quot; ]]" data-paging="false">
<thead>
<tr>
<th>Name</th>
Expand Down
2 changes: 1 addition & 1 deletion conditional/templates/co_op_management.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h3 class="panel-title">Co-Op Management</h3>
</div>
<div class="panel-body table-fill">
<div class="table-responsive">
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="false" data-sort-column="1" data-sort-order="asc" data-length-changable="true" data-paginated="false">
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="false" data-order="[[ 1, &quot;asc&quot; ]]" data-length-change="true" data-paging="false" data-info="true">
<thead>
<tr>
<th>Name</th>
Expand Down
2 changes: 1 addition & 1 deletion conditional/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ <h3 class="panel-title">Directorship Meeting Attendance</h3>
</div>

<div class="panel-body table-fill">
<table class="table table-striped table-responsive" data-module="table">
<table class="table table-striped table-responsive" data-module="table" data-length-change="false" data-searching="false">
<thead>
<tr>
<th>Event</th>
Expand Down
4 changes: 1 addition & 3 deletions conditional/templates/gatekeep.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,9 @@ <h4>Missed House Meetings</h4>
</div>
<div id="eval-table" style="display:none;">
<div class="panel panel-default">
<div class="panel-body table-fill">
<div class="panel-body table-fill">
<div class="table-responsive">
<table class="table table-striped" data-module="table" data-searchable="true" data-sort-column="4" data-sort-order="asc" data-length-changable="true" data-paginated="false">
<table class="table table-striped" data-module="table" data-order="[[ 4, &quot;asc&quot; ]]" data-length-change="true" data-paging="false" data-info="false">
<thead>
<tr>
<th>Name</th>
Expand Down Expand Up @@ -181,7 +180,6 @@ <h4>Missed House Meetings</h4>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion conditional/templates/housing.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h3 class="panel-title">Housing Queue
</div>
<div class="panel-body table-fill">
<div class="table-responsive">
<table class="table table-striped no-bottom-margin" data-module="table" data-paginated="false" data-ordering="false"{% if is_eval_director %} data-searchable="true" data-show="all"{% endif %}>
<table class="table table-striped no-bottom-margin" data-module="table" data-paging="false" data-ordering="false"{% if is_eval_director %} data-search="true" data-show="all"{% endif %}>
<thead>
<tr>
<th>Member</th>
Expand Down
6 changes: 2 additions & 4 deletions conditional/templates/intro_evals.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,17 @@ <h4>Other Comments</h4>

<div id="eval-table" style="display:none;">
<div class="panel panel-default">
<div class="panel-body table-fill">
<div class="panel-body table-fill">
<div class="table-responsive">
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-sort-column="3" data-sort-order="asc" data-length-changable="true" data-paginated="false">
<table class="table table-striped" data-module="table" data-order="[[ 4, &quot;asc&quot; ]]" data-sort-order="asc" data-length-change="true" data-paging="false" data-info="false">
<thead>
<tr>
<th>Name</th>
<th>Result</th>
<th>Meetings</th>
<th>Signatures Missed</th>
<th>Technical Seminars</th>
<th>House Meetings Missed</th>
<th>House Meetings Missed</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -239,7 +238,6 @@ <h4>Other Comments</h4>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
34 changes: 17 additions & 17 deletions conditional/templates/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
<h3 class="page-title">User Logs</h3>
<div class="panel panel-default">
<div class="panel-body table-fill">
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-sort-column="0" data-sort-order="desc" data-length-changable="true" data-page-length="100">
<table class="table table-striped" data-module="table" data-searchable="true" data-order="[[ 0, &quot;desc&quot; ]]" data-length-change="true" data-page-length="100">
<thead>
<th>ID</th>
<th>Method</th>
<th>User</th>
<th>Blueprint</th>
<th>URL</th>
<th>Description</th>
<th>ID</th>
<th>Method</th>
<th>User</th>
<th>Blueprint</th>
<th>URL</th>
<th>Description</th>
</thead>
<tbody>
{% for log in logs %}
<tr>
<td>{{log.timestamp}}</td>
<td>{{log.method}}</td>
<td>{{log.uid}}</td>
<td>{{log.blueprint}}</td>
<td>{{log.path}}</td>
<td>{{log.description}}</td>
</tr>
{% endfor %}
{% for log in logs %}
<tr>
<td data-sort="{{log.timestamp}}">{{log.timestamp}}</td>
<td>{{log.method}}</td>
<td>{{log.uid}}</td>
<td>{{log.blueprint}}</td>
<td>{{log.path}}</td>
<td>{{log.description}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
Expand Down
4 changes: 2 additions & 2 deletions conditional/templates/member_management.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h3 class="panel-title">Freshman Management</h3>
</div>
<div class="panel-body table-fill">
<div class="table-responsive">
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-sort-column="0" data-sort-order="asc" data-length-changable="true"{% if freshmen|length < 11 %} data-paginated="false" {% endif %}>
<table class="table table-striped no-bottom-margin" data-module="table" data-order="[[ 0, &quot;asc&quot' ]]" data-length-change="true">
<thead>
<tr>
<th>Name</th>
Expand Down Expand Up @@ -145,7 +145,7 @@ <h3 class="panel-title">
</div>
<div class="panel-body table-fill">
<div class="table-responsive">
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-sort-column="0" data-sort-order="asc" data-length-changable="true">
<table class="table table-striped" data-module="table" data-order="[[ 0, &quot;asc&quot;]]" data-length-change="true">
<thead>
<tr>
<th>Name</th>
Expand Down
2 changes: 1 addition & 1 deletion conditional/templates/new_year.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h3 class="page-title">Clear Active Members and Floor Roster</h3>
<div id="new-current" style="display: none;">
<h3 class="page-title">Prune Current Students Group</h3>
<p>Take a second and scroll down the list, remove anyone who has graduated. Anyone in this list who is in good standing can become active, so it is important it is correct.</p>
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-sort-column="0" data-sort-order="asc" data-length-changable="true">
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-order="[[ 0, &quot;asc&quot; ]]" data-paging="false">
<thead>
<tr>
<th>Name</th>
Expand Down
6 changes: 2 additions & 4 deletions conditional/templates/spring_evals.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,16 @@ <h4>Major Projects</h4>
</div>
<div id="eval-table" style="display:none;">
<div class="panel panel-default">
<div class="panel-body table-fill">
<div class="panel-body table-fill">
<div class="table-responsive">
<table class="table table-striped no-bottom-margin" data-module="table" data-searchable="true" data-sort-column="4" data-sort-order="asc" data-length-changable="true" data-paginated="false">
<table class="table table-striped" data-module="table" data-order="[[ 4, &quot;asc&quot; ]]" data-sort-order="asc" data-length-change="true" data-paging="false" data-info="false">
<thead>
<tr>
<th>Name</th>
<th>Result</th>
<th>Meetings</th>
<th>Major Project</th>
<th>House Meetings Missed</th>
<th>House Meetings Missed</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -238,7 +237,6 @@ <h4>Major Projects</h4>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
13 changes: 10 additions & 3 deletions conditional/util/housing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from conditional.models.models import InHousingQueue
from conditional.models.models import OnFloorStatusAssigned
from conditional.util.ldap import ldap_get_member, ldap_is_current_student
from conditional.util.ldap import ldap_get_current_students, ldap_get_member, ldap_is_current_student


def get_housing_queue(is_eval_director=False):
Expand All @@ -24,7 +24,14 @@ def get_housing_queue(is_eval_director=False):
}

# CSHMember accounts that are in queue
potential_accounts = [ldap_get_member(username) for username in in_queue]
potential_accounts = []

if is_eval_director:
potential_accounts = ldap_get_current_students()
else:
potential_accounts = [ldap_get_member(username) for username in in_queue]

potential_accounts = [user for user in potential_accounts if ldap_is_current_student(user)]

# Populate a list of dictionaries containing the name, username,
# and on-floor datetime for each current studetn who has on-floor status
Expand All @@ -37,7 +44,7 @@ def get_housing_queue(is_eval_director=False):
"time": in_queue.get(account.uid, {}).get('time', datetime.now()) or datetime.now(),
"in_queue": account.uid in in_queue
} for account in potential_accounts
if ldap_is_current_student(account) and (is_eval_director or account.roomNumber is None)
if is_eval_director or account.roomNumber is None
]

# Sort based on time (ascending) and then points (decending).
Expand Down
33 changes: 2 additions & 31 deletions frontend/javascript/modules/table.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,8 @@
/* global $ */
import _ from "lodash";
import "datatables.net-bs";
import DataTable from "datatables.net-bs";

export default class Table {
constructor(table) {
this.table = table;

// Set options based on data attributes
this.sortColumn = (_.isNil(this.table.dataset.sortColumn) ||
_.isNaN(this.table.dataset.sortColumn)) ?
1 : this.table.dataset.sortColumn;
this.sortOrder = this.table.dataset.sortOrder === "asc" ? "asc" : "desc";

this.options = {
lengthChange: this.table.dataset.lengthChangable === 'true',
info: false,
paging: !(this.table.dataset.paginated === 'false'),
pagingType: "numbers",
order: [],
pageLength: this.table.dataset.pageLength || 10
};

// Just remove the search input from the DOM instead of disabling it
if (this.table.dataset.searchable !== 'true') {
this.options.dom = "lrtip";
}

this.render();
}

render() {
this.table = $(this.table).DataTable(this.options) // eslint-disable-line new-cap
.order([this.sortColumn, this.sortOrder])
.draw();
this.table = new DataTable(table)
}
}
1 change: 0 additions & 1 deletion frontend/stylesheets/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ $bootstrap-icons-font-dir: "../fonts/";
// Components
@import 'components/switches';
@import 'components/flat-buttons';
@import 'components/datatables';
@import 'components/date-picker';
@import 'components/select';
@import 'components/dropzone';
Expand Down
4 changes: 0 additions & 4 deletions frontend/stylesheets/components/_datatables.scss

This file was deleted.

1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var babelQuery = {
var webpackConfig = {
context: jsSrc,
entry: ["./javascript/app.js"],
devtool: "source-map",
output: {
path: path.normalize(jsDest),
filename: 'js/app.js',
Expand Down
Loading