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
......@@ -531,173 +531,6 @@ app/assets/javascripts/snippets/components/snippet_blob_view.vue
app/assets/javascripts/snippets/components/snippet_header.vue
app/assets/javascripts/snippets/mixins/snippets.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
ee/app/assets/javascripts/approvals/components/project_settings/project_rules.vue
ee/app/assets/javascripts/approvals/components/rule_form.vue
ee/app/assets/javascripts/approvals/components/security_configuration/unconfigured_security_rules.vue
ee/app/assets/javascripts/approvals/mappers.js
ee/app/assets/javascripts/approvals/stores/modules/base/getters.js
ee/app/assets/javascripts/approvals/stores/modules/license_compliance/actions.js
ee/app/assets/javascripts/approvals/stores/modules/mr_edit/actions.js
ee/app/assets/javascripts/approvals/stores/modules/mr_edit/mutations.js
ee/app/assets/javascripts/approvals/stores/modules/project_settings/actions.js
ee/app/assets/javascripts/audit_events/components/audit_events_filter.vue
ee/app/assets/javascripts/audit_events/components/sorting_field.vue
ee/app/assets/javascripts/audit_events/components/tokens/member_token.vue
ee/app/assets/javascripts/audit_events/components/tokens/project_token.vue
ee/app/assets/javascripts/audit_events/components/tokens/shared/audit_filter_token.vue
ee/app/assets/javascripts/audit_events/components/tokens/user_token.vue
ee/app/assets/javascripts/audit_events/constants.js
ee/app/assets/javascripts/audit_events/init_audit_events.js
ee/app/assets/javascripts/audit_events/store/getters.js
ee/app/assets/javascripts/audit_events/utils.js
ee/app/assets/javascripts/audit_events/validators.js
ee/app/assets/javascripts/billings/seat_usage/store/actions.js
ee/app/assets/javascripts/billings/seat_usage/store/getters.js
ee/app/assets/javascripts/billings/subscriptions/store/actions.js
ee/app/assets/javascripts/billings/subscriptions/store/getters.js
ee/app/assets/javascripts/billings/subscriptions/store/mutations.js
ee/app/assets/javascripts/boards/boards_util.js
ee/app/assets/javascripts/boards/components/board_scope.vue
ee/app/assets/javascripts/boards/components/boards_list_selector/index.js
ee/app/assets/javascripts/boards/components/boards_list_selector/list_container.vue
ee/app/assets/javascripts/boards/components/epics_swimlanes.vue
ee/app/assets/javascripts/boards/components/new_list_dropdown.js
## great-keldysh
ee/app/assets/javascripts/boards/components/sidebar/remove_issue.js
ee/app/assets/javascripts/boards/config_toggle.js
ee/app/assets/javascripts/boards/ee_functions.js
ee/app/assets/javascripts/boards/mixins/modal_footer.js
ee/app/assets/javascripts/boards/models/list.js
ee/app/assets/javascripts/boards/stores/actions.js
ee/app/assets/javascripts/boards/stores/boards_store_ee.js
ee/app/assets/javascripts/boards/stores/mutations.js
ee/app/assets/javascripts/boards/toggle_labels.js
ee/app/assets/javascripts/burndown_chart/burn_chart_data.js
ee/app/assets/javascripts/burndown_chart/components/burn_charts.vue
ee/app/assets/javascripts/burndown_chart/components/burnup_chart.vue
ee/app/assets/javascripts/burndown_chart/components/open_timebox_summary.vue
ee/app/assets/javascripts/clusters/components/environments.vue
ee/app/assets/javascripts/clusters/mixins/track_uninstall_button_click.js
ee/app/assets/javascripts/clusters_list/components/agents.vue
ee/app/assets/javascripts/codequality_report/store/actions.js
ee/app/assets/javascripts/codequality_report/store/getters.js
ee/app/assets/javascripts/compliance_dashboard/compliance_dashboard_bundle.js
ee/app/assets/javascripts/dependencies/components/dependencies_actions.vue
ee/app/assets/javascripts/dependencies/components/paginated_dependencies_table.vue
ee/app/assets/javascripts/dependencies/store/getters.js
ee/app/assets/javascripts/dependencies/store/modules/list/actions.js
ee/app/assets/javascripts/diffs/mixins/image_diff.js
ee/app/assets/javascripts/droplab/plugins/custom_number.js
ee/app/assets/javascripts/ee_trial_banner/ee_trial_banner.js
ee/app/assets/javascripts/environments/stores/environments_store.js
ee/app/assets/javascripts/epic/components/epic_form.vue
ee/app/assets/javascripts/epic/components/sidebar_items/sidebar_labels.vue
ee/app/assets/javascripts/epic/epic_bundle.js
ee/app/assets/javascripts/epic/epic_tabs.js
## stoic-einstein
ee/app/assets/javascripts/epic/store/actions.js
ee/app/assets/javascripts/epic/store/mutations.js
ee/app/assets/javascripts/epic/utils/epic_utils.js
ee/app/assets/javascripts/event_tracking/navbar.js
ee/app/assets/javascripts/filtered_search/dropdown_weight.js
ee/app/assets/javascripts/filtered_search/filtered_search_manager.js
ee/app/assets/javascripts/filtered_search/issuable_filtered_search_token_keys.js
ee/app/assets/javascripts/geo_node_form/components/geo_node_form_capacities.vue
ee/app/assets/javascripts/geo_node_form/components/geo_node_form_namespaces.vue
ee/app/assets/javascripts/geo_node_form/components/geo_node_form_shards.vue
ee/app/assets/javascripts/geo_node_form/store/actions.js
ee/app/assets/javascripts/geo_node_form/store/getters.js
ee/app/assets/javascripts/geo_node_form/validations.js
ee/app/assets/javascripts/geo_nodes/components/app.vue
ee/app/assets/javascripts/geo_nodes/components/node_detail_sections/node_details_section_main.vue
ee/app/assets/javascripts/geo_nodes/store/geo_nodes_store.js
ee/app/assets/javascripts/geo_replicable/graphql/replicable_type_query_builder.js
ee/app/assets/javascripts/geo_replicable/store/actions.js
ee/app/assets/javascripts/geo_replicable/store/getters.js
ee/app/assets/javascripts/geo_replicable/store/index.js
ee/app/assets/javascripts/geo_settings/store/getters.js
ee/app/assets/javascripts/geo_settings/store/state.js
ee/app/assets/javascripts/geo_settings/validations.js
ee/app/assets/javascripts/gfm_auto_complete.js
ee/app/assets/javascripts/group_member_contributions/store/group_member_store.js
ee/app/assets/javascripts/groups/members/utils.js
ee/app/assets/javascripts/groups/settings/access_restriction_field/validate_ip_address.js
ee/app/assets/javascripts/groups/settings/compliance_frameworks/components/list.vue
ee/app/assets/javascripts/groups/settings/compliance_frameworks/init_list.js
ee/app/assets/javascripts/groups/settings/components/comma_separated_list_token_selector.vue
ee/app/assets/javascripts/insights/components/insights.vue
ee/app/assets/javascripts/insights/components/insights_chart.vue
## pedantic-noether
ee/app/assets/javascripts/insights/stores/modules/insights/actions.js
ee/app/assets/javascripts/insights/stores/modules/insights/helpers.js
ee/app/assets/javascripts/insights/stores/modules/insights/mutations.js
ee/app/assets/javascripts/integrations/jira/issues_list/components/jira_issues_list_root.vue
ee/app/assets/javascripts/integrations/jira/issues_list/jira_issues_list_bundle.js
ee/app/assets/javascripts/issues_analytics/components/issues_analytics.vue
ee/app/assets/javascripts/issues_analytics/filtered_search_issues_analytics.js
ee/app/assets/javascripts/issues_analytics/stores/modules/issue_analytics/actions.js
ee/app/assets/javascripts/issues_analytics/stores/modules/issue_analytics/getters.js
ee/app/assets/javascripts/iterations/components/iteration_report.vue
ee/app/assets/javascripts/iterations/components/iteration_report_tabs.vue
ee/app/assets/javascripts/iterations/components/iterations.vue
ee/app/assets/javascripts/iterations/components/iterations_list.vue
ee/app/assets/javascripts/ldap_groups_select.js
ee/app/assets/javascripts/license_compliance/store/modules/list/actions.js
ee/app/assets/javascripts/license_compliance/store/modules/list/getters.js
ee/app/assets/javascripts/license_compliance/store/plugins/mediator.js
ee/app/assets/javascripts/license_compliance/utils/mappers.js
ee/app/assets/javascripts/maintenance_mode_settings/store/index.js
ee/app/assets/javascripts/members.js
ee/app/assets/javascripts/members/components/table/members_table_cell.vue
ee/app/assets/javascripts/members/store/state.js
ee/app/assets/javascripts/members/utils.js
ee/app/assets/javascripts/on_demand_scans/components/on_demand_scans_form.vue
ee/app/assets/javascripts/on_demand_scans/components/profile_selector/scanner_profile_selector.vue
ee/app/assets/javascripts/on_demand_scans/components/profile_selector/site_profile_selector.vue
ee/app/assets/javascripts/oncall_schedules/components/add_edit_schedule_form.vue
ee/app/assets/javascripts/oncall_schedules/components/add_edit_schedule_modal.vue
ee/app/assets/javascripts/oncall_schedules/components/delete_schedule_modal.vue
ee/app/assets/javascripts/oncall_schedules/components/oncall_schedule.vue
ee/app/assets/javascripts/oncall_schedules/components/rotations/components/add_rotation_modal.vue
## gifted-dewdney
ee/app/assets/javascripts/oncall_schedules/utils/cache_updates.js
ee/app/assets/javascripts/oncall_schedules/utils/common_utils.js
......
......@@ -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);
......
......@@ -6,7 +6,7 @@ export default class extends FilteredSearchManager {
const { tokens, ...rest } = super.getSearchTokens();
const hasEqualsToEpicIdToken = tokens.some(
token =>
(token) =>
token?.key === epicTokenKey.key &&
token?.operator === '=' &&
!Number.isNaN(Number(token?.value)),
......
......@@ -120,7 +120,7 @@ export const iterationConditions = [
*/
class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys {
constructor() {
const milestoneTokenKeyIndex = tokenKeys.findIndex(tk => tk.key === 'milestone');
const milestoneTokenKeyIndex = tokenKeys.findIndex((tk) => tk.key === 'milestone');
tokenKeys.splice(milestoneTokenKeyIndex + 1, 0, iterationTokenKey);
super([...tokenKeys, epicTokenKey, weightTokenKey], alternativeTokenKeys, [
......@@ -135,7 +135,7 @@ class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys {
* Changes assignee token to accept multiple values.
*/
enableMultipleAssignees() {
const assigneeTokenKey = this.tokenKeys.find(tk => tk.key === 'assignee');
const assigneeTokenKey = this.tokenKeys.find((tk) => tk.key === 'assignee');
// Add the original as an alternative token key
this.tokenKeysWithAlternative.push({ ...assigneeTokenKey });
......@@ -153,7 +153,7 @@ class IssuesFilteredSearchTokenKeysEE extends FilteredSearchTokenKeys {
}
removeToken(tokenKey) {
const index = this.tokenKeys.findIndex(token => token.key === tokenKey.key);
const index = this.tokenKeys.findIndex((token) => token.key === tokenKey.key);
if (index >= 0) {
this.tokenKeys.splice(index, 1);
}
......
......@@ -57,7 +57,7 @@ export default {
computed: {
...mapState(['formErrors']),
visibleFormGroups() {
return this.formGroups.filter(group => {
return this.formGroups.filter((group) => {
if (group.conditional) {
return this.nodeData.primary
? group.conditional === 'primary'
......
......@@ -32,7 +32,7 @@ export default {
methods: {
...mapActions(['fetchSyncNamespaces']),
toggleNamespace(namespace) {
const index = this.selectedNamespaces.findIndex(id => id === namespace.id);
const index = this.selectedNamespaces.findIndex((id) => id === namespace.id);
if (index > -1) {
this.$emit('removeSyncOption', { key: SELECTIVE_SYNC_NAMESPACES, index });
} else {
......
......@@ -34,7 +34,7 @@ export default {
},
methods: {
toggleShard(shard) {
const index = this.selectedShards.findIndex(value => value === shard.value);
const index = this.selectedShards.findIndex((value) => value === shard.value);
if (index > -1) {
this.$emit('removeSyncOption', { key: SELECTIVE_SYNC_SHARDS, index });
} else {
......
......@@ -6,13 +6,13 @@ import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils';
import { __ } from '~/locale';
import * as types from './mutation_types';
const getSaveErrorMessageParts = messages => {
const getSaveErrorMessageParts = (messages) => {
return flatten(
Object.entries(messages || {}).map(([key, value]) => value.map(x => `${key} ${x}`)),
Object.entries(messages || {}).map(([key, value]) => value.map((x) => `${key} ${x}`)),
);
};
const getSaveErrorMessage = messages => {
const getSaveErrorMessage = (messages) => {
const parts = getSaveErrorMessageParts(messages);
return `${__('Errors:')} ${parts.join(', ')}`;
};
......@@ -29,7 +29,7 @@ export const fetchSyncNamespaces = ({ dispatch }, search) => {
dispatch('requestSyncNamespaces');
Api.groups(search)
.then(res => {
.then((res) => {
dispatch('receiveSyncNamespacesSuccess', res);
})
.catch(() => {
......
export const formHasError = state => Object.values(state.formErrors).some(val => Boolean(val));
export const formHasError = (state) => Object.values(state.formErrors).some((val) => Boolean(val));
import { sprintf, s__ } from '~/locale';
import { isSafeURL } from '~/lib/utils/url_utility';
export const validateName = data => {
export const validateName = (data) => {
if (!data) {
return s__("Geo|Node name can't be blank");
} else if (data.length > 255) {
......@@ -11,7 +11,7 @@ export const validateName = data => {
return '';
};
export const validateUrl = data => {
export const validateUrl = (data) => {
if (!data) {
return s__("Geo|URL can't be blank");
} else if (!isSafeURL(data)) {
......
......@@ -89,8 +89,8 @@ export default {
fetchGeoNodes() {
return this.service
.getGeoNodes()
.then(res => res.data)
.then(nodes => {
.then((res) => res.data)
.then((nodes) => {
this.store.setNodes(nodes);
this.isLoading = false;
})
......@@ -103,8 +103,8 @@ export default {
const nodeId = node.id;
return this.service
.getGeoNodeDetails(node)
.then(res => res.data)
.then(nodeDetails => {
.then((res) => res.data)
.then((nodeDetails) => {
const primaryNodeVersion = this.store.getPrimaryNodeVersion();
const updatedNodeDetails = Object.assign(nodeDetails, {
primaryVersion: primaryNodeVersion.version,
......@@ -113,7 +113,7 @@ export default {
this.store.setNodeDetails(nodeId, updatedNodeDetails);
eventHub.$emit('nodeDetailsLoaded', this.store.getNodeDetails(nodeId));
})
.catch(err => {
.catch((err) => {
this.store.setNodeDetails(nodeId, {
geo_node_id: nodeId,
health: err.message,
......@@ -142,8 +142,8 @@ export default {
this.setNodeActionStatus(targetNode, true);
return this.service
.toggleNode(targetNode)
.then(res => res.data)
.then(node => {
.then((res) => res.data)
.then((node) => {
Object.assign(targetNode, {
enabled: node.enabled,
nodeActionActive: false,
......
......@@ -61,7 +61,7 @@ export default {
if (selectiveSyncType === 'namespaces') {
return sprintf(__('Groups (%{groups})'), {
groups: this.nodeDetails.namespaces.map(n => n.full_path).join(', '),
groups: this.nodeDetails.namespaces.map((n) => n.full_path).join(', '),
});
}
......
......@@ -11,7 +11,7 @@ export default class GeoNodesStore {
}
setNodes(nodes) {
this.state.nodes = nodes.map(node => GeoNodesStore.formatNode(node));
this.state.nodes = nodes.map((node) => GeoNodesStore.formatNode(node));
}
getNodes() {
......@@ -67,7 +67,7 @@ export default class GeoNodesStore {
}
static formatNodeDetails(rawNodeDetails, replicableTypes) {
const syncStatuses = replicableTypes.map(replicable => {
const syncStatuses = replicableTypes.map((replicable) => {
return {
itemEnabled: rawNodeDetails[`${replicable.namePlural}_replication_enabled`],
itemTitle: replicable.titlePlural,
......@@ -87,7 +87,7 @@ export default class GeoNodesStore {
});
// Adds replicable to array as long as value is defined
const verificationStatuses = syncStatuses.filter(s =>
const verificationStatuses = syncStatuses.filter((s) =>
Boolean(
!isNil(s.itemValue.verificationSuccessCount) ||
!isNil(s.itemValue.verificationFailureCount),
......@@ -95,7 +95,7 @@ export default class GeoNodesStore {
);
// Adds replicable to array as long as value is defined
const checksumStatuses = syncStatuses.filter(s =>
const checksumStatuses = syncStatuses.filter((s) =>
Boolean(!isNil(s.itemValue.checksumSuccessCount) || !isNil(s.itemValue.checksumFailureCount)),
);
......
import gql from 'graphql-tag';
import PageInfo from '~/graphql_shared/fragments/pageInfo.fragment.graphql';
export default graphQlFieldName => {
export default (graphQlFieldName) => {
return gql`
query($first: Int, $last: Int, $before: String!, $after: String!) {
geoNode {
......
......@@ -54,7 +54,7 @@ export const fetchReplicableItemsGraphQl = ({ state, dispatch }, direction) => {
query: buildReplicableTypeQuery(state.graphqlFieldName),
variables: { first, last, before, after },
})
.then(res => {
.then((res) => {
if (!res.data.geoNode || !(state.graphqlFieldName in res.data.geoNode)) {
dispatch('receiveReplicableItemsSuccess', { data: [], pagination: null });
return;
......@@ -86,7 +86,7 @@ export const fetchReplicableItemsRestful = ({ state, dispatch }) => {
};
Api.getGeoReplicableItems(state.replicableType, query)
.then(res => {
.then((res) => {
const normalizedHeaders = normalizeHeaders(res.headers);
const pagination = parseIntPagination(normalizedHeaders);
const data = convertObjectPropsToCamelCase(res.data, { deep: true });
......
export const replicableTypeName = state => state.replicableType.split('_').join(' ');
export const replicableTypeName = (state) => state.replicableType.split('_').join(' ');
......@@ -14,5 +14,5 @@ export const getStoreConfig = ({ replicableType, graphqlFieldName }) => ({
state: createState({ replicableType, graphqlFieldName }),
});
const createStore = config => new Vuex.Store(getStoreConfig(config));
const createStore = (config) => new Vuex.Store(getStoreConfig(config));
export default createStore;
export const formHasError = state =>
export const formHasError = (state) =>
Object.keys(state.formErrors)
.map(key => state.formErrors[key])
.some(val => Boolean(val));
.map((key) => state.formErrors[key])
.some((val) => Boolean(val));
......@@ -5,6 +5,6 @@ export default () => ({
timeout: DEFAULT_TIMEOUT,
allowedIp: DEFAULT_ALLOWED_IP,
formErrors: Object.keys(FORM_VALIDATION_FIELDS)
.map(key => FORM_VALIDATION_FIELDS[key])
.map((key) => FORM_VALIDATION_FIELDS[key])
.reduce((acc, cur) => ({ ...acc, [cur]: '' }), {}),
});
import validateIpAddress from 'ee/validators/ip_address';
import { s__ } from '~/locale';
const validateIP = data => {
const validateIP = (data) => {
let addresses = data.replace(/\s/g, '').split(',');
addresses = addresses.map(address => validateIpAddress(address));
addresses = addresses.map((address) => validateIpAddress(address));
return !addresses.some(a => !a);
return !addresses.some((a) => !a);
};
export const validateTimeout = data => {
export const validateTimeout = (data) => {
if (!data && data !== 0) {
return s__("Geo|Connection timeout can't be blank");
} else if (data && Number.isNaN(Number(data))) {
......@@ -21,7 +21,7 @@ export const validateTimeout = data => {
return '';
};
export const validateAllowedIp = data => {
export const validateAllowedIp = (data) => {
if (!data) {
return s__("Geo|Allowed Geo IP can't be blank");
} else if (data.length > 255) {
......
......@@ -41,7 +41,7 @@ class GfmAutoCompleteEE extends GfmAutoComplete {
callbacks: {
...defaultCallbacks,
beforeSave(merges) {
return $.map(merges, m => {
return $.map(merges, (m) => {
if (m.title == null) {
return m;
}
......@@ -75,7 +75,7 @@ class GfmAutoCompleteEE extends GfmAutoComplete {
callbacks: {
...defaultCallbacks,
beforeSave(merges) {
return merges.map(m => {
return merges.map((m) => {
if (m.title == null) {
return m;
}
......
......@@ -37,7 +37,7 @@ export default class GroupMemberStore {
}
setMembers(rawMembers) {
this.state.members = rawMembers.map(rawMember => GroupMemberStore.formatMember(rawMember));
this.state.members = rawMembers.map((rawMember) => GroupMemberStore.formatMember(rawMember));
}
sortMembers(sortByColumn) {
......@@ -67,13 +67,13 @@ export default class GroupMemberStore {
fetchContributedMembers() {
return axios
.get(this.memberContributionsPath)
.then(res => res.data)
.then(members => {
.then((res) => res.data)
.then((members) => {
this.setColumns(COLUMNS);
this.setMembers(members);
this.state.isLoading = false;
})
.catch(e => {
.catch((e) => {
this.state.isLoading = false;
Flash(__('Something went wrong while fetching group member contributions'));
throw e;
......
import { parseDataAttributes as CEParseDataAttributes } from '~/groups/members/utils';
export const parseDataAttributes = el => {
export const parseDataAttributes = (el) => {
const { ldapOverridePath } = el.dataset;
return {
......
import validateIpAddress from 'ee/validators/ip_address';
import { __, sprintf } from '~/locale';
export default address => {
export default (address) => {
if (!validateIpAddress(address)) {
return sprintf(__('%{address} is an invalid IP address range'), { address });
}
......
......@@ -46,7 +46,7 @@ export default {
const nodes = data.namespace?.complianceFrameworks?.nodes;
return (
nodes?.map(framework => ({
nodes?.map((framework) => ({
...framework,
parsedId: getIdFromGraphQLId(framework.id),
})) || []
......
......@@ -10,7 +10,7 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
const createComplianceFrameworksListApp = el => {
const createComplianceFrameworksListApp = (el) => {
if (!el) {
return false;
}
......
......@@ -71,7 +71,7 @@ export default {
},
watch: {
selectedTokens(newValue) {
this.$options.hiddenInput.value = newValue.map(token => token.name).join(',');
this.$options.hiddenInput.value = newValue.map((token) => token.name).join(',');
// Dispatch `input` event so form submit button becomes active
this.$options.hiddenInput.dispatchEvent(
......
......@@ -44,11 +44,11 @@ export default {
};
},
hasAllChartsLoaded() {
const requestedChartKeys = this.activePage?.charts?.map(chart => chart.title) || [];
return requestedChartKeys.every(key => this.chartData[key]?.loaded);
const requestedChartKeys = this.activePage?.charts?.map((chart) => chart.title) || [];
return requestedChartKeys.every((key) => this.chartData[key]?.loaded);
},
hasChartsError() {
return Object.values(this.chartData).some(data => data.error);
return Object.values(this.chartData).some((data) => data.error);
},
pageLoading() {
return !this.hasChartsError && !this.hasAllChartsLoaded;
......@@ -71,7 +71,7 @@ export default {
}
}
return Object.keys(configData).map(key => ({
return Object.keys(configData).map((key) => ({
name: configData[key].title,
scope: key,
isActive: this.activeTab === key,
......
......@@ -100,12 +100,12 @@ export default {
methods: {
setSvg(name) {
return getSvgIconPathContent(name)
.then(path => {
.then((path) => {
if (path) {
this.$set(this.svgs, name, `path://${path}`);
}
})
.catch(e => {
.catch((e) => {
// eslint-disable-next-line no-console, @gitlab/require-i18n-strings
console.error('SVG could not be rendered correctly: ', e);
});
......
......@@ -26,7 +26,7 @@ export const fetchConfigData = ({ dispatch }, endpoint) => {
dispatch('receiveConfigError');
}
})
.catch(error => {
.catch((error) => {
dispatch('receiveConfigError', error.response.data.message);
});
};
......@@ -45,7 +45,7 @@ export const fetchChartData = ({ dispatch }, { endpoint, chart }) =>
data,
}),
)
.catch(error => {
.catch((error) => {
let message = `${__('There was an error gathering the chart data')}`;
if (error.response.data && error.response.data.message) {
......
import { CHART_TYPES } from 'ee/insights/constants';
import { __ } from '~/locale';
const getAxisTitle = label => {
const getAxisTitle = (label) => {
switch (label) {
case 'day':
return __('Days');
......@@ -41,7 +41,7 @@ export const transformChartDataForGlCharts = (
break;
case CHART_TYPES.STACKED_BAR:
formattedData.datasets.push(
...datasets.map(dataset => ({
...datasets.map((dataset) => ({
name: dataset.label,
data: dataset.data,
})),
......@@ -49,7 +49,7 @@ export const transformChartDataForGlCharts = (
break;
case CHART_TYPES.LINE:
formattedData.datasets.push(
...datasets.map(dataset => ({
...datasets.map((dataset) => ({
name: dataset.label,
data: labels.map((label, i) => [label, dataset.data[i]]),
})),
......
......@@ -11,7 +11,7 @@ export default {
[types.RECEIVE_CONFIG_SUCCESS](state, data) {
state.configData = pick(
data,
Object.keys(data).filter(key => data[key].title && data[key].charts),
Object.keys(data).filter((key) => data[key].title && data[key].charts),
);
state.configLoading = false;
},
......
......@@ -106,7 +106,7 @@ export default {
search: this.filterParams.search,
},
})
.then(res => {
.then((res) => {
const { headers, data } = res;
this.currentPage = parseInt(headers['x-page'], 10);
this.totalIssues = parseInt(headers['x-total'], 10);
......@@ -126,7 +126,7 @@ export default {
});
this.issuesCount[this.currentState] = this.issues.length;
})
.catch(error => {
.catch((error) => {
this.issuesListLoadFailed = true;
createFlash({
message: __('An error occurred while loading issues'),
......@@ -156,7 +156,7 @@ export default {
const filterParams = {};
const plainText = [];
filters.forEach(filter => {
filters.forEach((filter) => {
if (filter.type === 'filtered-search-term' && filter.value.data) {
plainText.push(filter.value.data);
}
......
......@@ -32,7 +32,7 @@ export default function initJiraIssuesList({ mountPointSelector }) {
initialState,
initialSortBy,
},
render: createElement =>
render: (createElement) =>
createElement(JiraIssuesListApp, {
props: {
initialFilterParams,
......
......@@ -66,7 +66,7 @@ export default {
const data = [];
if (chartHasData()) {
Object.keys(chartData).forEach(key => {
Object.keys(chartData).forEach((key) => {
const date = new Date(key);
const label = `${getMonthNames(true)[date.getUTCMonth()]} ${date.getUTCFullYear()}`;
const val = chartData[key];
......@@ -78,7 +78,7 @@ export default {
return data;
},
chartLabels() {
return this.data.map(val => val[0]);
return this.data.map((val) => val[0]);
},
chartDateRange() {
return `${this.chartLabels[0]} - ${this.chartLabels[this.chartLabels.length - 1]}`;
......@@ -110,7 +110,7 @@ export default {
};
},
series() {
return this.data.map(val => val[1]);
return this.data.map((val) => val[1]);
},
seriesAverage() {
return engineeringNotation(average(...this.series), 0);
......@@ -159,11 +159,11 @@ export default {
return false;
}
return Object.values(this.chartData).some(val => val > 0);
return Object.values(this.chartData).some((val) => val > 0);
},
setSvg(name) {
getSvgIconPathContent(name)
.then(path => {
.then((path) => {
if (path) {
this.$set(this.svgs, name, `path://${path}`);
}
......
......@@ -32,7 +32,7 @@ export default class FilteredSearchIssueAnalytics extends FilteredSearchManager
* Updates issue analytics store and window history
* with filter path
*/
updateObject = path => {
updateObject = (path) => {
historyPushState(path);
const filters = urlParamsToObject(path);
......
......@@ -16,8 +16,8 @@ export const fetchChartData = ({ commit, dispatch, getters }, endpoint) => {
return service
.fetchChartData(endpoint, getters.appliedFilters)
.then(res => res.data)
.then(data => commit(types.SET_CHART_DATA, data))
.then((res) => res.data)
.then((data) => commit(types.SET_CHART_DATA, data))
.then(() => dispatch('setLoadingState', false))
.catch(() => flash(__('An error occurred while loading chart data')));
};
export const hasFilters = state => Object.keys(state.filters).length > 0;
export const appliedFilters = state => state.filters;
export const hasFilters = (state) => Object.keys(state.filters).length > 0;
export const appliedFilters = (state) => state.filters;
......@@ -92,7 +92,7 @@ export default {
type: String,
required: false,
default: Namespace.Group,
validator: value => Object.values(Namespace).includes(value),
validator: (value) => Object.values(Namespace).includes(value),
},
previewMarkdownPath: {
type: String,
......
......@@ -66,7 +66,7 @@ export default {
update(data) {
const { nodes: issues = [], count, pageInfo = {} } = data[this.namespaceType]?.issues || {};
const list = issues.map(issue => ({
const list = issues.map((issue) => ({
...issue,
labels: issue?.labels?.nodes || [],
assignees: issue?.assignees?.nodes || [],
......@@ -96,7 +96,7 @@ export default {
type: String,
required: false,
default: Namespace.Group,
validator: value => Object.values(Namespace).includes(value),
validator: (value) => Object.values(Namespace).includes(value),
},
},
data() {
......
......@@ -31,7 +31,7 @@ export default {
type: String,
required: false,
default: Namespace.Group,
validator: value => Object.values(Namespace).includes(value),
validator: (value) => Object.values(Namespace).includes(value),
},
newIterationPath: {
type: String,
......
......@@ -17,7 +17,7 @@ export default {
type: String,
required: false,
default: Namespace.Group,
validator: value => Object.values(Namespace).includes(value),
validator: (value) => Object.values(Namespace).includes(value),
},
},
methods: {
......
......@@ -26,7 +26,7 @@ export default function initLDAPGroupsSelect() {
minimumInputLength: 1,
query(query) {
const provider = $('#ldap_group_link_provider').val();
return Api.ldapGroups(query.term, provider, groups => {
return Api.ldapGroups(query.term, provider, (groups) => {
const data = {
results: groups,
};
......
......@@ -26,10 +26,10 @@ export const fetchLicenses = ({ state, dispatch }, params = {}) => {
...params,
},
})
.then(response => {
.then((response) => {
dispatch('receiveLicensesSuccess', response);
})
.catch(error => {
.catch((error) => {
dispatch('receiveLicensesError', error);
});
};
......
import { LICENSE_APPROVAL_CLASSIFICATION } from 'ee/vue_shared/license_compliance/constants';
import { REPORT_STATUS } from './constants';
export const isJobSetUp = state => state.reportInfo.status !== REPORT_STATUS.jobNotSetUp;
export const isJobFailed = state =>
export const isJobSetUp = (state) => state.reportInfo.status !== REPORT_STATUS.jobNotSetUp;
export const isJobFailed = (state) =>
[REPORT_STATUS.jobFailed, REPORT_STATUS.noLicenses, REPORT_STATUS.incomplete].includes(
state.reportInfo.status,
);
export const hasPolicyViolations = state => {
export const hasPolicyViolations = (state) => {
return state.licenses.some(
license => license.classification === LICENSE_APPROVAL_CLASSIFICATION.DENIED,
(license) => license.classification === LICENSE_APPROVAL_CLASSIFICATION.DENIED,
);
};
......@@ -2,7 +2,7 @@ import { LICENSE_MANAGEMENT } from 'ee/vue_shared/license_compliance/store/const
import * as licenseMangementMutationTypes from 'ee/vue_shared/license_compliance/store/mutation_types';
import { LICENSE_LIST } from '../constants';
export default store => {
export default (store) => {
store.subscribe(({ type }) => {
switch (type) {
case `${LICENSE_MANAGEMENT}/${licenseMangementMutationTypes.RECEIVE_SET_LICENSE_APPROVAL}`:
......
......@@ -12,7 +12,7 @@ export const getLicenseKey = ({ id }) => {
* Maps an individual license response entity into the license object we'll store in our Vuex state
* @param {Object} license
*/
export const toLicenseObject = license => ({
export const toLicenseObject = (license) => ({
...license,
key: getLicenseKey(license),
});
......@@ -12,4 +12,4 @@ export const getStoreConfig = ({ maintenanceEnabled, bannerMessage }) => ({
state: createState({ maintenanceEnabled, bannerMessage }),
});
export const createStore = config => new Vuex.Store(getStoreConfig(config));
export const createStore = (config) => new Vuex.Store(getStoreConfig(config));
......@@ -70,7 +70,7 @@ export default class MembersEE extends Members {
$toggle.enable();
$dateInput.enable();
})
.catch(xhr => {
.catch((xhr) => {
$btn.enable();
if (xhr.status === 403) {
......
......@@ -19,7 +19,7 @@ export default {
return createElement(CEMembersTableCell, {
props: { member: this.member },
scopedSlots: {
default: props => {
default: (props) => {
return this.$scopedSlots.default({
...props,
permissions: {
......
import createState from '~/members/store/state';
export default initialState => {
export default (initialState) => {
const { ldapOverridePath } = initialState;
return {
......
......@@ -34,4 +34,4 @@ export const generateBadges = (member, isCurrentUser) => [
},
];
export const canOverride = member => member.canOverride;
export const canOverride = (member) => member.canOverride;
......@@ -144,7 +144,7 @@ export default {
return ERROR_MESSAGES[this.errorType] || null;
},
isLoadingProfiles() {
return ['scannerProfiles', 'siteProfiles'].some(name => this.$apollo.queries[name].loading);
return ['scannerProfiles', 'siteProfiles'].some((name) => this.$apollo.queries[name].loading);
},
failedToLoadProfiles() {
return [ERROR_FETCH_SCANNER_PROFILES, ERROR_FETCH_SITE_PROFILES].includes(this.errorType);
......@@ -201,7 +201,7 @@ export default {
}
},
)
.catch(e => {
.catch((e) => {
Sentry.captureException(e);
this.showErrors(ERROR_RUN_SCAN);
this.loading = false;
......
......@@ -26,8 +26,8 @@ export default {
},
computed: {
formattedProfiles() {
return this.profiles.map(profile => {
const addSuffix = str =>
return this.profiles.map((profile) => {
const addSuffix = (str) =>
this.glFeatures.securityOnDemandScansSiteValidation
? `${str} (${SCAN_TYPE_LABEL[profile.scanType]})`
: str;
......
......@@ -27,12 +27,12 @@ export default {
},
computed: {
formattedProfiles() {
return this.profiles.map(profile => {
return this.profiles.map((profile) => {
const isValidated = profile.validationStatus === DAST_SITE_VALIDATION_STATUS.PASSED;
const suffix = isValidated
? s__('DastProfiles|Validated')
: s__('DastProfiles|Not Validated');
const addSuffix = str =>
const addSuffix = (str) =>
this.glFeatures.securityOnDemandScansSiteValidation ? `${str} (${suffix})` : str;
return {
...profile,
......
......@@ -74,7 +74,7 @@ export default {
computed: {
filteredTimezones() {
const lowerCaseTzSearchTerm = this.tzSearchTerm.toLowerCase();
return this.timezones.filter(tz =>
return this.timezones.filter((tz) =>
this.getFormattedTimezone(tz).toLowerCase().includes(lowerCaseTzSearchTerm),
);
},
......
......@@ -128,7 +128,7 @@ export default {
this.$emit('scheduleCreated');
},
)
.catch(error => {
.catch((error) => {
this.error = error;
})
.finally(() => {
......@@ -161,7 +161,7 @@ export default {
this.$refs.addUpdateScheduleModal.hide();
},
)
.catch(error => {
.catch((error) => {
this.error = error;
})
.finally(() => {
......
......@@ -75,7 +75,7 @@ export default {
}
this.$refs.deleteScheduleModal.hide();
})
.catch(error => {
.catch((error) => {
this.error = error;
})
.finally(() => {
......
......@@ -65,7 +65,7 @@ export default {
},
computed: {
offset() {
const selectedTz = this.timezones.find(tz => tz.identifier === this.schedule.timezone);
const selectedTz = this.timezones.find((tz) => tz.identifier === this.schedule.timezone);
return __(`(UTC ${selectedTz.formatted_offset})`);
},
timeframe() {
......
......@@ -154,7 +154,7 @@ export default {
this.$refs.createScheduleModal.hide();
},
)
.catch(error => {
.catch((error) => {
this.error = error;
})
.finally(() => {
......
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