shubhamkarande13 / FLINT-UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FLINT UI

A FLINT client, written in Vue, to provide an awesome user interface for configuring simulations using the FLINT.Cloud APIs.

About Project

This project provides an intuitive way for new to explore some preconfigured FLINT modules, including the Generic Budget Carbon Model (GCBM), in order to better understand how the FLINT system works. Our client is written as a Web application and can be used in a local or remote environment. Please contact us if you'd like help deploying your cloud instance or customizing the client.

Usage

To set up this project locally follows the below procedure:

  1. Clone FLINT.Example repository. A Dockerfile is inside the Docker folder. So to build the image follow the below command:
cd Docker
docker build --build-arg NUM_CPU=8 -t moja/flint.example:bionic .

It will take some time to build the image. For more information, you can follow https://docs.moja.global/en/latest/DevelopmentSetup/docker_installation_example.html.

  1. Clone FLINT.UI repository:

When using submodules the installation code needs to be:

git clone --recursive https://github.com/moja-global/flint-ui

Or if you've already initialized the repository without the submodule

git submodule update --init --recursive
  1. Now you have to get inside the repository directory and to build the docker-compose.yml file follow the below command:
docker-compose up

This will build all the docker images inside the docker-compose.yml file. It will take some time and after that, you can see all images list in the Docker app.


docker-compose.yml file is compose of four services i.e. flint.example.api, flint.gcbm.api, flint.ui and storybook.

Now you can start all the containers by clicking on the START button or using the command docker-compose up. You can also use the command docker start {name of the container} to start the only specific container.

All containers list will look like this in the Docker app:


If you want to shut down a specific container click on the STOP button of that specific container in the Docker app. You can also use the command line to stop a specific container by using the command docker stop {name of the container you want to stop}

To shut down, the whole docker-compose.yml file and all services inside it then use the command docker-compose down.

You can also run Detached mode in Detached mode. Detached mode, shown by the option --detach or -d, means that a Docker container runs in the background of your terminal. It does not receive input or display output. So the command for running docker-compose up in Detached mode is docker-compose up -d.

You may encounter a problem with the flint.gcbm.api containers because it is not refactored for a local environment yet.

  1. To view the UI please navigate to localhost:8080. UI will look someting like this:

Developer notes

Vue app

To run the Vue app locally, you can follow the below procedure:

  1. Go to the flint.ui folder and run npm install.
  2. Run npm run serve to start the Vue app server.
  3. Go to localhost:8000 to view the Vue app.

Storybook

To run Storybook locally, you can follow the below procedure:

  1. Go to the flint.ui folder and run npm install.
  2. Run npm run storybook to start the Storybook server.
  3. Go to localhost:6006 to view the Storybook.

Dependency management

Our package.json file is gitignored to enforce strict management of our client dependencies.

In order to add a new dependency, please:

  1. use npm install <your-package>
  2. git checkout -b dependency/<your-package>
  3. git add --force flint.ui/package.json
  4. git push and submit a PR with only the package.json changes

Our CI build will test for conflicts and your new dependency will be added after your PR has been reviewed.

npm ci

You can also use npm ci to test your changes locally. CI stands for continuous integration and npm ci is used to install all exact version dependencies or devDependencies from a package-lock.json file.

  • It is generally used to install dependencies.
  • It never writes to package.json or package-lock.json.
  • Individual dependencies cannot be added with this command.
  • It is faster in execution.
  • If any dependencies are missing or have incompatible versions, then npm ci will throw an error.
  • If a node_modules is already present, it will be automatically removed before npm ci begins its install.
  • It can not install global packages.
  • Used for the deterministic, repeatable build.

Code Style

The Vue.js style guide has been used to maintain a consistent style throughout the project. Click here to learn more about the style guide.

One exception is the case used to describe the ecological models exposed to our FLINT client. Because model names, and sometimes model variables, often use acronyms these remain capitalized.

Obvious examples are:

  • GCBM: Generic Carbon Budget model
  • FLINT: Full Lands Integration Tool
  • RothC: Rothamstead Carbon model

We recommend using ESLint and the prettier plugins to make conforming to the Vue style guide easily. There is official integration for VSCode and Atom editors. Find out more here.

If you have ESLint installed globally, you can run it from the flint.ui directory. For example, this will detect any errors in the src folder:

eslint --ext .js,.vue src

Minor errors can be fixed automatically:

eslint --fix --ext .js,.vue src

How to Get Involved?

moja global welcomes a wide range of contributions as explained in Contributing document and the About moja-global Wiki.

FAQ and Other Questions

Contributors

Thanks goes to these wonderful people (emoji key):

moja global
moja global

📆

This project follows the all-contributors specification. Contributions of any kind are welcome!

Maintainers Reviewers Ambassadors Coaches

The following people are Maintainers Reviewers Ambassadors or Coaches

moja global
moja global

📆

Maintainers review and accept proposed changes Reviewers check proposed changes before they go to the Maintainers Ambassadors are available to provide training related to this repository Coaches are available to provide information to new contributors to this repository

License

Mozilla Public License Version 2.0

About

License:Mozilla Public License 2.0


Languages

Language:Vue 64.8%Language:JavaScript 32.9%Language:CSS 1.2%Language:HTML 0.8%Language:Dockerfile 0.3%