Commit 72c11eb5 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 35 of 73

Part of our prettier migration; changing the arrow-parens style.
parent b48e14b8
...@@ -1020,39 +1020,6 @@ ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart ...@@ -1020,39 +1020,6 @@ ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/type_of_work/actions.js ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/type_of_work/actions.js
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js
## strange-shirley
ee/app/assets/javascripts/approvals/components/project_settings/project_rules.vue
ee/app/assets/javascripts/approvals/components/rule_form.vue
ee/app/assets/javascripts/approvals/components/security_configuration/unconfigured_security_rules.vue
ee/app/assets/javascripts/approvals/mappers.js
ee/app/assets/javascripts/approvals/stores/modules/base/getters.js
ee/app/assets/javascripts/approvals/stores/modules/license_compliance/actions.js
ee/app/assets/javascripts/approvals/stores/modules/mr_edit/actions.js
ee/app/assets/javascripts/approvals/stores/modules/mr_edit/mutations.js
ee/app/assets/javascripts/approvals/stores/modules/project_settings/actions.js
ee/app/assets/javascripts/audit_events/components/audit_events_filter.vue
ee/app/assets/javascripts/audit_events/components/sorting_field.vue
ee/app/assets/javascripts/audit_events/components/tokens/member_token.vue
ee/app/assets/javascripts/audit_events/components/tokens/project_token.vue
ee/app/assets/javascripts/audit_events/components/tokens/shared/audit_filter_token.vue
ee/app/assets/javascripts/audit_events/components/tokens/user_token.vue
ee/app/assets/javascripts/audit_events/constants.js
ee/app/assets/javascripts/audit_events/init_audit_events.js
ee/app/assets/javascripts/audit_events/store/getters.js
ee/app/assets/javascripts/audit_events/utils.js
ee/app/assets/javascripts/audit_events/validators.js
ee/app/assets/javascripts/billings/seat_usage/store/actions.js
ee/app/assets/javascripts/billings/seat_usage/store/getters.js
ee/app/assets/javascripts/billings/subscriptions/store/actions.js
ee/app/assets/javascripts/billings/subscriptions/store/getters.js
ee/app/assets/javascripts/billings/subscriptions/store/mutations.js
ee/app/assets/javascripts/boards/boards_util.js
ee/app/assets/javascripts/boards/components/board_scope.vue
ee/app/assets/javascripts/boards/components/boards_list_selector/index.js
ee/app/assets/javascripts/boards/components/boards_list_selector/list_container.vue
ee/app/assets/javascripts/boards/components/epics_swimlanes.vue
ee/app/assets/javascripts/boards/components/new_list_dropdown.js
## great-keldysh ## great-keldysh
ee/app/assets/javascripts/boards/components/sidebar/remove_issue.js ee/app/assets/javascripts/boards/components/sidebar/remove_issue.js
ee/app/assets/javascripts/boards/config_toggle.js ee/app/assets/javascripts/boards/config_toggle.js
......
...@@ -29,15 +29,15 @@ export default { ...@@ -29,15 +29,15 @@ export default {
computed: { computed: {
...mapState(['settings']), ...mapState(['settings']),
...mapState({ ...mapState({
rules: state => state.approvals.rules, rules: (state) => state.approvals.rules,
}), }),
hasNamedRule() { hasNamedRule() {
return this.rules.some(rule => rule.ruleType === RULE_TYPE_REGULAR); return this.rules.some((rule) => rule.ruleType === RULE_TYPE_REGULAR);
}, },
hasAnyRule() { hasAnyRule() {
return ( return (
this.settings.allowMultiRule && this.settings.allowMultiRule &&
!this.rules.some(rule => rule.ruleType === RULE_TYPE_ANY_APPROVER) !this.rules.some((rule) => rule.ruleType === RULE_TYPE_ANY_APPROVER)
); );
}, },
}, },
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
handler(newValue) { handler(newValue) {
if ( if (
this.settings.allowMultiRule && this.settings.allowMultiRule &&
!newValue.some(rule => rule.ruleType === RULE_TYPE_ANY_APPROVER) !newValue.some((rule) => rule.ruleType === RULE_TYPE_ANY_APPROVER)
) { ) {
this.addEmptyRule(); this.addEmptyRule();
} }
......
...@@ -14,7 +14,7 @@ const DEFAULT_NAME_FOR_VULNERABILITY_CHECK = 'Vulnerability-Check'; ...@@ -14,7 +14,7 @@ const DEFAULT_NAME_FOR_VULNERABILITY_CHECK = 'Vulnerability-Check';
const READONLY_NAMES = [DEFAULT_NAME_FOR_LICENSE_REPORT, DEFAULT_NAME_FOR_VULNERABILITY_CHECK]; const READONLY_NAMES = [DEFAULT_NAME_FOR_LICENSE_REPORT, DEFAULT_NAME_FOR_VULNERABILITY_CHECK];
function mapServerResponseToValidationErrors(messages) { function mapServerResponseToValidationErrors(messages) {
return Object.entries(messages).flatMap(([key, msgs]) => msgs.map(msg => `${key} ${msg}`)); return Object.entries(messages).flatMap(([key, msgs]) => msgs.map((msg) => `${key} ${msg}`));
} }
export default { export default {
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
return this.defaultRuleName ? null : this.initRule; return this.defaultRuleName ? null : this.initRule;
}, },
approversByType() { approversByType() {
return groupBy(this.approvers, x => x.type); return groupBy(this.approvers, (x) => x.type);
}, },
users() { users() {
return this.approversByType[TYPE_USER] || []; return this.approversByType[TYPE_USER] || [];
...@@ -80,10 +80,10 @@ export default { ...@@ -80,10 +80,10 @@ export default {
return this.approversByType[TYPE_GROUP] || []; return this.approversByType[TYPE_GROUP] || [];
}, },
userIds() { userIds() {
return this.users.map(x => x.id); return this.users.map((x) => x.id);
}, },
groupIds() { groupIds() {
return this.groups.map(x => x.id); return this.groups.map((x) => x.id);
}, },
validation() { validation() {
if (!this.showValidation) { if (!this.showValidation) {
...@@ -140,12 +140,12 @@ export default { ...@@ -140,12 +140,12 @@ export default {
invalidBranches() { invalidBranches() {
if (this.isMrEdit) return ''; if (this.isMrEdit) return '';
const invalidTypes = this.branches.filter(id => typeof id !== 'number'); const invalidTypes = this.branches.filter((id) => typeof id !== 'number');
return invalidTypes.length ? __('Please select a valid target branch') : ''; return invalidTypes.length ? __('Please select a valid target branch') : '';
}, },
isValid() { isValid() {
return Object.keys(this.validation).every(key => !this.validation[key]); return Object.keys(this.validation).every((key) => !this.validation[key]);
}, },
isMultiSubmission() { isMultiSubmission() {
return this.settings.allowMultiRule && !this.isFallbackSubmission; return this.settings.allowMultiRule && !this.isFallbackSubmission;
...@@ -229,7 +229,7 @@ export default { ...@@ -229,7 +229,7 @@ export default {
submission = this.submitRule(); submission = this.submitRule();
} }
submission.catch(failureResponse => { submission.catch((failureResponse) => {
this.serverValidationErrors = mapServerResponseToValidationErrors( this.serverValidationErrors = mapServerResponseToValidationErrors(
failureResponse?.response?.data?.message || {}, failureResponse?.response?.data?.message || {},
); );
...@@ -293,9 +293,9 @@ export default { ...@@ -293,9 +293,9 @@ export default {
const { containsHiddenGroups = false, removeHiddenGroups = false } = this.initRule; const { containsHiddenGroups = false, removeHiddenGroups = false } = this.initRule;
const users = this.initRule.users.map(x => ({ ...x, type: TYPE_USER })); const users = this.initRule.users.map((x) => ({ ...x, type: TYPE_USER }));
const groups = this.initRule.groups.map(x => ({ ...x, type: TYPE_GROUP })); const groups = this.initRule.groups.map((x) => ({ ...x, type: TYPE_GROUP }));
const branches = this.initRule.protectedBranches?.map(x => x.id) || []; const branches = this.initRule.protectedBranches?.map((x) => x.id) || [];
return { return {
name: this.initRule.name || '', name: this.initRule.name || '',
......
...@@ -34,9 +34,9 @@ export default { ...@@ -34,9 +34,9 @@ export default {
computed: { computed: {
...mapState('securityConfiguration', ['configuration']), ...mapState('securityConfiguration', ['configuration']),
...mapState({ ...mapState({
rules: state => state.approvals.rules, rules: (state) => state.approvals.rules,
isApprovalsLoading: state => state.approvals.isLoading, isApprovalsLoading: (state) => state.approvals.isLoading,
isSecurityConfigurationLoading: state => state.securityConfiguration.isLoading, isSecurityConfigurationLoading: (state) => state.securityConfiguration.isLoading,
}), }),
isRulesLoading() { isRulesLoading() {
return this.isApprovalsLoading || this.isSecurityConfigurationLoading; return this.isApprovalsLoading || this.isSecurityConfigurationLoading;
...@@ -84,14 +84,14 @@ export default { ...@@ -84,14 +84,14 @@ export default {
...mapActions('securityConfiguration', ['fetchSecurityConfiguration']), ...mapActions('securityConfiguration', ['fetchSecurityConfiguration']),
...mapActions({ openCreateModal: 'createModal/open' }), ...mapActions({ openCreateModal: 'createModal/open' }),
hasApprovalRuleDefined(matchRule) { hasApprovalRuleDefined(matchRule) {
return this.rules.some(rule => { return this.rules.some((rule) => {
return matchRule.name === rule.name; return matchRule.name === rule.name;
}); });
}, },
hasConfiguredJob(matchRule) { hasConfiguredJob(matchRule) {
const { features = [] } = this.configuration; const { features = [] } = this.configuration;
return this.$options.featureTypes[camelCase(matchRule.name)].some(featureType => { return this.$options.featureTypes[camelCase(matchRule.name)].some((featureType) => {
return features.some(feature => { return features.some((feature) => {
return feature.type === featureType && feature.configured; return feature.type === featureType && feature.configured;
}); });
}); });
......
...@@ -24,7 +24,7 @@ function withDefaultEmptyRule(rules = []) { ...@@ -24,7 +24,7 @@ function withDefaultEmptyRule(rules = []) {
]; ];
} }
export const mapApprovalRuleRequest = req => ({ export const mapApprovalRuleRequest = (req) => ({
name: req.name, name: req.name,
approvals_required: req.approvalsRequired, approvals_required: req.approvalsRequired,
users: req.users, users: req.users,
...@@ -33,11 +33,11 @@ export const mapApprovalRuleRequest = req => ({ ...@@ -33,11 +33,11 @@ export const mapApprovalRuleRequest = req => ({
protected_branch_ids: req.protectedBranchIds, protected_branch_ids: req.protectedBranchIds,
}); });
export const mapApprovalFallbackRuleRequest = req => ({ export const mapApprovalFallbackRuleRequest = (req) => ({
fallback_approvals_required: req.approvalsRequired, fallback_approvals_required: req.approvalsRequired,
}); });
export const mapApprovalRuleResponse = res => ({ export const mapApprovalRuleResponse = (res) => ({
id: res.id, id: res.id,
hasSource: Boolean(res.source_rule), hasSource: Boolean(res.source_rule),
name: res.name, name: res.name,
...@@ -52,7 +52,7 @@ export const mapApprovalRuleResponse = res => ({ ...@@ -52,7 +52,7 @@ export const mapApprovalRuleResponse = res => ({
overridden: res.overridden, overridden: res.overridden,
}); });
export const mapApprovalSettingsResponse = res => ({ export const mapApprovalSettingsResponse = (res) => ({
rules: withDefaultEmptyRule(res.rules.map(mapApprovalRuleResponse)), rules: withDefaultEmptyRule(res.rules.map(mapApprovalRuleResponse)),
fallbackApprovalsRequired: res.fallback_approvals_required, fallbackApprovalsRequired: res.fallback_approvals_required,
}); });
...@@ -78,7 +78,7 @@ export const mapMRSourceRule = ({ id, ...rule }) => ({ ...@@ -78,7 +78,7 @@ export const mapMRSourceRule = ({ id, ...rule }) => ({
* - If needed, extract the fallback approvals required * - If needed, extract the fallback approvals required
* from the fallback rule. * from the fallback rule.
*/ */
export const mapMRApprovalSettingsResponse = res => { export const mapMRApprovalSettingsResponse = (res) => {
const rules = res.rules.filter(({ rule_type }) => visibleTypes.has(rule_type)); const rules = res.rules.filter(({ rule_type }) => visibleTypes.has(rule_type));
const fallbackApprovalsRequired = res.fallback_approvals_required || 0; const fallbackApprovalsRequired = res.fallback_approvals_required || 0;
...@@ -87,7 +87,7 @@ export const mapMRApprovalSettingsResponse = res => { ...@@ -87,7 +87,7 @@ export const mapMRApprovalSettingsResponse = res => {
rules: withDefaultEmptyRule( rules: withDefaultEmptyRule(
rules rules
.map(mapApprovalRuleResponse) .map(mapApprovalRuleResponse)
.map(res.approval_rules_overwritten ? x => x : mapMRSourceRule), .map(res.approval_rules_overwritten ? (x) => x : mapMRSourceRule),
), ),
fallbackApprovalsRequired, fallbackApprovalsRequired,
minFallbackApprovalsRequired: 0, minFallbackApprovalsRequired: 0,
......
export const isEmpty = state => !state.rules || !state.rules.length; export const isEmpty = (state) => !state.rules || !state.rules.length;
...@@ -20,7 +20,7 @@ export const fetchRules = ({ rootState, dispatch, commit }) => { ...@@ -20,7 +20,7 @@ export const fetchRules = ({ rootState, dispatch, commit }) => {
return axios return axios
.get(settingsPath) .get(settingsPath)
.then(response => dispatch('receiveRulesSuccess', mapApprovalSettingsResponse(response.data))) .then((response) => dispatch('receiveRulesSuccess', mapApprovalSettingsResponse(response.data)))
.catch(() => createFlash(__('An error occurred fetching the approval rules.'))); .catch(() => createFlash(__('An error occurred fetching the approval rules.')));
}; };
......
...@@ -7,20 +7,20 @@ import * as types from './mutation_types'; ...@@ -7,20 +7,20 @@ import * as types from './mutation_types';
import { RULE_TYPE_ANY_APPROVER } from '../../../constants'; import { RULE_TYPE_ANY_APPROVER } from '../../../constants';
import { mapMRApprovalSettingsResponse } from '../../../mappers'; import { mapMRApprovalSettingsResponse } from '../../../mappers';
const fetchGroupMembers = memoize(id => Api.groupMembers(id).then(response => response.data)); const fetchGroupMembers = memoize((id) => Api.groupMembers(id).then((response) => response.data));
const fetchApprovers = ({ userRecords, groups }) => { const fetchApprovers = ({ userRecords, groups }) => {
const groupUsersAsync = Promise.all(groups.map(fetchGroupMembers)); const groupUsersAsync = Promise.all(groups.map(fetchGroupMembers));
return groupUsersAsync return groupUsersAsync
.then(flatten) .then(flatten)
.then(groupUsers => groupUsers.concat(userRecords)) .then((groupUsers) => groupUsers.concat(userRecords))
.then(users => uniqBy(users, x => x.id)); .then((users) => uniqBy(users, (x) => x.id));
}; };
const seedApprovers = rule => const seedApprovers = (rule) =>
rule.groups || rule.userRecords rule.groups || rule.userRecords
? fetchApprovers(rule).then(approvers => ({ ? fetchApprovers(rule).then((approvers) => ({
...rule, ...rule,
approvers, approvers,
})) }))
...@@ -32,9 +32,9 @@ const seedUsers = ({ userRecords, ...rule }) => ...@@ -32,9 +32,9 @@ const seedUsers = ({ userRecords, ...rule }) =>
const seedGroups = ({ groupRecords, ...rule }) => const seedGroups = ({ groupRecords, ...rule }) =>
groupRecords ? { ...rule, groups: groupRecords } : rule; groupRecords ? { ...rule, groups: groupRecords } : rule;
const seedLocalRule = rule => seedApprovers(rule).then(seedUsers).then(seedGroups); const seedLocalRule = (rule) => seedApprovers(rule).then(seedUsers).then(seedGroups);
const seedNewRule = rule => { const seedNewRule = (rule) => {
const name = rule.ruleType === RULE_TYPE_ANY_APPROVER ? '' : rule.name; const name = rule.ruleType === RULE_TYPE_ANY_APPROVER ? '' : rule.name;
return { return {
...@@ -78,34 +78,34 @@ export const fetchRules = ( ...@@ -78,34 +78,34 @@ export const fetchRules = (
return axios return axios
.get(path, params) .get(path, params)
.then(response => mapMRApprovalSettingsResponse(response.data)) .then((response) => mapMRApprovalSettingsResponse(response.data))
.then(settings => ({ .then((settings) => ({
...settings, ...settings,
rules: settings.rules.map(x => (x.id ? x : seedNewRule(x))), rules: settings.rules.map((x) => (x.id ? x : seedNewRule(x))),
})) }))
.then(settings => dispatch('receiveRulesSuccess', { settings, resetToDefault })) .then((settings) => dispatch('receiveRulesSuccess', { settings, resetToDefault }))
.catch(() => dispatch('receiveRulesError')); .catch(() => dispatch('receiveRulesError'));
}; };
export const postRule = ({ commit, dispatch }, rule) => export const postRule = ({ commit, dispatch }, rule) =>
seedLocalRule(rule) seedLocalRule(rule)
.then(seedNewRule) .then(seedNewRule)
.then(newRule => { .then((newRule) => {
commit(types.POST_RULE, newRule); commit(types.POST_RULE, newRule);
dispatch('createModal/close'); dispatch('createModal/close');
}) })
.catch(e => { .catch((e) => {
createFlash(__('An error occurred fetching the approvers for the new rule.')); createFlash(__('An error occurred fetching the approvers for the new rule.'));
throw e; throw e;
}); });
export const putRule = ({ commit, dispatch }, rule) => export const putRule = ({ commit, dispatch }, rule) =>
seedLocalRule(rule) seedLocalRule(rule)
.then(newRule => { .then((newRule) => {
commit(types.PUT_RULE, newRule); commit(types.PUT_RULE, newRule);
dispatch('createModal/close'); dispatch('createModal/close');
}) })
.catch(e => { .catch((e) => {
createFlash(__('An error occurred fetching the approvers for the new rule.')); createFlash(__('An error occurred fetching the approvers for the new rule.'));
throw e; throw e;
}); });
...@@ -131,12 +131,12 @@ export const requestDeleteRule = ({ dispatch }, rule) => { ...@@ -131,12 +131,12 @@ export const requestDeleteRule = ({ dispatch }, rule) => {
export const postRegularRule = ({ commit, dispatch }, rule) => export const postRegularRule = ({ commit, dispatch }, rule) =>
seedLocalRule(rule) seedLocalRule(rule)
.then(seedNewRule) .then(seedNewRule)
.then(newRule => { .then((newRule) => {
commit(types.POST_REGULAR_RULE, newRule); commit(types.POST_REGULAR_RULE, newRule);
commit(types.DELETE_ANY_RULE); commit(types.DELETE_ANY_RULE);
dispatch('createModal/close'); dispatch('createModal/close');
}) })
.catch(e => { .catch((e) => {
createFlash(__('An error occurred fetching the approvers for the new rule.')); createFlash(__('An error occurred fetching the approvers for the new rule.'));
throw e; throw e;
}); });
......
...@@ -5,7 +5,7 @@ import { RULE_TYPE_ANY_APPROVER } from '../../../constants'; ...@@ -5,7 +5,7 @@ import { RULE_TYPE_ANY_APPROVER } from '../../../constants';
export default { export default {
...base, ...base,
[types.DELETE_RULE](state, id) { [types.DELETE_RULE](state, id) {
const idx = state.rules.findIndex(x => x.id === id); const idx = state.rules.findIndex((x) => x.id === id);
if (idx < 0) { if (idx < 0) {
return; return;
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
state.rules = [newRule]; state.rules = [newRule];
}, },
[types.PUT_RULE](state, { id, ...newRule }) { [types.PUT_RULE](state, { id, ...newRule }) {
const idx = state.rules.findIndex(x => x.id === id); const idx = state.rules.findIndex((x) => x.id === id);
if (idx < 0) { if (idx < 0) {
return; return;
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
state.fallbackApprovalsRequired = fallback.approvalsRequired; state.fallbackApprovalsRequired = fallback.approvalsRequired;
}, },
[types.SET_EMPTY_RULE](state) { [types.SET_EMPTY_RULE](state) {
const anyRule = state.initialRules.find(rule => rule.ruleType === RULE_TYPE_ANY_APPROVER); const anyRule = state.initialRules.find((rule) => rule.ruleType === RULE_TYPE_ANY_APPROVER);
if (anyRule) { if (anyRule) {
state.rules = [anyRule]; state.rules = [anyRule];
......
...@@ -28,7 +28,7 @@ export const fetchRules = ({ rootState, dispatch }) => { ...@@ -28,7 +28,7 @@ export const fetchRules = ({ rootState, dispatch }) => {
return axios return axios
.get(settingsPath) .get(settingsPath)
.then(response => dispatch('receiveRulesSuccess', mapApprovalSettingsResponse(response.data))) .then((response) => dispatch('receiveRulesSuccess', mapApprovalSettingsResponse(response.data)))
.catch(() => dispatch('receiveRulesError')); .catch(() => dispatch('receiveRulesError'));
}; };
......
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
}, },
data() { data() {
return { return {
filterTokens: this.filterTokenOptions.map(option => ({ filterTokens: this.filterTokenOptions.map((option) => ({
...AUDIT_FILTER_CONFIGS.find(({ type }) => type === option.type), ...AUDIT_FILTER_CONFIGS.find(({ type }) => type === option.type),
...option, ...option,
})), })),
...@@ -30,14 +30,14 @@ export default { ...@@ -30,14 +30,14 @@ export default {
}, },
computed: { computed: {
tokenSearchTerm() { tokenSearchTerm() {
return this.value.find(term => this.filterTokens.find(token => token.type === term.type)); return this.value.find((term) => this.filterTokens.find((token) => token.type === term.type));
}, },
enabledTokens() { enabledTokens() {
const { tokenSearchTerm } = this; const { tokenSearchTerm } = this;
// If a user has searched for a term within a token, limit the user to that one token // If a user has searched for a term within a token, limit the user to that one token
if (tokenSearchTerm) { if (tokenSearchTerm) {
return this.filterTokens.map(token => ({ return this.filterTokens.map((token) => ({
...token, ...token,
disabled: tokenSearchTerm.type !== token.type, disabled: tokenSearchTerm.type !== token.type,
})); }));
......
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
}, },
computed: { computed: {
selectedOption() { selectedOption() {
return SORTING_OPTIONS.find(option => option.key === this.sortBy) || SORTING_OPTIONS[0]; return SORTING_OPTIONS.find((option) => option.key === this.sortBy) || SORTING_OPTIONS[0];
}, },
}, },
methods: { methods: {
......
...@@ -10,13 +10,13 @@ export default { ...@@ -10,13 +10,13 @@ export default {
inheritAttrs: false, inheritAttrs: false,
tokenMethods: { tokenMethods: {
fetchItem(id) { fetchItem(id) {
return Api.user(id).then(res => res.data); return Api.user(id).then((res) => res.data);
}, },
fetchSuggestions(term) { fetchSuggestions(term) {
const { groupId, projectPath } = this.config; const { groupId, projectPath } = this.config;
if (groupId) { if (groupId) {
return Api.groupMembers(groupId, { search: term }).then(res => res.data); return Api.groupMembers(groupId, { search: term }).then((res) => res.data);
} }
if (projectPath) { if (projectPath) {
......
...@@ -9,10 +9,10 @@ export default { ...@@ -9,10 +9,10 @@ export default {
inheritAttrs: false, inheritAttrs: false,
tokenMethods: { tokenMethods: {
fetchItem(id) { fetchItem(id) {
return Api.project(id).then(res => res.data); return Api.project(id).then((res) => res.data);
}, },
fetchSuggestions(term) { fetchSuggestions(term) {
return Api.projects(term, { membership: false }).then(res => res.data); return Api.projects(term, { membership: false }).then((res) => res.data);
}, },
getItemName({ name }) { getItemName({ name }) {
return name; return name;
......
...@@ -105,12 +105,12 @@ export default { ...@@ -105,12 +105,12 @@ export default {
createFlash(sprintf(message, { type })); createFlash(sprintf(message, { type }));
}, },
selectActiveItem(id) { selectActiveItem(id) {
this.activeItem = this.suggestions.find(u => u.id === id); this.activeItem = this.suggestions.find((u) => u.id === id);
}, },
loadView(id) { loadView(id) {
this.viewLoading = true; this.viewLoading = true;
return this.fetchItem(id) return this.fetchItem(id)
.then(data => { .then((data) => {
this.activeItem = data; this.activeItem = data;
}) })
.catch(this.onApiError) .catch(this.onApiError)
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
loadSuggestions(term) { loadSuggestions(term) {
this.suggestionsLoading = true; this.suggestionsLoading = true;
return this.fetchSuggestions(term) return this.fetchSuggestions(term)
.then(data => { .then((data) => {
this.suggestions = data; this.suggestions = data;
}) })
.catch(this.onApiError) .catch(this.onApiError)
......
...@@ -9,10 +9,10 @@ export default { ...@@ -9,10 +9,10 @@ export default {
inheritAttrs: false, inheritAttrs: false,
tokenMethods: { tokenMethods: {
fetchItem(id) { fetchItem(id) {
return Api.user(id).then(res => res.data); return Api.user(id).then((res) => res.data);
}, },
fetchSuggestions(term) { fetchSuggestions(term) {
return Api.users(term).then(res => res.data); return Api.users(term).then((res) => res.data);
}, },
getItemName({ name }) { getItemName({ name }) {
return name; return name;
......
...@@ -55,7 +55,7 @@ export const AUDIT_FILTER_CONFIGS = [ ...@@ -55,7 +55,7 @@ export const AUDIT_FILTER_CONFIGS = [
}, },
]; ];
export const AVAILABLE_TOKEN_TYPES = AUDIT_FILTER_CONFIGS.map(token => token.type); export const AVAILABLE_TOKEN_TYPES = AUDIT_FILTER_CONFIGS.map((token) => token.type);
export const MAX_DATE_RANGE = 31; export const MAX_DATE_RANGE = 31;
......
...@@ -5,7 +5,7 @@ import { convertObjectPropsToCamelCase, parseBoolean } from '~/lib/utils/common_ ...@@ -5,7 +5,7 @@ import { convertObjectPropsToCamelCase, parseBoolean } from '~/lib/utils/common_
import AuditEventsApp from './components/audit_events_app.vue'; import AuditEventsApp from './components/audit_events_app.vue';
import createStore from './store'; import createStore from './store';
export default selector => { export default (selector) => {
const el = document.querySelector(selector); const el = document.querySelector(selector);
const { events, isLastPage, filterTokenOptions, exportUrl, showFilter = true } = el.dataset; const { events, isLastPage, filterTokenOptions, exportUrl, showFilter = true } = el.dataset;
...@@ -15,12 +15,12 @@ export default selector => { ...@@ -15,12 +15,12 @@ export default selector => {
return new Vue({ return new Vue({
el, el,
store, store,
render: createElement => render: (createElement) =>
createElement(AuditEventsApp, { createElement(AuditEventsApp, {
props: { props: {
events: JSON.parse(events), events: JSON.parse(events),
isLastPage: parseBoolean(isLastPage), isLastPage: parseBoolean(isLastPage),
filterTokenOptions: JSON.parse(filterTokenOptions).map(filterTokenOption => filterTokenOptions: JSON.parse(filterTokenOptions).map((filterTokenOption) =>
convertObjectPropsToCamelCase(filterTokenOption), convertObjectPropsToCamelCase(filterTokenOption),
), ),
exportUrl, exportUrl,
......
...@@ -6,7 +6,7 @@ import { createAuditEventSearchQuery } from '../utils'; ...@@ -6,7 +6,7 @@ import { createAuditEventSearchQuery } from '../utils';
* @param {string} exportUrl * @param {string} exportUrl
* @returns {string} * @returns {string}
*/ */
export const buildExportHref = state => exportUrl => { export const buildExportHref = (state) => (exportUrl) => {
return setUrlParams( return setUrlParams(
createAuditEventSearchQuery({ createAuditEventSearchQuery({
filterValue: state.filterValue, filterValue: state.filterValue,
......
import { parsePikadayDate, pikadayToString } from '~/lib/utils/datetime_utility'; import { parsePikadayDate, pikadayToString } from '~/lib/utils/datetime_utility';
import { AVAILABLE_TOKEN_TYPES, AUDIT_FILTER_CONFIGS } from './constants'; import { AVAILABLE_TOKEN_TYPES, AUDIT_FILTER_CONFIGS } from './constants';
export const isNumeric = str => { export const isNumeric = (str) => {
return !Number.isNaN(parseInt(str, 10)); return !Number.isNaN(parseInt(str, 10));
}; };
export const getTypeFromEntityType = entityType => { export const getTypeFromEntityType = (entityType) => {
return AUDIT_FILTER_CONFIGS.find( return AUDIT_FILTER_CONFIGS.find(
({ entityType: configEntityType }) => configEntityType === entityType, ({ entityType: configEntityType }) => configEntityType === entityType,
)?.type; )?.type;
}; };
export const getEntityTypeFromType = type => { export const getEntityTypeFromType = (type) => {
return AUDIT_FILTER_CONFIGS.find(({ type: configType }) => configType === type)?.entityType; return AUDIT_FILTER_CONFIGS.find(({ type: configType }) => configType === type)?.entityType;
}; };
...@@ -28,7 +28,7 @@ export const parseAuditEventSearchQuery = ({ ...@@ -28,7 +28,7 @@ export const parseAuditEventSearchQuery = ({
}); });
export const createAuditEventSearchQuery = ({ filterValue, startDate, endDate, sortBy }) => { export const createAuditEventSearchQuery = ({ filterValue, startDate, endDate, sortBy }) => {
const entityValue = filterValue.find(value => AVAILABLE_TOKEN_TYPES.includes(value.type)); const entityValue = filterValue.find((value) => AVAILABLE_TOKEN_TYPES.includes(value.type));
return { return {
created_after: startDate ? pikadayToString(startDate) : null, created_after: startDate ? pikadayToString(startDate) : null,
......
...@@ -3,5 +3,5 @@ import { AVAILABLE_TOKEN_TYPES } from './constants'; ...@@ -3,5 +3,5 @@ import { AVAILABLE_TOKEN_TYPES } from './constants';
export function filterTokenOptionsValidator(filterTokenOptions) { export function filterTokenOptionsValidator(filterTokenOptions) {
return filterTokenOptions return filterTokenOptions
.map(({ type }) => type) .map(({ type }) => type)
.every(type => AVAILABLE_TOKEN_TYPES.includes(type)); .every((type) => AVAILABLE_TOKEN_TYPES.includes(type));
} }
...@@ -7,7 +7,7 @@ export const fetchBillableMembersList = ({ dispatch, state }, page) => { ...@@ -7,7 +7,7 @@ export const fetchBillableMembersList = ({ dispatch, state }, page) => {
dispatch('requestBillableMembersList'); dispatch('requestBillableMembersList');
return Api.fetchBillableGroupMembersList(state.namespaceId, { page }) return Api.fetchBillableGroupMembersList(state.namespaceId, { page })
.then(data => dispatch('receiveBillableMembersListSuccess', data)) .then((data) => dispatch('receiveBillableMembersListSuccess', data))
.catch(() => dispatch('receiveBillableMembersListError')); .catch(() => dispatch('receiveBillableMembersListError'));
}; };
......
export const tableItems = state => { export const tableItems = (state) => {
if (state.members.length) { if (state.members.length) {
return state.members.map(({ name, username, avatar_url, web_url, email }) => { return state.members.map(({ name, username, avatar_url, web_url, email }) => {
const formattedUserName = `@${username}`; const formattedUserName = `@${username}`;
......
...@@ -38,7 +38,7 @@ export const fetchHasBillableGroupMembers = ({ dispatch, state }) => { ...@@ -38,7 +38,7 @@ export const fetchHasBillableGroupMembers = ({ dispatch, state }) => {
dispatch('requestHasBillableGroupMembers'); dispatch('requestHasBillableGroupMembers');
return Api.fetchBillableGroupMembersList(state.namespaceId, { per_page: 1, page: 1 }) return Api.fetchBillableGroupMembersList(state.namespaceId, { per_page: 1, page: 1 })
.then(data => dispatch('receiveHasBillableGroupMembersSuccess', data)) .then((data) => dispatch('receiveHasBillableGroupMembersSuccess', data))
.catch(() => dispatch('receiveHasBillableGroupMembersError')); .catch(() => dispatch('receiveHasBillableGroupMembersError'));
}; };
......
export const isFreePlan = state => ['free', null].includes(state.plan.code); export const isFreePlan = (state) => ['free', null].includes(state.plan.code);
...@@ -32,8 +32,8 @@ export default { ...@@ -32,8 +32,8 @@ export default {
tableKey = TABLE_TYPE_TRIAL; tableKey = TABLE_TYPE_TRIAL;
} }
state.tables[tableKey].rows.forEach(row => { state.tables[tableKey].rows.forEach((row) => {
row.columns.forEach(col => { row.columns.forEach((col) => {
if (Object.prototype.hasOwnProperty.call(usage, col.id)) { if (Object.prototype.hasOwnProperty.call(usage, col.id)) {
Vue.set(col, 'value', usage[col.id]); Vue.set(col, 'value', usage[col.id]);
} else if (Object.prototype.hasOwnProperty.call(billing, col.id)) { } else if (Object.prototype.hasOwnProperty.call(billing, col.id)) {
......
...@@ -67,7 +67,7 @@ export function transformBoardConfig(boardConfig) { ...@@ -67,7 +67,7 @@ export function transformBoardConfig(boardConfig) {
let updatedFilterPath = objectToQuery(updatedBoardConfig); let updatedFilterPath = objectToQuery(updatedBoardConfig);
const filterPath = updatedFilterPath ? updatedFilterPath.split('&') : []; const filterPath = updatedFilterPath ? updatedFilterPath.split('&') : [];
boardConfig.labels.forEach(label => { boardConfig.labels.forEach((label) => {
const labelTitle = encodeURIComponent(label.title); const labelTitle = encodeURIComponent(label.title);
const param = `label_name[]=${labelTitle}`; const param = `label_name[]=${labelTitle}`;
const labelIndex = passedFilterParams.label_name?.indexOf(labelTitle); const labelIndex = passedFilterParams.label_name?.indexOf(labelTitle);
......
...@@ -75,7 +75,7 @@ export default { ...@@ -75,7 +75,7 @@ export default {
handleLabelClick(label) { handleLabelClick(label) {
if (label.isAny) { if (label.isAny) {
this.board.labels = []; this.board.labels = [];
} else if (!this.board.labels.find(l => l.id === label.id)) { } else if (!this.board.labels.find((l) => l.id === label.id)) {
this.board.labels.push( this.board.labels.push(
new ListLabel({ new ListLabel({
id: label.id, id: label.id,
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
); );
} else { } else {
let { labels } = this.board; let { labels } = this.board;
labels = labels.filter(selected => selected.id !== label.id); labels = labels.filter((selected) => selected.id !== label.id);
this.board.labels = labels; this.board.labels = labels;
} }
}, },
......
...@@ -37,7 +37,7 @@ export default Vue.extend({ ...@@ -37,7 +37,7 @@ export default Vue.extend({
filterItems(term, items) { filterItems(term, items) {
const query = term.toLowerCase(); const query = term.toLowerCase();
return items.filter(item => { return items.filter((item) => {
const name = item.name ? item.name.toLowerCase() : item.title.toLowerCase(); const name = item.name ? item.name.toLowerCase() : item.title.toLowerCase();
const foundName = name.indexOf(query) > -1; const foundName = name.indexOf(query) > -1;
......
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
if (!this.query) return this.items; if (!this.query) return this.items;
const query = this.query.toLowerCase(); const query = this.query.toLowerCase();
return this.items.filter(item => { return this.items.filter((item) => {
const name = item.name ? item.name.toLowerCase() : item.title.toLowerCase(); const name = item.name ? item.name.toLowerCase() : item.title.toLowerCase();
if (this.listType === 'milestones') { if (this.listType === 'milestones') {
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
...mapState(['epics', 'pageInfoByListId', 'listsFlags']), ...mapState(['epics', 'pageInfoByListId', 'listsFlags']),
...mapGetters(['getUnassignedIssues']), ...mapGetters(['getUnassignedIssues']),
unassignedIssues() { unassignedIssues() {
return listId => this.getUnassignedIssues(listId); return (listId) => this.getUnassignedIssues(listId);
}, },
unassignedIssuesCount() { unassignedIssuesCount() {
return this.lists.reduce( return this.lists.reduce(
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
hasMoreUnassignedIssues() { hasMoreUnassignedIssues() {
return ( return (
this.unassignedIssuesCount > 0 && this.unassignedIssuesCount > 0 &&
this.lists.some(list => this.pageInfoByListId[list.id]?.hasNextPage) this.lists.some((list) => this.pageInfoByListId[list.id]?.hasNextPage)
); );
}, },
}, },
...@@ -89,7 +89,7 @@ export default { ...@@ -89,7 +89,7 @@ export default {
}); });
}, },
fetchMoreUnassignedIssues() { fetchMoreUnassignedIssues() {
this.lists.forEach(list => { this.lists.forEach((list) => {
if (this.pageInfoByListId[list.id]?.hasNextPage) { if (this.pageInfoByListId[list.id]?.hasNextPage) {
this.fetchIssuesForList({ listId: list.id, fetchNext: true, noEpicIssues: true }); this.fetchIssuesForList({ listId: list.id, fetchNext: true, noEpicIssues: true });
} }
......
...@@ -3,7 +3,7 @@ import initNewListDropdown from '~/boards/components/new_list_dropdown'; ...@@ -3,7 +3,7 @@ import initNewListDropdown from '~/boards/components/new_list_dropdown';
import AssigneeList from './assignees_list_selector'; import AssigneeList from './assignees_list_selector';
import MilestoneList from './milestone_list_selector'; import MilestoneList from './milestone_list_selector';
const handleDropdownHide = e => { const handleDropdownHide = (e) => {
const $currTarget = $(e.currentTarget); const $currTarget = $(e.currentTarget);
if ($currTarget.data('preventClose')) { if ($currTarget.data('preventClose')) {
e.preventDefault(); e.preventDefault();
...@@ -14,7 +14,7 @@ const handleDropdownHide = e => { ...@@ -14,7 +14,7 @@ const handleDropdownHide = e => {
let assigneeList; let assigneeList;
let milestoneList; let milestoneList;
const handleDropdownTabClick = e => { const handleDropdownTabClick = (e) => {
const $addListEl = $('#js-add-list'); const $addListEl = $('#js-add-list');
$addListEl.data('preventClose', true); $addListEl.data('preventClose', true);
if (e.target.dataset.action === 'tab-assignees' && !assigneeList) { if (e.target.dataset.action === 'tab-assignees' && !assigneeList) {
......
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