Commit b48e14b8 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 32 files - 34 of 73

Part of our prettier migration; changing the arrow-parens style.
parent dc6c2412
...@@ -1020,40 +1020,6 @@ ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/duration_chart ...@@ -1020,40 +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
## frosty-sammet
ee/app/assets/javascripts/analytics/group_ci_cd_analytics/index.js
ee/app/assets/javascripts/analytics/merge_request_analytics/components/filter_bar.vue
ee/app/assets/javascripts/analytics/merge_request_analytics/components/throughput_chart.vue
ee/app/assets/javascripts/analytics/merge_request_analytics/components/throughput_table.vue
ee/app/assets/javascripts/analytics/merge_request_analytics/graphql/throughput_chart_query_builder.js
ee/app/assets/javascripts/analytics/merge_request_analytics/index.js
ee/app/assets/javascripts/analytics/merge_request_analytics/utils.js
ee/app/assets/javascripts/analytics/productivity_analytics/components/app.vue
ee/app/assets/javascripts/analytics/productivity_analytics/components/metric_chart.vue
ee/app/assets/javascripts/analytics/productivity_analytics/components/mr_table.vue
ee/app/assets/javascripts/analytics/productivity_analytics/filtered_search_productivity_analytics.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/getters.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/charts/actions.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/charts/getters.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/filters/getters.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/table/actions.js
ee/app/assets/javascripts/analytics/productivity_analytics/store/modules/table/getters.js
ee/app/assets/javascripts/analytics/productivity_analytics/utils.js
ee/app/assets/javascripts/analytics/repository_analytics/components/download_test_coverage.vue
ee/app/assets/javascripts/analytics/repository_analytics/components/test_coverage_table.vue
ee/app/assets/javascripts/analytics/shared/components/groups_dropdown_filter.vue
ee/app/assets/javascripts/analytics/shared/components/projects_dropdown_filter.vue
ee/app/assets/javascripts/analytics/shared/components/scatterplot.vue
ee/app/assets/javascripts/analytics/shared/utils.js
ee/app/assets/javascripts/approvals/components/app.vue
ee/app/assets/javascripts/approvals/components/approvers_select.vue
ee/app/assets/javascripts/approvals/components/branches_select.vue
ee/app/assets/javascripts/approvals/components/license_compliance/index.vue
ee/app/assets/javascripts/approvals/components/mr_edit/app.vue
ee/app/assets/javascripts/approvals/components/mr_edit/mr_rules.vue
ee/app/assets/javascripts/approvals/components/mr_edit/mr_rules_hidden_inputs.vue
ee/app/assets/javascripts/approvals/components/mr_edit/rule_input.vue
## strange-shirley ## strange-shirley
ee/app/assets/javascripts/approvals/components/project_settings/project_rules.vue 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/rule_form.vue
......
...@@ -8,6 +8,6 @@ export default () => { ...@@ -8,6 +8,6 @@ export default () => {
return new Vue({ return new Vue({
el, el,
render: createElement => createElement(CiCdAnalyticsApp), render: (createElement) => createElement(CiCdAnalyticsApp),
}); });
}; };
...@@ -26,17 +26,17 @@ export default { ...@@ -26,17 +26,17 @@ export default {
inject: ['fullPath', 'type'], inject: ['fullPath', 'type'],
computed: { computed: {
...mapState('filters', { ...mapState('filters', {
selectedSourceBranch: state => state.branches.source.selected, selectedSourceBranch: (state) => state.branches.source.selected,
selectedTargetBranch: state => state.branches.target.selected, selectedTargetBranch: (state) => state.branches.target.selected,
selectedMilestone: state => state.milestones.selected, selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: state => state.authors.selected, selectedAuthor: (state) => state.authors.selected,
selectedAssignee: state => state.assignees.selected, selectedAssignee: (state) => state.assignees.selected,
selectedLabelList: state => state.labels.selectedList, selectedLabelList: (state) => state.labels.selectedList,
milestonesData: state => state.milestones.data, milestonesData: (state) => state.milestones.data,
labelsData: state => state.labels.data, labelsData: (state) => state.labels.data,
assigneesData: state => state.assignees.data, assigneesData: (state) => state.assignees.data,
authorsData: state => state.authors.data, authorsData: (state) => state.authors.data,
branchesData: state => state.branches.data, branchesData: (state) => state.branches.data,
}), }),
tokens() { tokens() {
return [ return [
......
...@@ -62,12 +62,12 @@ export default { ...@@ -62,12 +62,12 @@ export default {
}, },
computed: { computed: {
...mapState('filters', { ...mapState('filters', {
selectedSourceBranch: state => state.branches.source.selected, selectedSourceBranch: (state) => state.branches.source.selected,
selectedTargetBranch: state => state.branches.target.selected, selectedTargetBranch: (state) => state.branches.target.selected,
selectedMilestone: state => state.milestones.selected, selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: state => state.authors.selected, selectedAuthor: (state) => state.authors.selected,
selectedAssignee: state => state.assignees.selected, selectedAssignee: (state) => state.assignees.selected,
selectedLabelList: state => state.labels.selectedList, selectedLabelList: (state) => state.labels.selectedList,
}), }),
chartOptions() { chartOptions() {
return { return {
...@@ -75,7 +75,7 @@ export default { ...@@ -75,7 +75,7 @@ export default {
name: THROUGHPUT_CHART_STRINGS.X_AXIS_TITLE, name: THROUGHPUT_CHART_STRINGS.X_AXIS_TITLE,
type: 'category', type: 'category',
axisLabel: { axisLabel: {
formatter: value => { formatter: (value) => {
return value.split(' ')[0]; // Aug 2020 => Aug return value.split(' ')[0]; // Aug 2020 => Aug
}, },
}, },
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
return !this.hasError && this.$apollo.queries.throughputChartData.loading; return !this.hasError && this.$apollo.queries.throughputChartData.loading;
}, },
chartDataAvailable() { chartDataAvailable() {
return this.formattedThroughputChartData[0]?.data?.some(entry => Boolean(entry[1])); return this.formattedThroughputChartData[0]?.data?.some((entry) => Boolean(entry[1]));
}, },
alertDetails() { alertDetails() {
return { return {
......
...@@ -155,12 +155,12 @@ export default { ...@@ -155,12 +155,12 @@ export default {
}, },
computed: { computed: {
...mapState('filters', { ...mapState('filters', {
selectedSourceBranch: state => state.branches.source.selected, selectedSourceBranch: (state) => state.branches.source.selected,
selectedTargetBranch: state => state.branches.target.selected, selectedTargetBranch: (state) => state.branches.target.selected,
selectedMilestone: state => state.milestones.selected, selectedMilestone: (state) => state.milestones.selected,
selectedAuthor: state => state.authors.selected, selectedAuthor: (state) => state.authors.selected,
selectedAssignee: state => state.assignees.selected, selectedAssignee: (state) => state.assignees.selected,
selectedLabelList: state => state.labels.selectedList, selectedLabelList: (state) => state.labels.selectedList,
}), }),
options() { options() {
return filterToQueryObject({ return filterToQueryObject({
......
...@@ -16,7 +16,7 @@ export default (startDate = null, endDate = null) => { ...@@ -16,7 +16,7 @@ export default (startDate = null, endDate = null) => {
if (!monthData.length) return ''; if (!monthData.length) return '';
const computedMonthData = monthData.map(value => { const computedMonthData = monthData.map((value) => {
const { year, month, mergedAfter, mergedBefore } = 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). // first: 0 is an optimization which makes sure we don't load merge request objects into memory (backend).
......
...@@ -58,7 +58,7 @@ export default () => { ...@@ -58,7 +58,7 @@ export default () => {
fullPath, fullPath,
type, type,
}, },
render: createElement => render: (createElement) =>
createElement(MergeRequestAnalyticsApp, { createElement(MergeRequestAnalyticsApp, {
props: { props: {
startDate: startDateParam.length startDate: startDateParam.length
......
...@@ -53,12 +53,12 @@ export const computeMonthRangeData = (startDate, endDate, format = dateFormats.i ...@@ -53,12 +53,12 @@ export const computeMonthRangeData = (startDate, endDate, format = dateFormats.i
* *
* @return {Array} the formatted chart data * @return {Array} the formatted chart data
*/ */
export const formatThroughputChartData = chartData => { export const formatThroughputChartData = (chartData) => {
if (!chartData) return []; if (!chartData) return [];
const data = Object.keys(chartData) const data = Object.keys(chartData)
.slice(0, -1) // Remove the __typeName key .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 [ return [
{ {
......
...@@ -141,7 +141,7 @@ export default { ...@@ -141,7 +141,7 @@ export default {
return { return {
yAxis: { yAxis: {
axisLabel: { axisLabel: {
formatter: value => value, formatter: (value) => value,
}, },
minInterval: 1, minInterval: 1,
}, },
...@@ -227,7 +227,7 @@ export default { ...@@ -227,7 +227,7 @@ export default {
:chart-data="getScatterPlotMainData" :chart-data="getScatterPlotMainData"
:selected-metric="getSelectedMetric(chartKeys.scatterplot)" :selected-metric="getSelectedMetric(chartKeys.scatterplot)"
@metricTypeChange=" @metricTypeChange="
metric => setMetricType({ metricType: metric, chartKey: chartKeys.scatterplot }) (metric) => setMetricType({ metricType: metric, chartKey: chartKeys.scatterplot })
" "
> >
<scatterplot <scatterplot
...@@ -252,7 +252,7 @@ export default { ...@@ -252,7 +252,7 @@ export default {
:selected-metric="getSelectedMetric(chartKeys.timeBasedHistogram)" :selected-metric="getSelectedMetric(chartKeys.timeBasedHistogram)"
:chart-data="getColumnChartData(chartKeys.timeBasedHistogram)" :chart-data="getColumnChartData(chartKeys.timeBasedHistogram)"
@metricTypeChange=" @metricTypeChange="
metric => (metric) =>
setMetricType({ metricType: metric, chartKey: chartKeys.timeBasedHistogram }) setMetricType({ metricType: metric, chartKey: chartKeys.timeBasedHistogram })
" "
> >
...@@ -278,7 +278,7 @@ export default { ...@@ -278,7 +278,7 @@ export default {
:selected-metric="getSelectedMetric(chartKeys.commitBasedHistogram)" :selected-metric="getSelectedMetric(chartKeys.commitBasedHistogram)"
:chart-data="getColumnChartData(chartKeys.commitBasedHistogram)" :chart-data="getColumnChartData(chartKeys.commitBasedHistogram)"
@metricTypeChange=" @metricTypeChange="
metric => (metric) =>
setMetricType({ metricType: metric, chartKey: chartKeys.commitBasedHistogram }) setMetricType({ metricType: metric, chartKey: chartKeys.commitBasedHistogram })
" "
> >
......
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
return this.metricTypes.length; return this.metricTypes.length;
}, },
metricDropdownLabel() { 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'); return foundMetric ? foundMetric.label : s__('MetricChart|Please select a metric');
}, },
isServerError() { isServerError() {
......
...@@ -35,7 +35,7 @@ export default { ...@@ -35,7 +35,7 @@ export default {
}, },
computed: { computed: {
metricDropdownLabel() { metricDropdownLabel() {
return this.columnOptions.find(option => option.key === this.metricType).label; return this.columnOptions.find((option) => option.key === this.metricType).label;
}, },
showPagination() { showPagination() {
return this.pageInfo && this.pageInfo.total; return this.pageInfo && this.pageInfo.total;
......
...@@ -22,7 +22,7 @@ export default class FilteredSearchProductivityAnalytics extends FilteredSearchM ...@@ -22,7 +22,7 @@ export default class FilteredSearchProductivityAnalytics extends FilteredSearchM
/** /**
* Updates filters in productivity analytics store * Updates filters in productivity analytics store
*/ */
updateObject = path => { updateObject = (path) => {
const filters = urlParamsToObject(path); const filters = urlParamsToObject(path);
store.dispatch('filters/setFilters', filters); store.dispatch('filters/setFilters', filters);
}; };
......
export const getMetricTypes = state => chartKey => export const getMetricTypes = (state) => (chartKey) =>
state.metricTypes.filter(m => m.charts.indexOf(chartKey) !== -1); state.metricTypes.filter((m) => m.charts.indexOf(chartKey) !== -1);
...@@ -8,7 +8,7 @@ import { transformScatterData } from '../../../utils'; ...@@ -8,7 +8,7 @@ import { transformScatterData } from '../../../utils';
* Fetches data for all charts except for the main chart * Fetches data for all charts except for the main chart
*/ */
export const fetchSecondaryChartData = ({ state, dispatch }) => { export const fetchSecondaryChartData = ({ state, dispatch }) => {
Object.keys(state.charts).forEach(chartKey => { Object.keys(state.charts).forEach((chartKey) => {
if (chartKey !== chartKeys.main) { if (chartKey !== chartKeys.main) {
dispatch('fetchChartData', chartKey); dispatch('fetchChartData', chartKey);
} }
...@@ -27,7 +27,7 @@ export const fetchChartData = ({ dispatch, getters, state, rootState }, chartKey ...@@ -27,7 +27,7 @@ export const fetchChartData = ({ dispatch, getters, state, rootState }, chartKey
axios axios
.get(rootState.endpoint, { params }) .get(rootState.endpoint, { params })
.then(response => { .then((response) => {
const { data } = response; const { data } = response;
if (chartKey === chartKeys.scatterplot) { if (chartKey === chartKeys.scatterplot) {
...@@ -42,7 +42,7 @@ export const fetchChartData = ({ dispatch, getters, state, rootState }, chartKey ...@@ -42,7 +42,7 @@ export const fetchChartData = ({ dispatch, getters, state, rootState }, chartKey
dispatch('receiveChartDataSuccess', { chartKey, data }); dispatch('receiveChartDataSuccess', { chartKey, data });
} }
}) })
.catch(error => dispatch('receiveChartDataError', { chartKey, error })); .catch((error) => dispatch('receiveChartDataError', { chartKey, error }));
} }
}; };
......
...@@ -13,9 +13,9 @@ import { ...@@ -13,9 +13,9 @@ import {
} from '../../../constants'; } from '../../../constants';
import { getScatterPlotData, getMedianLineData } from '../../../utils'; 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. * 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 ...@@ -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. * the itemStyle will be set accordingly in order to highlight the relevant bar.
* *
*/ */
export const getColumnChartData = state => chartKey => { export const getColumnChartData = (state) => (chartKey) => {
const dataWithSelected = Object.keys(state.charts[chartKey].data).map(key => { const dataWithSelected = Object.keys(state.charts[chartKey].data).map((key) => {
const dataArr = [key, state.charts[chartKey].data[key]]; const dataArr = [key, state.charts[chartKey].data[key]];
let itemStyle = {}; let itemStyle = {};
...@@ -54,7 +54,7 @@ export const getColumnChartData = state => chartKey => { ...@@ -54,7 +54,7 @@ export const getColumnChartData = state => chartKey => {
return dataWithSelected; 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) => export const getScatterPlotMainData = (state, getters, rootState) =>
getScatterPlotData( getScatterPlotData(
...@@ -77,10 +77,10 @@ export const getScatterPlotMedianData = (state, getters, rootState) => ...@@ -77,10 +77,10 @@ export const getScatterPlotMedianData = (state, getters, rootState) =>
scatterPlotAddonQueryDays, scatterPlotAddonQueryDays,
); );
export const getMetricLabel = state => chartKey => export const getMetricLabel = (state) => (chartKey) =>
metricTypes.find(m => m.key === state.charts[chartKey].params.metricType).label; 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]; const { params: chartParams = {} } = state.charts[chartKey];
// common filter params // common filter params
...@@ -109,7 +109,7 @@ export const getFilterParams = (state, getters, rootState, rootGetters) => chart ...@@ -109,7 +109,7 @@ export const getFilterParams = (state, getters, rootState, rootGetters) => chart
* it will return an empty dataZoom property. * it will return an empty dataZoom property.
* *
*/ */
export const getColumnChartDatazoomOption = state => chartKey => { export const getColumnChartDatazoomOption = (state) => (chartKey) => {
const { data } = state.charts[chartKey]; const { data } = state.charts[chartKey];
const totalItems = Object.keys(data).length; const totalItems = Object.keys(data).length;
const MAX_ITEMS_PER_PAGE = maxColumnChartItemsPerPage[chartKey] const MAX_ITEMS_PER_PAGE = maxColumnChartItemsPerPage[chartKey]
...@@ -123,7 +123,7 @@ export const getColumnChartDatazoomOption = state => chartKey => { ...@@ -123,7 +123,7 @@ export const getColumnChartDatazoomOption = state => chartKey => {
const intervalEnd = Math.ceil((MAX_ITEMS_PER_PAGE / totalItems) * 100); const intervalEnd = Math.ceil((MAX_ITEMS_PER_PAGE / totalItems) * 100);
return { return {
dataZoom: dataZoomOptions.map(item => { dataZoom: dataZoomOptions.map((item) => {
const result = { const result = {
...item, ...item,
end: intervalEnd, end: intervalEnd,
...@@ -134,7 +134,7 @@ export const getColumnChartDatazoomOption = state => chartKey => { ...@@ -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. * Returns the y axis label for the scatterplot.
...@@ -143,16 +143,16 @@ export const getSelectedMetric = state => chartKey => state.charts[chartKey].par ...@@ -143,16 +143,16 @@ export const getSelectedMetric = state => chartKey => state.charts[chartKey].par
export const scatterplotYaxisLabel = (_state, getters, rootState) => { export const scatterplotYaxisLabel = (_state, getters, rootState) => {
const selectedMetric = getters.getSelectedMetric(chartKeys.scatterplot); const selectedMetric = getters.getSelectedMetric(chartKeys.scatterplot);
const metricTypesInHours = rootState.metricTypes const metricTypesInHours = rootState.metricTypes
.filter(metric => metric.charts.indexOf(chartKeys.timeBasedHistogram) !== -1) .filter((metric) => metric.charts.indexOf(chartKeys.timeBasedHistogram) !== -1)
.map(metric => metric.key); .map((metric) => metric.key);
if (selectedMetric === daysToMergeMetric.key) return s__('ProductivityAnalytics|Days'); if (selectedMetric === daysToMergeMetric.key) return s__('ProductivityAnalytics|Days');
if (metricTypesInHours.indexOf(selectedMetric) !== -1) return s__('ProductivityAnalytics|Hours'); if (metricTypesInHours.indexOf(selectedMetric) !== -1) return s__('ProductivityAnalytics|Hours');
return getters.getMetricLabel(chartKeys.scatterplot); return getters.getMetricLabel(chartKeys.scatterplot);
}; };
export const hasNoAccessError = state => export const hasNoAccessError = (state) =>
state.charts[chartKeys.main].errorCode === httpStatus.FORBIDDEN; 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'; ...@@ -19,7 +19,7 @@ import { dateFormats } from '../../../../shared/constants';
* } * }
* *
*/ */
export const getCommonFilterParams = (state, getters) => chartKey => { export const getCommonFilterParams = (state, getters) => (chartKey) => {
const { const {
groupNamespace, groupNamespace,
projectPath, projectPath,
...@@ -55,7 +55,7 @@ export const getCommonFilterParams = (state, getters) => chartKey => { ...@@ -55,7 +55,7 @@ export const getCommonFilterParams = (state, getters) => chartKey => {
* When a minDate exists and the minDate is after the computed dateInPast, * When a minDate exists and the minDate is after the computed dateInPast,
* the minDate is returned. Otherwise the computed dateInPast is returned. * the minDate is returned. Otherwise the computed dateInPast is returned.
*/ */
export const scatterplotStartDate = state => { export const scatterplotStartDate = (state) => {
const { startDate, minDate } = state; const { startDate, minDate } = state;
const dateInPast = getDateInPast(startDate, scatterPlotAddonQueryDays); const dateInPast = getDateInPast(startDate, scatterPlotAddonQueryDays);
......
...@@ -17,11 +17,11 @@ export const fetchMergeRequests = ({ dispatch, state, rootState, rootGetters }) ...@@ -17,11 +17,11 @@ export const fetchMergeRequests = ({ dispatch, state, rootState, rootGetters })
return axios return axios
.get(rootState.endpoint, { params }) .get(rootState.endpoint, { params })
.then(response => { .then((response) => {
const { headers, data } = response; const { headers, data } = response;
dispatch('receiveMergeRequestsSuccess', { headers, data }); dispatch('receiveMergeRequestsSuccess', { headers, data });
}) })
.catch(err => dispatch('receiveMergeRequestsError', err)); .catch((err) => dispatch('receiveMergeRequestsError', err));
}; };
export const requestMergeRequests = ({ commit }) => commit(types.REQUEST_MERGE_REQUESTS); export const requestMergeRequests = ({ commit }) => commit(types.REQUEST_MERGE_REQUESTS);
......
import { chartKeys, tableSortOrder, daysToMergeMetric } from '../../../constants'; 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) => 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) => [ export const tableSortOptions = (_state, _getters, _rootState, rootGetters) => [
daysToMergeMetric, daysToMergeMetric,
...@@ -15,6 +15,6 @@ export const tableSortOptions = (_state, _getters, _rootState, rootGetters) => [ ...@@ -15,6 +15,6 @@ export const tableSortOptions = (_state, _getters, _rootState, rootGetters) => [
export const columnMetricLabel = (state, _getters, _rootState, rootGetters) => export const columnMetricLabel = (state, _getters, _rootState, rootGetters) =>
rootGetters rootGetters
.getMetricTypes(chartKeys.timeBasedHistogram) .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) => { ...@@ -91,7 +91,7 @@ export const transformScatterData = (data, startDate, endDate) => {
const result = initDateArray(startDate, endDate); const result = initDateArray(startDate, endDate);
const totalItems = result.length; const totalItems = result.length;
Object.keys(data).forEach(id => { Object.keys(data).forEach((id) => {
const mergedAtDate = new Date(data[id].merged_at); const mergedAtDate = new Date(data[id].merged_at);
const dayDiff = getDayDifference(mergedAtDate, endDate); const dayDiff = getDayDifference(mergedAtDate, endDate);
...@@ -134,7 +134,7 @@ export const getScatterPlotData = (data, startDate, endDate) => { ...@@ -134,7 +134,7 @@ export const getScatterPlotData = (data, startDate, endDate) => {
const visibleData = data.slice(startIndex); const visibleData = data.slice(startIndex);
// group by date // group by date
const result = flatten(visibleData).map(item => [ const result = flatten(visibleData).map((item) => [
dateFormat(item.merged_at, dateFormats.isoDate), dateFormat(item.merged_at, dateFormats.isoDate),
item.metric, item.metric,
item.merged_at, item.merged_at,
...@@ -162,7 +162,7 @@ export const getScatterPlotData = (data, startDate, endDate) => { ...@@ -162,7 +162,7 @@ export const getScatterPlotData = (data, startDate, endDate) => {
export const getMedianLineData = (data, startDate, endDate, daysOffset) => { export const getMedianLineData = (data, startDate, endDate, daysOffset) => {
const result = []; const result = [];
const dayDiff = getDayDifference(startDate, endDate); 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; const len = data.length;
let i = len - dayDiff; let i = len - dayDiff;
......
...@@ -60,7 +60,7 @@ export default { ...@@ -60,7 +60,7 @@ export default {
// not including a project_ids param is the same as selecting all the projects // not including a project_ids param is the same as selecting all the projects
if (!this.allProjectsSelected) { 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()}`; return `${this.groupAnalyticsCoverageReportsPath}&${queryParams.toString()}`;
......
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
// Remove the projects that don't have any code coverage // Remove the projects that don't have any code coverage
...data.projects.nodes ...data.projects.nodes
.filter(({ codeCoverageSummary }) => Boolean(codeCoverageSummary)) .filter(({ codeCoverageSummary }) => Boolean(codeCoverageSummary))
.map(project => ({ .map((project) => ({
...project, ...project,
codeCoveragePath: joinPaths( codeCoveragePath: joinPaths(
gon.relative_url_root || '', gon.relative_url_root || '',
...@@ -76,7 +76,7 @@ export default { ...@@ -76,7 +76,7 @@ export default {
selectedProjectIds() { selectedProjectIds() {
// Get the IDs of the projects that we haven't requested yet // Get the IDs of the projects that we haven't requested yet
return Object.keys(this.projectIds).filter( return Object.keys(this.projectIds).filter(
id => !this.allCoverageData.some(project => project.id === id), (id) => !this.allCoverageData.some((project) => project.id === id),
); );
}, },
selectedCoverageData() { selectedCoverageData() {
......
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
}, },
fetchData() { fetchData() {
this.loading = true; 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.loading = false;
this.groups = groups; this.groups = groups;
}); });
......
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
return this.selectedProjects.length === 1; return this.selectedProjects.length === 1;
}, },
selectedProjectIds() { selectedProjectIds() {
return this.selectedProjects.map(p => p.id); return this.selectedProjects.map((p) => p.id);
}, },
availableProjects() { availableProjects() {
return filterBySearchTerm(this.projects, this.searchTerm); return filterBySearchTerm(this.projects, this.searchTerm);
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
getSelectedProjects(selectedProject, isMarking) { getSelectedProjects(selectedProject, isMarking) {
return isMarking return isMarking
? this.selectedProjects.concat([selectedProject]) ? this.selectedProjects.concat([selectedProject])
: this.selectedProjects.filter(project => project.id !== selectedProject.id); : this.selectedProjects.filter((project) => project.id !== selectedProject.id);
}, },
singleSelectedProject(selectedObj, isMarking) { singleSelectedProject(selectedObj, isMarking) {
return isMarking ? [selectedObj] : []; return isMarking ? [selectedObj] : [];
...@@ -136,7 +136,7 @@ export default { ...@@ -136,7 +136,7 @@ export default {
...this.queryParams, ...this.queryParams,
}, },
}) })
.then(response => { .then((response) => {
const { const {
data: { data: {
group: { group: {
......
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
xAxis: { xAxis: {
type: 'time', type: 'time',
axisLabel: { axisLabel: {
formatter: date => dateFormat(date, dateFormats.defaultDate), formatter: (date) => dateFormat(date, dateFormats.defaultDate),
}, },
}, },
dataZoom: [ dataZoom: [
......
...@@ -2,13 +2,13 @@ import dateFormat from 'dateformat'; ...@@ -2,13 +2,13 @@ import dateFormat from 'dateformat';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { dateFormats } from './constants'; import { dateFormats } from './constants';
export const toYmd = date => dateFormat(date, dateFormats.isoDate); export const toYmd = (date) => dateFormat(date, dateFormats.isoDate);
export default { export default {
toYmd, 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. * 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); ...@@ -16,7 +16,7 @@ export const formattedDate = d => dateFormat(d, dateFormats.defaultDate);
* @param {Object} dataset - The raw value stream object * @param {Object} dataset - The raw value stream object
* @returns {Object} - A 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) : {}; const { id, name, is_custom: isCustom } = valueStream ? JSON.parse(valueStream) : {};
return id ? { id, name, isCustom } : null; return id ? { id, name, isCustom } : null;
}; };
...@@ -27,7 +27,7 @@ export const buildValueStreamFromJson = valueStream => { ...@@ -27,7 +27,7 @@ export const buildValueStreamFromJson = valueStream => {
* @param {Object} dataset - The container's dataset * @param {Object} dataset - The container's dataset
* @returns {Object} - A group object * @returns {Object} - A group object
*/ */
export const buildGroupFromDataset = dataset => { export const buildGroupFromDataset = (dataset) => {
const { groupId, groupName, groupFullPath, groupAvatarUrl, groupParentId } = dataset; const { groupId, groupName, groupFullPath, groupAvatarUrl, groupParentId } = dataset;
if (groupId) { if (groupId) {
...@@ -49,7 +49,7 @@ export const buildGroupFromDataset = dataset => { ...@@ -49,7 +49,7 @@ export const buildGroupFromDataset = dataset => {
* @param {Object} dataset - The container's dataset * @param {Object} dataset - The container's dataset
* @returns {Object} - A project object * @returns {Object} - A project object
*/ */
export const buildProjectFromDataset = dataset => { export const buildProjectFromDataset = (dataset) => {
const { projectGid, projectName, projectPathWithNamespace, projectAvatarUrl } = dataset; const { projectGid, projectName, projectPathWithNamespace, projectAvatarUrl } = dataset;
if (projectGid) { if (projectGid) {
...@@ -117,5 +117,5 @@ export const buildCycleAnalyticsInitialData = ({ ...@@ -117,5 +117,5 @@ export const buildCycleAnalyticsInitialData = ({
export const filterBySearchTerm = (data = [], searchTerm = '', filterByKey = 'name') => { export const filterBySearchTerm = (data = [], searchTerm = '', filterByKey = 'name') => {
if (!searchTerm?.length) return data; 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 { ...@@ -23,9 +23,9 @@ export default {
computed: { computed: {
...mapState({ ...mapState({
settings: 'settings', settings: 'settings',
isLoading: state => state.approvals.isLoading, isLoading: (state) => state.approvals.isLoading,
hasLoaded: state => state.approvals.hasLoaded, hasLoaded: (state) => state.approvals.hasLoaded,
targetBranch: state => state.approvals.targetBranch, targetBranch: (state) => state.approvals.targetBranch,
}), }),
createModalId() { createModalId() {
return `${this.settings.prefix}-approvals-create-modal`; return `${this.settings.prefix}-approvals-create-modal`;
......
...@@ -8,7 +8,7 @@ import { renderAvatar } from '~/helpers/avatar_helper'; ...@@ -8,7 +8,7 @@ import { renderAvatar } from '~/helpers/avatar_helper';
import { loadCSSFile } from '~/lib/utils/css_utils'; import { loadCSSFile } from '~/lib/utils/css_utils';
function addType(type) { function addType(type) {
return items => items.map(obj => Object.assign(obj, { type })); return (items) => items.map((obj) => Object.assign(obj, { type }));
} }
function formatSelection(group) { function formatSelection(group) {
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
}, 250), }, 250),
id: ({ type, id }) => `${type}${id}`, id: ({ type, id }) => `${type}${id}`,
}) })
.on('change', e => this.onChange(e)); .on('change', (e) => this.onChange(e));
}) })
.catch(() => {}); .catch(() => {});
}) })
...@@ -132,7 +132,7 @@ export default { ...@@ -132,7 +132,7 @@ export default {
return Promise.all([groupsAsync, usersAsync]) return Promise.all([groupsAsync, usersAsync])
.then(([groups, users]) => groups.concat(users)) .then(([groups, users]) => groups.concat(users))
.then(results => ({ results })); .then((results) => ({ results }));
}, },
fetchGroups(term) { fetchGroups(term) {
// Don't includeAll when search is empty. Otherwise, the user could get a lot of garbage choices. // Don't includeAll when search is empty. Otherwise, the user could get a lot of garbage choices.
......
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
}, 250), }, 250),
id: ({ type, id }) => `${type}${id}`, id: ({ type, id }) => `${type}${id}`,
}) })
.on('change', e => this.onChange(e)) .on('change', (e) => this.onChange(e))
.on('select2-open', () => { .on('select2-open', () => {
// https://stackoverflow.com/questions/18487056/select2-doesnt-work-when-embedded-in-a-bootstrap-modal // https://stackoverflow.com/questions/18487056/select2-doesnt-work-when-embedded-in-a-bootstrap-modal
// Ensure search feature works in modal // Ensure search feature works in modal
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
methods: { methods: {
fetchBranches(term) { fetchBranches(term) {
const excludeAnyBranch = term && !term.toLowerCase().includes('any'); 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], results: excludeAnyBranch ? results : [anyBranch, ...results],
})); }));
}, },
......
...@@ -22,8 +22,8 @@ export default { ...@@ -22,8 +22,8 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
isLoading: state => state[APPROVALS].isLoading, isLoading: (state) => state[APPROVALS].isLoading,
rules: state => state[APPROVALS].rules, rules: (state) => state[APPROVALS].rules,
documentationPath: ({ settings }) => settings.approvalsDocumentationPath, documentationPath: ({ settings }) => settings.approvalsDocumentationPath,
licenseCheckRuleName: ({ settings }) => settings.lockedApprovalsRuleName, licenseCheckRuleName: ({ settings }) => settings.lockedApprovalsRuleName,
}), }),
......
...@@ -36,8 +36,8 @@ export default { ...@@ -36,8 +36,8 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
rules: state => state.approvals.rules, rules: (state) => state.approvals.rules,
canOverride: state => state.settings.canOverride, canOverride: (state) => state.settings.canOverride,
}), }),
toggleIcon() { toggleIcon() {
return this.isCollapsed ? 'chevron-down' : 'chevron-right'; return this.isCollapsed ? 'chevron-down' : 'chevron-right';
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
return this.glFeatures.mergeRequestReviewers && this.glFeatures.mrCollapsedApprovalRules; return this.glFeatures.mergeRequestReviewers && this.glFeatures.mrCollapsedApprovalRules;
}, },
hasOptionalRules() { hasOptionalRules() {
return this.rules.every(r => r.approvalsRequired === 0); return this.rules.every((r) => r.approvalsRequired === 0);
}, },
requiredRules() { requiredRules() {
return this.rules.reduce((acc, rule) => { return this.rules.reduce((acc, rule) => {
......
...@@ -21,12 +21,12 @@ export default { ...@@ -21,12 +21,12 @@ export default {
computed: { computed: {
...mapState(['settings']), ...mapState(['settings']),
...mapState({ ...mapState({
rules: state => state.approvals.rules, rules: (state) => state.approvals.rules,
targetBranch: state => state.approvals.targetBranch, targetBranch: (state) => state.approvals.targetBranch,
}), }),
hasNamedRule() { hasNamedRule() {
if (this.settings.allowMultiRule) { 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; const [rule] = this.rules;
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
} }
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();
} }
......
...@@ -17,10 +17,10 @@ export default { ...@@ -17,10 +17,10 @@ export default {
computed: { computed: {
...mapState(['settings']), ...mapState(['settings']),
...mapState({ ...mapState({
resetToDefault: state => state.approvals.resetToDefault, resetToDefault: (state) => state.approvals.resetToDefault,
rules: state => state.approvals.rules, rules: (state) => state.approvals.rules,
rulesToDelete: state => state.approvals.rulesToDelete, rulesToDelete: (state) => state.approvals.rulesToDelete,
fallbackApprovalsRequired: state => state.approvals.fallbackApprovalsRequired, fallbackApprovalsRequired: (state) => state.approvals.fallbackApprovalsRequired,
}), }),
}, },
INPUT_ID, INPUT_ID,
......
...@@ -21,7 +21,7 @@ export default { ...@@ -21,7 +21,7 @@ export default {
...mapState(['settings']), ...mapState(['settings']),
}, },
created() { created() {
this.onInputChangeDebounced = debounce(event => { this.onInputChangeDebounced = debounce((event) => {
this.onInputChange(event); this.onInputChange(event);
}, 1000); }, 1000);
}, },
......
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