-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into new-service
rebase
- Loading branch information
Showing
94 changed files
with
4,397 additions
and
2,435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 24.3.0 | ||
hooks: | ||
- id: black | ||
language_version: python3 | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 7.0.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [Flake8-pyproject] | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-ast | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
- repo: https://github.com/Yelp/detect-secrets | ||
rev: v1.4.0 | ||
hooks: | ||
- id: detect-secrets | ||
args: | ||
[ | ||
"--disable-plugin", | ||
"HexHighEntropyString", | ||
"--disable-plugin", | ||
"Base64HighEntropyString", | ||
] | ||
exclude: .env.development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
"autoStartBrowser": false | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
{ | ||
{ "workbench.colorCustomizations": { | ||
"titleBar.activeBackground": "#bf4bb7", | ||
"titleBar.activeForeground": "#fdfbfb", | ||
}, | ||
"python.testing.pytestArgs": [ | ||
"tests" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
############################################################################### | ||
# | ||
# Self Service Dev Image | ||
# Fund Application Builder (FAB) Dev Image | ||
# | ||
############################################################################### | ||
|
||
FROM ghcr.io/communitiesuk/fsd-base-dev/frontend:sha-68d9e31a4ff4adc9b5ead035e1a82203ec93d919 as self-serve-dev | ||
FROM python:3.10-bullseye as fab-dev | ||
|
||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
RUN apt-get update && apt-get install -y postgresql-client | ||
|
||
RUN python3 -m pip install --upgrade pip && pip install -r requirements.txt | ||
|
||
|
||
RUN python3 -m pip install --upgrade pip && pip install pip-tools && pip install -r requirements.txt | ||
RUN python3 -m pip install -r requirements-dev.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,90 @@ | ||
# funding-service-design-self-serve | ||
Prototype self service app | ||
# Prototype Fund Application Builder (FAB) | ||
Flask app, with database, for building a fund and applications. | ||
|
||
# Run | ||
## Dev Containers | ||
This repo contains a devcontainer spec for VS code at [.devcontainer](.devcontainer/python-container/devcontainer.json). This uses docker-compose to start up a container to develop the app, and also a companion postgres instance. The default connection URLs used for tests and at runtime are set to pickup the DB from that docker-compose instance so you don't need to set anything up manually. | ||
|
||
## Local development | ||
If developing locally, you will need a postgres instance running and to set the following environment variables: | ||
- `DATABASE_URL` to a suitable connection string. The default used is | ||
`postgresql://postgres:password@fab-db:5432/fund_builder`. # pragma: allowlist secret | ||
- `DATABASE_URL_UNIT_TEST` default | ||
`postgresql://postgres:password@fab-db:5432/fund_builder_unit_test` # pragma: allowlist secret | ||
|
||
## General | ||
Run the app with `flask run` (include `--debug` for auto reloading on file changes) | ||
|
||
## Helper Tasks | ||
Contained in [db_tasks.py](./tasks/db_tasks.py) | ||
|
||
### Recreate Local DBs | ||
For both `DATABASE_URL` and `DATABASE_URL_UNIT_TEST`, drops the database if it exists and then recreates it. | ||
|
||
### Init migrations | ||
Deletes the [versions](./app/db/migrations/versions/) directory and runs `migrate()` to generate a new intial migration version for the SQLAlchemy models. | ||
|
||
### Create Test Data | ||
Inserts a set of seed data comprising one Fund, 2 rounds and the applicaiton/assessment config for one of those rounds. The data created is defined in [test_data.py](./tasks/test_data.py) | ||
|
||
## With Form Runner for Form Previews | ||
In order to use the 'Preview Form' function, FAB needs to connect to a running instance of form runner. For prototyping, no session is created in the form runner, so it needs to be started without expecting the JWT information. | ||
|
||
Below is a docker-compose file that will start both the FAB app, and the form runner, with the appropriate connection information. FAB will start on http://localhost:8080 and connect to the form runner defined in docker compose. If you want to do this, create the following directory structure and put this file in docker-compose.yml under DC. | ||
|
||
|
||
``` | ||
workspace | ||
| - dc | ||
| - docker-compose.yml | ||
| - digital-form-builder | ||
| - funding-service-design-fund-application-builder | ||
``` | ||
|
||
``` | ||
services: | ||
fab: | ||
hostname: fab | ||
build: | ||
context: ../funding-service-design-fund-application-builder | ||
dockerfile: Dockerfile | ||
command: ["sh", "-c", "python -m flask db upgrade && inv create-test-data && python -m flask run --host 0.0.0.0 --port 8080"] | ||
ports: | ||
- 8080:8080 | ||
environment: | ||
- FORM_RUNNER_INTERNAL_HOST=http://form-runner:3009 | ||
- FORM_RUNNER_EXTERNAL_HOST=http://localhost:3009 | ||
- DATABASE_URL=postgresql://postgres:password@fab-db:5432/fund_builder # pragma: allowlist secret | ||
depends_on: [fab-db] | ||
fab-db: | ||
image: postgres | ||
environment: | ||
- POSTGRES_PASSWORD=password | ||
- POSTGRES_DB=fund_builder | ||
form-runner: | ||
build: | ||
context: ../digital-form-builder | ||
dockerfile: ./fsd_config/Dockerfile | ||
command: yarn runner startdebug | ||
links: | ||
- fab:fab | ||
ports: | ||
- 3009:3009 | ||
- 9228:9228 | ||
environment: | ||
- LOG_LEVEL=debug | ||
- 'NODE_CONFIG={"safelist": ["fab"]}' | ||
- CONTACT_US_URL=http://localhost:3008/contact_us | ||
- FEEDBACK_LINK=http://localhost:3008/feedback | ||
- COOKIE_POLICY_URL=http://localhost:3008/cookie_policy | ||
- ACCESSIBILITY_STATEMENT_URL=http://localhost:3008/accessibility_statement | ||
- SERVICE_START_PAGE=http://localhost:3008/account | ||
- MULTIFUND_URL=http://localhost:3008/account | ||
- LOGOUT_URL=http://localhost:3004/sessions/sign-out | ||
- PRIVACY_POLICY_URL=http://localhost:3008/privacy | ||
- ELIGIBILITY_RESULT_URL=http://localhost:3008/eligibility-result | ||
- PREVIEW_MODE=true | ||
- NODE_ENV=development | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
def determine_display_value_for_condition( | ||
condition_value: str, | ||
list_name: str = None, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from flask_wtf import FlaskForm | ||
from wtforms import BooleanField | ||
from wtforms import HiddenField | ||
from wtforms import StringField | ||
from wtforms.validators import DataRequired | ||
from wtforms.validators import Length | ||
|
||
|
||
class FundForm(FlaskForm): | ||
fund_id = HiddenField("Fund ID") | ||
name_en = StringField("Name", validators=[DataRequired()]) | ||
title_en = StringField("Title", validators=[DataRequired()]) | ||
short_name = StringField("Short Name", validators=[DataRequired(), Length(max=6)]) | ||
description_en = StringField("Description", validators=[DataRequired()]) | ||
welsh_available = BooleanField("Welsh Available") |
Oops, something went wrong.