Code Monkey home page Code Monkey logo

mem-mmti-public's Introduction

BCMI (mem-mmti-public)

Prerequisites

Node and NPM

Node 10.19 must be installed.

Install angular/cli

Note, use angular/cli, do not use angular/angular-cli

npm i -g @angular/cli

ng is the CLI itself

Verify the installation

npm list -g @angular/cli --depth=0
ng -v

Fork, Build and Deployment

  1. After installing Node and Angular CLI, you can fork or straight download a copy of this application to start your own app.

  2. First download all the dependencies with npm install

  3. Run npm start to start the webpack server to run the application on port 4300

    Go to http://localhost:4300 to verify that the application is running

    ๐Ÿ’ก To change the default port, open .angular-cli.json, change the value on defaults.serve.port

  4. Run npm run build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build, like so: ng serve --prod to run in production mode.

  5. Run npm run lint to lint your app code using TSLint

  6. Run npm run test to run the unit tests

Code scaffolding

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

Example: Generate a customer component

ng g c customer

Example: Generate a directive: search-box

ng g d search-box

Example: Generate a service: general-data

ng g s general-data

Angular will give out a warning line after this command,

WARNING Service is generated but not provided, it must be provided to be used

After generating a service, we must go to its owning module and add the service to the providers array.

Example: Generate a service and include it in a module automatically

ng g s general-data2 -m app.module

Example: Generate a class, an interface and enum

# class
ng g cl models/customer

# interface
ng g i models/person

# enum
ng g enum models/gender

Example: Generate a pipe

ng g pipe shared/init-caps

Generate a module

Create a login directory and generate a login module in that directory

ng g module login/login.module

Add/Generate Routing Features

Generate a module called admin and add routing feature to it.

ng g module admin --routing

Running Tests

Unit tests

Set up via Karma, Jasmine.

  1. Run ng test to execute the unit tests.

End-to-end functional tests

Set up with BDDStack and BrowserStack. Modify GebConfig.groovy to customise your preferred browser. Configured remotes, confirmed to work with current tests include Chrome, Firefox, and Edge. Internet explorer and Safari are available as well, but tests fail due to driver compatiblity with current tests.

BrowserStack Config

Open Source projects have free access to Browserstack Live and Automate, for up to 5 team members. To run tests with Browserstack you need to set the following environemnt variables:

  1. BROWSERSTACK_USERNAME
  2. BROWSERSTACK_TOKEN
  3. DEBUG_MODE (true or false)

Run tests against local application:

  • Run ng run e2e to automatically start the application locally and execute the end-to-end tests against a headless Chrome.

    OR

  • Download BrowserStack binary set BASEURL to your local application address, and run ./gradlew remoteChrome

Note, e2e functional testing requires Java 10+.

Run tests against remote application:

  1. Determine the URL at which the application is running.
  2. Update the baseurl to the URL from step 1:
    1. Either modify the GebConfig.groovy baseUrl directly.
    2. Or set a BASEURL environment variable
  3. See functional-tests/readme.md for how to execute the tests.

See the BDDStack Wiki for more information.

Change aspects of the application

Change style dialect

ng set default.styleExt css

Regenerate a brand new project with routing and scss options

ng new my-app --routing --style scss

Getting Help

  1. To get more help on the Angular CLI use ng help or go check out the Angular CLI README
  2. ng doc component to look up documentation for features
  3. ng serve --help to look up doc for ng serve command

Build and Deployment

For dev, test, and production builds on OpenShift/Jenkins see openshift/README.md for detailed instructions on how to setup in an OpenShift environment using nginx.

Visual Studio Code

To use our Visual Studio Code extensions copy the contents of vscodeextensions.txt in the scripts directory and paste it into bash. If it doesnt work, make sure you have the Code CLI installed code --version and if it's not installed open the command palette (shift + command + p) and run Shell Command: install 'code' command in PATH.

How to Contribute

Feel free to create pull requests from the default "master" branch, click here to create one automatically: https://github.com/bcgov/mem-mmti-public/pull/new/master

Testing Thanks

Thanks to BrowserStack for Testing Tool support via OpenSource Licensing BrowserStack

mem-mmti-public's People

Contributors

actionanalytics avatar adrielai avatar asanchezr avatar bcgovneal avatar btzc avatar cebergin avatar danieltruong avatar davidclaveau avatar dependabot[bot] avatar dhlevi avatar esune avatar fieranmason avatar jeznorth avatar keifere avatar kitarmstrong avatar kylecjo avatar marklise avatar matbusby-fw avatar maxwardle avatar mtcarto avatar nickphura avatar rpyyj avatar sanjaytkbabu avatar simensma-fresh avatar

Stargazers

 avatar  avatar

Watchers

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

mem-mmti-public's Issues

Solution to provide Angular app deployment flexibility

Routing information is being placed in at develop time in the Angular api service files. This makes deployment involve app code changes. Here are the hardcoded values:

case 'www-mem-mmt-dev.pathfinder.gov.bc.ca':

Background

This has been a challenge to address up to now in API backed Angular front-ends (architecture diagram) that are built using the s2i built approach (build diagram), which creates a high performance web server image but at the cost of extra build complexity.

