Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monolith final #387

Open
wants to merge 87 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
ae77b3d
rip out old styles and add bootstrap in assets pipeline
timcowlishaw Oct 29, 2024
fd0ebed
some sensible bootstrap defaults
timcowlishaw Oct 29, 2024
7f648fd
use bootstrap forms
timcowlishaw Oct 29, 2024
0377066
fix specs
timcowlishaw Oct 29, 2024
31ec21e
style tweaks: form borders, container, flashes, background, some buttons
timcowlishaw Oct 29, 2024
b421b11
fix build
timcowlishaw Oct 29, 2024
5d61e56
set titles in controllers
timcowlishaw Oct 29, 2024
c2cb2df
basic bootstap navbar styles
timcowlishaw Oct 29, 2024
e4e29a1
nicer buttons
timcowlishaw Oct 29, 2024
db3cd45
more button tweaks
timcowlishaw Oct 29, 2024
0532e0e
slim down form borders
timcowlishaw Oct 29, 2024
63ecb68
button styles final
timcowlishaw Oct 29, 2024
035a155
stupid esoteric keyboard focus states fixed
timcowlishaw Oct 29, 2024
5d4afe3
footergit status
timcowlishaw Oct 29, 2024
36ba2aa
footer flag alignment
timcowlishaw Oct 29, 2024
3440a53
footer alignment
timcowlishaw Oct 29, 2024
ff45731
footer positioning fix
timcowlishaw Oct 31, 2024
57e5eeb
Navbar styles
timcowlishaw Oct 31, 2024
a1b0a18
responsive design tweaks at small breakpoints
timcowlishaw Oct 31, 2024
b0bfc51
white box doesnt fill whole height of viewport
timcowlishaw Oct 31, 2024
e7f43aa
smidge more breathing room underneath the flash alert component
timcowlishaw Oct 31, 2024
b0deb77
Move all user-facing web copy into localization files
timcowlishaw Oct 31, 2024
4471c22
Happy path for user signup
timcowlishaw Nov 5, 2024
1b14357
responsive tweaks, link back to login from signup
timcowlishaw Nov 5, 2024
ba4be1a
tests for error cases on user creation, tidy up validations and fix b…
timcowlishaw Nov 5, 2024
fe1d894
logged in users can't create new users
timcowlishaw Nov 5, 2024
e86aef9
happy path for user deletion
timcowlishaw Nov 22, 2024
5c865fc
error case behaviour for user deletion
timcowlishaw Nov 22, 2024
3189867
extra user controller specs
timcowlishaw Nov 22, 2024
066a798
user profile WIP
timcowlishaw Nov 27, 2024
3522d61
user profile and edit form
timcowlishaw Dec 11, 2024
74615fb
extra permissions checks for user updates, controller specs
timcowlishaw Dec 11, 2024
9737ed9
user secrets page!
timcowlishaw Dec 12, 2024
9c54d66
refactor user controller, remove redundant index action
timcowlishaw Dec 12, 2024
145b410
navbar refresh, add profile image when logged in
timcowlishaw Dec 12, 2024
2f344df
breadccrumb navigation
timcowlishaw Dec 12, 2024
04ea9b3
remove a stray console.log
timcowlishaw Dec 12, 2024
6fc3965
typo in copy
timcowlishaw Dec 12, 2024
3ea94b0
Bugfixes: menu bar profile picture, persmissions, posessive pronouns
timcowlishaw Dec 13, 2024
22aa324
CTA on profile when user has no devices
timcowlishaw Dec 13, 2024
4c3dbb5
move js packaging from sprockets to webpacker, for leaflet.js and fut…
timcowlishaw Dec 16, 2024
5a72a8c
device listing component, beginning of device management section
timcowlishaw Dec 16, 2024
6a5e35e
move devices strings into i18n
timcowlishaw Dec 16, 2024
6d8ffba
refactor profile image into reusable block
timcowlishaw Dec 16, 2024
4632457
refactor profile header out into reusable component
timcowlishaw Dec 16, 2024
318095a
beginnings of device profile w/ reusable maps and metadata components
timcowlishaw Dec 17, 2024
0fdd2f4
add edit action to show device page, spec for devices controller
timcowlishaw Dec 17, 2024
a02e724
Device update form WIP
timcowlishaw Dec 18, 2024
9918107
map location picker for devices
timcowlishaw Dec 18, 2024
12ccc71
styling tweaks
timcowlishaw Dec 18, 2024
9f5b3ac
device edit form: tags, map, postprocessing
timcowlishaw Dec 20, 2024
ee568ef
Switch CI build process to use docker
timcowlishaw Dec 20, 2024
8d7041f
allow users to delete devices
timcowlishaw Dec 21, 2024
da3ae41
allow users to download device data as CSV
timcowlishaw Dec 28, 2024
80ea977
Device show page
timcowlishaw Jan 10, 2025
c99554e
abstract out device form for use in legacy create
timcowlishaw Jan 14, 2025
cd60b1d
registration of legacy device
timcowlishaw Jan 15, 2025
0a6caf9
breadcrumbs for device registration
timcowlishaw Jan 15, 2025
364cdeb
allow users to upload CSV data for devices
timcowlishaw Jan 17, 2025
fd75471
correct heading font weight and letter spacing
timcowlishaw Jan 17, 2025
fa338de
show experiments and readings
timcowlishaw Jan 29, 2025
faceb06
edit experiments
timcowlishaw Jan 30, 2025
8e8076e
edit experiment controller specs
timcowlishaw Jan 31, 2025
1528ae7
create experiments
timcowlishaw Jan 31, 2025
dbbcf2f
deleting experiments
timcowlishaw Jan 31, 2025
4620d69
monolith deployment configuration
oscgonfer Jan 31, 2025
53a4e45
sign out button alignment
oscgonfer Jan 31, 2025
34d9faf
ensure experiment devices can be removed, get rid of outline of devic…
timcowlishaw Feb 11, 2025
0635c8a
style flatpackr calendar
timcowlishaw Feb 11, 2025
2c165c4
add flatpickr overrides css
timcowlishaw Feb 11, 2025
cf2854a
add uptimerobot logo to footer
timcowlishaw Feb 11, 2025
f9501f3
responsive layout tweaks
timcowlishaw Feb 14, 2025
c5442a2
fix tests
timcowlishaw Feb 18, 2025
0c7c717
briefer breadcrumb wording
timcowlishaw Feb 18, 2025
cc5884a
fix two column layout alingment
timcowlishaw Feb 18, 2025
dd576e1
user profile spacing
timcowlishaw Feb 18, 2025
0085620
container spacing on form pages
timcowlishaw Feb 18, 2025
4840417
goto redirects for sign in/out/up
timcowlishaw Feb 18, 2025
b0310f8
home link becomes map
timcowlishaw Feb 18, 2025
70c9f89
link to map on device page
timcowlishaw Feb 19, 2025
5a2d83a
yellow drop shadows
timcowlishaw Feb 19, 2025
6d75d3f
danger zonegit add .!
timcowlishaw Feb 19, 2025
d78e8c2
briefer titles and breadcrumbs
timcowlishaw Feb 19, 2025
6e9f80e
big style refresh
timcowlishaw Feb 19, 2025
89204a6
nginx config for whitelisting smartcitizen domains
timcowlishaw Feb 19, 2025
5ce4f3f
button and nav fade transitions on hover
timcowlishaw Feb 19, 2025
a817330
wording changes
timcowlishaw Feb 19, 2025
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
76 changes: 15 additions & 61 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,26 @@ name: Ruby
on: [push]

