Commit c0292b8b authored by Scott Stern's avatar Scott Stern Committed by Paul Slaughter

Update ee_features.md for developing on EE features for frontend

https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74030
parent 5f77f0df
......@@ -23,7 +23,33 @@ when no license is active. So EE features always should be guarded by
`project.feature_available?` or `group.licensed_feature_available?` (or
`License.feature_available?` if it is a system-wide feature).
Frontend features should be guarded by pushing a flag from the backend by [using `push_licensed_feature`](licensed_feature_availability.md#restricting-frontend-features), and checked using `this.glFeatures.someFeature` in the frontend.
Frontend features should be guarded by pushing a flag from the backend by [using `push_licensed_feature`](licensed_feature_availability.md#restricting-frontend-features), and checked using `this.glFeatures.someFeature` in the frontend. For example:
```html
<script>
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default {
mixins: [glFeatureFlagMixin()],
components: {
EEComponent: () => import('ee_component/components/test.vue'),
},
computed: {
shouldRenderComponent() {
return this.glFeatures.myEEFeature;
}
},
};
</script>
<template>
<div>
<ee-component v-if="shouldRenderComponent"/>
</div>
</template>
```
Look in `ee/app/models/license.rb` for the names of the licensed features.
CE specs should remain untouched as much as possible and extra specs
should be added for EE. Licensed features can be stubbed using the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment