项目作者: peopledoc

项目描述 :
Hot plug your features.
高级语言: JavaScript
项目地址: git://github.com/peopledoc/ember-feature-controls.git
创建时间: 2018-03-06T14:30:14Z
项目社区:https://github.com/peopledoc/ember-feature-controls

开源协议:MIT License

下载


ember-feature-controls

CI Ember Observer Score License: MIT

Hot plug your features: ember-feature-controls provides an administration panel to enable or disable feature flags.

Demo is available here: https://dazzlingfugu.github.io/ember-feature-controls/.

Compatibility

  • Ember.js v4.8 or above
  • Ember CLI v4.8 or above
  • Node.js v18 or above

Installation

  1. ember install ember-feature-controls

Usage

This addon works with ember-feature-flags.
It displays an administration panel to enable or disable feature flags.

Screenshot

Within a template

The addon provides a component <FeatureControls ></FeatureControls> to add in a template of your app.
This component basically displays the table with actions buttons.

  1. <FeatureControls ></FeatureControls>

Options

  1. <FeatureControls @showRefresh={{false}} @showReset={{false}} ></FeatureControls>
  • showRefresh: Show the refresh button, true by default
  • showReset: Show the refresh button, true by default

Within the router

You can configure a route for feature-controls in your app. This will add a route under the name features-list and the path features by default. You can use an object as second parameter to configure the route like any route in your app. For example:

  1. // app/router.ts
  2. import EmberRouter from "@ember/routing/router";
  3. import config from "dummy/config/environment";
  4. import featureControlsRouteSetup from "ember-feature-controls/route-setup";
  5. export default class Router extends EmberRouter {
  6. location = config.locationType;
  7. rootURL = config.rootURL;
  8. }
  9. Router.map(function () {
  10. featureControlsRouteSetup(this, { path: "__features" });
  11. });

Configuration

config.featureFlags

Define a set of custom feature flags by defining the featureFlags property in config/environment.js.

Then, you can configure a set of metadata for your feature flags by defining the property featureControls. This is an easy way to change settings for a given environment. For example:

  1. // config/environment.js
  2. module.exports = function (environment) {
  3. var ENV = {
  4. featureFlags: {
  5. "show-spinners": true,
  6. "download-cats": false,
  7. },
  8. featureControls: {
  9. useLocalStorage: true,
  10. metadata: [
  11. {
  12. key: "show-spinners",
  13. description: "Show spinners",
  14. },
  15. {
  16. key: "download-cats",
  17. description: "Add button to download cats image",
  18. reload: true,
  19. },
  20. {
  21. key: "easter-egg",
  22. hide: true,
  23. },
  24. ],
  25. },
  26. };
  27. return ENV;
  28. };

About useLocalStorage: this property is not mandatory, but setting it to true register the new value of some flag in the local storage. This way, the values for all flags remain the same after refreshing your application.

About reload: this property is not mandatory. It forces the browser to reload if this flag change. This is needed for flags involved in the setup of your application.

About hide: this property is not mandatory. It forces to hide the feature flag in the listing.

Contributing

See the Contributing guide for details.

Contributors













GreatWizard


GreatWizard



MrChocolatine


MrChocolatine



romgere


romgere



saintsebastian


saintsebastian



yonmey


yonmey



cah-danmonroe


cah-danmonroe



amessinger


amessinger



BlueCutOfficial


BlueCutOfficial



Pixelik


Pixelik


License

This project is licensed under the MIT License.