jobs:
docker_build:
name: Build Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Build the Dockerfile
run: docker build -t app .
build:
name: The Build
name: Build and test
runs-on: ubuntu-latest

services:
redis:
image: redis:4
ports:
- 6379:6379
postgres:
image: postgres:10
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
ports: ["5432:5432"]
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/[email protected]
- uses: actions/checkout@v3
- name: Copy .env file
uses: canastro/copy-file-action@master
with:
source: "env.example"
target: ".env"

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build the Stack
run: "docker compose build"

- name: Show available Ruby versions
run: |
ls $RUNNER_TOOL_CACHE/Ruby
uname -a
cat /etc/os-release
- name: Start dependencies
run: "docker compose up -d --no-deps db redis app"

- name: Install required packages
run: sudo apt-get install libpq-dev
- name: Run all tests
run: "docker compose exec app ./ci.sh"

- name: Test
run: |
RAILS_ENV=test bundle exec rails db:create
RAILS_ENV=test bundle exec rails db:schema:load
bundle exec rake
env:
#Note: DATABASE_URL does not work in TEST env.
TEST_DB_HOST: localhost
TEST_DB_USERNAME: postgres
TEST_DB_PASSWORD: postgres
TEST_DB_NAME: postgres
discourse_sso_secret: "secret"
discourse_endpoint: "https://example.com"
PG_PORT: ${{ job.services.postgres.ports['5432'] }}
- name: Teardown the stack
run: "docker compose down"

