Commit 85642364 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch 'user-lists-create-edit-mount-fe' into 'master'

Mount Vue Compoents for Creating and Editing User Lists

See merge request gitlab-org/gitlab!37013
parents 4a2caedc 6ff5f4a6
...@@ -136,10 +136,47 @@ target users. See the [Ruby example](#ruby-application-example) below. ...@@ -136,10 +136,47 @@ target users. See the [Ruby example](#ruby-application-example) below.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35930) in GitLab 13.1. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/35930) in GitLab 13.1.
Enables the feature for lists of users created with the [Feature Flag User List API](../api/feature_flag_user_lists.md). Enables the feature for lists of users created [in the Feature Flags UI](#create-a-user-list), or with the [Feature Flag User List API](../api/feature_flag_user_lists.md).
Similar to [User IDs](#user-ids), it uses the Unleash [`userWithId`](https://unleash.github.io/docs/activation_strategy#userwithid) Similar to [User IDs](#user-ids), it uses the Unleash [`userWithId`](https://unleash.github.io/docs/activation_strategy#userwithid)
activation strategy. activation strategy.
#### Create a user list
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13308) in GitLab 13.3.
To create a user list:
1. In your project, navigate to **Operations > Feature Flags**.
1. Click on **New list**.
1. Enter a name for the list.
1. Click **Create**.
You can view a list's User IDs by clicking the **{pencil}** (edit) button next to it.
When viewing a list, you can rename it by clicking the **Edit** button.
#### Add users to a user list
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13308) in GitLab 13.3.
To add users to a user list:
1. In your project, navigate to **Operations > Feature Flags**.
1. Click on the **{pencil}** (edit) button next to the list you want to add users to.
1. Click on **Add Users**.
1. Enter the user IDs as a comma-separated list of values. For example,
`user@example.com, user2@example.com`, or `username1,username2,username3`, and so on.
1. Click on **Add**.
#### Remove users from a user list
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13308) in GitLab 13.3.
To remove users from a user list:
1. In your project, navigate to **Operations > Feature Flags**.
1. Click on the **{pencil}** (edit) button next to the list you want to change.
1. Click on the **{remove}** (remove) button next to the ID you want to remove.
### Enable or disable feature flag strategies ### Enable or disable feature flag strategies
This feature is under development, but is ready for production use. It's This feature is under development, but is ready for production use. It's
......
import Vue from 'vue';
import Vuex from 'vuex';
import EditUserList from 'ee/user_lists/components/edit_user_list.vue';
import createStore from 'ee/user_lists/store/edit';
Vue.use(Vuex);
document.addEventListener('DOMContentLoaded', () => {
const el = document.getElementById('js-edit-user-list');
const { userListsDocsPath } = el.dataset;
return new Vue({
el,
store: createStore(el.dataset),
provide: { userListsDocsPath },
render(h) {
return h(EditUserList, {});
},
});
});
import Vue from 'vue';
import Vuex from 'vuex';
import NewUserList from 'ee/user_lists/components/new_user_list.vue';
import createStore from 'ee/user_lists/store/new';
Vue.use(Vuex);
document.addEventListener('DOMContentLoaded', () => {
const el = document.getElementById('js-new-user-list');
const { userListsDocsPath, featureFlagsPath } = el.dataset;
return new Vue({
el,
store: createStore(el.dataset),
provide: {
userListsDocsPath,
featureFlagsPath,
},
render(h) {
return h(NewUserList);
},
});
});
...@@ -11,12 +11,7 @@ export default { ...@@ -11,12 +11,7 @@ export default {
GlLoadingIcon, GlLoadingIcon,
UserListForm, UserListForm,
}, },
props: { inject: ['userListsDocsPath'],
userListsDocsPath: {
type: String,
required: true,
},
},
translations: { translations: {
saveButtonLabel: s__('UserLists|Save'), saveButtonLabel: s__('UserLists|Save'),
}, },
......
...@@ -9,16 +9,7 @@ export default { ...@@ -9,16 +9,7 @@ export default {
GlAlert, GlAlert,
UserListForm, UserListForm,
}, },
props: { inject: ['userListsDocsPath', 'featureFlagsPath'],
featureFlagsPath: {
type: String,
required: true,
},
userListsDocsPath: {
type: String,
required: true,
},
},
translations: { translations: {
pageTitle: s__('UserLists|New list'), pageTitle: s__('UserLists|New list'),
createButtonLabel: s__('UserLists|Create'), createButtonLabel: s__('UserLists|Create'),
......
...@@ -76,8 +76,12 @@ export default { ...@@ -76,8 +76,12 @@ export default {
</gl-sprintf> </gl-sprintf>
</div> </div>
<div class="gl-flex-fill-1 gl-ml-7"> <div class="gl-flex-fill-1 gl-ml-7">
<gl-form-group :label="$options.translations.nameLabel" class="gl-mb-7"> <gl-form-group
<gl-form-input v-model="name" data-testid="user-list-name" required /> label-for="user-list-name"
:label="$options.translations.nameLabel"
class="gl-mb-7"
>
<gl-form-input id="user-list-name" v-model="name" data-testid="user-list-name" required />
</gl-form-group> </gl-form-group>
<div :class="$options.classes.actionContainer"> <div :class="$options.classes.actionContainer">
<gl-button variant="success" data-testid="save-user-list" @click="submit"> <gl-button variant="success" data-testid="save-user-list" @click="submit">
......
- add_to_breadcrumbs s_('FeatureFlags|Feature Flags'), project_feature_flags_path(@project) - add_to_breadcrumbs s_('FeatureFlags|Feature Flags'), project_feature_flags_path(@project)
- breadcrumb_title s_('FeatureFlags|Edit list') - breadcrumb_title s_('FeatureFlags|Edit User List')
- page_title s_('FeatureFlags|Edit Feature Flag User List') - page_title s_('FeatureFlags|Edit User List')
Edit list #js-edit-user-list{ data: { 'user-lists-docs-path' => help_page_path('operations/feature_flags.md', anchor: 'user-list'),
'user-list-iid' => @user_list.iid,
%label{ for: 'name' }= s_('FeatureFlags|Name') 'project-id' => @project.id } }
%input{ id: 'name', value: @user_list.name }
- @breadcrumb_link = new_project_feature_flags_user_list_path(@project)
- add_to_breadcrumbs s_('FeatureFlags|Feature Flags'), project_feature_flags_path(@project) - add_to_breadcrumbs s_('FeatureFlags|Feature Flags'), project_feature_flags_path(@project)
- breadcrumb_title s_('FeatureFlags|New list') - breadcrumb_title s_('FeatureFlags|New User List')
- page_title s_('FeatureFlags|New Feature Flag User List') - page_title s_('FeatureFlags|New User List')
New list #js-new-user-list{ data: { 'user-lists-docs-path' => help_page_path('operations/feature_flags.md', anchor: 'user-list'),
'feature-flags-path' => project_feature_flags_path(@project),
'project-id' => @project.id } }
...@@ -32,7 +32,7 @@ describe('ee/user_lists/components/edit_user_list', () => { ...@@ -32,7 +32,7 @@ describe('ee/user_lists/components/edit_user_list', () => {
wrapper = mount(EditUserList, { wrapper = mount(EditUserList, {
localVue, localVue,
store: createStore({ projectId: '1', userListIid: '2' }), store: createStore({ projectId: '1', userListIid: '2' }),
propsData: { provide: {
userListsDocsPath: '/docs/user_lists', userListsDocsPath: '/docs/user_lists',
}, },
}); });
......
...@@ -26,7 +26,7 @@ describe('ee/user_lists/components/new_user_list', () => { ...@@ -26,7 +26,7 @@ describe('ee/user_lists/components/new_user_list', () => {
wrapper = mount(NewUserList, { wrapper = mount(NewUserList, {
localVue, localVue,
store: createStore({ projectId: '1' }), store: createStore({ projectId: '1' }),
propsData: { provide: {
featureFlagsPath: '/feature_flags', featureFlagsPath: '/feature_flags',
userListsDocsPath: '/docs/user_lists', userListsDocsPath: '/docs/user_lists',
}, },
......
...@@ -10219,10 +10219,7 @@ msgstr "" ...@@ -10219,10 +10219,7 @@ msgstr ""
msgid "FeatureFlags|Edit Feature Flag" msgid "FeatureFlags|Edit Feature Flag"
msgstr "" msgstr ""
msgid "FeatureFlags|Edit Feature Flag User List" msgid "FeatureFlags|Edit User List"
msgstr ""
msgid "FeatureFlags|Edit list"
msgstr "" msgstr ""
msgid "FeatureFlags|Enable features for specific users and specific environments by defining feature flag strategies." msgid "FeatureFlags|Enable features for specific users and specific environments by defining feature flag strategies."
...@@ -10303,15 +10300,12 @@ msgstr "" ...@@ -10303,15 +10300,12 @@ msgstr ""
msgid "FeatureFlags|New Feature Flag" msgid "FeatureFlags|New Feature Flag"
msgstr "" msgstr ""
msgid "FeatureFlags|New Feature Flag User List" msgid "FeatureFlags|New User List"
msgstr "" msgstr ""
msgid "FeatureFlags|New feature flag" msgid "FeatureFlags|New feature flag"
msgstr "" msgstr ""
msgid "FeatureFlags|New list"
msgstr ""
msgid "FeatureFlags|Percent rollout (logged in users)" msgid "FeatureFlags|Percent rollout (logged in users)"
msgstr "" msgstr ""
......
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