Giter Site home page Giter Site logo

sajidmirza / nimble-frontend-service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nimble-platform/frontend-service

0.0 1.0 0.0 32.47 MB

Frontend Services for the Nimble Platform.

License: Apache License 2.0

Shell 0.04% JavaScript 0.20% TypeScript 65.28% CSS 3.25% HTML 31.23% Dockerfile 0.01%

nimble-frontend-service's Introduction

Frontend Service

Frontend Services for the Nimble Platform.

Development

The complete frontend is developed with Angular in TypeScript.

With Node.js (aka. full development)

For development purposes it is advisable to set up Node.js on your machine since it delivers all possibly required functionality and provides way faster build cycles.

The following versions are used for deployment:

  • Node.js: 10.16.0
  • NPM: 6.9.0

In order to install all the dependencies execute

npm install

In order to build the resources execute

npm run build:dev

for the development build or

npm run build:production

for the production build

In order to start the webpack-dev-server (any file changes will be deployed on the fly during development) execute

npm run start

The port can be adapted in package.json (default is 9092).

Without Node.js (aka. basic development / debugging only)

In case you don't want / need to set up a full-stack Node.js on your machine you can execute

mvn clean install

in order to install all the dependencies using a minified Node.js version pulled by Maven.

You can mount the generated WAR file on your preferred server or directly on Tomcat using Maven

mvn tomcat7:run-war

The port can be adapted in pom.xml (default is 9092).

Deployment

Local / Non-cloud

In order to install all the dependencies and build the WAR file (see target/frontend-service.war) for local deployment execute

mvn clean install

You can mount the WAR file on your preferred server or directly on Tomcat using Maven

mvn tomcat7:run-war

The port can be adapted in pom.xml (default is 9092).

Docker / Cloud

In order to build the docker image execute

./deploy.sh docker-build

Alternative:

mvn clean install
docker build -t nimbleplatform/frontend-service ./target

In order to run the docker image execute

./deploy.sh docker-run

Alternative:

docker run -it --rm -p 9092:8080 --name nimble-core_frontend-service nimbleplatform/frontend-service

Environments

There are various environment files for different build configurations. By default src/app/globals.ts and src/global-styles.css are used.

In case you want to build using a different environment file (see src/environments/globals.[ENVIRONMENT].ts and src/environments/global-styles.[ENVIRONMENT].css) execute

mvn clean install -Denv=[ENVIRONMENT]

or

./deploy.sh docker-build [ENVIRONMENT]

Internationalization / Localization

For Internationalization @ngx-translate/core is used.

Import the TranslateService for every component that requires translations and declare it to the constructor, e.g.

import {TranslateService} from '@ngx-translate/core';
constructor(private translate: TranslateService){}

Also make sure that the AppCommonModule is imported in the corresponding module.

The translations themself have to be added to src/assets/[LANG].json

Translating text in HTML

In order to translate text in HTML files wrap the text inside a (or other HTML tag) and make sure it does not contain any Angular variable bindings, e.g. convert

Hello {{user}} - Welcome to the NIMBLE platform!

to

<span [innerHTML]="'Hello' | translate"></span> {{user}} - <span [innerHTML]="'Welcome to the NIMBLE platform!' | translate"></span>

Translating HTML properties

In order to translate HTML properties (e.g. titles, placeholders, ...) use the following annotation:

<span [title]="'Some title' | translate"></span>

Translating dynamic values

In order to translate dynamic values or anything coming from TypeScript files use the following annotation:

this.appComponent.translate.get(['Some text']).subscribe((res: string) => {
    console.log(res);
});

The results is a JSON object with the provided keys and the translations as values which can then be referenced, e.g.

translation = res['Some text'];

Make sure the AppComponent is imported and declared for every component that requires translation of dynamic values in the TypeScript files:

import {AppComponent} from '../app.component';
constructor(private appComponent: AppComponent){}

Beautifying code

For code beautification the Atom plugin atom-beautify is used.

The config file .jsbeautifyrc can be found in the project root folder and will get applied automatically when using "Right Click > Beautify File" in Atom.

For even stricter code linting TSLint can be executed by running the following command:

npm run lint

The project leading to this application has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 723810.

nimble-frontend-service's People

Contributors

akayeshmantha avatar deterjan avatar dileepajayakody avatar dogukan10 avatar gabrieleg avatar hspotorno avatar iot365 avatar jinnerbichler avatar marcofranke avatar mytrill avatar narmin9 avatar nimble-ci avatar oliver-jung avatar quandeng avatar shantanoo-desai avatar srfg-mat avatar sshniro avatar suatgonul avatar yildiraykabak avatar

Watchers

 avatar

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.