#- name: Deploy to server via SSH
#uses: appleboy/ssh-action@master
#with:
#host: ${{ secrets.HOST }}
#key: ${{ secrets.KEY }}
#port: ${{ secrets.PORT }}
#username: ${{ secrets.USERNAME }}
#script: |
#cd smartcitizen-api
#pwd
#./scripts/deploy.sh
#if: github.ref == 'refs/heads/master' && job.status == 'success'
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/config/application.yml

/public/api
/public/assets
/public/coverage
/coverage
*.rdb
Expand Down Expand Up @@ -54,3 +55,10 @@ scripts/emqt
.tool-versions

compose.override.yml

/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity
30 changes: 29 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
FROM ruby:3.0.6

SHELL ["/bin/bash", "--login", "-c"]

# Set debconf to run non-interactively
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

# Install essential Linux packages
RUN apt-get update -qq && apt-get install -y \
build-essential \
libpq-dev \
postgresql-client \
nodejs
apt-transport-https \
ca-certificates \
curl \
git \
libssl-dev \
wget

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 22.12.0
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/v$NODE_VERSION/bin:$PATH

RUN mkdir $NVM_DIR

RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.40.1/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default \
&& npm install -g yarn

WORKDIR /app

Expand All @@ -18,6 +42,10 @@ ARG BUNDLE_WITHOUT
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT}
RUN bundle install


COPY package.json yarn.lock /app/
RUN . $NVM_DIR/nvm.sh && nvm use default && yarn install

# Copy the Rails application into place
COPY . /app

Expand Down
9 changes: 7 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ source 'https://rubygems.org'
gem 'rails', '6.1.7.3'
gem 'sidekiq', '~> 6'
gem 'doorkeeper', '~> 5'

gem "webpacker"
gem 'jquery-rails'
gem 'sass-rails'
gem 'turbolinks'
gem 'uglifier'

gem "autoprefixer-rails"
gem "bootstrap", "~> 5.3.3"
gem "bootstrap_form", "~> 5.4"
gem "font-awesome-sass", "~> 4.6.2"
# To resize active storage images:
# Revise if this is needed after Rails 6.0
gem 'image_processing'
Expand All @@ -23,6 +26,7 @@ gem "bootsnap", '~> 1.9.4'
gem 'browser'
gem 'c_geohash', require: false
gem 'countries'
gem "country_select"
gem 'dalli'
gem 'date_validator'
gem 'diffy', require: false
Expand Down Expand Up @@ -77,6 +81,7 @@ group :test do
gem 'vcr'
gem 'webmock'
gem 'zonebie'
gem 'rails-controller-testing'
end

