Commit ac332957 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'leipert-prettier-arrow-parens-8' into 'master'

Format files with prettier arrowParens [8/15]

See merge request gitlab-org/gitlab!50534
parents 8675dcbc 06329078
This diff is collapsed.
......@@ -8,6 +8,6 @@ export default () => {
return new Vue({
el,
render: createElement => createElement(CiCdAnalyticsApp),
render: (createElement) => createElement(CiCdAnalyticsApp),
});
};
......@@ -26,17 +26,17 @@ export default {
inject: ['fullPath', 'type'],
computed: {
...mapState('filters', {
selectedSourceBranch: state => state.branches.source.selected,
selectedTargetBranch: state => state.branches.target.selected,
selectedMilestone: state => state.milestones.selected,
selectedAuthor: state => state.authors.selected,
selectedAssignee: state => state.assignees.selected,
selectedLabelList: state => state.labels.selectedList,
milestonesData: state => state.milestones.data,
labelsData: state => state.labels.data,
assigneesData: state => state.assignees.data,
authorsData: state => state.authors.data,
branchesData: state => state.branches.data,
selectedSourceBranch: (state) => state.branches.source.selected,
selectedTargetBranch: (state) => state.branches.target.selected,
selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: (state) => state.authors.selected,
selectedAssignee: (state) => state.assignees.selected,
selectedLabelList: (state) => state.labels.selectedList,
milestonesData: (state) => state.milestones.data,
labelsData: (state) => state.labels.data,
assigneesData: (state) => state.assignees.data,
authorsData: (state) => state.authors.data,
branchesData: (state) => state.branches.data,
}),
tokens() {
return [
......
......@@ -62,12 +62,12 @@ export default {
},
computed: {
...mapState('filters', {
selectedSourceBranch: state => state.branches.source.selected,
selectedTargetBranch: state => state.branches.target.selected,
selectedMilestone: state => state.milestones.selected,
selectedAuthor: state => state.authors.selected,
selectedAssignee: state => state.assignees.selected,
selectedLabelList: state => state.labels.selectedList,
selectedSourceBranch: (state) => state.branches.source.selected,
selectedTargetBranch: (state) => state.branches.target.selected,
selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: (state) => state.authors.selected,
selectedAssignee: (state) => state.assignees.selected,
selectedLabelList: (state) => state.labels.selectedList,
}),
chartOptions() {
return {
......@@ -75,7 +75,7 @@ export default {
name: THROUGHPUT_CHART_STRINGS.X_AXIS_TITLE,
type: 'category',
axisLabel: {
formatter: value => {
formatter: (value) => {
return value.split(' ')[0]; // Aug 2020 => Aug
},
},
......@@ -92,7 +92,7 @@ export default {
return !this.hasError && this.$apollo.queries.throughputChartData.loading;
},
chartDataAvailable() {
return this.formattedThroughputChartData[0]?.data?.some(entry => Boolean(entry[1]));
return this.formattedThroughputChartData[0]?.data?.some((entry) => Boolean(entry[1]));
},
alertDetails() {
return {
......
......@@ -155,12 +155,12 @@ export default {
},
computed: {
...mapState('filters', {
selectedSourceBranch: state => state.branches.source.selected,
selectedTargetBranch: state => state.branches.target.selected,
selectedMilestone: state => state.milestones.selected,
selectedAuthor: state => state.authors.selected,
selectedAssignee: state => state.assignees.selected,
selectedLabelList: state => state.labels.selectedList,
selectedSourceBranch: (state) => state.branches.source.selected,
selectedTargetBranch: (state) => state.branches.target.selected,
selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: (state) => state.authors.selected,
selectedAssignee: (state) => state.assignees.selected,
selectedLabelList: (state) => state.labels.selectedList,
}),
options() {
return filterToQueryObject({
......
......@@ -16,7 +16,7 @@ export default (startDate = null, endDate = null) => {
if (!monthData.length) return '';
const computedMonthData = monthData.map(value => {
const computedMonthData = monthData.map((value) => {
const { year, month, mergedAfter, mergedBefore } = value;
// first: 0 is an optimization which makes sure we don't load merge request objects into memory (backend).
......
......@@ -58,7 +58,7 @@ export default () => {
fullPath,
type,
},
render: createElement =>
render: (createElement) =>
createElement(MergeRequestAnalyticsApp, {
props: {
startDate: startDateParam.length
......
......@@ -53,12 +53,12 @@ export const computeMonthRangeData = (startDate, endDate, format = dateFormats.i
*
* @return {Array} the formatted chart data
*/
export const formatThroughputChartData = chartData => {
export const formatThroughputChartData = (chartData) => {
if (!chartData) return [];
const data = Object.keys(chartData)
.slice(0, -1) // Remove the __typeName key
.map(value => [value.split('_').join(' '), chartData[value].count]); // key: Aug_2020 => Aug 2020
.map((value) => [value.split('_').join(' '), chartData[value].count]); // key: Aug_2020 => Aug 2020
return [
{
......
......@@ -141,7 +141,7 @@ export default {
return {
yAxis: {
axisLabel: {
formatter: value => value,
formatter: (value) => value,
},
minInterval: 1,
},
......@@ -227,7 +227,7 @@ export default {
:chart-data="getScatterPlotMainData"
:selected-metric="getSelectedMetric(chartKeys.scatterplot)"
@metricTypeChange="
metric => setMetricType({ metricType: metric, chartKey: chartKeys.scatterplot })
(metric) => setMetricType({ metricType: metric, chartKey: chartKeys.scatterplot })
"
>
<scatterplot
......@@ -252,7 +252,7 @@ export default {
:selected-metric="getSelectedMetric(chartKeys.timeBasedHistogram)"
:chart-data="getColumnChartData(chartKeys.timeBasedHistogram)"
@metricTypeChange="
metric =>
(metric) =>
setMetricType({ metricType: metric, chartKey: chartKeys.timeBasedHistogram })
"
>
......@@ -278,7 +278,7 @@ export default {
:selected-metric="getSelectedMetric(chartKeys.commitBasedHistogram)"
:chart-data="getColumnChartData(chartKeys.commitBasedHistogram)"
@metricTypeChange="
metric =>
(metric) =>
setMetricType({ metricType: metric, chartKey: chartKeys.commitBasedHistogram })
"
>
......
......@@ -55,7 +55,7 @@ export default {
return this.metricTypes.length;
},
metricDropdownLabel() {
const foundMetric = this.metricTypes.find(m => m.key === this.selectedMetric);
const foundMetric = this.metricTypes.find((m) => m.key === this.selectedMetric);
return foundMetric ? foundMetric.label : s__('MetricChart|Please select a metric');
},
isServerError() {
......
......@@ -35,7 +35,7 @@ export default {
},
computed: {
metricDropdownLabel() {
return this.columnOptions.find(option => option.key === this.metricType).label;
return this.columnOptions.find((option) => option.key === this.metricType).label;
},
showPagination() {
return this.pageInfo && this.pageInfo.total;
......
......@@ -22,7 +22,7 @@ export default class FilteredSearchProductivityAnalytics extends FilteredSearchM
/**
* Updates filters in productivity analytics store
*/
updateObject = path => {
updateObject = (path) => {
const filters = urlParamsToObject(path);
store.dispatch('filters/setFilters', filters);
};
......
export const getMetricTypes = state => chartKey =>
state.metricTypes.filter(m => m.charts.indexOf(chartKey) !== -1);
export const getMetricTypes = (state) => (chartKey) =>
state.metricTypes.filter((m) => m.charts.indexOf(chartKey) !== -1);
......@@ -8,7 +8,7 @@ import { transformScatterData } from '../../../utils';
* Fetches data for all charts except for the main chart
*/
export const fetchSecondaryChartData = ({ state, dispatch }) => {
Object.keys(state.charts).forEach(chartKey => {
Object.keys(state.charts).forEach((chartKey) => {
if (chartKey !== chartKeys.main) {
dispatch('fetchChartData', chartKey);
}
......@@ -27,7 +27,7 @@ export const fetchChartData = ({ dispatch, getters, state, rootState }, chartKey
axios
.get(rootState.endpoint, { params })
.then(response => {
.then((response) => {
const { data } = response;
if (chartKey === chartKeys.scatterplot) {
......@@ -42,7 +42,7 @@ export const fetchChartData = ({ dispatch, getters, state, rootState }, chartKey
dispatch('receiveChartDataSuccess', { chartKey, data });
}
})
.catch(error => dispatch('receiveChartDataError', { chartKey, error }));
.catch((error) => dispatch('receiveChartDataError', { chartKey, error }));
}
};
......
......@@ -13,9 +13,9 @@ import {
} from '../../../constants';
import { getScatterPlotData, getMedianLineData } from '../../../utils';
export const chartLoading = state => chartKey => state.charts[chartKey].isLoading;
export const chartLoading = (state) => (chartKey) => state.charts[chartKey].isLoading;
export const chartErrorCode = state => chartKey => state.charts[chartKey].errorCode;
export const chartErrorCode = (state) => (chartKey) => state.charts[chartKey].errorCode;
/**
* Creates a series object for the column chart with the given chartKey.
......@@ -36,8 +36,8 @@ export const chartErrorCode = state => chartKey => state.charts[chartKey].errorC
* the itemStyle will be set accordingly in order to highlight the relevant bar.
*
*/
export const getColumnChartData = state => chartKey => {
const dataWithSelected = Object.keys(state.charts[chartKey].data).map(key => {
export const getColumnChartData = (state) => (chartKey) => {
const dataWithSelected = Object.keys(state.charts[chartKey].data).map((key) => {
const dataArr = [key, state.charts[chartKey].data[key]];
let itemStyle = {};
......@@ -54,7 +54,7 @@ export const getColumnChartData = state => chartKey => {
return dataWithSelected;
};
export const chartHasData = state => chartKey => !isEmpty(state.charts[chartKey].data);
export const chartHasData = (state) => (chartKey) => !isEmpty(state.charts[chartKey].data);
export const getScatterPlotMainData = (state, getters, rootState) =>
getScatterPlotData(
......@@ -77,10 +77,10 @@ export const getScatterPlotMedianData = (state, getters, rootState) =>
scatterPlotAddonQueryDays,
);
export const getMetricLabel = state => chartKey =>
metricTypes.find(m => m.key === state.charts[chartKey].params.metricType).label;
export const getMetricLabel = (state) => (chartKey) =>
metricTypes.find((m) => m.key === state.charts[chartKey].params.metricType).label;
export const getFilterParams = (state, getters, rootState, rootGetters) => chartKey => {
export const getFilterParams = (state, getters, rootState, rootGetters) => (chartKey) => {
const { params: chartParams = {} } = state.charts[chartKey];
// common filter params
......@@ -109,7 +109,7 @@ export const getFilterParams = (state, getters, rootState, rootGetters) => chart
* it will return an empty dataZoom property.
*
*/
export const getColumnChartDatazoomOption = state => chartKey => {
export const getColumnChartDatazoomOption = (state) => (chartKey) => {
const { data } = state.charts[chartKey];
const totalItems = Object.keys(data).length;
const MAX_ITEMS_PER_PAGE = maxColumnChartItemsPerPage[chartKey]
......@@ -123,7 +123,7 @@ export const getColumnChartDatazoomOption = state => chartKey => {
const intervalEnd = Math.ceil((MAX_ITEMS_PER_PAGE / totalItems) * 100);
return {
dataZoom: dataZoomOptions.map(item => {
dataZoom: dataZoomOptions.map((item) => {
const result = {
...item,
end: intervalEnd,
......@@ -134,7 +134,7 @@ export const getColumnChartDatazoomOption = state => chartKey => {
};
};
export const getSelectedMetric = state => chartKey => state.charts[chartKey].params.metricType;
export const getSelectedMetric = (state) => (chartKey) => state.charts[chartKey].params.metricType;
/**
* Returns the y axis label for the scatterplot.
......@@ -143,16 +143,16 @@ export const getSelectedMetric = state => chartKey => state.charts[chartKey].par
export const scatterplotYaxisLabel = (_state, getters, rootState) => {
const selectedMetric = getters.getSelectedMetric(chartKeys.scatterplot);
const metricTypesInHours = rootState.metricTypes
.filter(metric => metric.charts.indexOf(chartKeys.timeBasedHistogram) !== -1)
.map(metric => metric.key);
.filter((metric) => metric.charts.indexOf(chartKeys.timeBasedHistogram) !== -1)
.map((metric) => metric.key);
if (selectedMetric === daysToMergeMetric.key) return s__('ProductivityAnalytics|Days');
if (metricTypesInHours.indexOf(selectedMetric) !== -1) return s__('ProductivityAnalytics|Hours');
return getters.getMetricLabel(chartKeys.scatterplot);
};
export const hasNoAccessError = state =>
export const hasNoAccessError = (state) =>
state.charts[chartKeys.main].errorCode === httpStatus.FORBIDDEN;
export const isChartEnabled = state => chartKey => state.charts[chartKey].enabled;
export const isChartEnabled = (state) => (chartKey) => state.charts[chartKey].enabled;
export const isFilteringByDaysToMerge = state => state.charts[chartKeys.main].selected.length > 0;
export const isFilteringByDaysToMerge = (state) => state.charts[chartKeys.main].selected.length > 0;
......@@ -19,7 +19,7 @@ import { dateFormats } from '../../../../shared/constants';
* }
*
*/
export const getCommonFilterParams = (state, getters) => chartKey => {
export const getCommonFilterParams = (state, getters) => (chartKey) => {
const {
groupNamespace,
projectPath,
......@@ -55,7 +55,7 @@ export const getCommonFilterParams = (state, getters) => chartKey => {
* When a minDate exists and the minDate is after the computed dateInPast,
* the minDate is returned. Otherwise the computed dateInPast is returned.
*/
export const scatterplotStartDate = state => {
export const scatterplotStartDate = (state) => {
const { startDate, minDate } = state;
const dateInPast = getDateInPast(startDate, scatterPlotAddonQueryDays);
......
......@@ -17,11 +17,11 @@ export const fetchMergeRequests = ({ dispatch, state, rootState, rootGetters })
return axios
.get(rootState.endpoint, { params })
.then(response => {
.then((response) => {
const { headers, data } = response;
dispatch('receiveMergeRequestsSuccess', { headers, data });
})
.catch(err => dispatch('receiveMergeRequestsError', err));
.catch((err) => dispatch('receiveMergeRequestsError', err));
};
export const requestMergeRequests = ({ commit }) => commit(types.REQUEST_MERGE_REQUESTS);
......
import { chartKeys, tableSortOrder, daysToMergeMetric } from '../../../constants';
export const sortIcon = state => tableSortOrder[state.sortOrder].icon;
export const sortIcon = (state) => tableSortOrder[state.sortOrder].icon;
export const sortTooltipTitle = state => tableSortOrder[state.sortOrder].title;
export const sortTooltipTitle = (state) => tableSortOrder[state.sortOrder].title;
export const sortFieldDropdownLabel = (state, _, rootState) =>
rootState.metricTypes.find(metric => metric.key === state.sortField).label;
rootState.metricTypes.find((metric) => metric.key === state.sortField).label;
export const tableSortOptions = (_state, _getters, _rootState, rootGetters) => [
daysToMergeMetric,
......@@ -15,6 +15,6 @@ export const tableSortOptions = (_state, _getters, _rootState, rootGetters) => [
export const columnMetricLabel = (state, _getters, _rootState, rootGetters) =>
rootGetters
.getMetricTypes(chartKeys.timeBasedHistogram)
.find(metric => metric.key === state.columnMetric).label;
.find((metric) => metric.key === state.columnMetric).label;
export const isSelectedSortField = state => sortField => state.sortField === sortField;
export const isSelectedSortField = (state) => (sortField) => state.sortField === sortField;
......@@ -91,7 +91,7 @@ export const transformScatterData = (data, startDate, endDate) => {
const result = initDateArray(startDate, endDate);
const totalItems = result.length;
Object.keys(data).forEach(id => {
Object.keys(data).forEach((id) => {
const mergedAtDate = new Date(data[id].merged_at);
const dayDiff = getDayDifference(mergedAtDate, endDate);
......@@ -134,7 +134,7 @@ export const getScatterPlotData = (data, startDate, endDate) => {
const visibleData = data.slice(startIndex);
// group by date
const result = flatten(visibleData).map(item => [
const result = flatten(visibleData).map((item) => [
dateFormat(item.merged_at, dateFormats.isoDate),
item.metric,
item.merged_at,
......@@ -162,7 +162,7 @@ export const getScatterPlotData = (data, startDate, endDate) => {
export const getMedianLineData = (data, startDate, endDate, daysOffset) => {
const result = [];
const dayDiff = getDayDifference(startDate, endDate);
const transformedData = data.map(arr => arr.map(x => x.metric));
const transformedData = data.map((arr) => arr.map((x) => x.metric));
const len = data.length;
let i = len - dayDiff;
......
......@@ -60,7 +60,7 @@ export default {
// not including a project_ids param is the same as selecting all the projects
if (!this.allProjectsSelected) {
this.selectedProjectIds.forEach(id => queryParams.append('project_ids[]', id));
this.selectedProjectIds.forEach((id) => queryParams.append('project_ids[]', id));
}
return `${this.groupAnalyticsCoverageReportsPath}&${queryParams.toString()}`;
......
......@@ -36,7 +36,7 @@ export default {
// Remove the projects that don't have any code coverage
...data.projects.nodes
.filter(({ codeCoverageSummary }) => Boolean(codeCoverageSummary))
.map(project => ({
.map((project) => ({
...project,
codeCoveragePath: joinPaths(
gon.relative_url_root || '',
......@@ -76,7 +76,7 @@ export default {
selectedProjectIds() {
// Get the IDs of the projects that we haven't requested yet
return Object.keys(this.projectIds).filter(
id => !this.allCoverageData.some(project => project.id === id),
(id) => !this.allCoverageData.some((project) => project.id === id),
);
},
selectedCoverageData() {
......
......@@ -87,7 +87,7 @@ export default {
},
fetchData() {
this.loading = true;
return Api.groups(this.searchTerm, this.queryParams).then(groups => {
return Api.groups(this.searchTerm, this.queryParams).then((groups) => {
this.loading = false;
this.groups = groups;
});
......
......@@ -85,7 +85,7 @@ export default {
return this.selectedProjects.length === 1;
},
selectedProjectIds() {
return this.selectedProjects.map(p => p.id);
return this.selectedProjects.map((p) => p.id);
},
availableProjects() {
return filterBySearchTerm(this.projects, this.searchTerm);
......@@ -110,7 +110,7 @@ export default {
getSelectedProjects(selectedProject, isMarking) {
return isMarking
? this.selectedProjects.concat([selectedProject])
: this.selectedProjects.filter(project => project.id !== selectedProject.id);
: this.selectedProjects.filter((project) => project.id !== selectedProject.id);
},
singleSelectedProject(selectedObj, isMarking) {
return isMarking ? [selectedObj] : [];
......@@ -136,7 +136,7 @@ export default {
...this.queryParams,
},
})
.then(response => {
.then((response) => {
const {
data: {
group: {
......
......@@ -39,7 +39,7 @@ export default {
xAxis: {
type: 'time',
axisLabel: {
formatter: date => dateFormat(date, dateFormats.defaultDate),
formatter: (date) => dateFormat(date, dateFormats.defaultDate),
},
},
dataZoom: [
......
......@@ -2,13 +2,13 @@ import dateFormat from 'dateformat';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { dateFormats } from './constants';
export const toYmd = date => dateFormat(date, dateFormats.isoDate);
export const toYmd = (date) => dateFormat(date, dateFormats.isoDate);
export default {
toYmd,
};
export const formattedDate = d => dateFormat(d, dateFormats.defaultDate);
export const formattedDate = (d) => dateFormat(d, dateFormats.defaultDate);
/**
* Creates a value stream object from a dataset. Returns null if no valueStreamId is present.
......@@ -16,7 +16,7 @@ export const formattedDate = d => dateFormat(d, dateFormats.defaultDate);
* @param {Object} dataset - The raw value stream object
* @returns {Object} - A value stream object
*/
export const buildValueStreamFromJson = valueStream => {
export const buildValueStreamFromJson = (valueStream) => {
const { id, name, is_custom: isCustom } = valueStream ? JSON.parse(valueStream) : {};
return id ? { id, name, isCustom } : null;
};
......@@ -27,7 +27,7 @@ export const buildValueStreamFromJson = valueStream => {
* @param {Object} dataset - The container's dataset
* @returns {Object} - A group object
*/
export const buildGroupFromDataset = dataset => {
export const buildGroupFromDataset = (dataset) => {
const { groupId, groupName, groupFullPath, groupAvatarUrl, groupParentId } = dataset;
if (groupId) {
......@@ -49,7 +49,7 @@ export const buildGroupFromDataset = dataset => {
* @param {Object} dataset - The container's dataset
* @returns {Object} - A project object
*/
export const buildProjectFromDataset = dataset => {
export const buildProjectFromDataset = (dataset) => {
const { projectGid, projectName, projectPathWithNamespace, projectAvatarUrl } = dataset;
if (projectGid) {
......@@ -117,5 +117,5 @@ export const buildCycleAnalyticsInitialData = ({
export const filterBySearchTerm = (data = [], searchTerm = '', filterByKey = 'name') => {
if (!searchTerm?.length) return data;
return data.filter(item => item[filterByKey].toLowerCase().includes(searchTerm.toLowerCase()));
return data.filter((item) => item[filterByKey].toLowerCase().includes(searchTerm.toLowerCase()));
};
......@@ -23,9 +23,9 @@ export default {
computed: {
...mapState({
settings: 'settings',
isLoading: state => state.approvals.isLoading,
hasLoaded: state => state.approvals.hasLoaded,
targetBranch: state => state.approvals.targetBranch,
isLoading: (state) => state.approvals.isLoading,
hasLoaded: (state) => state.approvals.hasLoaded,
targetBranch: (state) => state.approvals.targetBranch,
}),
createModalId() {
return `${this.settings.prefix}-approvals-create-modal`;
......
......@@ -8,7 +8,7 @@ import { renderAvatar } from '~/helpers/avatar_helper';
import { loadCSSFile } from '~/lib/utils/css_utils';
function addType(type) {
return items => items.map(obj => Object.assign(obj, { type }));
return (items) => items.map((obj) => Object.assign(obj, { type }));
}
function formatSelection(group) {
......@@ -116,7 +116,7 @@ export default {
}, 250),
id: ({ type, id }) => `${type}${id}`,
})
.on('change', e => this.onChange(e));
.on('change', (e) => this.onChange(e));
})
.catch(() => {});
})
......@@ -132,7 +132,7 @@ export default {
return Promise.all([groupsAsync, usersAsync])
.then(([groups, users]) => groups.concat(users))
.then(results => ({ results }));
.then((results) => ({ results }));
},
fetchGroups(term) {
// Don't includeAll when search is empty. Otherwise, the user could get a lot of garbage choices.
......
......@@ -73,7 +73,7 @@ export default {
}, 250),
id: ({ type, id }) => `${type}${id}`,
})
.on('change', e => this.onChange(e))
.on('change', (e) => this.onChange(e))
.on('select2-open', () => {
// https://stackoverflow.com/questions/18487056/select2-doesnt-work-when-embedded-in-a-bootstrap-modal
// Ensure search feature works in modal
......@@ -92,7 +92,7 @@ export default {
methods: {
fetchBranches(term) {
const excludeAnyBranch = term && !term.toLowerCase().includes('any');
return Api.projectProtectedBranches(this.projectId, term).then(results => ({
return Api.projectProtectedBranches(this.projectId, term).then((results) => ({
results: excludeAnyBranch ? results : [anyBranch, ...results],
}));
},
......
......@@ -22,8 +22,8 @@ export default {
},
computed: {
...mapState({
isLoading: state => state[APPROVALS].isLoading,
rules: state => state[APPROVALS].rules,
isLoading: (state) => state[APPROVALS].isLoading,
rules: (state) => state[APPROVALS].rules,
documentationPath: ({ settings }) => settings.approvalsDocumentationPath,
licenseCheckRuleName: ({ settings }) => settings.lockedApprovalsRuleName,
}),
......
......@@ -36,8 +36,8 @@ export default {
},
computed: {
...mapState({
rules: state => state.approvals.rules,
canOverride: state => state.settings.canOverride,
rules: (state) => state.approvals.rules,
canOverride: (state) => state.settings.canOverride,
}),
toggleIcon() {
return this.isCollapsed ? 'chevron-down' : 'chevron-right';
......@@ -46,7 +46,7 @@ export default {
return this.glFeatures.mergeRequestReviewers && this.glFeatures.mrCollapsedApprovalRules;
},
hasOptionalRules() {
return this.rules.every(r => r.approvalsRequired === 0);
return this.rules.every((r) => r.approvalsRequired === 0);
},
requiredRules() {
return this.rules.reduce((acc, rule) => {
......
......@@ -21,12 +21,12 @@ export default {
computed: {
...mapState(['settings']),
...mapState({
rules: state => state.approvals.rules,
targetBranch: state => state.approvals.targetBranch,
rules: (state) => state.approvals.rules,
targetBranch: (state) => state.approvals.targetBranch,
}),
hasNamedRule() {
if (this.settings.allowMultiRule) {
return this.rules.some(rule => rule.ruleType !== RULE_TYPE_ANY_APPROVER);
return this.rules.some((rule) => rule.ruleType !== RULE_TYPE_ANY_APPROVER);
}
const [rule] = this.rules;
......@@ -49,7 +49,7 @@ export default {
}
if (
this.settings.allowMultiRule &&
!newValue.some(rule => rule.ruleType === RULE_TYPE_ANY_APPROVER)
!newValue.some((rule) => rule.ruleType === RULE_TYPE_ANY_APPROVER)
) {
this.addEmptyRule();
}
......
......@@ -17,10 +17,10 @@ export default {
computed: {
...mapState(['settings']),
...mapState({
resetToDefault: state => state.approvals.resetToDefault,
rules: state => state.approvals.rules,
rulesToDelete: state => state.approvals.rulesToDelete,
fallbackApprovalsRequired: state => state.approvals.fallbackApprovalsRequired,
resetToDefault: (state) => state.approvals.resetToDefault,
rules: (state) => state.approvals.rules,
rulesToDelete: (state) => state.approvals.rulesToDelete,
fallbackApprovalsRequired: (state) => state.approvals.fallbackApprovalsRequired,
}),
},
INPUT_ID,
......
......@@ -21,7 +21,7 @@ export default {
...mapState(['settings']),
},
created() {
this.onInputChangeDebounced = debounce(event => {
this.onInputChangeDebounced = debounce((event) => {
this.onInputChange(event);
}, 1000);
},
......
......@@ -29,15 +29,15 @@ export default {
computed: {
...mapState(['settings']),
...mapState({
rules: state => state.approvals.rules,
rules: (state) => state.approvals.rules,
}),
hasNamedRule() {
return this.rules.some(rule => rule.ruleType === RULE_TYPE_REGULAR);
return this.rules.some((rule) => rule.ruleType === RULE_TYPE_REGULAR);
},
hasAnyRule() {
return (
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 {
handler(newValue) {
if (
this.settings.allowMultiRule &&
!newValue.some(rule => rule.ruleType === RULE_TYPE_ANY_APPROVER)
!newValue.some((rule) => rule.ruleType === RULE_TYPE_ANY_APPROVER)
) {
this.addEmptyRule();
}
......
......@@ -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];
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 {
......@@ -71,7 +71,7 @@ export default {
return this.defaultRuleName ? null : this.initRule;
},
approversByType() {
return groupBy(this.approvers, x => x.type);
return groupBy(this.approvers, (x) => x.type);
},
users() {
return this.approversByType[TYPE_USER] || [];
......@@ -80,10 +80,10 @@ export default {
return this.approversByType[TYPE_GROUP] || [];
},
userIds() {
return this.users.map(x => x.id);
return this.users.map((x) => x.id);
},
groupIds() {
return this.groups.map(x => x.id);
return this.groups.map((x) => x.id);
},
validation() {
if (!this.showValidation) {
......@@ -140,12 +140,12 @@ export default {
invalidBranches() {
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') : '';
},
isValid() {
return Object.keys(this.validation).every(key => !this.validation[key]);
return Object.keys(this.validation).every((key) => !this.validation[key]);
},
isMultiSubmission() {
return this.settings.allowMultiRule && !this.isFallbackSubmission;
......@@ -229,7 +229,7 @@ export default {
submission = this.submitRule();
}
submission.catch(failureResponse => {
submission.catch((failureResponse) => {
this.serverValidationErrors = mapServerResponseToValidationErrors(
failureResponse?.response?.data?.message || {},
);
......@@ -293,9 +293,9 @@ export default {
const { containsHiddenGroups = false, removeHiddenGroups = false } = this.initRule;
const users = this.initRule.users.map(x => ({ ...x, type: TYPE_USER }));
const groups = this.initRule.groups.map(x => ({ ...x, type: TYPE_GROUP }));
const branches = this.initRule.protectedBranches?.map(x => x.id) || [];
const users = this.initRule.users.map((x) => ({ ...x, type: TYPE_USER }));
const groups = this.initRule.groups.map((x) => ({ ...x, type: TYPE_GROUP }));
const branches = this.initRule.protectedBranches?.map((x) => x.id) || [];
return {
name: this.initRule.name || '',
......
......@@ -34,9 +34,9 @@ export default {
computed: {
...mapState('securityConfiguration', ['configuration']),
...mapState({
rules: state => state.approvals.rules,
isApprovalsLoading: state => state.approvals.isLoading,
isSecurityConfigurationLoading: state => state.securityConfiguration.isLoading,
rules: (state) => state.approvals.rules,
isApprovalsLoading: (state) => state.approvals.isLoading,
isSecurityConfigurationLoading: (state) => state.securityConfiguration.isLoading,
}),
isRulesLoading() {
return this.isApprovalsLoading || this.isSecurityConfigurationLoading;
......@@ -84,14 +84,14 @@ export default {
...mapActions('securityConfiguration', ['fetchSecurityConfiguration']),
...mapActions({ openCreateModal: 'createModal/open' }),
hasApprovalRuleDefined(matchRule) {
return this.rules.some(rule => {
return this.rules.some((rule) => {
return matchRule.name === rule.name;
});
},
hasConfiguredJob(matchRule) {
const { features = [] } = this.configuration;
return this.$options.featureTypes[camelCase(matchRule.name)].some(featureType => {
return features.some(feature => {
return this.$options.featureTypes[camelCase(matchRule.name)].some((featureType) => {
return features.some((feature) => {
return feature.type === featureType && feature.configured;
});
});
......
......@@ -24,7 +24,7 @@ function withDefaultEmptyRule(rules = []) {
];
}
export const mapApprovalRuleRequest = req => ({
export const mapApprovalRuleRequest = (req) => ({
name: req.name,
approvals_required: req.approvalsRequired,
users: req.users,
......@@ -33,11 +33,11 @@ export const mapApprovalRuleRequest = req => ({
protected_branch_ids: req.protectedBranchIds,
});
export const mapApprovalFallbackRuleRequest = req => ({
export const mapApprovalFallbackRuleRequest = (req) => ({
fallback_approvals_required: req.approvalsRequired,
});
export const mapApprovalRuleResponse = res => ({
export const mapApprovalRuleResponse = (res) => ({
id: res.id,
hasSource: Boolean(res.source_rule),
name: res.name,
......@@ -52,7 +52,7 @@ export const mapApprovalRuleResponse = res => ({
overridden: res.overridden,
});
export const mapApprovalSettingsResponse = res => ({
export const mapApprovalSettingsResponse = (res) => ({
rules: withDefaultEmptyRule(res.rules.map(mapApprovalRuleResponse)),
fallbackApprovalsRequired: res.fallback_approvals_required,
});
......@@ -78,7 +78,7 @@ export const mapMRSourceRule = ({ id, ...rule }) => ({
* - If needed, extract the fallback approvals required
* from the fallback rule.
*/
export const mapMRApprovalSettingsResponse = res => {
export const mapMRApprovalSettingsResponse = (res) => {
const rules = res.rules.filter(({ rule_type }) => visibleTypes.has(rule_type));
const fallbackApprovalsRequired = res.fallback_approvals_required || 0;
......@@ -87,7 +87,7 @@ export const mapMRApprovalSettingsResponse = res => {
rules: withDefaultEmptyRule(
rules
.map(mapApprovalRuleResponse)
.map(res.approval_rules_overwritten ? x => x : mapMRSourceRule),
.map(res.approval_rules_overwritten ? (x) => x : mapMRSourceRule),
),
fallbackApprovalsRequired,
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 }) => {
return axios
.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.')));
};
......
......@@ -7,20 +7,20 @@ import * as types from './mutation_types';
import { RULE_TYPE_ANY_APPROVER } from '../../../constants';
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 groupUsersAsync = Promise.all(groups.map(fetchGroupMembers));
return groupUsersAsync
.then(flatten)
.then(groupUsers => groupUsers.concat(userRecords))
.then(users => uniqBy(users, x => x.id));
.then((groupUsers) => groupUsers.concat(userRecords))
.then((users) => uniqBy(users, (x) => x.id));
};
const seedApprovers = rule =>
const seedApprovers = (rule) =>
rule.groups || rule.userRecords
? fetchApprovers(rule).then(approvers => ({
? fetchApprovers(rule).then((approvers) => ({
...rule,
approvers,
}))
......@@ -32,9 +32,9 @@ const seedUsers = ({ userRecords, ...rule }) =>
const seedGroups = ({ 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;
return {
......@@ -78,34 +78,34 @@ export const fetchRules = (
return axios
.get(path, params)
.then(response => mapMRApprovalSettingsResponse(response.data))
.then(settings => ({
.then((response) => mapMRApprovalSettingsResponse(response.data))
.then((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'));
};
export const postRule = ({ commit, dispatch }, rule) =>
seedLocalRule(rule)
.then(seedNewRule)
.then(newRule => {
.then((newRule) => {
commit(types.POST_RULE, newRule);
dispatch('createModal/close');
})
.catch(e => {
.catch((e) => {
createFlash(__('An error occurred fetching the approvers for the new rule.'));
throw e;
});
export const putRule = ({ commit, dispatch }, rule) =>
seedLocalRule(rule)
.then(newRule => {
.then((newRule) => {
commit(types.PUT_RULE, newRule);
dispatch('createModal/close');
})
.catch(e => {
.catch((e) => {
createFlash(__('An error occurred fetching the approvers for the new rule.'));
throw e;
});
......@@ -131,12 +131,12 @@ export const requestDeleteRule = ({ dispatch }, rule) => {
export const postRegularRule = ({ commit, dispatch }, rule) =>
seedLocalRule(rule)
.then(seedNewRule)
.then(newRule => {
.then((newRule) => {
commit(types.POST_REGULAR_RULE, newRule);
commit(types.DELETE_ANY_RULE);
dispatch('createModal/close');
})
.catch(e => {
.catch((e) => {
createFlash(__('An error occurred fetching the approvers for the new rule.'));
throw e;
});
......
......@@ -5,7 +5,7 @@ import { RULE_TYPE_ANY_APPROVER } from '../../../constants';
export default {
...base,
[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) {
return;
......@@ -34,7 +34,7 @@ export default {
state.rules = [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) {
return;
......@@ -63,7 +63,7 @@ export default {
state.fallbackApprovalsRequired = fallback.approvalsRequired;
},
[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) {
state.rules = [anyRule];
......
......@@ -28,7 +28,7 @@ export const fetchRules = ({ rootState, dispatch }) => {
return axios
.get(settingsPath)
.then(response => dispatch('receiveRulesSuccess', mapApprovalSettingsResponse(response.data)))
.then((response) => dispatch('receiveRulesSuccess', mapApprovalSettingsResponse(response.data)))
.catch(() => dispatch('receiveRulesError'));
};
......
......@@ -22,7 +22,7 @@ export default {
},
data() {
return {
filterTokens: this.filterTokenOptions.map(option => ({
filterTokens: this.filterTokenOptions.map((option) => ({
...AUDIT_FILTER_CONFIGS.find(({ type }) => type === option.type),
...option,
})),
......@@ -30,14 +30,14 @@ export default {
},
computed: {
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() {
const { tokenSearchTerm } = this;
// If a user has searched for a term within a token, limit the user to that one token
if (tokenSearchTerm) {
return this.filterTokens.map(token => ({
return this.filterTokens.map((token) => ({
...token,
disabled: tokenSearchTerm.type !== token.type,
}));
......
......@@ -29,7 +29,7 @@ export default {
},
computed: {
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: {
......
......@@ -10,13 +10,13 @@ export default {
inheritAttrs: false,
tokenMethods: {
fetchItem(id) {
return Api.user(id).then(res => res.data);
return Api.user(id).then((res) => res.data);
},
fetchSuggestions(term) {
const { groupId, projectPath } = this.config;
if (groupId) {
return Api.groupMembers(groupId, { search: term }).then(res => res.data);
return Api.groupMembers(groupId, { search: term }).then((res) => res.data);
}
if (projectPath) {
......
......@@ -9,10 +9,10 @@ export default {
inheritAttrs: false,
tokenMethods: {
fetchItem(id) {
return Api.project(id).then(res => res.data);
return Api.project(id).then((res) => res.data);
},
fetchSuggestions(term) {
return Api.projects(term, { membership: false }).then(res => res.data);
return Api.projects(term, { membership: false }).then((res) => res.data);
},
getItemName({ name }) {
return name;
......
......@@ -105,12 +105,12 @@ export default {
createFlash(sprintf(message, { type }));
},
selectActiveItem(id) {
this.activeItem = this.suggestions.find(u => u.id === id);
this.activeItem = this.suggestions.find((u) => u.id === id);
},
loadView(id) {
this.viewLoading = true;
return this.fetchItem(id)
.then(data => {
.then((data) => {
this.activeItem = data;
})
.catch(this.onApiError)
......@@ -121,7 +121,7 @@ export default {
loadSuggestions(term) {
this.suggestionsLoading = true;
return this.fetchSuggestions(term)
.then(data => {
.then((data) => {
this.suggestions = data;
})
.catch(this.onApiError)
......
......@@ -9,10 +9,10 @@ export default {
inheritAttrs: false,
tokenMethods: {
fetchItem(id) {
return Api.user(id).then(res => res.data);
return Api.user(id).then((res) => res.data);
},
fetchSuggestions(term) {
return Api.users(term).then(res => res.data);
return Api.users(term).then((res) => res.data);
},
getItemName({ name }) {
return name;
......
......@@ -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;
......
......@@ -5,7 +5,7 @@ import { convertObjectPropsToCamelCase, parseBoolean } from '~/lib/utils/common_
import AuditEventsApp from './components/audit_events_app.vue';
import createStore from './store';
export default selector => {
export default (selector) => {
const el = document.querySelector(selector);
const { events, isLastPage, filterTokenOptions, exportUrl, showFilter = true } = el.dataset;
......@@ -15,12 +15,12 @@ export default selector => {
return new Vue({
el,
store,
render: createElement =>
render: (createElement) =>
createElement(AuditEventsApp, {
props: {
events: JSON.parse(events),
isLastPage: parseBoolean(isLastPage),
filterTokenOptions: JSON.parse(filterTokenOptions).map(filterTokenOption =>
filterTokenOptions: JSON.parse(filterTokenOptions).map((filterTokenOption) =>
convertObjectPropsToCamelCase(filterTokenOption),
),
exportUrl,
......
......@@ -6,7 +6,7 @@ import { createAuditEventSearchQuery } from '../utils';
* @param {string} exportUrl
* @returns {string}
*/
export const buildExportHref = state => exportUrl => {
export const buildExportHref = (state) => (exportUrl) => {
return setUrlParams(
createAuditEventSearchQuery({
filterValue: state.filterValue,
......
import { parsePikadayDate, pikadayToString } from '~/lib/utils/datetime_utility';
import { AVAILABLE_TOKEN_TYPES, AUDIT_FILTER_CONFIGS } from './constants';
export const isNumeric = str => {
export const isNumeric = (str) => {
return !Number.isNaN(parseInt(str, 10));
};
export const getTypeFromEntityType = entityType => {
export const getTypeFromEntityType = (entityType) => {
return AUDIT_FILTER_CONFIGS.find(
({ entityType: configEntityType }) => configEntityType === entityType,
)?.type;
};
export const getEntityTypeFromType = type => {
export const getEntityTypeFromType = (type) => {
return AUDIT_FILTER_CONFIGS.find(({ type: configType }) => configType === type)?.entityType;
};
......@@ -28,7 +28,7 @@ export const parseAuditEventSearchQuery = ({
});
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 {
created_after: startDate ? pikadayToString(startDate) : null,
......
......@@ -3,5 +3,5 @@ import { AVAILABLE_TOKEN_TYPES } from './constants';
export function filterTokenOptionsValidator(filterTokenOptions) {
return filterTokenOptions
.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) => {
dispatch('requestBillableMembersList');
return Api.fetchBillableGroupMembersList(state.namespaceId, { page })
.then(data => dispatch('receiveBillableMembersListSuccess', data))
.then((data) => dispatch('receiveBillableMembersListSuccess', data))
.catch(() => dispatch('receiveBillableMembersListError'));
};
......
export const tableItems = state => {
export const tableItems = (state) => {
if (state.members.length) {
return state.members.map(({ name, username, avatar_url, web_url, email }) => {
const formattedUserName = `@${username}`;
......
......@@ -38,7 +38,7 @@ export const fetchHasBillableGroupMembers = ({ dispatch, state }) => {
dispatch('requestHasBillableGroupMembers');
return Api.fetchBillableGroupMembersList(state.namespaceId, { per_page: 1, page: 1 })
.then(data => dispatch('receiveHasBillableGroupMembersSuccess', data))
.then((data) => dispatch('receiveHasBillableGroupMembersSuccess', data))
.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 {
tableKey = TABLE_TYPE_TRIAL;
}
state.tables[tableKey].rows.forEach(row => {
row.columns.forEach(col => {
state.tables[tableKey].rows.forEach((row) => {
row.columns.forEach((col) => {
if (Object.prototype.hasOwnProperty.call(usage, col.id)) {
Vue.set(col, 'value', usage[col.id]);
} else if (Object.prototype.hasOwnProperty.call(billing, col.id)) {
......
......@@ -67,7 +67,7 @@ export function transformBoardConfig(boardConfig) {
let updatedFilterPath = objectToQuery(updatedBoardConfig);
const filterPath = updatedFilterPath ? updatedFilterPath.split('&') : [];
boardConfig.labels.forEach(label => {
boardConfig.labels.forEach((label) => {
const labelTitle = encodeURIComponent(label.title);
const param = `label_name[]=${labelTitle}`;
const labelIndex = passedFilterParams.label_name?.indexOf(labelTitle);
......
......@@ -75,7 +75,7 @@ export default {
handleLabelClick(label) {
if (label.isAny) {
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(
new ListLabel({
id: label.id,
......@@ -86,7 +86,7 @@ export default {
);
} else {
let { labels } = this.board;
labels = labels.filter(selected => selected.id !== label.id);
labels = labels.filter((selected) => selected.id !== label.id);
this.board.labels = labels;
}
},
......
......@@ -37,7 +37,7 @@ export default Vue.extend({
filterItems(term, items) {
const query = term.toLowerCase();
return items.filter(item => {
return items.filter((item) => {
const name = item.name ? item.name.toLowerCase() : item.title.toLowerCase();
const foundName = name.indexOf(query) > -1;
......
......@@ -33,7 +33,7 @@ export default {
if (!this.query) return this.items;
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();
if (this.listType === 'milestones') {
......
......@@ -40,7 +40,7 @@ export default {
...mapState(['epics', 'pageInfoByListId', 'listsFlags']),
...mapGetters(['getUnassignedIssues']),
unassignedIssues() {
return listId => this.getUnassignedIssues(listId);
return (listId) => this.getUnassignedIssues(listId);
},
unassignedIssuesCount() {
return this.lists.reduce(
......@@ -70,7 +70,7 @@ export default {
hasMoreUnassignedIssues() {
return (
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 {
});
},
fetchMoreUnassignedIssues() {
this.lists.forEach(list => {
this.lists.forEach((list) => {
if (this.pageInfoByListId[list.id]?.hasNextPage) {
this.fetchIssuesForList({ listId: list.id, fetchNext: true, noEpicIssues: true });
}
......
......@@ -3,7 +3,7 @@ import initNewListDropdown from '~/boards/components/new_list_dropdown';
import AssigneeList from './assignees_list_selector';
import MilestoneList from './milestone_list_selector';
const handleDropdownHide = e => {
const handleDropdownHide = (e) => {
const $currTarget = $(e.currentTarget);
if ($currTarget.data('preventClose')) {
e.preventDefault();
......@@ -14,7 +14,7 @@ const handleDropdownHide = e => {
let assigneeList;
let milestoneList;
const handleDropdownTabClick = e => {
const handleDropdownTabClick = (e) => {
const $addListEl = $('#js-add-list');
$addListEl.data('preventClose', true);
if (e.target.dataset.action === 'tab-assignees' && !assigneeList) {
......
......@@ -7,9 +7,9 @@ export default {
seedPatchRequest(issue, req) {
/* eslint-disable no-param-reassign */
const board = boardsStore.state.currentBoard;
const boardLabelIds = board.labels.map(label => label.id);
const boardLabelIds = board.labels.map((label) => label.id);
req.label_ids = req.label_ids.filter(id => !boardLabelIds.includes(id));
req.label_ids = req.label_ids.filter((id) => !boardLabelIds.includes(id));
if (board.milestone_id) {
req.milestone_id = -1;
......@@ -21,8 +21,8 @@ export default {
const boardAssignee = board.assignee ? board.assignee.id : null;
const assigneeIds = issue.assignees
.map(assignee => assignee.id)
.filter(id => id !== boardAssignee);
.map((assignee) => assignee.id)
.filter((id) => id !== boardAssignee);
return {
...req,
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import { GlButton, GlModalDirective, GlTooltipDirective } from '@gitlab/ui';
import { s__, __ } from '~/locale';
export default boardsStore => {
export default (boardsStore) => {
const configEl = document.querySelector('.js-board-config');
if (configEl) {
......@@ -31,7 +31,7 @@ export default boardsStore => {
},
},
methods: {
showPage: page => boardsStore.showPage(page),
showPage: (page) => boardsStore.showPage(page),
},
template: `
<div class="gl-ml-3">
......
......@@ -5,7 +5,7 @@ export const setEpicFetchingState = (issue, value) => {
issue.setFetchingState('epic', value);
};
export const getMilestoneTitle = $boardApp => ({
export const getMilestoneTitle = ($boardApp) => ({
milestoneTitle: $boardApp.dataset.boardMilestoneTitle,
});
......
......@@ -2,7 +2,7 @@ export default {
methods: {
buildUpdateRequest(list) {
const { currentBoard } = this.state;
const boardLabelIds = currentBoard.labels.map(label => label.id);
const boardLabelIds = currentBoard.labels.map((label) => label.id);
const assigneeIds = currentBoard.assignee && [currentBoard.assignee.id];
return {
......
......@@ -10,7 +10,7 @@ class ListEE extends List {
}
getIssues(...args) {
return super.getIssues(...args).then(data => {
return super.getIssues(...args).then((data) => {
this.totalWeight = data.total_weight;
});
}
......@@ -38,7 +38,7 @@ class ListEE extends List {
onNewIssueResponse(issue, data) {
issue.milestone = data.milestone ? new ListMilestone(data.milestone) : data.milestone;
issue.assignees = Array.isArray(data.assignees)
? data.assignees.map(assignee => new ListAssignee(assignee))
? data.assignees.map((assignee) => new ListAssignee(assignee))
: data.assignees;
issue.labels = data.labels;
......
......@@ -144,7 +144,7 @@ export default {
})
.then(({ data }) => {
const { epics, lists } = data[boardType]?.board;
const epicsFormatted = epics.edges.map(e => ({
const epicsFormatted = epics.edges.map((e) => ({
...e.node,
}));
......
......@@ -20,7 +20,7 @@ class BoardsStoreEE {
this.store.loadList = (listPath, listType) => this.loadList(listPath, listType);
const superSetCurrentBoard = this.store.setCurrentBoard.bind(this.store);
this.store.setCurrentBoard = board => {
this.store.setCurrentBoard = (board) => {
superSetCurrentBoard(board);
this.store.state.assignees = [];
this.store.state.milestones = [];
......@@ -95,7 +95,7 @@ class BoardsStoreEE {
.concat(
this.store.filter.path
.split('&')
.filter(param => param.match(new RegExp(`^${key}=(.*)$`, 'g')) === null),
.filter((param) => param.match(new RegExp(`^${key}=(.*)$`, 'g')) === null),
)
.join('&');
};
......@@ -142,7 +142,7 @@ class BoardsStoreEE {
}
const filterPath = this.store.filter.path.split('&');
this.store.boardConfig.labels.forEach(label => {
this.store.boardConfig.labels.forEach((label) => {
const labelTitle = encodeURIComponent(label.title);
const param = `label_name[]=${labelTitle}`;
const labelIndex = filterPath.indexOf(param);
......@@ -176,8 +176,8 @@ class BoardsStoreEE {
issue.setLoadingState('weight', true);
this.store
.updateWeight(issue.sidebarInfoEndpoint, newWeight)
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
const lists = issue.getLists();
const oldWeight = issue.weight;
const weightDiff = newWeight - oldWeight;
......@@ -186,7 +186,7 @@ class BoardsStoreEE {
issue.updateData({
weight: data.weight,
});
lists.forEach(list => {
lists.forEach((list) => {
list.addWeight(weightDiff);
});
})
......
......@@ -59,7 +59,7 @@ export default {
Vue.set(state.boardLists, listId, list);
},
[mutationTypes.UPDATE_LIST_FAILURE]: state => {
[mutationTypes.UPDATE_LIST_FAILURE]: (state) => {
state.error = s__('Boards|An error occurred while updating the list. Please try again.');
},
......@@ -100,12 +100,12 @@ export default {
Vue.set(state.epicsFlags, epicId, { isLoading: false });
},
[mutationTypes.TOGGLE_EPICS_SWIMLANES]: state => {
[mutationTypes.TOGGLE_EPICS_SWIMLANES]: (state) => {
state.isShowingEpicsSwimlanes = !state.isShowingEpicsSwimlanes;
state.epicsSwimlanesFetchInProgress = true;
},
[mutationTypes.SET_EPICS_SWIMLANES]: state => {
[mutationTypes.SET_EPICS_SWIMLANES]: (state) => {
state.isShowingEpicsSwimlanes = true;
state.epicsSwimlanesFetchInProgress = true;
},
......@@ -115,7 +115,7 @@ export default {
state.epicsSwimlanesFetchInProgress = false;
},
[mutationTypes.RECEIVE_SWIMLANES_FAILURE]: state => {
[mutationTypes.RECEIVE_SWIMLANES_FAILURE]: (state) => {
state.error = s__(
'Boards|An error occurred while fetching the board swimlanes. Please reload the page.',
);
......@@ -133,7 +133,7 @@ export default {
Vue.set(state, 'epics', unionBy(state.epics || [], epics, 'id'));
},
[mutationTypes.RESET_EPICS]: state => {
[mutationTypes.RESET_EPICS]: (state) => {
Vue.set(state, 'epics', []);
},
......@@ -159,7 +159,7 @@ export default {
[mutationTypes.SET_BOARD_EPIC_USER_PREFERENCES]: (state, val) => {
const { userPreferences, epicId } = val;
const epic = state.epics.filter(currentEpic => currentEpic.id === epicId)[0];
const epic = state.epics.filter((currentEpic) => currentEpic.id === epicId)[0];
if (epic) {
Vue.set(epic, 'userPreferences', userPreferences);
......
......@@ -9,5 +9,5 @@ export default () =>
ToggleLabels,
},
store,
render: createElement => createElement('toggle-labels'),
render: (createElement) => createElement('toggle-labels'),
});
......@@ -35,7 +35,7 @@ export default class BurnChartData {
const dateString = dateFormat(date, this.dateFormatMask);
const openedIssuesToday = this.filterAndSummarizeBurndownEvents(
event =>
(event) =>
event.created_at === dateString &&
event.event_type === 'milestone' &&
event.milestone_id === milestoneId &&
......@@ -43,7 +43,7 @@ export default class BurnChartData {
);
const closedIssuesToday = this.filterAndSummarizeBurndownEvents(
event =>
(event) =>
event.created_at === dateString &&
event.event_type === 'milestone' &&
((event.action === 'remove' && event.milestone_id === milestoneId) ||
......@@ -87,13 +87,13 @@ export default class BurnChartData {
const dateString = dateFormat(date, this.dateFormatMask);
const openedIssuesToday = this.filterAndSummarizeBurndownEvents(
event =>
(event) =>
event.created_at === dateString &&
(event.action === 'created' || event.action === 'reopened'),
);
const closedIssuesToday = this.filterAndSummarizeBurndownEvents(
event => event.created_at === dateString && event.action === 'closed',
(event) => event.created_at === dateString && event.action === 'closed',
);
openIssuesCount += openedIssuesToday.count - closedIssuesToday.count;
......@@ -128,7 +128,7 @@ export default class BurnChartData {
// 1. Set event creation date to milestone start date if created before milestone start
// 2. Convert event creation datetime to date in local timezone
processRawEvents(events) {
return events.map(event => ({
return events.map((event) => ({
...event,
created_at:
dateFormat(event.created_at, this.dateFormatMask) < this.startDate
......
......@@ -170,7 +170,7 @@ export default {
axios
.get(this.burndownEventsPath)
.then(burndownResponse => {
.then((burndownResponse) => {
const burndownEvents = burndownResponse.data;
const burndownChartData = new BurndownChartData(
burndownEvents,
......@@ -178,8 +178,8 @@ export default {
this.dueDate,
).generateBurndownTimeseries();
this.openIssuesCount = burndownChartData.map(d => [d[0], d[1]]);
this.openIssuesWeight = burndownChartData.map(d => [d[0], d[2]]);
this.openIssuesCount = burndownChartData.map((d) => [d[0], d[1]]);
this.openIssuesWeight = burndownChartData.map((d) => [d[0], d[2]]);
})
.catch(() => {
this.fetchedLegacyData = false;
......@@ -187,7 +187,7 @@ export default {
});
},
pluckBurnupDataProperties(total, completed) {
return this.burnupData.map(data => {
return this.burnupData.map((data) => {
return [data.date, data[total] - data[completed]];
});
},
......@@ -203,7 +203,7 @@ export default {
padSparseBurnupData(sparseBurnupData) {
// if we don't have data for the startDate, we still want to draw a point at 0
// on the chart, so add an item to the start of the array
const hasDataForStartDate = sparseBurnupData.find(d => d.date === this.startDate);
const hasDataForStartDate = sparseBurnupData.find((d) => d.date === this.startDate);
if (!hasDataForStartDate) {
sparseBurnupData.unshift({
date: this.startDate,
......@@ -222,7 +222,7 @@ export default {
// similar to the startDate padding, if we don't have a value for the
// last item in the array, we should add one. If no events occur on
// a day then we don't get any data for that day in the response
const hasDataForLastDate = sparseBurnupData.find(d => d.date === lastDate);
const hasDataForLastDate = sparseBurnupData.find((d) => d.date === lastDate);
if (!hasDataForLastDate) {
const lastItem = sparseBurnupData[sparseBurnupData.length - 1];
sparseBurnupData.push({
......
......@@ -81,7 +81,7 @@ export default {
methods: {
// transform the object to a chart-friendly array of date + value
transform(key) {
return this.burnupData.map(val => [val.date, val[key]]);
return this.burnupData.map((val) => [val.date, val[key]]);
},
formatTooltipText(params) {
const [total, completed] = params.seriesData;
......
......@@ -36,13 +36,13 @@ export default {
type: String,
required: false,
default: Namespace.Group,
validator: value => Object.values(Namespace).includes(value),
validator: (value) => Object.values(Namespace).includes(value),
},
displayValue: {
type: String,
required: false,
default: Unit.count,
validator: val => Unit[val],
validator: (val) => Unit[val],
},
},
data() {
......
......@@ -43,7 +43,7 @@ export default {
podsInUseCount() {
let podsInUse = 0;
this.environments.forEach(environment => {
this.environments.forEach((environment) => {
if (this.hasInstances(environment.rolloutStatus)) {
podsInUse += environment.rolloutStatus.instances.length;
}
......@@ -66,8 +66,8 @@ export default {
];
},
methods: {
hasInstances: rolloutStatus => rolloutStatus.instances && rolloutStatus.instances.length,
isLoadingRollout: rolloutStatus => rolloutStatus.status === 'loading',
hasInstances: (rolloutStatus) => rolloutStatus.instances && rolloutStatus.instances.length,
isLoadingRollout: (rolloutStatus) => rolloutStatus.status === 'loading',
},
};
</script>
......
......@@ -2,7 +2,7 @@ import Tracking from '~/tracking';
export default {
methods: {
trackUninstallButtonClick: application => {
trackUninstallButtonClick: (application) => {
Tracking.event('k8s_cluster', 'uninstall', {
label: application,
});
......
......@@ -14,7 +14,7 @@ export default {
projectPath: this.projectPath,
};
},
update: data => {
update: (data) => {
return {
list: data?.project?.clusterAgents?.nodes,
folders: data?.project?.repository?.tree?.trees?.nodes,
......@@ -52,7 +52,7 @@ export default {
const configFolders = this.agents?.folders;
if (list && configFolders) {
list = list.map(agent => {
list = list.map((agent) => {
const configFolder = configFolders.find(({ name }) => name === agent.name);
return { ...agent, configFolder };
});
......
......@@ -23,7 +23,7 @@ export const fetchReport = ({ state, dispatch }) => {
if (!state.blobPath) throw new Error();
dispatch('receiveReportSuccess', data);
})
.catch(error => {
.catch((error) => {
dispatch('receiveReportError', error);
createFlash(s__('ciReport|There was an error fetching the codequality report.'));
});
......
export const codequalityIssues = state => {
export const codequalityIssues = (state) => {
const { page, perPage } = state.pageInfo;
const start = (page - 1) * perPage;
return state.allCodequalityIssues.slice(start, start + perPage);
};
export const codequalityIssueTotal = state => state.allCodequalityIssues.length;
export const codequalityIssueTotal = (state) => state.allCodequalityIssues.length;
......@@ -9,7 +9,7 @@ export default () => {
return new Vue({
el,
render: createElement =>
render: (createElement) =>
createElement(ComplianceDashboard, {
props: {
mergeRequests: JSON.parse(mergeRequests),
......
......@@ -19,7 +19,7 @@ export default {
namespace: {
type: String,
required: true,
validator: value =>
validator: (value) =>
Object.values(DEPENDENCY_LIST_TYPES).some(({ namespace }) => value === namespace),
},
},
......
......@@ -14,7 +14,7 @@ export default {
namespace: {
type: String,
required: true,
validator: value =>
validator: (value) =>
Object.values(DEPENDENCY_LIST_TYPES).some(({ namespace }) => value === namespace),
},
},
......
......@@ -10,7 +10,7 @@ export const isIncomplete = ({ currentList }, getters) => getters[`${currentList
export const hasNoDependencies = ({ currentList }, getters) =>
getters[`${currentList}/hasNoDependencies`];
export const totals = state =>
export const totals = (state) =>
state.listTypes.reduce(
(acc, { namespace }) => ({
...acc,
......
......@@ -41,14 +41,14 @@ export const fetchDependencies = ({ state, dispatch }, params = {}) => {
...params,
},
})
.then(response => {
.then((response) => {
if (isValidResponse(response)) {
dispatch('receiveDependenciesSuccess', response);
} else {
throw new Error(__('Invalid server response'));
}
})
.catch(error => {
.catch((error) => {
dispatch('receiveDependenciesError', error);
createFlash(FETCH_ERROR_MESSAGE);
});
......
......@@ -3,7 +3,7 @@ import { mapActions } from 'vuex';
export default {
computed: {
diffFileDiscussions() {
return this.allDiscussions.filter(d => !d.isDraft);
return this.allDiscussions.filter((d) => !d.isDraft);
},
},
methods: {
......
......@@ -10,7 +10,7 @@ const CustomNumber = {
const isValidNumber = !Number.isNaN(parsedValue) && value !== '';
const customOption = [{ id: parsedValue, title: parsedValue }];
const defaultDropdownOptions = defaultOptions.map(o => ({ id: o, title: o }));
const defaultDropdownOptions = defaultOptions.map((o) => ({ id: o, title: o }));
list.setData(isValidNumber ? customOption : defaultDropdownOptions);
list.currentIndex = 0;
......
......@@ -14,7 +14,7 @@ export default class EETrialBanner {
init() {
// Wait for navbars to render before querying
this.setCookies();
this.$trialBanner.on('close.bs.alert', e => this.handleTrialBannerDismiss(e));
this.$trialBanner.on('close.bs.alert', (e) => this.handleTrialBannerDismiss(e));
}
/**
......
......@@ -24,7 +24,7 @@ export default class EnvironmentsStore extends CeEnvironmentsStore {
toggleDeployBoard(environmentID) {
const environments = this.state.environments.slice();
this.state.environments = environments.map(env => {
this.state.environments = environments.map((env) => {
let updated = { ...env };
if (env.id === environmentID) {
......
......@@ -46,7 +46,7 @@ export default {
},
computed: {
labelIds() {
return this.labels.map(label => label.id);
return this.labels.map((label) => label.id);
},
},
i18n: {
......@@ -102,7 +102,7 @@ export default {
const ids = [];
const allLabels = [...labels, ...this.labels];
this.labels = allLabels.filter(label => {
this.labels = allLabels.filter((label) => {
const exists = ids.includes(label.id);
ids.push(label.id);
......
......@@ -84,7 +84,7 @@ export default {
if (label.isAny) {
this.epicContext.labels = [];
} else {
const labelIndex = this.epicContext.labels.findIndex(l => l.id === label.id);
const labelIndex = this.epicContext.labels.findIndex((l) => l.id === label.id);
if (labelIndex === -1) {
this.epicContext.labels.push(
......@@ -109,9 +109,9 @@ export default {
// either selected or removed aren't leading to same selection
// as current one, as then we don't want to make network call
// since nothing has changed.
const anyLabelUpdated = labels.some(label => {
const anyLabelUpdated = labels.some((label) => {
// Find this label in existing selection.
const existingLabel = this.epicContext.labels.find(l => l.id === label.id);
const existingLabel = this.epicContext.labels.find((l) => l.id === label.id);
// Check either of the two following conditions;
// 1. A label that's not currently applied is being applied.
......
......@@ -34,7 +34,7 @@ export default (epicCreate = false) => {
methods: {
...mapActions(['setEpicMeta']),
},
render: createElement =>
render: (createElement) =>
createElement('epic-create-app', {
props: {
alignRight: el.dataset.alignRight,
......@@ -66,6 +66,6 @@ export default (epicCreate = false) => {
methods: {
...mapActions(['setEpicMeta', 'setEpicData']),
},
render: createElement => createElement('epic-app'),
render: (createElement) => createElement('epic-app'),
});
};
......@@ -29,7 +29,7 @@ export default class EpicTabs {
*/
loadRoadmapBundle() {
import('ee/roadmap/roadmap_bundle')
.then(roadmapBundle => {
.then((roadmapBundle) => {
this.initRoadmap = roadmapBundle.default;
})
.catch(() => {});
......
......@@ -29,7 +29,7 @@ export const fetchEpicDetails = ({ state, dispatch }) => {
variables,
})
.then(({ data }) => {
const participants = data.group.epic.participants.edges.map(participant => ({
const participants = data.group.epic.participants.edges.map((participant) => ({
name: participant.node.name,
avatar_url: participant.node.avatarUrl,
web_url: participant.node.webUrl,
......@@ -218,7 +218,7 @@ export const updateConfidentialityOnIssuable = ({ state, commit }, { confidentia
throw errMsg;
}
})
.catch(error => {
.catch((error) => {
flash(error);
throw error;
});
......@@ -235,8 +235,8 @@ export const receiveEpicLabelsSelectFailure = ({ commit }) => {
flash(s__('Epics|An error occurred while updating labels.'));
};
export const updateEpicLabels = ({ dispatch, state }, labels) => {
const addLabelIds = labels.filter(label => label.set).map(label => label.id);
const removeLabelIds = labels.filter(label => !label.set).map(label => label.id);
const addLabelIds = labels.filter((label) => label.set).map((label) => label.id);
const removeLabelIds = labels.filter((label) => !label.set).map((label) => label.id);
const updateEpicInput = {
iid: `${state.epicIid}`,
groupPath: state.fullPath,
......
......@@ -110,9 +110,9 @@ export default {
state.epicLabelsSelectInProgress = true;
},
[types.RECEIVE_EPIC_LABELS_SELECT_SUCCESS](state, labels) {
const addedLabels = labels.filter(label => label.set);
const removeLabelIds = labels.filter(label => !label.set).map(label => label.id);
const updatedLabels = state.labels.filter(label => !removeLabelIds.includes(label.id));
const addedLabels = labels.filter((label) => label.set);
const removeLabelIds = labels.filter((label) => !label.set).map((label) => label.id);
const updatedLabels = state.labels.filter((label) => !removeLabelIds.includes(label.id));
updatedLabels.push(...addedLabels);
state.epicLabelsSelectInProgress = false;
......
......@@ -24,7 +24,7 @@ const bindDocumentEvent = (eventName, callback) => {
$(document).on(eventName, callback);
};
const toggleContainerClass = className => {
const toggleContainerClass = (className) => {
const containerEl = document.querySelector('.page-with-contextual-sidebar');
if (containerEl) {
......@@ -34,7 +34,7 @@ const toggleContainerClass = className => {
const getCollapsedGutter = () => parseBoolean(Cookies.get('collapsed_gutter'));
const setCollapsedGutter = value => Cookies.set('collapsed_gutter', value);
const setCollapsedGutter = (value) => Cookies.set('collapsed_gutter', value);
const getDateValidity = (startDateTime, dueDateTime) => {
// If both dates are defined
......
......@@ -9,7 +9,7 @@ const NAVSOURCE_VALUE = 'navbar';
* intercepts clicks on navbar links
* and adds the 'nav_source=navbar' query parameter
*/
const appendLinkParam = e => {
const appendLinkParam = (e) => {
const target = e.currentTarget;
// get closest link in case the target is a wrapping DOM node
......@@ -28,8 +28,8 @@ export default function trackNavbarEvents() {
if (!navbar) return;
// track search inputs within frequent-items component
navbar.querySelectorAll(`.frequent-items-dropdown-container input`).forEach(el => {
el.addEventListener('click', e => {
navbar.querySelectorAll(`.frequent-items-dropdown-container input`).forEach((el) => {
el.addEventListener('click', (e) => {
const parentDropdown = e.currentTarget.closest('li.dropdown');
Tracking.event(TRACKING_CATEGORY, 'activate_form_input', {
......
......@@ -16,7 +16,7 @@ export default class DropdownWeight extends FilteredSearchDropdown {
}
itemClicked(e) {
super.itemClicked(e, selected => {
super.itemClicked(e, (selected) => {
const title = selected.querySelector('.js-data-value').innerText.trim();
return `${DropdownUtils.getEscapedText(title)}`;
});
......@@ -25,7 +25,7 @@ export default class DropdownWeight extends FilteredSearchDropdown {
renderContent(forceShowList = false) {
this.droplab.changeHookList(this.hookId, this.dropdown, [CustomNumber], this.config);
const defaultDropdownOptions = this.defaultOptions.map(o => ({ id: o, title: o }));
const defaultDropdownOptions = this.defaultOptions.map((o) => ({ id: o, title: o }));
this.droplab.setData(defaultDropdownOptions);
super.renderContent(forceShowList);
......
This diff is collapsed.
This diff is collapsed.
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