Giter VIP home page Giter VIP logo

omahelsinki's Introduction

Oma.helsinki

๐Ÿ”ฅ Wagtail CMS + ReactJS ๐Ÿ”ฅ

Oma.helsinki is a MyData-based user account for city services. It provides user-driven data handling and consent management for City of Helsinki services.

Installation

General prerequisites

For any type of local development setup the following is recommended:

  1. Create local settings: touch local_settings.py

  2. Set DEBUG = True

  3. In order to use some Tunnistamo instance to handle user logins, set proper url and keys in local_settings.py:

TUNNISTAMO_BASE_URL = 'http://some.url'

SOCIAL_AUTH_TUNNISTAMO_KEY = 'some key'
SOCIAL_AUTH_TUNNISTAMO_SECRET = 'some secret'
SOCIAL_AUTH_TUNNISTAMO_OIDC_ENDPOINT = TUNNISTAMO_BASE_URL + '/openid'

Get these from someone involved in the project.

The project will also work without them, but the only way to login would be through Wagtail admin interface.

Development with Docker

  1. Start docker containers: docker-compose up

  2. When you run your containers for the first time, apply Django migrations:

  • docker exec -it omahelsinki python manage.py migrate
  • answer yes to all questions

Now your project is live at localhost:8000

You can load some dummy data for wagtail if you want:

curl "https://omahelsinki.test.hel.ninja/media/omahelsinki-datadump.json" > omahelsinki-datadump.json
docker exec omahelsinki python manage.py loaddata omahelsinki-datadump.json

To log into django container do docker exec -it omahelsinki bash

There is a compiler container for the react app, so any changes to react JS files will get built automatically and cause the current Django page to reload.

Development w/o Docker

Requirements:

  • PostgreSQL
  • Python >3
  • Virtualenv
  • gettext (to compile translations)

Setting up

  • Create Virtualenv env: virtualenv -p python3 django
  • Navigate to env directory, activate env: cd django && source bin/activate
  • Clone omahelsinki to env dir: git clone https://github.com/City-of-Helsinki/omahelsinki.git
  • Go inside oma dir cd omahelsinki
  • Install dependencies pip install -r requirements.txt
  • Install dev-dependencies pip install -r requirements-dev.txt

Bundling/Compile JS assets:

yarn install
yarn build

Initialize Database (if doesnt exist)

  • Check if db service is running
  • Create database

Serve build

python manage.py migrate
python manage.py compilemessages
python manage.py createsuperuser
python manage.py runserver

Now your project is live at localhost:8000

Load test content

You can load some test content for the Wagtail part:

curl "https://omahelsinki.test.hel.ninja/media/omahelsinki-datadump.json" > omahelsinki-datadump.json
python manage.py loaddata omahelsinki-datadump.json

Authentication

In order to log in into the profile through Omahelsinki UI you either:

a). Have proper keys to test instance of Tunnisamo mentioned in part 3 of general prerequisites

or

b). Have set up your own local instances of:

If you are running all of these services locally through Docker, you need to make sure that they can communicate with each other. Here is a guide that will help you to set them up properly:

If you are not using Docker (you run all of the projects directly on your machine with some virtual environment for python dependencies), you can skip this part.

Here is a guide that will help you configure all of the clients, scopes and APIs in you local Tunnistamo:

Prettier / eslint

It's recommended to have format on save in your editor to automatically comply with prettier/eslint rules. For example with VSCode you should have the following in your Workspace Settings:

{
    "editor.formatOnSave": true
}

You can also manually prettify everything with (from project root folder)

yarn prettier  "assets/**/*.js" --write

Also to verify everything is OK, use

yarn lint

Views

License

This project is licensed under the MIT License

omahelsinki's People

Contributors

hkotkanen avatar igordavydsson avatar jaaniles avatar janimattiellonen avatar jimppa avatar juyrjola avatar rasbin avatar sanjoggit avatar terotik avatar tuomas777 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

omahelsinki's Issues

Profile: delete profile

Add a new button to profile-page that deletes oma.helsinki user profile.

And all that it needs to function :)

Image crop component

Create component that user uses to select profile picture and crop it.

Should support pre-selected image (e.g. from profile) and deleting image.
https://github.com/DominicTobias/react-image-crop could be used for the cropping.
Aspect ratio could be 1/1.
The image manipulation should be done in browser so that the server does not need to implement any cropping functionality.

The component will be used in user onboarding and mydata profile page.

My data changes

Implement Services, currently lorem ipsum.

Profile:

  • Show first/last/email as text instead of input since they can't be changed.
  • Remove password

History

  • use API to fetch events

Interests:

  • should use API

React-intl translation doesnt work on dev

Current issue:

React-intl translation doesnt work on dev
But it works on prod

Expected:
Working in both dev and prod

Suggest: could be something with file-loader / json-loader in webpack setting

Download own data button

Add a new button to profile-page to download users own data. Should produce a JSON that user can download/copy.

It should aggregate the data from different endpoints:

  • User API
    • Profile /v1/profile/
  • Tunnistamo
    • Login history /v1/user_login_entry/
    • List of connected services /v1/service/
    • User consents /v1/user_consent/

Onboarding changes

Disable the following steps:

  • Personal information
  • Password

Your Interests step:

  • Use API instead of mocks for subjects, regions and decisions
  • emit the selected values to container (Onboarding-component)

New step that replaces Personal Information:

  • Fields for nickname and profile picture. Default image fetched from fb/g+/github/...

New functionality: messaging and user settings

This issue is to be done after MVP.

There will be a new "settings" tab in Mydata profile page. In settings, the user can define what kind of messages and notifications she prefers from the service.

Needs a lot of development in the backend.

Profile: concepts of interest list bug

If a concept does not have a translation for the current language in Profiles API, then it will get displayed as an empty string.

Should there be a fallback language, when react fethes those? Should it be FI? ๐Ÿค”

Services component

Create a component that's used to render services.
Used on My data page to show services that user is NOT yet using.
Same component should be used to render services on wagtail Services page. A new entry point for react (ReactDOM.render()) is needed for this page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.