group :development do
Expand Down
39 changes: 38 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ GEM
api-pagination (5.0.0)
api_cache (0.3.0)
ast (2.4.2)
autoprefixer-rails (10.4.19.0)
execjs (~> 2)
awesome_print (1.9.2)
aws-eventstream (1.2.0)
aws-partitions (1.769.0)
Expand All @@ -113,6 +115,12 @@ GEM
bcrypt (3.1.18)
bootsnap (1.9.4)
msgpack (~> 1.0)
bootstrap (5.3.3)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 2.11.8, < 3)
bootstrap_form (5.4.0)
actionpack (>= 6.1)
activemodel (>= 6.1)
browser (5.3.1)
builder (3.2.4)
byebug (11.1.3)
Expand All @@ -134,6 +142,8 @@ GEM
connection_pool (2.4.1)
countries (5.4.0)
unaccent (~> 0.3)
country_select (9.0.0)
countries (> 5.0, < 7.0)
crack (0.4.5)
rexml
crass (1.0.6)
Expand Down Expand Up @@ -189,6 +199,8 @@ GEM
fog-xml (0.1.4)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
font-awesome-sass (4.6.2)
sass (>= 3.2)
formatador (1.1.0)
friendly_id (5.5.0)
activerecord (>= 4.0.0)
Expand Down Expand Up @@ -323,6 +335,7 @@ GEM
activerecord (>= 5.2)
activesupport (>= 5.2)
polyglot (0.3.5)
popper_js (2.11.8)
premailer (1.21.0)
addressable
css_parser (>= 1.12.0)
Expand Down Expand Up @@ -356,6 +369,8 @@ GEM
rack (>= 2.0.0)
rack-protection (3.0.6)
rack
rack-proxy (0.7.7)
rack
rack-test (2.1.0)
rack (>= 1.3)
rack-timeout (0.6.3)
Expand All @@ -375,6 +390,10 @@ GEM
bundler (>= 1.15.0)
railties (= 6.1.7.3)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand Down Expand Up @@ -460,6 +479,11 @@ GEM
rufus-scheduler (3.8.2)
fugit (~> 1.1, >= 1.1.6)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.4.0)
Expand All @@ -470,6 +494,7 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
semantic_range (3.1.0)
sentry-rails (5.9.0)
railties (>= 5.0)
sentry-ruby (~> 5.9.0)
Expand Down Expand Up @@ -548,6 +573,11 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.4.4)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
webrick (1.8.1)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
Expand All @@ -569,17 +599,21 @@ DEPENDENCIES
ancestry
api-pagination
api_cache
autoprefixer-rails
awesome_print
aws-sdk-s3
bcrypt
bootsnap (~> 1.9.4)
bootstrap (~> 5.3.3)
bootstrap_form (~> 5.4)
brakeman!
browser
byebug
c_geohash
cane
capybara
countries
country_select
dalli
date_validator
diffy
Expand All @@ -589,6 +623,7 @@ DEPENDENCIES
faker
fast_blank
fog-aws (~> 3.19.0)
font-awesome-sass (~> 4.6.2)
friendly_id
geocoder
guard-rspec
Expand Down Expand Up @@ -620,6 +655,7 @@ DEPENDENCIES
rack-timeout
railroady
rails (= 6.1.7.3)
rails-controller-testing
rails-erd
ransack
rdoc
Expand Down Expand Up @@ -648,6 +684,7 @@ DEPENDENCIES
vcr
versionist!
webmock
webpacker
webrick
workflow
workflow-activerecord
Expand All @@ -657,4 +694,4 @@ RUBY VERSION
ruby 3.0.6p216

BUNDLED WITH
2.5.22
2.5.23
3 changes: 1 addition & 2 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link application.css
5 changes: 5 additions & 0 deletions app/assets/images/clipboard_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/images/clock-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/images/close_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/default_avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions app/assets/images/default_avatar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/eu_flag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions app/assets/images/fb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/iaac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading