Code Monkey home page Code Monkey logo

settings-frontend's Introduction

Settings Frontend

Global settings frontend for cloud.redhat.com

Usage

This project uses Data Driven Forms.

Prerequisites

  1. Your application must be active in the Cloud Services Config source of truth with the api field.
  2. Your API must have a GET and POST endpoint at /api/{appName}/{version}/settings.

GET and POST endpoints

GET

Your GET endpoint will return an array in the format provided by Data Driven Forms.

Example:

[
    {
        "fields": [
            {
                "component": "checkbox",
                "label": "Checkbox",
                "name": "checkbox",
                "isRequired": true,
                "validate": [{
                    "type": "required-validator"
                }]
            },
            {
                "name": "conditionalTextField",
                "label": "When checkbox is checked!",
                "component": "text-field",
                "condition": {
                    "when": "checkbox", // name of controlled field
                    "is": true, // condition
                }
            }
        ]
    }
]

There is a live editor where you can test the schema before implementing it.

POST

The POST endpoint will receive the submitted values

Dev Instructions

  • npm install

Proxy/Routing

Using insights frontend-components

  • Edit dev.webpack.config.js to add route for local backend API server(If needed)

Example:

const webpackProxy = {
  deployment: process.env.BETA ? 'beta/apps' : 'apps',
  useProxy: true,
  env: `${process.env.ENVIRONMENT || 'ci'}-${
    process.env.BETA ? 'beta' : 'stable'
  }`, // for accessing prod-beta start your app with ENVIRONMENT=prod and BETA=true
  appUrl: process.env.BETA ? '/beta/settings/applications' : '/settings/applications',
  routes: {
    '/api/cost-management/v1/': { host: 'http://localhost:8000' },
    ...(process.env.CONFIG_PORT && {
      [`${process.env.BETA ? '/beta' : ''}/config`]: {
        host: `http://localhost:${process.env.CONFIG_PORT}`,
      },
    }),
  },
};
  • Run npm run start:proxy

If you want to run on beta environment just run BETA=true npm run start:proxy

If you want to run on different environmnent other than just ENVIRONMENT=edge npm run start:proxy

  • Just run npm start it will start serving your assets over webpack dev server, you also have to run the spandx proxy.

  • edit settings-frontend/profiles/local-frontend-and-api.js (changing the port and path to local proxy server, if needed)

  • Run npm run start

  • Run SPANDX_CONFIG=path/to/settings-frontend/profiles/local-frontend-and-api.js sh path/to/insights-proxy/scripts/run.sh

settings-frontend's People

Contributors

ddonahue007 avatar hyperkid123 avatar tahmidefaz avatar karelhala avatar ryelo avatar dependabot-preview[bot] avatar rvsia avatar epwinchell avatar dependabot[bot] avatar boaz0 avatar fhlavac avatar panspagetka avatar arivepr avatar chambridge avatar radekkaluzik avatar bastilian avatar casey-williams-rh 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.