Commit 4ef4f0f1 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'jivanvl-replace-undercore-lodash-feature-flags' into 'master'

Replace underscore/lodash in feature_flags

Closes #210264

See merge request gitlab-org/gitlab!27130
parents d2beeb7e e9168f21
<script>
import _ from 'underscore';
import { isEmpty } from 'lodash';
import { GlLoadingIcon, GlButton } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale';
......@@ -80,7 +80,7 @@ export default {
* @returns Boolean
*/
shouldRenderCreateButton() {
return !_.isEmpty(this.filter) && !this.isLoading && !this.results.length;
return !isEmpty(this.filter) && !this.isLoading && !this.results.length;
},
},
watch: {
......
<script>
import { createNamespacedHelpers } from 'vuex';
import _ from 'underscore';
import { isEmpty } from 'lodash';
import { GlEmptyState, GlLoadingIcon, GlButton, GlModalDirective, GlLink } from '@gitlab/ui';
import FeatureFlagsTable from './feature_flags_table.vue';
import store from '../store';
......@@ -148,7 +148,7 @@ export default {
];
},
hasNewPath() {
return !_.isEmpty(this.newFeatureFlagPath);
return !isEmpty(this.newFeatureFlagPath);
},
emptyStateTitle() {
if (this.scope === this.$options.scopes.disabled) {
......
<script>
import _ from 'underscore';
import { escape as esc } from 'lodash';
import { GlButton, GlTooltipDirective, GlModal, GlToggle } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
......@@ -41,7 +41,7 @@ export default {
return sprintf(
s__('FeatureFlags|Delete %{name}?'),
{
name: _.escape(this.deleteFeatureFlagName),
name: esc(this.deleteFeatureFlagName),
},
false,
);
......@@ -50,7 +50,7 @@ export default {
return sprintf(
s__('FeatureFlags|Feature flag %{name} will be removed. Are you sure?'),
{
name: _.escape(this.deleteFeatureFlagName),
name: esc(this.deleteFeatureFlagName),
},
false,
);
......
<script>
import Vue from 'vue';
import _ from 'underscore';
import { memoize, isString } from 'lodash';
import {
GlButton,
GlBadge,
......@@ -134,7 +134,7 @@ export default {
* @param {Object} scope
*/
removeScope(scope) {
if (_.isString(scope.id) && scope.id.startsWith(INTERNAL_ID_PREFIX)) {
if (isString(scope.id) && scope.id.startsWith(INTERNAL_ID_PREFIX)) {
this.formScopes = this.formScopes.filter(s => s !== scope);
} else {
Vue.set(scope, 'shouldBeDestroyed', true);
......@@ -169,7 +169,7 @@ export default {
return !this.permissionsFlag || scope.canUpdate;
},
isRolloutPercentageInvalid: _.memoize(function isRolloutPercentageInvalid(percentage) {
isRolloutPercentageInvalid: memoize(function isRolloutPercentageInvalid(percentage) {
return !this.$options.rolloutPercentageRegex.test(percentage);
}),
......
import _ from 'underscore';
import { property } from 'lodash';
export const ROLLOUT_STRATEGY_ALL_USERS = 'default';
export const ROLLOUT_STRATEGY_PERCENT_ROLLOUT = 'gradualRolloutUserId';
......@@ -12,5 +12,5 @@ export const ALL_ENVIRONMENTS_NAME = '*';
export const INTERNAL_ID_PREFIX = 'internal_';
export const fetchPercentageParams = _.property(['parameters', 'percentage']);
export const fetchUserIdParams = _.property(['parameters', 'userIds']);
export const fetchPercentageParams = property(['parameters', 'percentage']);
export const fetchUserIdParams = property(['parameters', 'userIds']);
import _ from 'underscore';
import { isEmpty, uniqueId, isString } from 'lodash';
import {
ROLLOUT_STRATEGY_ALL_USERS,
ROLLOUT_STRATEGY_PERCENT_ROLLOUT,
......@@ -74,7 +74,7 @@ export const mapFromScopesViewModel = params => {
}
// Strip out any internal IDs
const id = _.isString(s.id) && s.id.startsWith(INTERNAL_ID_PREFIX) ? undefined : s.id;
const id = isString(s.id) && s.id.startsWith(INTERNAL_ID_PREFIX) ? undefined : s.id;
const strategies = [
{
......@@ -83,7 +83,7 @@ export const mapFromScopesViewModel = params => {
},
];
if (!_.isEmpty(userIdParameters)) {
if (!isEmpty(userIdParameters)) {
strategies.push({ name: ROLLOUT_STRATEGY_USER_ID, parameters: userIdParameters });
}
......@@ -123,7 +123,7 @@ export const createNewEnvironmentScope = (overrides = {}, featureFlagPermissions
const defaultScope = {
environmentScope: '',
active: false,
id: _.uniqueId(INTERNAL_ID_PREFIX),
id: uniqueId(INTERNAL_ID_PREFIX),
rolloutStrategy: ROLLOUT_STRATEGY_ALL_USERS,
rolloutPercentage: DEFAULT_PERCENT_ROLLOUT,
rolloutUserIds: '',
......
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