Solution

Here is a simple pattern from Eagle EPIC that solves this in a few lines, meeting the https://12factor.net Factor III, "Store config in the environment" and allowing the app to be deployed based on settings alone. It handles the more complicated s2i builds (other projects that expose environment settings in a similar pattern like MDS use a much simpler build process).

Please see the following areas of code:

  1. Here's where the Angular app consumes the settings from the server and replaces the hardcoded routes
  2. Make sure this line gets placed in the HTML head as it needs to run prior to app load
  3. Create the landing point for the environment variables at server build time
  4. When the pod starts up, and on every subsequent redeployment, set the variables. Javascript was chosen over JSON as it's a direct plugin for the existing variables in api.ts without having to do overhead to handle the JSON. MDS uses JSON.
  5. Pass the environment variables along
  6. Settings exposed in OpenShift

You can check if your settings are exposed by (if you used the same pattern as above) visiting https://your-front-end-url/publicServerEnvironmentSettings.js

And remember to set your app to redeploy on environment variable change. That way your app will get new environment settings without needing a build.

Cheers!

PS. If you have a discrete admin site, the above solution uses the same pattern with slight variations on the path (/admin in the server build and image startup script but html stays the same). Note the use of uniquely named client-side variables to avoid collisions (public vs admin).

ZAP Scan Baseline Report

View the following link to download the report.
RunnerID:122991053

It's Been a While Since This Repository has Been Updated

This issue is a kind reminder that your repository has been inactive for 181 days. Some repositories are maintained in accordance with business requirements that infrequently change thus appearing inactive, and some repositories are inactive because they are unmaintained.

To help differentiate products that are unmaintained from products that do not require frequent maintenance, repomountie will open an issue whenever a repository has not been updated in 180 days.

  • If this product is being actively maintained, please close this issue.
  • If this repository isn't being actively maintained anymore, please archive this repository. Also, for bonus points, please add a dormant or retired life cycle badge.

Thank you for your help ensuring effective governance of our open-source ecosystem!

Add missing topics

TL;DR

Topics greatly improve the discoverability of repos; please add the short code from the table below to the topics of your repo so that ministries can use GitHub's search to find out what repos belong to them and other visitors can find useful content (and reuse it!).

Why Topic

In short order we'll add our 800th repo. This large number clearly demonstrates the success of using GitHub and our Open Source initiative. This huge success means its critical that we work to make our content as discoverable as possible; Through discoverability, we promote code reuse across a large decentralized organization like the Government of British Columbia as well as allow ministries to find the repos they own.

What to do

Below is a table of abbreviation a.k.a short codes for each ministry; they're the ones used in all @gov.bc.ca email addresses. Please add the short codes of the ministry or organization that "owns" this repo as a topic.

add a topic

That's in, you're done!!!

How to use

Once topics are added, you can use them in GitHub's search. For example, enter something like org:bcgov topic:citz to find all the repos that belong to Citizens' Services. You can refine this search by adding key words specific to a subject you're interested in. To learn more about searching through repos check out GitHub's doc on searching.

Pro Tip ๐Ÿค“

  • If your org is not in the list below, or the table contains errors, please create an issue here.

  • While you're doing this, add additional topics that would help someone searching for "something". These can be the language used javascript or R; something like opendata or data for data only repos; or any other key words that are useful.

  • Add a meaningful description to your repo. This is hugely valuable to people looking through our repositories.

  • If your application is live, add the production URL.

Ministry Short Codes

Short Code Organization Name
AEST Advanced Education, Skills & Training
AGRI Agriculture
ALC Agriculture Land Commission
AG Attorney General
MCF Children & Family Development
CITZ Citizens' Services
DBC Destination BC
EMBC Emergency Management BC
EAO Environmental Assessment Office
EDUC Education
EMPR Energy, Mines & Petroleum Resources
ENV Environment & Climate Change Strategy
FIN Finance
FLNR Forests, Lands, Natural Resource Operations & Rural Development
HLTH Health
FLNR Indigenous Relations & Reconciliation
JEDC Jobs, Economic Development & Competitiveness
LBR Labour Policy & Legislation
LDB BC Liquor Distribution Branch
MMHA Mental Health & Addictions
MAH Municipal Affairs & Housing
BCPC Pension Corporation
PSA Public Safety & Solicitor General & Emergency B.C.
SDPR Social Development & Poverty Reduction
TCA Tourism, Arts & Culture
TRAN Transportation & Infrastructure

NOTE See an error or omission? Please create an issue here to get it remedied.

Add project lifecycle badge

No Project Lifecycle Badge found in your readme!

Hello! I scanned your readme and could not find a project lifecycle badge. A project lifecycle badge will provide contributors to your project as well as other stakeholders (platform services, executive) insight into the lifecycle of your repository.

What is a Project Lifecycle Badge?

It is a simple image that neatly describes your project's stage in its lifecycle. More information can be found in the project lifecycle badges documentation.

What do I need to do?

I suggest you make a PR into your README.md and add a project lifecycle badge near the top where it is easy for your users to pick it up :). Once it is merged feel free to close this issue. I will not open up a new one :)

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.