Giter VIP home page Giter VIP logo

sormas-angular's Introduction

SORMAS-Angular

Technical setup - checklist:

  • RBAC - should be easy to do based on the roles of the user
  • E2E tests setup & run them in CI
  • CD pipeline - after CI is passing create a CD pipeline to deploy the applications for easy testing

This project was generated with Angular CLI version 11.0.4.

Local dev setup

Prerequisites:

Install dependencies

Run npm i Run npm run build Run cd ./projects/api-proxy & npm i

Development server

Run npm start for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

You can start the app in a different language using: Ex: npm run start:de

Note: Keycloak is required to run the app - see below

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run npm run build to build the project. The build artifacts will be stored in the dist/ directory.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

sormas-angular's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  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

sormas-angular's Issues

Local dev setup using SORMAS-Docker

Background

We need a fast way of setting a local environment for the Sormas-Project.
We want to see if using the Sormas-Docker repository can help us with this.

Outcome

We want to investigate and document how we can use the Sormas-Docker repo to start a local Sormas environment with:

Support Legacy Login - for local development

Background

The new Angular application currently supports login via the Keycloak integration.

Since a lot of Sormas installations don't use Keyclaok, we need to think about a solution of using the Sormas Rest API without Keyclaok.

Angular setup

The Angular application needs to be configured at build time with an environment variable:

  • USE_LEGACY_LOGIN
    If this variable is true, the Angular application should provide a Login Screen where the user can supply his credentials.
    Upon login, the Angular application shall not store those credentials but obtain an Access Token or a Cookie from Sormas Rest.

Sormas Rest

We need to update Sormas Rest so it supports a new safe Auth mechanism.
A new endpoint shall be provided for the Angular client to log in a user. This endpoint should validate the user credentials and return:

  • Option A - an access/refresh token pair
  • Option B - set a session cookie on the calling client

Local Docker-Compose with Keycloak

Current status

We integrated the Angular App with Keycloak and the Rest API using OIDC (using a test BE).
We currently have a docker-compose file that is usable but needs some extra settings because the Rest API rejects Basic or Bearer Authentication.
Read more: #4

Desired state

Update the docker-compose file so the Sormas-Rest Basic and Bearer auth works.

Would be nice to have two options:

  • one with Keycloak
  • one without Keycloak

Common components - Modal

Modal component

We want to have a generic Modal component that supports:

  • header
  • content - dynamic
  • footer with - action buttons - Yes / No
  • action buttons names are configurable & we can emit an event on click

image

At this point styling is not the main concern - we will have further tasks to enhance it.

Results

We want the result of this issue to be an example in the Sormas-Angular project with a page containing a button that can toggle the modal component.

Common components - Table

Table component

We want to have a generic table component that supports:

  • client-side pagination, sorting, filtering
  • server-side pagination, sorting, filtering
  • column resize

We can select an open-source component that provides this or build our own.
At this point styling is not the main concern - we will have further tasks to enhance it.

Results

We want the result of this issue to be an example in the Sormas-Angular project with a page containing two tables:

  • one with client-side pagination, sorting, filtering
  • one with server-side pagination, sorting, filtering

Integrate Sormas-Angular with Sormas Keycloak & Sormas API backend

Integration

Please take a look at https://github.com/hzi-braunschweig/SORMAS-Angular#auth-with-keycloak

Configuration

We should be able to configure Keyclaok with a new Client for the Angular app:
Client ID: sormas-angular
Client Protocol: openid-connect
Root URL: http://localhost:4200/
Extra scopes to call the Sormas API

Upon login, Angular app can call the Sormas API

The angular client needs to be adjusted to make a sample call to the Sormas API

Theme customizations - adopt new UX design (not yet ready for dev)

Disable Material ripple effects

https://material.angular.io/components/ripple/overview#disabling-animation

Theme colors

Adjust theme colors to be the ones from the UX designs.

Components

Adjust defaults Angular Components styles to look like the ones in the UX designs.
This ticket is for the designs of the first set of components - needed for forms:

  • radio
  • button
  • text input
  • select / dropdown
  • checkbox
  • datepicker

More info:
https://material.angular.io/guide/theming-your-components

Component library

Background

We want to start using a component library for Sormas Angular that provides developers with a fast way of creating UI components.

Component lib requirements

  • rich set of components
  • good documentation
  • same cross-browser look & feel
  • RTL support
  • well known in the OSS community

Selection

After our discussions, we decided to go with Angular Material.

Out of scope

Custom theme - this requires UX work first.

E2E tests setup

Current situation

We currently have the default Unit / Integration testing setup with the Karma (angular default). This also runs the tests in CI.
We want to decide if we use the default Angular E2E test setup (Protractor) or if we setup E2E tests with Cypress, or another solution?

Expected

  • create the E2E test setup and a few sample tests
  • the E2E tests should spin up the environment with docker-compose and then run the tests. Keycloak and the BE API are not mocked in those tests.

Initial Nonfunctional Requirements (NFRs)

This is an umbrella issue to keep track of some of the non-functional requirements of Sormas Angular.

App interop

  • there will be no app interop between the current app & the new app.
  • In the future, there will be an opt-in from old to new.

Auth 

Keycloak will be used for environments with Sormas Angular.
Keep in mind - legacy login (without Keycloak) might still be required
 (currently only supported in dev mode)

Internationalization (i18n)   - default Angular approach


https://angular.io/guide/i18n

 Timezones support

Needed to adjust dates to the user's timezone.

RTL (right to left support)

RTL support is necessary.

Devices support

  • Desktop
  • Tablet (including low resolutions)


Offline / PWA

Would be nice.

SSR?

Still need to consider if it is really needed.

CORS proxy or setup CORS headers for SORMAS-REST

Current issue

For local development, I fixed this using a local Proxy, but for calling the API when running the solution with docker-compose we still have this:
GH issue

Posible solutions

We can fix this eighter by proxy-ing the calls from Nginx to the Sormas API - then the CORS check is not done server-side, or fix it by adding the proper CORS headers for the API.

Add RTL example for an arabic language

Prerequisites

#8

Outcomes

We want a new language example for an Arabic language and create functionality that for those languages the app is correctly displayed (RTL).

Changing back to a non-Arabic language should display the app LTR.

Dynamic forms

Because in Sormas different countries or settings can affect forms - we want to build those dynamically.

We want to research a prefered way of doing dynamic forms in Sormas Angular.

One way we can do this is to have a JSON file with the form configuration (including validation config) and use a library to apply it.

We want the result of this issue to be an example in the Sormas-Angular project with a page containing a Dynamic form. Changing the configuration file we can see the form elements and validations on the form are changed.

Design breakdown

Break down the current design in smaller tasks to be able to start implementing them.

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.