diff --git a/.github/workflows/node-js.yml b/.github/workflows/node-js.yml deleted file mode 100644 index 37bd3ea7..00000000 --- a/.github/workflows/node-js.yml +++ /dev/null @@ -1,27 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Node.js CI - -on: - push: - branches: [develop, master] - pull_request: - branches: [develop, master] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [8.x, 10.x] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm run production diff --git a/Dockerfile b/Dockerfile index e6c23e22..3c538da4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,22 @@ -FROM docker.io/python:3.12-bookworm +FROM node:25-bookworm-slim AS build-frontend + +RUN mkdir /opt/conditional + +WORKDIR /opt/conditional + +RUN apt-get -yq update && \ + apt-get -yq install curl git + +COPY package.json package-lock.json /opt/conditional/ + +RUN npm ci + +COPY build*.js webpack.config.js /opt/conditional +COPY frontend /opt/conditional/frontend + +RUN npm run webpack + +FROM docker.io/python:3.12-slim-bookworm MAINTAINER Computer Science House RUN mkdir /opt/conditional @@ -12,21 +30,13 @@ RUN apt-get -yq update && \ pip install -r requirements.txt && \ apt-get -yq clean all -ENV NVM_DIR /usr/local/nvm -ENV NODE_VERSION v10.24.1 -RUN mkdir -p $NVM_DIR - -RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash +ARG PORT=8080 +ENV PORT=${PORT} +EXPOSE ${PORT} -RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION" - -ADD . /opt/conditional - -RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm use --delete-prefix $NODE_VERSION && npm install && npm run production" - -RUN rm -rf node_modules && \ - apt-get -yq clean all +COPY . /opt/conditional +COPY --from=build-frontend /opt/conditional/conditional/static /opt/conditional/conditional/static RUN ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime -CMD ["gunicorn", "conditional:app", "--bind=0.0.0.0:8080", "--access-logfile=-", "--timeout=256"] +CMD ["sh", "-c", "gunicorn conditional:app --bind=0.0.0.0:${PORT} --access-logfile=- --timeout=256"] diff --git a/build-css.js b/build-css.js new file mode 100644 index 00000000..5f396e58 --- /dev/null +++ b/build-css.js @@ -0,0 +1,36 @@ +const { exec } = require('child_process'); +const path = require('path'); +const sass = require('sass'); +const fs = require('node:fs'); + +// yes I know this is awkward. I want to actually use the node libraries but that gets SUBSTANTIALLY easier when node and all the dependinces are updated +// So after I can update node and stuff I'll change this to do it in a sane way, probably in webpack + +const loadPaths = [ + "./node_modules/csh-material-bootstrap/dist", + "./node_modules/csh-material-bootstrap/dist/css", + "./node_modules/datatables.net-bs/css", + "./node_modules/bootstrap-material-datetimepicker/css", + "./node_modules/load-awesome/css", + "./node_modules/reveal.js/css", + "./node_modules", + ".", +] + +function compileFile(file) { + const result = sass.compile("frontend/stylesheets/" + file + ".scss", { + loadPaths: loadPaths, + importers: [ + new sass.NodePackageImporter() + ], + }) + + fs.writeFileSync("conditional/static/css/" + file + ".css", result.css); +} + +exec("mkdir -p " + path.resolve("conditional/static/css")) + +compileFile("app") + +compileFile("presentations") + diff --git a/conditional/__init__.py b/conditional/__init__.py index bb467c3c..1448326f 100644 --- a/conditional/__init__.py +++ b/conditional/__init__.py @@ -40,13 +40,9 @@ app.config['LDAP_BIND_PW'], ro=app.config['LDAP_RO']) -client_metadata = ClientMetadata( - client_id = app.config['OIDC_CLIENT_ID'], - client_secret = app.config['OIDC_CLIENT_SECRET'], - post_logout_redirect_uris = app.config['OIDC_POST_LOGOUT_REDIRECT_URIS'], -) -provider_config = ProviderConfiguration(issuer=app.config["OIDC_ISSUER"], client_metadata=client_metadata) - +provider_config = ProviderConfiguration( + app.config['OIDC_ISSUER'], + client_metadata=ClientMetadata(**app.config['OIDC_CLIENT_CONFIG'])) auth = OIDCAuthentication({'default': provider_config}, app) app.secret_key = app.config["SECRET_KEY"] diff --git a/conditional/templates/attendance_history.html b/conditional/templates/attendance_history.html index 3af638fc..7f50fb6a 100644 --- a/conditional/templates/attendance_history.html +++ b/conditional/templates/attendance_history.html @@ -23,7 +23,7 @@
{{meeting["name"]}}
@@ -50,7 +50,7 @@
{{seminar["name"]}}
@@ -76,7 +76,7 @@
{{meeting["name"]}}
diff --git a/conditional/templates/co_op_management.html b/conditional/templates/co_op_management.html index 20472150..a7a98b65 100644 --- a/conditional/templates/co_op_management.html +++ b/conditional/templates/co_op_management.html @@ -30,7 +30,7 @@

