Commit 6f0bd2d8 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 33 files - 41 of 73

Part of our prettier migration; changing the arrow-parens style.
parent d53974df
...@@ -5,14 +5,14 @@ import { VULNERABILITY_STATES } from 'ee/vulnerabilities/constants'; ...@@ -5,14 +5,14 @@ import { VULNERABILITY_STATES } from 'ee/vulnerabilities/constants';
import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils';
import { s__, __ } from '~/locale'; import { s__, __ } from '~/locale';
const parseOptions = obj => const parseOptions = (obj) =>
Object.entries(obj).map(([id, name]) => ({ id: id.toUpperCase(), name })); Object.entries(obj).map(([id, name]) => ({ id: id.toUpperCase(), name }));
export const mapProjects = projects => export const mapProjects = (projects) =>
projects.map(p => ({ id: p.id.split('/').pop(), name: p.name })); projects.map((p) => ({ id: p.id.split('/').pop(), name: p.name }));
const stateOptions = parseOptions(VULNERABILITY_STATES); const stateOptions = parseOptions(VULNERABILITY_STATES);
const defaultStateOptions = stateOptions.filter(x => ['DETECTED', 'CONFIRMED'].includes(x.id)); const defaultStateOptions = stateOptions.filter((x) => ['DETECTED', 'CONFIRMED'].includes(x.id));
export const stateFilter = { export const stateFilter = {
name: s__('SecurityReports|Status'), name: s__('SecurityReports|Status'),
...@@ -38,7 +38,7 @@ export const scannerFilter = { ...@@ -38,7 +38,7 @@ export const scannerFilter = {
defaultOptions: [], defaultOptions: [],
}; };
export const getProjectFilter = projects => { export const getProjectFilter = (projects) => {
return { return {
name: s__('SecurityReports|Project'), name: s__('SecurityReports|Project'),
id: 'projectId', id: 'projectId',
...@@ -92,7 +92,7 @@ export const getFormattedSummary = (rawSummary = {}) => { ...@@ -92,7 +92,7 @@ export const getFormattedSummary = (rawSummary = {}) => {
return name ? [name, scanSummary] : null; return name ? [name, scanSummary] : null;
}); });
// Filter out keys that could not be matched with any translation and are thus considered invalid // Filter out keys that could not be matched with any translation and are thus considered invalid
return formattedEntries.filter(entry => entry !== null); return formattedEntries.filter((entry) => entry !== null);
}; };
/** /**
...@@ -103,7 +103,7 @@ export const getFormattedSummary = (rawSummary = {}) => { ...@@ -103,7 +103,7 @@ export const getFormattedSummary = (rawSummary = {}) => {
* @param {Object} pageInfo * @param {Object} pageInfo
* @returns {Object} * @returns {Object}
*/ */
export const preparePageInfo = pageInfo => { export const preparePageInfo = (pageInfo) => {
return { ...pageInfo, hasNextPage: Boolean(pageInfo?.endCursor) }; return { ...pageInfo, hasNextPage: Boolean(pageInfo?.endCursor) };
}; };
......
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import apolloProvider from './graphql/provider'; import apolloProvider from './graphql/provider';
import InstanceSecurityDashboardSettings from './components/first_class_instance_security_dashboard_settings.vue'; import InstanceSecurityDashboardSettings from './components/first_class_instance_security_dashboard_settings.vue';
export default el => { export default (el) => {
if (!el) { if (!el) {
return null; return null;
} }
......
...@@ -7,8 +7,8 @@ import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils'; ...@@ -7,8 +7,8 @@ import { convertObjectPropsToSnakeCase } from '~/lib/utils/common_utils';
export const setFilter = ({ commit }, filter) => { export const setFilter = ({ commit }, filter) => {
// Convert the filter key to snake case and the selected option IDs to lower case. The API // Convert the filter key to snake case and the selected option IDs to lower case. The API
// endpoint needs them to be in this format. // endpoint needs them to be in this format.
const convertedFilter = mapValues(convertObjectPropsToSnakeCase(filter), array => const convertedFilter = mapValues(convertObjectPropsToSnakeCase(filter), (array) =>
array.map(element => element.toLowerCase()), array.map((element) => element.toLowerCase()),
); );
commit(SET_FILTER, convertedFilter); commit(SET_FILTER, convertedFilter);
......
...@@ -29,11 +29,11 @@ export const fetchPipelineJobs = ({ commit, state }) => { ...@@ -29,11 +29,11 @@ export const fetchPipelineJobs = ({ commit, state }) => {
} }
return requestPromise return requestPromise
.then(response => { .then((response) => {
const { data } = response; const { data } = response;
commit(types.RECEIVE_PIPELINE_JOBS_SUCCESS, data); commit(types.RECEIVE_PIPELINE_JOBS_SUCCESS, data);
}) })
.catch(error => { .catch((error) => {
Sentry.captureException(error); Sentry.captureException(error);
commit(types.RECEIVE_PIPELINE_JOBS_ERROR); commit(types.RECEIVE_PIPELINE_JOBS_ERROR);
}); });
......
import { FUZZING_STAGE } from './constants'; import { FUZZING_STAGE } from './constants';
export const hasFuzzingArtifacts = state => { export const hasFuzzingArtifacts = (state) => {
return state.pipelineJobs.some(job => { return state.pipelineJobs.some((job) => {
return job.stage === FUZZING_STAGE && job.artifacts.length > 0; return job.stage === FUZZING_STAGE && job.artifacts.length > 0;
}); });
}; };
export const fuzzingJobsWithArtifact = state => { export const fuzzingJobsWithArtifact = (state) => {
return state.pipelineJobs.filter(job => { return state.pipelineJobs.filter((job) => {
return job.stage === FUZZING_STAGE && job.artifacts.length > 0; return job.stage === FUZZING_STAGE && job.artifacts.length > 0;
}); });
}; };
...@@ -37,9 +37,9 @@ export const addProjects = ({ state, dispatch }) => { ...@@ -37,9 +37,9 @@ export const addProjects = ({ state, dispatch }) => {
return axios return axios
.post(state.projectEndpoints.add, { .post(state.projectEndpoints.add, {
project_ids: state.selectedProjects.map(p => p.id), project_ids: state.selectedProjects.map((p) => p.id),
}) })
.then(response => dispatch('receiveAddProjectsSuccess', response.data)) .then((response) => dispatch('receiveAddProjectsSuccess', response.data))
.catch(() => dispatch('receiveAddProjectsError')) .catch(() => dispatch('receiveAddProjectsError'))
.finally(() => dispatch('clearSearchResults')); .finally(() => dispatch('clearSearchResults'));
}; };
...@@ -55,8 +55,8 @@ export const receiveAddProjectsSuccess = ({ commit, dispatch, state }, data) => ...@@ -55,8 +55,8 @@ export const receiveAddProjectsSuccess = ({ commit, dispatch, state }, data) =>
if (invalid.length) { if (invalid.length) {
const [firstProject, secondProject, ...rest] = state.selectedProjects const [firstProject, secondProject, ...rest] = state.selectedProjects
.filter(project => invalid.includes(project.id)) .filter((project) => invalid.includes(project.id))
.map(project => project.name); .map((project) => project.name);
const translationValues = { const translationValues = {
firstProject, firstProject,
secondProject, secondProject,
...@@ -154,7 +154,7 @@ export const fetchSearchResults = ({ state, dispatch, commit }) => { ...@@ -154,7 +154,7 @@ export const fetchSearchResults = ({ state, dispatch, commit }) => {
} }
return searchProjects(searchQuery) return searchProjects(searchQuery)
.then(payload => commit(types.RECEIVE_SEARCH_RESULTS_SUCCESS, payload)) .then((payload) => commit(types.RECEIVE_SEARCH_RESULTS_SUCCESS, payload))
.catch(() => dispatch('receiveSearchResultsError')); .catch(() => dispatch('receiveSearchResultsError'));
}; };
......
...@@ -9,12 +9,12 @@ export default { ...@@ -9,12 +9,12 @@ export default {
state.searchQuery = query; state.searchQuery = query;
}, },
[types.SELECT_PROJECT](state, project) { [types.SELECT_PROJECT](state, project) {
if (!state.selectedProjects.some(p => p.id === project.id)) { if (!state.selectedProjects.some((p) => p.id === project.id)) {
state.selectedProjects.push(project); state.selectedProjects.push(project);
} }
}, },
[types.DESELECT_PROJECT](state, project) { [types.DESELECT_PROJECT](state, project) {
state.selectedProjects = state.selectedProjects.filter(p => p.id !== project.id); state.selectedProjects = state.selectedProjects.filter((p) => p.id !== project.id);
}, },
[types.REQUEST_ADD_PROJECTS](state) { [types.REQUEST_ADD_PROJECTS](state) {
state.isAddingProjects = true; state.isAddingProjects = true;
......
...@@ -18,7 +18,7 @@ const groupPageInfo = ({ page, nextPage, total, totalPages }) => ({ ...@@ -18,7 +18,7 @@ const groupPageInfo = ({ page, nextPage, total, totalPages }) => ({
* @param {{headers}} res * @param {{headers}} res
* @returns {*} * @returns {*}
*/ */
const getHeaders = res => res.headers; const getHeaders = (res) => res.headers;
/** /**
* Takes an XHR-response object and returns an object containing pagination related * Takes an XHR-response object and returns an object containing pagination related
...@@ -36,6 +36,6 @@ const pageInfo = flow(getHeaders, normalizeHeaders, parseIntPagination, groupPag ...@@ -36,6 +36,6 @@ const pageInfo = flow(getHeaders, normalizeHeaders, parseIntPagination, groupPag
* @param {Object} res * @param {Object} res
* @return {Object} * @return {Object}
*/ */
const addPageInfo = res => (res?.headers ? { ...res, ...pageInfo(res) } : res); const addPageInfo = (res) => (res?.headers ? { ...res, ...pageInfo(res) } : res);
export default addPageInfo; export default addPageInfo;
...@@ -35,7 +35,7 @@ export const fetchProjects = ({ state, dispatch }) => { ...@@ -35,7 +35,7 @@ export const fetchProjects = ({ state, dispatch }) => {
dispatch('requestProjects'); dispatch('requestProjects');
getAllProjects(state.projectsEndpoint) getAllProjects(state.projectsEndpoint)
.then(projects => { .then((projects) => {
dispatch('receiveProjectsSuccess', { projects }); dispatch('receiveProjectsSuccess', { projects });
}) })
.catch(() => { .catch(() => {
......
...@@ -14,7 +14,7 @@ export const fetchUnscannedProjects = ({ dispatch }, endpoint) => { ...@@ -14,7 +14,7 @@ export const fetchUnscannedProjects = ({ dispatch }, endpoint) => {
return axios return axios
.get(endpoint) .get(endpoint)
.then(({ data }) => data.map(convertObjectPropsToCamelCase)) .then(({ data }) => data.map(convertObjectPropsToCamelCase))
.then(data => { .then((data) => {
dispatch('receiveUnscannedProjectsSuccess', data); dispatch('receiveUnscannedProjectsSuccess', data);
}) })
.catch(() => { .catch(() => {
......
...@@ -9,7 +9,7 @@ export const untestedProjectsCount = (state, getters) => getters.untestedProject ...@@ -9,7 +9,7 @@ export const untestedProjectsCount = (state, getters) => getters.untestedProject
export const outdatedProjects = ({ projects }) => export const outdatedProjects = ({ projects }) =>
groupByDateRanges({ groupByDateRanges({
ranges: UNSCANNED_PROJECTS_DATE_RANGES, ranges: UNSCANNED_PROJECTS_DATE_RANGES,
dateFn: x => x.securityTestsLastSuccessfulRun, dateFn: (x) => x.securityTestsLastSuccessfulRun,
projects, projects,
}); });
......
...@@ -6,7 +6,7 @@ import { getDayDifference, isValidDate } from '~/lib/utils/datetime_utility'; ...@@ -6,7 +6,7 @@ import { getDayDifference, isValidDate } from '~/lib/utils/datetime_utility';
* @param daysInPast {number} * @param daysInPast {number}
* @returns {function({fromDay: Number, toDay: Number}): boolean} * @returns {function({fromDay: Number, toDay: Number}): boolean}
*/ */
const isWithinDateRange = daysInPast => ({ fromDay, toDay }) => const isWithinDateRange = (daysInPast) => ({ fromDay, toDay }) =>
daysInPast >= fromDay && daysInPast < toDay; daysInPast >= fromDay && daysInPast < toDay;
/** /**
...@@ -15,7 +15,7 @@ const isWithinDateRange = daysInPast => ({ fromDay, toDay }) => ...@@ -15,7 +15,7 @@ const isWithinDateRange = daysInPast => ({ fromDay, toDay }) =>
* @param ranges {*}[] * @param ranges {*}[]
* @returns {{projects: []}}[] * @returns {{projects: []}}[]
*/ */
const withEmptyProjectsArray = ranges => ranges.map(range => ({ ...range, projects: [] })); const withEmptyProjectsArray = (ranges) => ranges.map((range) => ({ ...range, projects: [] }));
/** /**
* Checks if a given group-object has any projects * Checks if a given group-object has any projects
...@@ -23,7 +23,7 @@ const withEmptyProjectsArray = ranges => ranges.map(range => ({ ...range, projec ...@@ -23,7 +23,7 @@ const withEmptyProjectsArray = ranges => ranges.map(range => ({ ...range, projec
* @param group {{ projects: [] }} * @param group {{ projects: [] }}
* @returns {boolean} * @returns {boolean}
*/ */
const hasProjects = group => group.projects.length > 0; const hasProjects = (group) => group.projects.length > 0;
/** /**
* Takes an array of objects and groups them based on the given ranges * Takes an array of objects and groups them based on the given ranges
......
...@@ -47,11 +47,11 @@ export const fetchVulnerabilities = ({ state, dispatch }, params = {}) => { ...@@ -47,11 +47,11 @@ export const fetchVulnerabilities = ({ state, dispatch }, params = {}) => {
url: state.vulnerabilitiesEndpoint, url: state.vulnerabilitiesEndpoint,
params, params,
}) })
.then(response => { .then((response) => {
const { headers, data } = response; const { headers, data } = response;
dispatch('receiveVulnerabilitiesSuccess', { headers, data }); dispatch('receiveVulnerabilitiesSuccess', { headers, data });
}) })
.catch(error => { .catch((error) => {
dispatch('receiveVulnerabilitiesError', error?.response?.status); dispatch('receiveVulnerabilitiesError', error?.response?.status);
}); });
}; };
...@@ -65,7 +65,7 @@ export const receiveVulnerabilitiesSuccess = ({ commit }, { headers, data }) => ...@@ -65,7 +65,7 @@ export const receiveVulnerabilitiesSuccess = ({ commit }, { headers, data }) =>
const pageInfo = parseIntPagination(normalizedHeaders); const pageInfo = parseIntPagination(normalizedHeaders);
// Vulnerabilities on pipelines don't have IDs. // Vulnerabilities on pipelines don't have IDs.
// We need to add dummy IDs here to avoid rendering issues. // We need to add dummy IDs here to avoid rendering issues.
const vulnerabilities = data.map(vulnerability => ({ const vulnerabilities = data.map((vulnerability) => ({
...vulnerability, ...vulnerability,
id: vulnerability.id || _.uniqueId('client_'), id: vulnerability.id || _.uniqueId('client_'),
})); }));
...@@ -147,7 +147,7 @@ export const dismissSelectedVulnerabilities = ({ dispatch, state }, { comment } ...@@ -147,7 +147,7 @@ export const dismissSelectedVulnerabilities = ({ dispatch, state }, { comment }
dispatch('requestDismissSelectedVulnerabilities'); dispatch('requestDismissSelectedVulnerabilities');
const promises = dismissableVulnerabilties.map(vulnerability => const promises = dismissableVulnerabilties.map((vulnerability) =>
axios.post(vulnerability.create_vulnerability_feedback_dismissal_path, { axios.post(vulnerability.create_vulnerability_feedback_dismissal_path, {
vulnerability_feedback: { vulnerability_feedback: {
category: vulnerability.report_type, category: vulnerability.report_type,
......
import { LOADING_VULNERABILITIES_ERROR_CODES } from './constants'; import { LOADING_VULNERABILITIES_ERROR_CODES } from './constants';
export const dashboardError = state => export const dashboardError = (state) =>
state.errorLoadingVulnerabilities && state.errorLoadingVulnerabilitiesCount; state.errorLoadingVulnerabilities && state.errorLoadingVulnerabilitiesCount;
export const dashboardListError = state => export const dashboardListError = (state) =>
state.errorLoadingVulnerabilities && !state.errorLoadingVulnerabilitiesCount; state.errorLoadingVulnerabilities && !state.errorLoadingVulnerabilitiesCount;
export const dashboardCountError = state => export const dashboardCountError = (state) =>
!state.errorLoadingVulnerabilities && state.errorLoadingVulnerabilitiesCount; !state.errorLoadingVulnerabilities && state.errorLoadingVulnerabilitiesCount;
export const loadingVulnerabilitiesFailedWithRecognizedErrorCode = state => export const loadingVulnerabilitiesFailedWithRecognizedErrorCode = (state) =>
state.errorLoadingVulnerabilities && state.errorLoadingVulnerabilities &&
Object.values(LOADING_VULNERABILITIES_ERROR_CODES).includes( Object.values(LOADING_VULNERABILITIES_ERROR_CODES).includes(
state.loadingVulnerabilitiesErrorCode, state.loadingVulnerabilitiesErrorCode,
); );
export const selectedVulnerabilitiesCount = state => export const selectedVulnerabilitiesCount = (state) =>
Object.keys(state.selectedVulnerabilities).length; Object.keys(state.selectedVulnerabilities).length;
export const isSelectingVulnerabilities = (state, getters) => export const isSelectingVulnerabilities = (state, getters) =>
......
...@@ -76,7 +76,7 @@ export default { ...@@ -76,7 +76,7 @@ export default {
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS](state, payload) { [types.RECEIVE_DISMISS_VULNERABILITY_SUCCESS](state, payload) {
const vulnerability = state.vulnerabilities.find(vuln => const vulnerability = state.vulnerabilities.find((vuln) =>
isSameVulnerability(vuln, payload.vulnerability), isSameVulnerability(vuln, payload.vulnerability),
); );
vulnerability.dismissal_feedback = payload.data; vulnerability.dismissal_feedback = payload.data;
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_ADD_DISMISSAL_COMMENT_SUCCESS](state, payload) { [types.RECEIVE_ADD_DISMISSAL_COMMENT_SUCCESS](state, payload) {
const vulnerability = state.vulnerabilities.find(vuln => const vulnerability = state.vulnerabilities.find((vuln) =>
isSameVulnerability(vuln, payload.vulnerability), isSameVulnerability(vuln, payload.vulnerability),
); );
if (vulnerability) { if (vulnerability) {
...@@ -143,7 +143,7 @@ export default { ...@@ -143,7 +143,7 @@ export default {
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_DELETE_DISMISSAL_COMMENT_SUCCESS](state, payload) { [types.RECEIVE_DELETE_DISMISSAL_COMMENT_SUCCESS](state, payload) {
const vulnerability = state.vulnerabilities.find(vuln => vuln.id === payload.id); const vulnerability = state.vulnerabilities.find((vuln) => vuln.id === payload.id);
if (vulnerability) { if (vulnerability) {
vulnerability.dismissal_feedback = payload.data; vulnerability.dismissal_feedback = payload.data;
state.isDismissingVulnerability = false; state.isDismissingVulnerability = false;
...@@ -159,7 +159,7 @@ export default { ...@@ -159,7 +159,7 @@ export default {
Vue.set(state.modal, 'error', null); Vue.set(state.modal, 'error', null);
}, },
[types.RECEIVE_REVERT_DISMISSAL_SUCCESS](state, payload) { [types.RECEIVE_REVERT_DISMISSAL_SUCCESS](state, payload) {
const vulnerability = state.vulnerabilities.find(vuln => const vulnerability = state.vulnerabilities.find((vuln) =>
isSameVulnerability(vuln, payload.vulnerability), isSameVulnerability(vuln, payload.vulnerability),
); );
vulnerability.dismissal_feedback = null; vulnerability.dismissal_feedback = null;
......
import { isEqual } from 'lodash'; import { isEqual } from 'lodash';
const isVulnerabilityLike = object => const isVulnerabilityLike = (object) =>
Boolean(object && object.location && object.identifiers && object.identifiers[0]); Boolean(object && object.location && object.identifiers && object.identifiers[0]);
/** /**
......
...@@ -15,7 +15,7 @@ export const fetchProjects = ({ dispatch }, endpoint) => { ...@@ -15,7 +15,7 @@ export const fetchProjects = ({ dispatch }, endpoint) => {
return axios return axios
.get(endpoint) .get(endpoint)
.then(({ data }) => data.map(convertObjectPropsToCamelCase)) .then(({ data }) => data.map(convertObjectPropsToCamelCase))
.then(data => { .then((data) => {
dispatch('receiveProjectsSuccess', data); dispatch('receiveProjectsSuccess', data);
}) })
.catch(() => { .catch(() => {
......
...@@ -8,7 +8,7 @@ export const severityGroups = ({ projects }) => { ...@@ -8,7 +8,7 @@ export const severityGroups = ({ projects }) => {
); );
// return an array of severity groups, each containing an array of projects match the groups criteria // return an array of severity groups, each containing an array of projects match the groups criteria
return SEVERITY_GROUPS.map(severityGroup => ({ return SEVERITY_GROUPS.map((severityGroup) => ({
...severityGroup, ...severityGroup,
projects: projectsForSeverityGroup(projectsWithSeverityInformation, severityGroup), projects: projectsForSeverityGroup(projectsWithSeverityInformation, severityGroup),
})); }));
......
...@@ -16,7 +16,7 @@ export const vulnerabilityCount = (project, severityLevel) => ...@@ -16,7 +16,7 @@ export const vulnerabilityCount = (project, severityLevel) =>
* @param project * @param project
* @returns {function(*=): boolean} * @returns {function(*=): boolean}
*/ */
export const hasVulnerabilityWithSeverityLevel = project => severityLevel => export const hasVulnerabilityWithSeverityLevel = (project) => (severityLevel) =>
vulnerabilityCount(project, severityLevel) > 0; vulnerabilityCount(project, severityLevel) > 0;
/** /**
...@@ -45,7 +45,7 @@ export const mostSevereVulnerability = (severityLevelsOrderedBySeverity, project ...@@ -45,7 +45,7 @@ export const mostSevereVulnerability = (severityLevelsOrderedBySeverity, project
* @param severityLevelsInOrder * @param severityLevelsInOrder
* @returns {function(*=): {mostSevereVulnerability: *}} * @returns {function(*=): {mostSevereVulnerability: *}}
*/ */
export const addMostSevereVulnerabilityInformation = severityLevelsInOrder => project => ({ export const addMostSevereVulnerabilityInformation = (severityLevelsInOrder) => (project) => ({
...project, ...project,
mostSevereVulnerability: mostSevereVulnerability(severityLevelsInOrder, project), mostSevereVulnerability: mostSevereVulnerability(severityLevelsInOrder, project),
}); });
......
...@@ -2,8 +2,8 @@ import { SET_FILTER, SET_HIDE_DISMISSED } from '../modules/filters/mutation_type ...@@ -2,8 +2,8 @@ import { SET_FILTER, SET_HIDE_DISMISSED } from '../modules/filters/mutation_type
const refreshTypes = [`filters/${SET_FILTER}`, `filters/${SET_HIDE_DISMISSED}`]; const refreshTypes = [`filters/${SET_FILTER}`, `filters/${SET_HIDE_DISMISSED}`];
export default store => { export default (store) => {
const refreshVulnerabilities = payload => { const refreshVulnerabilities = (payload) => {
store.dispatch('vulnerabilities/fetchVulnerabilities', payload); store.dispatch('vulnerabilities/fetchVulnerabilities', payload);
}; };
......
...@@ -7,8 +7,8 @@ import { s__, sprintf } from '~/locale'; ...@@ -7,8 +7,8 @@ import { s__, sprintf } from '~/locale';
* @param {Array} invalidProjects all the projects that failed to be added * @param {Array} invalidProjects all the projects that failed to be added
* @returns {String} the invalid projects formated in a user-friendly way * @returns {String} the invalid projects formated in a user-friendly way
*/ */
export const createInvalidProjectMessage = invalidProjects => { export const createInvalidProjectMessage = (invalidProjects) => {
const [firstProject, secondProject, ...rest] = invalidProjects.map(project => project.name); const [firstProject, secondProject, ...rest] = invalidProjects.map((project) => project.name);
const translationValues = { const translationValues = {
firstProject, firstProject,
secondProject, secondProject,
......
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
return { return {
isDropdownShowing: false, isDropdownShowing: false,
selectedStatus: this.status, selectedStatus: this.status,
statusOptions: Object.keys(healthStatusTextMap).map(key => ({ statusOptions: Object.keys(healthStatusTextMap).map((key) => ({
key, key,
value: healthStatusTextMap[key], value: healthStatusTextMap[key],
})), })),
......
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
return { return {
isDropdownShowing: false, isDropdownShowing: false,
selectedStatus: this.status, selectedStatus: this.status,
statusOptions: Object.keys(healthStatusTextMap).map(key => ({ statusOptions: Object.keys(healthStatusTextMap).map((key) => ({
key, key,
value: healthStatusTextMap[key], value: healthStatusTextMap[key],
})), })),
......
...@@ -12,7 +12,7 @@ import { store } from '~/notes/stores'; ...@@ -12,7 +12,7 @@ import { store } from '~/notes/stores';
Vue.use(VueApollo); Vue.use(VueApollo);
const mountWeightComponent = mediator => { const mountWeightComponent = (mediator) => {
const el = document.querySelector('.js-sidebar-weight-entry-point'); const el = document.querySelector('.js-sidebar-weight-entry-point');
if (!el) return false; if (!el) return false;
...@@ -22,7 +22,7 @@ const mountWeightComponent = mediator => { ...@@ -22,7 +22,7 @@ const mountWeightComponent = mediator => {
components: { components: {
SidebarWeight, SidebarWeight,
}, },
render: createElement => render: (createElement) =>
createElement('sidebar-weight', { createElement('sidebar-weight', {
props: { props: {
mediator, mediator,
...@@ -31,7 +31,7 @@ const mountWeightComponent = mediator => { ...@@ -31,7 +31,7 @@ const mountWeightComponent = mediator => {
}); });
}; };
const mountStatusComponent = mediator => { const mountStatusComponent = (mediator) => {
const el = document.querySelector('.js-sidebar-status-entry-point'); const el = document.querySelector('.js-sidebar-status-entry-point');
if (!el) { if (!el) {
...@@ -44,7 +44,7 @@ const mountStatusComponent = mediator => { ...@@ -44,7 +44,7 @@ const mountStatusComponent = mediator => {
components: { components: {
SidebarStatus, SidebarStatus,
}, },
render: createElement => render: (createElement) =>
createElement('sidebar-status', { createElement('sidebar-status', {
props: { props: {
mediator, mediator,
...@@ -66,7 +66,7 @@ const mountEpicsSelect = () => { ...@@ -66,7 +66,7 @@ const mountEpicsSelect = () => {
components: { components: {
SidebarItemEpicsSelect, SidebarItemEpicsSelect,
}, },
render: createElement => render: (createElement) =>
createElement('sidebar-item-epics-select', { createElement('sidebar-item-epics-select', {
props: { props: {
sidebarStore, sidebarStore,
...@@ -97,7 +97,7 @@ function mountIterationSelect() { ...@@ -97,7 +97,7 @@ function mountIterationSelect() {
components: { components: {
IterationSelect, IterationSelect,
}, },
render: createElement => render: (createElement) =>
createElement('iteration-select', { createElement('iteration-select', {
props: { props: {
groupPath, groupPath,
......
...@@ -23,7 +23,7 @@ export default class SidebarMediator extends CESidebarMediator { ...@@ -23,7 +23,7 @@ export default class SidebarMediator extends CESidebarMediator {
this.store.setWeight(data.weight); this.store.setWeight(data.weight);
this.store.setLoadingState('weight', false); this.store.setLoadingState('weight', false);
}) })
.catch(err => { .catch((err) => {
this.store.setLoadingState('weight', false); this.store.setLoadingState('weight', false);
throw err; throw err;
}); });
...@@ -39,7 +39,7 @@ export default class SidebarMediator extends CESidebarMediator { ...@@ -39,7 +39,7 @@ export default class SidebarMediator extends CESidebarMediator {
} }
this.store.setStatus(data?.updateIssue?.issue?.healthStatus); this.store.setStatus(data?.updateIssue?.issue?.healthStatus);
}) })
.catch(error => { .catch((error) => {
throw error; throw error;
}) })
.finally(() => this.store.setFetchingState('status', false)); .finally(() => this.store.setFetchingState('status', false));
......
...@@ -34,7 +34,7 @@ export const updateStatusPageSettings = ({ state, dispatch, commit }) => { ...@@ -34,7 +34,7 @@ export const updateStatusPageSettings = ({ state, dispatch, commit }) => {
}, },
}) })
.then(() => dispatch('receiveStatusPageSettingsUpdateSuccess')) .then(() => dispatch('receiveStatusPageSettingsUpdateSuccess'))
.catch(error => dispatch('receiveStatusPageSettingsUpdateError', error)) .catch((error) => dispatch('receiveStatusPageSettingsUpdateError', error))
.finally(() => commit(mutationTypes.LOADING, false)); .finally(() => commit(mutationTypes.LOADING, false));
}; };
......
...@@ -6,7 +6,7 @@ import mutations from './mutations'; ...@@ -6,7 +6,7 @@ import mutations from './mutations';
Vue.use(Vuex); Vue.use(Vuex);
export default initialState => export default (initialState) =>
new Vuex.Store({ new Vuex.Store({
state: createState(initialState), state: createState(initialState),
actions, actions,
......
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
<gl-search-box-by-type <gl-search-box-by-type
:placeholder="__('Search by name')" :placeholder="__('Search by name')"
:debounce="$options.searchDebounceValue" :debounce="$options.searchDebounceValue"
@input="input => this.$emit('search', input)" @input="(input) => this.$emit('search', input)"
/> />
</div> </div>
</template> </template>
......
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
size: uploadsSize, size: uploadsSize,
}, },
] ]
.filter(data => data.size !== 0) .filter((data) => data.size !== 0)
.sort((a, b) => b.size - a.size); .sort((a, b) => b.size - a.size);
}, },
}, },
......
...@@ -5,7 +5,7 @@ import { STORAGE_USAGE_THRESHOLDS } from './constants'; ...@@ -5,7 +5,7 @@ import { STORAGE_USAGE_THRESHOLDS } from './constants';
export function usageRatioToThresholdLevel(currentUsageRatio) { export function usageRatioToThresholdLevel(currentUsageRatio) {
let currentLevel = Object.keys(STORAGE_USAGE_THRESHOLDS)[0]; let currentLevel = Object.keys(STORAGE_USAGE_THRESHOLDS)[0];
Object.keys(STORAGE_USAGE_THRESHOLDS).forEach(thresholdLevel => { Object.keys(STORAGE_USAGE_THRESHOLDS).forEach((thresholdLevel) => {
if (currentUsageRatio >= STORAGE_USAGE_THRESHOLDS[thresholdLevel]) if (currentUsageRatio >= STORAGE_USAGE_THRESHOLDS[thresholdLevel])
currentLevel = thresholdLevel; currentLevel = thresholdLevel;
}); });
...@@ -23,7 +23,7 @@ export function usageRatioToThresholdLevel(currentUsageRatio) { ...@@ -23,7 +23,7 @@ export function usageRatioToThresholdLevel(currentUsageRatio) {
* @param {Number} size size in bytes * @param {Number} size size in bytes
* @returns {String} * @returns {String}
*/ */
export const formatUsageSize = size => { export const formatUsageSize = (size) => {
const formatDecimalBytes = getFormatter(SUPPORTED_FORMATS.kibibytes); const formatDecimalBytes = getFormatter(SUPPORTED_FORMATS.kibibytes);
return formatDecimalBytes(bytesToKiB(size), 1); return formatDecimalBytes(bytesToKiB(size), 1);
}; };
...@@ -86,7 +86,7 @@ export const parseProjects = ({ ...@@ -86,7 +86,7 @@ export const parseProjects = ({
additionalPurchasedStorageSize - totalRepositorySizeExcess, additionalPurchasedStorageSize - totalRepositorySizeExcess,
); );
return projects.nodes.map(project => return projects.nodes.map((project) =>
calculateUsedAndRemStorage(project, purchasedStorageRemaining), calculateUsedAndRemStorage(project, purchasedStorageRemaining),
); );
}; };
...@@ -103,7 +103,7 @@ export const parseProjects = ({ ...@@ -103,7 +103,7 @@ export const parseProjects = ({
* @param {Object} data graphql result * @param {Object} data graphql result
* @returns {Object} * @returns {Object}
*/ */
export const parseGetStorageResults = data => { export const parseGetStorageResults = (data) => {
const { const {
namespace: { namespace: {
projects, projects,
......
...@@ -49,7 +49,7 @@ export const fetchCountries = ({ dispatch }) => ...@@ -49,7 +49,7 @@ export const fetchCountries = ({ dispatch }) =>
.catch(() => dispatch('fetchCountriesError')); .catch(() => dispatch('fetchCountriesError'));
export const fetchCountriesSuccess = ({ commit }, data = []) => { export const fetchCountriesSuccess = ({ commit }, data = []) => {
const countries = data.map(country => ({ text: country[0], value: country[1] })); const countries = data.map((country) => ({ text: country[0], value: country[1] }));
commit(types.UPDATE_COUNTRY_OPTIONS, countries); commit(types.UPDATE_COUNTRY_OPTIONS, countries);
}; };
...@@ -71,7 +71,7 @@ export const fetchStates = ({ state, dispatch }) => { ...@@ -71,7 +71,7 @@ export const fetchStates = ({ state, dispatch }) => {
}; };
export const fetchStatesSuccess = ({ commit }, data = {}) => { export const fetchStatesSuccess = ({ commit }, data = {}) => {
const states = Object.keys(data).map(state => ({ text: state, value: data[state] })); const states = Object.keys(data).map((state) => ({ text: state, value: data[state] }));
commit(types.UPDATE_STATE_OPTIONS, states); commit(types.UPDATE_STATE_OPTIONS, states);
}; };
......
import { STEPS, NEW_GROUP } from '../constants'; import { STEPS, NEW_GROUP } from '../constants';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
export const currentStep = state => state.currentStep; export const currentStep = (state) => state.currentStep;
export const stepIndex = () => step => STEPS.findIndex(el => el === step); export const stepIndex = () => (step) => STEPS.findIndex((el) => el === step);
export const currentStepIndex = (state, getters) => getters.stepIndex(state.currentStep); export const currentStepIndex = (state, getters) => getters.stepIndex(state.currentStep);
...@@ -12,8 +12,8 @@ export const selectedPlanText = (state, getters) => getters.selectedPlanDetails. ...@@ -12,8 +12,8 @@ export const selectedPlanText = (state, getters) => getters.selectedPlanDetails.
export const selectedPlanPrice = (state, getters) => export const selectedPlanPrice = (state, getters) =>
getters.selectedPlanDetails.pricePerUserPerYear; getters.selectedPlanDetails.pricePerUserPerYear;
export const selectedPlanDetails = state => export const selectedPlanDetails = (state) =>
state.availablePlans.find(plan => plan.value === state.selectedPlan); state.availablePlans.find((plan) => plan.value === state.selectedPlan);
export const confirmOrderParams = (state, getters) => ({ export const confirmOrderParams = (state, getters) => ({
setup_for_company: state.isSetupForCompany, setup_for_company: state.isSetupForCompany,
...@@ -35,7 +35,7 @@ export const confirmOrderParams = (state, getters) => ({ ...@@ -35,7 +35,7 @@ export const confirmOrderParams = (state, getters) => ({
}, },
}); });
export const endDate = state => export const endDate = (state) =>
new Date(state.startDate).setFullYear(state.startDate.getFullYear() + 1); new Date(state.startDate).setFullYear(state.startDate.getFullYear() + 1);
export const totalExVat = (state, getters) => state.numberOfUsers * getters.selectedPlanPrice; export const totalExVat = (state, getters) => state.numberOfUsers * getters.selectedPlanPrice;
...@@ -56,14 +56,14 @@ export const name = (state, getters) => { ...@@ -56,14 +56,14 @@ export const name = (state, getters) => {
return state.fullName; return state.fullName;
}; };
export const usersPresent = state => state.numberOfUsers > 0; export const usersPresent = (state) => state.numberOfUsers > 0;
export const isGroupSelected = state => export const isGroupSelected = (state) =>
state.selectedGroup !== null && state.selectedGroup !== NEW_GROUP; state.selectedGroup !== null && state.selectedGroup !== NEW_GROUP;
export const isSelectedGroupPresent = (state, getters) => { export const isSelectedGroupPresent = (state, getters) => {
return ( return (
getters.isGroupSelected && state.groupData.some(group => group.value === state.selectedGroup) getters.isGroupSelected && state.groupData.some((group) => group.value === state.selectedGroup)
); );
}; };
...@@ -71,7 +71,7 @@ export const selectedGroupUsers = (state, getters) => { ...@@ -71,7 +71,7 @@ export const selectedGroupUsers = (state, getters) => {
if (!getters.isGroupSelected) { if (!getters.isGroupSelected) {
return 1; return 1;
} else if (getters.isSelectedGroupPresent) { } else if (getters.isSelectedGroupPresent) {
return state.groupData.find(group => group.value === state.selectedGroup).numberOfUsers; return state.groupData.find((group) => group.value === state.selectedGroup).numberOfUsers;
} }
return null; return null;
...@@ -79,7 +79,7 @@ export const selectedGroupUsers = (state, getters) => { ...@@ -79,7 +79,7 @@ export const selectedGroupUsers = (state, getters) => {
export const selectedGroupName = (state, getters) => { export const selectedGroupName = (state, getters) => {
if (!getters.isGroupSelected) return null; if (!getters.isGroupSelected) return null;
return state.groupData.find(group => group.value === state.selectedGroup).text; return state.groupData.find((group) => group.value === state.selectedGroup).text;
}; };
export const selectedGroupId = (state, getters) => export const selectedGroupId = (state, getters) =>
......
...@@ -2,22 +2,22 @@ import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; ...@@ -2,22 +2,22 @@ import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import { STEPS, TAX_RATE } from '../constants'; import { STEPS, TAX_RATE } from '../constants';
const parsePlanData = planData => const parsePlanData = (planData) =>
JSON.parse(planData).map(plan => ({ JSON.parse(planData).map((plan) => ({
value: plan.id, value: plan.id,
text: capitalizeFirstCharacter(plan.code), text: capitalizeFirstCharacter(plan.code),
pricePerUserPerYear: plan.price_per_year, pricePerUserPerYear: plan.price_per_year,
})); }));
const parseGroupData = groupData => const parseGroupData = (groupData) =>
JSON.parse(groupData).map(group => ({ JSON.parse(groupData).map((group) => ({
value: group.id, value: group.id,
text: group.name, text: group.name,
numberOfUsers: group.users, numberOfUsers: group.users,
})); }));
const determineSelectedPlan = (planId, plans) => { const determineSelectedPlan = (planId, plans) => {
if (planId && plans.find(plan => plan.value === planId)) { if (planId && plans.find((plan) => plan.value === planId)) {
return planId; return planId;
} }
return plans[0] && plans[0].value; return plans[0] && plans[0].value;
...@@ -28,7 +28,7 @@ const determineNumberOfUsers = (groupId, groups) => { ...@@ -28,7 +28,7 @@ const determineNumberOfUsers = (groupId, groups) => {
return 1; return 1;
} }
const chosenGroup = groups.find(group => group.value === groupId); const chosenGroup = groups.find((group) => group.value === groupId);
if (chosenGroup?.numberOfUsers > 1) { if (chosenGroup?.numberOfUsers > 1) {
return chosenGroup.numberOfUsers; return chosenGroup.numberOfUsers;
......
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