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