Co-Op Management

- + diff --git a/conditional/templates/conditional.html b/conditional/templates/conditional.html index 30a19f10..5183355c 100644 --- a/conditional/templates/conditional.html +++ b/conditional/templates/conditional.html @@ -10,7 +10,7 @@

Conditionals {% if is_eval_director %} {% endif %}

@@ -43,7 +43,7 @@

- + {% endif %} diff --git a/conditional/templates/dashboard.html b/conditional/templates/dashboard.html index b8abfa96..35d1f565 100644 --- a/conditional/templates/dashboard.html +++ b/conditional/templates/dashboard.html @@ -44,11 +44,11 @@

Freshman Evaluations {% if freshman['status'] == "Passed" %} - Passed + Passed {% elif freshman['status'] == "Pending" %} - Pending + Pending {% else %} - Failed + Failed {% endif %}

@@ -63,8 +63,8 @@

Freshman Evaluations Signatures Missed {% if freshman['sig_missed'] == 0 %} - None {% else %} - {{freshman['sig_missed']}} {% endif %} + None {% else %} + {{freshman['sig_missed']}} {% endif %} @@ -72,8 +72,8 @@

Freshman Evaluations Directorship Meetings {% if freshman['committee_meetings'] >= 6 %} - {% else %} - {% endif %} {{freshman['committee_meetings']}} / 6 + {% else %} + {% endif %} {{freshman['committee_meetings']}} / 6 @@ -81,8 +81,8 @@

Freshman Evaluations House Meetings Missed {% if freshman['hm_missed'] == 0 %} - None {% else %} - {{ freshman['hm_missed'] }} {% endif %} + None {% else %} + {{ freshman['hm_missed'] }} {% endif %} @@ -111,11 +111,11 @@

Freshman Evaluations

Membership Evaluations {% if spring['status'] == "Passed" %} - Passed + Passed {% elif spring['status'] == "Failed" %} - Failed + Failed {% elif active %} - Pending + Pending {% endif %}

@@ -141,16 +141,16 @@

Membership Evaluations Directorship Meetings {% if spring['committee_meetings'] >= spring['req_meetings'] %} - {% else %} - {% endif %} {{ spring['committee_meetings'] }} / {{ spring['req_meetings'] }} + {% else %} + {% endif %} {{ spring['committee_meetings'] }} / {{ spring['req_meetings'] }} House Meetings Missed {% if spring['hm_missed'] == 0 %} - None {% else %} - {{spring['hm_missed']}} + None {% else %} + {{spring['hm_missed']}} {% endif %} @@ -160,9 +160,9 @@

Membership Evaluations {% if spring['mp_status'] == "Passed" %} - Passed {% elif spring['mp_status'] == "Pending" %} - Pending {% else %} - None {% endif %} + Passed {% elif spring['mp_status'] == "Pending" %} + Pending {% else %} + None {% endif %} @@ -193,9 +193,9 @@

Conditionals

{{c['description']}} {% if c['status'] == "Passed" %} - {% elif c['status'] == "Pending" %} - Pending {% else %} - Failed {% endif %} + {% elif c['status'] == "Pending" %} + Pending {% else %} + Failed {% endif %} {% endfor %} @@ -235,7 +235,7 @@

Member Statistics

{% if major_projects_count == 0 and not active%} - + {% elif major_projects_count > 0 %}
@@ -245,14 +245,17 @@

Major Projects

{% for p in major_projects %}
{% if p['status'] == "Passed" %} -
{{p['name']}}
+
{{p['name']}}
{% elif p['status'] == "Pending" %}
- {{p['name']}} - + {{p['name']}} +
{% else %} -
{{p['name']}}
+
{{p['name']}}
{% endif %}
{{p['description']}}
@@ -317,7 +320,7 @@

Housing Status

{% if hm_attendance_len == 0 and active%}
- You haven't missed any house meetings. + You haven't missed any house meetings.
{% elif hm_attendance_len > 0 %}
@@ -344,7 +347,7 @@

Missed House Meetings

{% endif %} {% if cm_attendance_len == 0 and active%} -
You have not attended any directorship meetings.
+
You have not attended any directorship meetings.
{% elif cm_attendance_len > 0 %}
diff --git a/conditional/templates/housing.html b/conditional/templates/housing.html index 67c51c0c..5b5381b7 100644 --- a/conditional/templates/housing.html +++ b/conditional/templates/housing.html @@ -11,7 +11,7 @@

Housing Queue {% if is_eval_director %} {% endif %}

@@ -50,7 +50,7 @@

Housing Queue

Current Room Numbers {% if is_eval_director %} {% endif %}

@@ -80,7 +80,7 @@

{{room}}

