Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dazzlingfugu/ember-feature-controls
Hot plug your features.
https://github.com/dazzlingfugu/ember-feature-controls
ember ember-addon feature-flag feature-flags feature-toggle feature-toggles features-switch hacktoberfest
Last synced: 27 days ago
JSON representation
Hot plug your features.
- Host: GitHub
- URL: https://github.com/dazzlingfugu/ember-feature-controls
- Owner: DazzlingFugu
- License: mit
- Created: 2018-03-06T14:30:14.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-06T11:04:56.000Z (about 1 month ago)
- Last Synced: 2024-10-10T11:40:14.022Z (27 days ago)
- Topics: ember, ember-addon, feature-flag, feature-flags, feature-toggle, feature-toggles, features-switch, hacktoberfest
- Language: JavaScript
- Homepage: https://dazzlingfugu.github.io/ember-feature-controls/
- Size: 2.85 MB
- Stars: 7
- Watchers: 32
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# ember-feature-controls
[![CI](https://github.com/DazzlingFugu/ember-feature-controls/actions/workflows/ci.yml/badge.svg)](https://github.com/DazzlingFugu/ember-feature-controls/actions/workflows/ci.yml) [![Ember Observer Score](https://emberobserver.com/badges/ember-feature-controls.svg)](https://emberobserver.com/addons/ember-feature-controls) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/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/](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
```
ember install ember-feature-controls
```## Usage
This addon works with [ember-feature-flags](https://github.com/kategengler/ember-feature-flags).
It displays an administration panel to enable or disable feature flags.![Screenshot](/docs/screenshot.png)
### Within a template
The addon provides a component `` to add in a template of your app.
This component basically displays the table with actions buttons.```hbs
```
#### Options
```hbs
```
- `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:
```js
// app/router.ts
import EmberRouter from "@ember/routing/router";
import config from "dummy/config/environment";
import featureControlsRouteSetup from "ember-feature-controls/route-setup";export default class Router extends EmberRouter {
location = config.locationType;
rootURL = config.rootURL;
}Router.map(function () {
featureControlsRouteSetup(this, { path: "__features" });
});
```## 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:
```js
// config/environment.js
module.exports = function (environment) {
var ENV = {
featureFlags: {
"show-spinners": true,
"download-cats": false,
},
featureControls: {
useLocalStorage: true,
metadata: [
{
key: "show-spinners",
description: "Show spinners",
},
{
key: "download-cats",
description: "Add button to download cats image",
reload: true,
},
{
key: "easter-egg",
hide: true,
},
],
},
};return ENV;
};
```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](CONTRIBUTING.md) guide for details.
## Contributors
GreatWizard
MrChocolatine
romgere
saintsebastian
yonmey
cah-danmonroe
amessinger
BlueCutOfficial
Pixelik
## License
This project is licensed under the [MIT License](LICENSE.md).