{% if is_eval_director %} {% endif %} diff --git a/conditional/templates/intro_eval_slideshow.html b/conditional/templates/intro_eval_slideshow.html index 2e102418..c3b2e3fd 100644 --- a/conditional/templates/intro_eval_slideshow.html +++ b/conditional/templates/intro_eval_slideshow.html @@ -18,7 +18,11 @@

{{m['name']}}

{% set packet_passed = m['signatures_missed'] == 0 %}
- + {% if packet_passed %} + + {% else %} + + {% endif %}

{{m['signatures_missed']}}

Signatures Missed

@@ -26,7 +30,11 @@

{{m['signatures_missed']}}

{% set committee_meetings_passed = m['committee_meetings'] >= 6 %}
- + {% if committee_meetings_passed %} + + {% else %} + + {% endif %}

{{m['committee_meetings']}}

Meetings

@@ -34,7 +42,11 @@

{{m['committee_meetings']}}

{% set house_meetings_passed = m['house_meetings_missed']|length == 0 %}
- + {% if house_meetings_passed %} + + {% else %} + + {% endif %}

{{m['house_meetings_missed']|length}}

Absences

@@ -42,7 +54,11 @@

{{m['house_meetings_missed']|length}}

{% set technical_seminars_passed = m['technical_seminars']|length >= 2 %}
- + {% if technical_seminars_passed %} + + {% else %} + + {% endif %}

{{m['technical_seminars']|length}}

Seminars

diff --git a/conditional/templates/intro_evals.html b/conditional/templates/intro_evals.html index d321fbef..d75e529b 100644 --- a/conditional/templates/intro_evals.html +++ b/conditional/templates/intro_evals.html @@ -30,14 +30,14 @@

Intro Evaluations

{{m['uid']}} {% if m['ldap_account'] %} {% if m['status'] == "Passed" %} - + {% elif m['status'] == "Pending" %} - + {% else %} - + {% endif %} {% else %} - + {% endif %}
@@ -58,17 +58,17 @@
{{ m['uid'] }}
{% if m['signatures_missed'] == 0 %}
- Signatures Missed + Signatures Missed {{ m['signatures_missed'] }}
{% elif m['signatures_missed'] > 0 %}
- Signatures Missed + Signatures Missed {{ m['signatures_missed'] }}
{% else %}
- Packet In Progress + Packet In Progress Pending
{% endif %} @@ -76,12 +76,12 @@
{{ m['uid'] }}
{% if m['committee_meetings'] < 6 %}
- Directorship Meetings + Directorship Meetings {{m['committee_meetings']}} / 6
{% else %}
- Directorship Meetings + Directorship Meetings {{m['committee_meetings']}} / 6
{% endif %} @@ -90,12 +90,12 @@
{{ m['uid'] }}
{% if m['house_meetings_missed']|length > 0 %}
- House Meetings Missed + House Meetings Missed {{m['house_meetings_missed']|length}}
{% else %}
- House Meetings Missed + House Meetings Missed {{m['house_meetings_missed']|length}}
{% endif %} @@ -107,7 +107,7 @@
{{ m['uid'] }}
{% if m['house_meetings_missed']|length != 0 or m['technical_seminars']|length != 0 or m['comments'] != "" %}
{% endif %} @@ -169,7 +169,7 @@

Other Comments

{% endfor %}
{% else %} - + {% endif %} {% endblock %} diff --git a/conditional/templates/major_project_submission.html b/conditional/templates/major_project_submission.html index 8705d2ad..c5287dc4 100644 --- a/conditional/templates/major_project_submission.html +++ b/conditional/templates/major_project_submission.html @@ -54,33 +54,35 @@

{{p['proj_name']}}

{% else %} {% if p['status'] == 'Passed' %} -
+
{% elif p['status'] == 'Failed' %} -
+
{% else %} -
+
{% endif %} {% if p.is_owner and p['status'] == 'Pending' %} - + {% endif %} {% endif %}
- +
{{p['description']}}
diff --git a/conditional/templates/member_management.html b/conditional/templates/member_management.html index 34d391ad..520b20c1 100644 --- a/conditional/templates/member_management.html +++ b/conditional/templates/member_management.html @@ -35,7 +35,7 @@

Administration

{% else %}
@@ -94,7 +94,7 @@

Add Users

{% if is_eval_director %} {% if freshmen|length == 0 %} - + {% else %}
@@ -138,7 +138,7 @@

Member Management

@@ -224,7 +224,7 @@

Missed House Meetings

- +
07/31/2016
@@ -239,7 +239,7 @@
07/31/2016
@@ -297,7 +297,7 @@

Missed House Meetings

- +
07/31/2016
@@ -312,7 +312,7 @@
07/31/2016
diff --git a/conditional/templates/nav.html b/conditional/templates/nav.html index 6e4173f7..9b0fa25c 100644 --- a/conditional/templates/nav.html +++ b/conditional/templates/nav.html @@ -14,69 +14,69 @@