Commit 2a753263 authored by Mike Greiling's avatar Mike Greiling

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

Format files with prettier arrowParens [6/15]

See merge request gitlab-org/gitlab!50532
parents 9a5c0155 bcbbcb2e
......@@ -9,7 +9,7 @@ export default class PerformanceBarService {
}
static registerInterceptor(peekUrl, callback) {
PerformanceBarService.interceptor = response => {
PerformanceBarService.interceptor = (response) => {
const [fireCallback, requestId, requestUrl] = PerformanceBarService.callbackParams(
response,
peekUrl,
......
......@@ -20,7 +20,7 @@ export default class PerformanceBarStore {
}
findRequest(requestId) {
return this.requests.find(request => request.id === requestId);
return this.requests.find((request) => request.id === requestId);
}
addRequestDetails(requestId, requestDetails) {
......@@ -43,13 +43,13 @@ export default class PerformanceBarStore {
}
requestsWithDetails() {
return this.requests.filter(request => request.details);
return this.requests.filter((request) => request.details);
}
canTrackRequest(requestUrl) {
return (
requestUrl.endsWith('/api/graphql') ||
this.requests.filter(request => request.url === requestUrl).length < 2
this.requests.filter((request) => request.url === requestUrl).length < 2
);
}
......
......@@ -28,10 +28,10 @@ export default class PersistentUserCallout {
}
handleCloseButtonCallout(closeButton) {
closeButton.addEventListener('click', event => this.dismiss(event));
closeButton.addEventListener('click', (event) => this.dismiss(event));
if (this.deferLinks) {
this.container.addEventListener('click', event => {
this.container.addEventListener('click', (event) => {
const isDeferredLink = event.target.classList.contains(DEFERRED_LINK_CLASS);
if (isDeferredLink) {
const { href, target } = event.target;
......@@ -43,7 +43,7 @@ export default class PersistentUserCallout {
}
handleFollowLinkCallout(followLink) {
followLink.addEventListener('click', event => this.registerCalloutWithLink(event));
followLink.addEventListener('click', (event) => this.registerCalloutWithLink(event));
}
dismiss(event, deferredLinkOptions = null) {
......
......@@ -11,7 +11,7 @@ const PERSISTENT_USER_CALLOUTS = [
];
const initCallouts = () => {
PERSISTENT_USER_CALLOUTS.forEach(calloutContainer =>
PERSISTENT_USER_CALLOUTS.forEach((calloutContainer) =>
PersistentUserCallout.factory(document.querySelector(calloutContainer)),
);
};
......
......@@ -18,7 +18,7 @@ export const resolvers = {
valid: data.valid,
errors: data.errors,
warnings: data.warnings,
jobs: data.jobs.map(job => {
jobs: data.jobs.map((job) => {
const only = job.only ? { refs: job.only.refs, __typename: 'CiLintJobOnlyPolicy' } : null;
return {
......
......@@ -121,12 +121,12 @@ export default {
return this.searchTerm.toLowerCase();
},
filteredBranches() {
return this.branches.filter(branch =>
return this.branches.filter((branch) =>
branch.shortName.toLowerCase().includes(this.lowerCasedSearchTerm),
);
},
filteredTags() {
return this.tags.filter(tag =>
return this.tags.filter((tag) =>
tag.shortName.toLowerCase().includes(this.lowerCasedSearchTerm),
);
},
......@@ -187,7 +187,7 @@ export default {
setVariable(refValue, type, key, value) {
const { variables } = this.form[refValue];
const variable = variables.find(v => v.key === key);
const variable = variables.find((v) => v.key === key);
if (variable) {
variable.type = type;
variable.value = value;
......@@ -270,11 +270,11 @@ export default {
stop(data);
}
})
.catch(error => {
.catch((error) => {
stop(error);
});
}, CONFIG_VARIABLES_TIMEOUT)
.then(data => {
.then((data) => {
const params = {};
const descriptions = {};
......@@ -287,7 +287,7 @@ export default {
return { params, descriptions };
})
.catch(error => {
.catch((error) => {
this.isLoading = false;
Sentry.captureException(error);
......@@ -314,7 +314,7 @@ export default {
.then(({ data }) => {
redirectTo(`${this.pipelinesPath}/${data.id}`);
})
.catch(err => {
.catch((err) => {
const { errors, warnings, total_warnings: totalWarnings } = err.response.data;
const [error] = errors;
this.error = error;
......
......@@ -3,7 +3,7 @@ import { BRANCH_REF_TYPE, TAG_REF_TYPE } from '../constants';
export default (refs, type) => {
let fullName;
return refs.map(ref => {
return refs.map((ref) => {
if (type === BRANCH_REF_TYPE) {
fullName = `refs/heads/${ref}`;
} else if (type === TAG_REF_TYPE) {
......
......@@ -56,15 +56,15 @@ export default {
const unwrappedGroups = stages
.map(({ name, groups: { nodes: groups } }) => {
return groups.map(group => {
return groups.map((group) => {
return { category: name, ...group };
});
})
.flat(2);
const nodes = unwrappedGroups.map(group => {
const nodes = unwrappedGroups.map((group) => {
const jobs = group.jobs.nodes.map(({ name, needs }) => {
return { name, needs: needs.nodes.map(need => need.name) };
return { name, needs: needs.nodes.map((need) => need.name) };
});
return { ...group, jobs };
......
......@@ -173,7 +173,7 @@ export default {
createClip(link) {
return link
.append('clipPath')
.attr('id', d => {
.attr('id', (d) => {
return this.createAndAssignId(d, 'clipId', 'dag-clip');
})
.append('path')
......@@ -183,7 +183,7 @@ export default {
createGradient(link) {
const gradient = link
.append('linearGradient')
.attr('id', d => {
.attr('id', (d) => {
return this.createAndAssignId(d, 'gradId', 'dag-grad');
})
.attr('gradientUnits', 'userSpaceOnUse')
......@@ -251,7 +251,7 @@ export default {
.data(linksData)
.enter()
.append('g')
.attr('id', d => {
.attr('id', (d) => {
return this.createAndAssignId(d, 'uid', LINK_SELECTOR);
})
.classed(
......@@ -273,10 +273,10 @@ export default {
`${NODE_SELECTOR} gl-transition-property-stroke ${this.$options.viewOptions.hoverFadeClasses}`,
true,
)
.attr('id', d => {
.attr('id', (d) => {
return this.createAndAssignId(d, 'uid', NODE_SELECTOR);
})
.attr('stroke', d => {
.attr('stroke', (d) => {
const color = this.color(d);
/* eslint-disable-next-line no-param-reassign */
d.color = color;
......@@ -284,10 +284,10 @@ export default {
})
.attr('stroke-width', nodeWidth)
.attr('stroke-linecap', 'round')
.attr('x1', d => Math.floor((d.x1 + d.x0) / 2))
.attr('x2', d => Math.floor((d.x1 + d.x0) / 2))
.attr('y1', d => d.y0 + 4)
.attr('y2', d => d.y1 - 4);
.attr('x1', (d) => Math.floor((d.x1 + d.x0) / 2))
.attr('x2', (d) => Math.floor((d.x1 + d.x0) / 2))
.attr('y1', (d) => d.y0 + 4)
.attr('y2', (d) => d.y1 - 4);
},
initColors() {
......
......@@ -92,8 +92,8 @@ export const createSankey = ({
]);
return ({ nodes, links }) =>
sankeyGenerator({
nodes: nodes.map(d => ({ ...d })),
links: links.map(d => ({ ...d })),
nodes: nodes.map((d) => ({ ...d })),
links: links.map((d) => ({ ...d })),
});
};
......
......@@ -13,22 +13,22 @@ export const getLiveLinksAsDict = () => {
return Object.fromEntries(
getLiveLinks()
.data()
.map(d => [d.uid, d]),
.map((d) => [d.uid, d]),
);
};
export const currentIsLive = (idx, collection) =>
getCurrent(idx, collection).classed(IS_HIGHLIGHTED);
const backgroundLinks = selection => selection.style('stroke-opacity', highlightOut);
const backgroundNodes = selection => selection.attr('stroke', '#f2f2f2');
const foregroundLinks = selection => selection.style('stroke-opacity', highlightIn);
const foregroundNodes = selection => selection.attr('stroke', d => d.color);
const backgroundLinks = (selection) => selection.style('stroke-opacity', highlightOut);
const backgroundNodes = (selection) => selection.attr('stroke', '#f2f2f2');
const foregroundLinks = (selection) => selection.style('stroke-opacity', highlightIn);
const foregroundNodes = (selection) => selection.attr('stroke', (d) => d.color);
const renewLinks = (selection, baseOpacity) => selection.style('stroke-opacity', baseOpacity);
const renewNodes = selection => selection.attr('stroke', d => d.color);
const renewNodes = (selection) => selection.attr('stroke', (d) => d.color);
export const getAllLinkAncestors = node => {
export const getAllLinkAncestors = (node) => {
if (node.targetLinks) {
return node.targetLinks.flatMap(n => {
return node.targetLinks.flatMap((n) => {
return [n, ...getAllLinkAncestors(n.source)];
});
}
......@@ -36,11 +36,11 @@ export const getAllLinkAncestors = node => {
return [];
};
const getAllNodeAncestors = node => {
const getAllNodeAncestors = (node) => {
let allNodes = [];
if (node.targetLinks) {
allNodes = node.targetLinks.flatMap(n => {
allNodes = node.targetLinks.flatMap((n) => {
return getAllNodeAncestors(n.source);
});
}
......@@ -74,7 +74,7 @@ const highlightPath = (parentLinks, parentNodes) => {
});
/* highlight correct nodes */
parentNodes.forEach(id => {
parentNodes.forEach((id) => {
foregroundNodes(d3.select(`#${id}`)).classed(IS_HIGHLIGHTED, true);
});
};
......@@ -86,7 +86,7 @@ const restoreNodes = () => {
rehighlights their nodes.
*/
getLiveLinks().each(d => {
getLiveLinks().each((d) => {
foregroundNodes(d3.select(`#${d.source.uid}`)).classed(IS_HIGHLIGHTED, true);
foregroundNodes(d3.select(`#${d.target.uid}`)).classed(IS_HIGHLIGHTED, true);
});
......@@ -97,7 +97,7 @@ const restorePath = (parentLinks, parentNodes, baseOpacity) => {
renewLinks(d3.select(`#${uid}`), baseOpacity).classed(IS_HIGHLIGHTED, false);
});
parentNodes.forEach(id => {
parentNodes.forEach((id) => {
d3.select(`#${id}`).classed(IS_HIGHLIGHTED, false);
});
......@@ -112,7 +112,7 @@ const restorePath = (parentLinks, parentNodes, baseOpacity) => {
restoreNodes();
};
export const restoreLinks = baseOpacity => {
export const restoreLinks = (baseOpacity) => {
/*
if there exist live links, reset to highlight out / pale
otherwise, reset to base
......
......@@ -78,11 +78,11 @@ export default {
return (
this.pipeline.triggered_by &&
Array.isArray(this.pipeline.triggered_by) &&
this.pipeline.triggered_by.find(el => el.isExpanded)
this.pipeline.triggered_by.find((el) => el.isExpanded)
);
},
expandedDownstream() {
return this.pipeline.triggered && this.pipeline.triggered.find(el => el.isExpanded);
return this.pipeline.triggered && this.pipeline.triggered.find((el) => el.isExpanded);
},
pipelineTypeUpstream() {
return this.type !== this.$options.downstream && this.expandedUpstream;
......
......@@ -9,7 +9,7 @@ const addMulti = (mainPipelineProjectPath, linkedPipeline) => {
};
};
const transformId = linkedPipeline => {
const transformId = (linkedPipeline) => {
return { ...linkedPipeline, id: getIdFromGraphQLId(linkedPipeline.id) };
};
......@@ -42,7 +42,7 @@ const unwrapPipelineData = (mainPipelineProjectPath, data) => {
};
const toggleQueryPollingByVisibility = (queryRef, interval = 10000) => {
const stopStartQuery = query => {
const stopStartQuery = (query) => {
if (!Visibility.hidden()) {
query.startPolling(interval);
} else {
......
......@@ -54,7 +54,7 @@ export default {
iid: this.pipelineIid,
};
},
update: data => data.project.pipeline,
update: (data) => data.project.pipeline,
error() {
this.reportFailure(LOAD_FAILURE);
},
......
......@@ -33,15 +33,15 @@ import { uniqWith, isEqual } from 'lodash';
10 -> value (constant)
*/
export const createNodeDict = nodes => {
export const createNodeDict = (nodes) => {
return nodes.reduce((acc, node) => {
const newNode = {
...node,
needs: node.jobs.map(job => job.needs || []).flat(),
needs: node.jobs.map((job) => job.needs || []).flat(),
};
if (node.size > 1) {
node.jobs.forEach(job => {
node.jobs.forEach((job) => {
acc[job.name] = newNode;
});
}
......@@ -54,13 +54,13 @@ export const createNodeDict = nodes => {
export const makeLinksFromNodes = (nodes, nodeDict) => {
const constantLinkValue = 10; // all links are the same weight
return nodes
.map(group => {
return group.jobs.map(job => {
.map((group) => {
return group.jobs.map((job) => {
if (!job.needs) {
return [];
}
return job.needs.map(needed => {
return job.needs.map((needed) => {
return {
source: nodeDict[needed]?.name,
target: group.name,
......@@ -74,7 +74,7 @@ export const makeLinksFromNodes = (nodes, nodeDict) => {
export const getAllAncestors = (nodes, nodeDict) => {
const needs = nodes
.map(node => {
.map((node) => {
return nodeDict[node].needs || '';
})
.flat()
......@@ -102,13 +102,13 @@ export const filterByAncestors = (links, nodeDict) =>
*/
const targetNode = target;
const targetNodeNeeds = nodeDict[targetNode].needs;
const targetNodeNeedsMinusSource = targetNodeNeeds.filter(need => need !== source);
const targetNodeNeedsMinusSource = targetNodeNeeds.filter((need) => need !== source);
const allAncestors = getAllAncestors(targetNodeNeedsMinusSource, nodeDict);
return !allAncestors.includes(source);
});
export const parseData = nodes => {
export const parseData = (nodes) => {
const nodeDict = createNodeDict(nodes);
const allLinks = makeLinksFromNodes(nodes, nodeDict);
const filteredLinks = filterByAncestors(allLinks, nodeDict);
......@@ -121,7 +121,7 @@ export const parseData = nodes => {
The number of nodes in the most populous generation drives the height of the graph.
*/
export const getMaxNodes = nodes => {
export const getMaxNodes = (nodes) => {
const counts = nodes.reduce((acc, { layer }) => {
if (!acc[layer]) {
acc[layer] = 0;
......@@ -141,6 +141,6 @@ export const getMaxNodes = nodes => {
to find nodes that have no relations.
*/
export const removeOrphanNodes = sankeyfiedNodes => {
return sankeyfiedNodes.filter(node => node.sourceLinks.length || node.targetLinks.length);
export const removeOrphanNodes = (sankeyfiedNodes) => {
return sankeyfiedNodes.filter((node) => node.sourceLinks.length || node.targetLinks.length);
};
......@@ -14,7 +14,7 @@ import { createUniqueLinkId } from '../../utils';
export const generateLinksData = ({ links }, containerID) => {
const containerEl = document.getElementById(containerID);
return links.map(link => {
return links.map((link) => {
const path = d3.path();
const sourceId = link.source;
......
......@@ -111,13 +111,13 @@ export default {
// If you are hovering on a job, then the links we want to highlight are:
// All the links whose `source` and `target` are highlighted jobs.
if (this.hasHighlightedJob) {
const filteredLinks = this.links.filter(link => {
const filteredLinks = this.links.filter((link) => {
return (
this.highlightedJobs.includes(link.source) && this.highlightedJobs.includes(link.target)
);
});
return filteredLinks.map(link => link.ref);
return filteredLinks.map((link) => link.ref);
}
return [];
......
......@@ -246,7 +246,7 @@ export default {
filterPipelines(filters) {
this.resetRequestData();
filters.forEach(filter => {
filters.forEach((filter) => {
// do not add Any for username query param, so we
// can fetch all trigger authors
if (
......
......@@ -33,7 +33,7 @@ export default {
},
computed: {
selectedTypes() {
return this.value.map(i => i.type);
return this.value.map((i) => i.type);
},
tokens() {
return [
......
......@@ -124,7 +124,7 @@ export default {
$(
'.js-builds-dropdown-list button, .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item',
this.$el,
).on('click', e => {
).on('click', (e) => {
e.stopPropagation();
});
},
......
......@@ -34,10 +34,10 @@ export default {
fetchBranches(searchterm) {
Api.branches(this.config.projectId, searchterm)
.then(({ data }) => {
this.branches = data.map(branch => branch.name);
this.branches = data.map((branch) => branch.name);
this.loading = false;
})
.catch(err => {
.catch((err) => {
createFlash(FETCH_BRANCH_ERROR_MESSAGE);
this.loading = false;
throw err;
......
......@@ -72,7 +72,7 @@ export default {
];
},
findActiveStatus() {
return this.statuses.find(status => status.value === this.value.data);
return this.statuses.find((status) => status.value === this.value.data);
},
},
};
......
......@@ -34,10 +34,10 @@ export default {
fetchTags(searchTerm) {
Api.tags(this.config.projectId, searchTerm)
.then(({ data }) => {
this.tags = data.map(tag => tag.name);
this.tags = data.map((tag) => tag.name);
this.loading = false;
})
.catch(err => {
.catch((err) => {
createFlash(FETCH_TAG_ERROR_MESSAGE);
this.loading = false;
throw err;
......
......@@ -45,7 +45,7 @@ export default {
return this.value.data.toLowerCase();
},
activeUser() {
return this.users.find(user => {
return this.users.find((user) => {
return user.username.toLowerCase() === this.currentValue;
});
},
......@@ -56,11 +56,11 @@ export default {
methods: {
fetchProjectUsers(searchTerm) {
Api.projectUsers(this.config.projectId, searchTerm)
.then(users => {
.then((users) => {
this.users = users;
this.loading = false;
})
.catch(err => {
.catch((err) => {
createFlash(FETCH_AUTHOR_ERROR_MESSAGE);
this.loading = false;
throw err;
......
......@@ -8,15 +8,15 @@
export const unwrapArrayOfJobs = (stages = []) => {
return stages
.map(({ name, groups }) => {
return groups.map(group => {
return groups.map((group) => {
return { category: name, ...group };
});
})
.flat(2);
};
const unwrapGroups = stages => {
return stages.map(stage => {
const unwrapGroups = (stages) => {
return stages.map((stage) => {
const {
groups: { nodes: groups },
} = stage;
......@@ -25,21 +25,21 @@ const unwrapGroups = stages => {
};
const unwrapNodesWithName = (jobArray, prop, field = 'name') => {
return jobArray.map(job => {
return { ...job, [prop]: job[prop].nodes.map(item => item[field]) };
return jobArray.map((job) => {
return { ...job, [prop]: job[prop].nodes.map((item) => item[field]) };
});
};
const unwrapJobWithNeeds = denodedJobArray => {
const unwrapJobWithNeeds = (denodedJobArray) => {
return unwrapNodesWithName(denodedJobArray, 'needs');
};
const unwrapStagesWithNeeds = denodedStages => {
const unwrapStagesWithNeeds = (denodedStages) => {
const unwrappedNestedGroups = unwrapGroups(denodedStages);
const nodes = unwrappedNestedGroups.map(node => {
const nodes = unwrappedNestedGroups.map((node) => {
const { groups } = node;
const groupsWithJobs = groups.map(group => {
const groupsWithJobs = groups.map((group) => {
const jobs = unwrapJobWithNeeds(group.jobs.nodes);
return { ...group, jobs };
});
......
......@@ -6,7 +6,7 @@ export default {
getExpandedPipelines(pipeline) {
this.mediator.service
.getPipeline(this.mediator.getExpandedParameters())
.then(response => {
.then((response) => {
this.mediator.store.toggleLoading(pipeline);
this.mediator.store.storePipeline(response.data);
this.mediator.poll.enable({ data: this.mediator.getExpandedParameters() });
......
......@@ -90,7 +90,7 @@ export default {
// fetch new data
return this.service
.getPipelines(this.requestData)
.then(response => {
.then((response) => {
this.isLoading = false;
this.successCallback(response);
......@@ -124,8 +124,8 @@ export default {
getPipelines() {
return this.service
.getPipelines(this.requestData)
.then(response => this.successCallback(response))
.catch(error => this.errorCallback(error));
.then((response) => this.successCallback(response))
.catch((error) => this.errorCallback(error));
},
setCommonData(pipelines) {
this.store.storePipelines(pipelines);
......
......@@ -20,7 +20,7 @@ const SELECTORS = {
PIPELINE_TESTS: '#js-pipeline-tests-detail',
};
const createLegacyPipelinesDetailApp = mediator => {
const createLegacyPipelinesDetailApp = (mediator) => {
if (!document.querySelector(SELECTORS.PIPELINE_GRAPH)) {
return;
}
......@@ -47,15 +47,15 @@ const createLegacyPipelinesDetailApp = mediator => {
refreshPipelineGraph: this.requestRefreshPipelineGraph,
onResetDownstream: (parentPipeline, pipeline) =>
this.resetDownstreamPipelines(parentPipeline, pipeline),
onClickUpstreamPipeline: pipeline => this.clickUpstreamPipeline(pipeline),
onClickDownstreamPipeline: pipeline => this.clickDownstreamPipeline(pipeline),
onClickUpstreamPipeline: (pipeline) => this.clickUpstreamPipeline(pipeline),
onClickDownstreamPipeline: (pipeline) => this.clickDownstreamPipeline(pipeline),
},
});
},
});
};
const createLegacyPipelineHeaderApp = mediator => {
const createLegacyPipelineHeaderApp = (mediator) => {
if (!document.querySelector(SELECTORS.PIPELINE_HEADER)) {
return;
}
......
......@@ -9,7 +9,7 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
export const createPipelineHeaderApp = elSelector => {
export const createPipelineHeaderApp = (elSelector) => {
const el = document.querySelector(elSelector);
if (!el) {
......
......@@ -55,7 +55,7 @@ export default class pipelinesMediator {
return this.service
.getPipeline()
.then(response => this.successCallback(response))
.then((response) => this.successCallback(response))
.catch(() => this.errorCallback())
.finally(() =>
this.poll.restart(
......
......@@ -29,11 +29,11 @@ export default class PipelineStore {
}
if (pipelineCopy.triggered && pipelineCopy.triggered.length) {
pipelineCopy.triggered.forEach(el => {
pipelineCopy.triggered.forEach((el) => {
const oldPipeline =
this.state.pipeline &&
this.state.pipeline.triggered &&
this.state.pipeline.triggered.find(element => element.id === el.id);
this.state.pipeline.triggered.find((element) => element.id === el.id);
this.parseTriggeredPipelines(oldPipeline, el);
});
......@@ -67,8 +67,8 @@ export default class PipelineStore {
}
if (newPipeline.triggered_by?.length > 0) {
newPipeline.triggered_by.forEach(el => {
const oldTriggeredBy = oldPipeline.triggered_by?.find(element => element.id === el.id);
newPipeline.triggered_by.forEach((el) => {
const oldTriggeredBy = oldPipeline.triggered_by?.find((element) => element.id === el.id);
this.parseTriggeredPipelines(oldTriggeredBy, el);
});
}
......@@ -88,9 +88,9 @@ export default class PipelineStore {
Vue.set(newPipeline, 'isLoading', false);
if (newPipeline.triggered && newPipeline.triggered.length > 0) {
newPipeline.triggered.forEach(el => {
newPipeline.triggered.forEach((el) => {
const oldTriggered =
oldPipeline.triggered && oldPipeline.triggered.find(element => element.id === el.id);
oldPipeline.triggered && oldPipeline.triggered.find((element) => element.id === el.id);
this.parseTriggeredPipelines(oldTriggered, el);
});
}
......@@ -102,7 +102,7 @@ export default class PipelineStore {
* @param {Object} pipeline
*/
resetTriggeredByPipeline(parentPipeline, pipeline) {
parentPipeline.triggered_by.forEach(el => this.closePipeline(el));
parentPipeline.triggered_by.forEach((el) => this.closePipeline(el));
if (pipeline.triggered_by && pipeline.triggered_by) {
this.resetTriggeredByPipeline(pipeline, pipeline.triggered_by);
......@@ -129,7 +129,7 @@ export default class PipelineStore {
this.closePipeline(pipeline);
if (pipeline.triggered_by && pipeline.triggered_by.length) {
pipeline.triggered_by.forEach(triggeredBy => this.closeTriggeredByPipeline(triggeredBy));
pipeline.triggered_by.forEach((triggeredBy) => this.closeTriggeredByPipeline(triggeredBy));
}
}
......@@ -139,10 +139,10 @@ export default class PipelineStore {
* @param {Object} pipeline
*/
resetTriggeredPipelines(parentPipeline, pipeline) {
parentPipeline.triggered.forEach(el => this.closePipeline(el));
parentPipeline.triggered.forEach((el) => this.closePipeline(el));
if (pipeline.triggered && pipeline.triggered.length) {
pipeline.triggered.forEach(el => this.resetTriggeredPipelines(pipeline, el));
pipeline.triggered.forEach((el) => this.resetTriggeredPipelines(pipeline, el));
}
}
......@@ -165,7 +165,7 @@ export default class PipelineStore {
this.closePipeline(pipeline);
if (pipeline.triggered && pipeline.triggered.length) {
pipeline.triggered.forEach(triggered => this.closeTriggeredPipeline(triggered));
pipeline.triggered.forEach((triggered) => this.closeTriggeredPipeline(triggered));
}
}
......@@ -199,7 +199,7 @@ export default class PipelineStore {
removeExpandedPipelineToRequestData(id) {
this.state.expandedPipelines.splice(
this.state.expandedPipelines.findIndex(el => el === id),
this.state.expandedPipelines.findIndex((el) => el === id),
1,
);
}
......
import { addIconStatus, formattedTime } from './utils';
export const getTestSuites = state => {
export const getTestSuites = (state) => {
const { test_suites: testSuites = [] } = state.testReports;
return testSuites.map(suite => ({
return testSuites.map((suite) => ({
...suite,
formattedTime: formattedTime(suite.total_time),
}));
};
export const getSelectedSuite = state =>
export const getSelectedSuite = (state) =>
state.testReports?.test_suites?.[state.selectedSuiteIndex] || {};
export const getSuiteTests = state => {
export const getSuiteTests = (state) => {
const { test_cases: testCases = [] } = getSelectedSuite(state);
const { page, perPage } = state.pageInfo;
const start = (page - 1) * perPage;
......@@ -20,4 +20,4 @@ export const getSuiteTests = state => {
return testCases.map(addIconStatus).slice(start, start + perPage);
};
export const getSuiteTestCount = state => getSelectedSuite(state)?.test_cases?.length || 0;
export const getSuiteTestCount = (state) => getSelectedSuite(state)?.test_cases?.length || 0;
......@@ -7,7 +7,7 @@ import mutations from './mutations';
Vue.use(Vuex);
export default initialState =>
export default (initialState) =>
new Vuex.Store({
actions,
getters,
......
......@@ -25,7 +25,7 @@ export const formattedTime = (seconds = 0) => {
return sprintf(__('%{seconds}s'), { seconds: seconds.toFixed(2) });
};
export const addIconStatus = testCase => ({
export const addIconStatus = (testCase) => ({
...testCase,
icon: iconForTestStatus(testCase.status),
formattedTime: formattedTime(testCase.execution_time),
......
import { pickBy } from 'lodash';
import { SUPPORTED_FILTER_PARAMETERS } from './constants';
export const validateParams = params => {
export const validateParams = (params) => {
return pickBy(params, (val, key) => SUPPORTED_FILTER_PARAMETERS.includes(key) && val);
};
......@@ -17,10 +17,10 @@ export const createUniqueLinkId = (stageName, jobName) => `${stageName}-${jobNam
export const createJobsHash = (stages = []) => {
const jobsHash = {};
stages.forEach(stage => {
stages.forEach((stage) => {
if (stage.groups.length > 0) {
stage.groups.forEach(group => {
group.jobs.forEach(job => {
stage.groups.forEach((group) => {
group.jobs.forEach((job) => {
jobsHash[job.name] = job;
});
});
......@@ -44,13 +44,13 @@ export const generateJobNeedsDict = (jobs = {}) => {
const arrOfJobNames = Object.keys(jobs);
return arrOfJobNames.reduce((acc, value) => {
const recursiveNeeds = jobName => {
const recursiveNeeds = (jobName) => {
if (!jobs[jobName]?.needs) {
return [];
}
return jobs[jobName].needs
.map(job => {
.map((job) => {
// If we already have the needs of a job in the accumulator,
// then we use the memoized data instead of the recursive call
// to save some performance.
......
......@@ -7,7 +7,7 @@
import { GlPopover } from '@gitlab/ui';
import { sanitize } from '~/lib/dompurify';
const newPopover = element => {
const newPopover = (element) => {
const { content, html, placement, title, triggers = 'focus' } = element.dataset;
return {
......@@ -30,8 +30,8 @@ export default {
};
},
created() {
this.observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
this.observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.removedNodes.forEach(this.dispose);
});
});
......@@ -61,7 +61,7 @@ export default {
if (!target) {
this.popovers = [];
} else {
const index = this.popovers.findIndex(popover => popover.target === target);
const index = this.popovers.findIndex((popover) => popover.target === target);
if (index > -1) {
this.popovers.splice(index, 1);
......@@ -69,7 +69,7 @@ export default {
}
},
popoverExists(element) {
return this.popovers.some(popover => popover.target === element);
return this.popovers.some((popover) => popover.target === element);
},
getSafeHtml(html) {
return sanitize(html);
......
......@@ -32,10 +32,10 @@ const handlePopoverEvent = (rootTarget, e, selector) => {
};
export const initPopovers = () => {
['mouseenter', 'focus', 'click'].forEach(event => {
['mouseenter', 'focus', 'click'].forEach((event) => {
document.addEventListener(
event,
e => handlePopoverEvent(document, e, '[data-toggle="popover"]'),
(e) => handlePopoverEvent(document, e, '[data-toggle="popover"]'),
true,
);
});
......@@ -43,7 +43,7 @@ export const initPopovers = () => {
return getPopoversApp();
};
export const dispose = elements => toArray(elements).forEach(getPopoversApp().dispose);
export const dispose = (elements) => toArray(elements).forEach(getPopoversApp().dispose);
export const destroy = () => {
getPopoversApp().$destroy();
......
......@@ -84,12 +84,12 @@ Please update your Git repository remotes as soon as possible.`),
return axios
.put(this.actionUrl, putData)
.then(result => {
.then((result) => {
Flash(result.data.message, 'notice');
this.username = username;
this.isRequestPending = false;
})
.catch(error => {
.catch((error) => {
Flash(error.response.data.message);
this.isRequestPending = false;
throw error;
......
......@@ -12,7 +12,7 @@ export default class AddSshKeyValidation {
}
register() {
this.form.addEventListener('submit', event => this.submit(event));
this.form.addEventListener('submit', (event) => this.submit(event));
this.confirmSubmitElement.addEventListener('click', () => {
this.isValid = true;
......
......@@ -18,6 +18,6 @@ export default () => {
el,
name: 'ProfilePreferencesApp',
provide,
render: createElement => createElement(ProfilePreferences),
render: (createElement) => createElement(ProfilePreferences),
});
};
......@@ -20,7 +20,7 @@ export default class Profile {
this.timezoneDropdown = new TimezoneDropdown({
$inputEl: this.$inputEl,
$dropdownEl: $('.js-timezone-dropdown'),
displayFormat: selectedItem => formatTimezone(selectedItem),
displayFormat: (selectedItem) => formatTimezone(selectedItem),
});
}
......@@ -39,7 +39,7 @@ export default class Profile {
bindEvents() {
$('.js-preferences-form').on('change.preference', 'input[type=radio]', this.submitForm);
$('.js-group-notification-email').on('change', this.submitForm);
$('#user_notification_email').on('select2-selecting', event => {
$('#user_notification_email').on('select2-selecting', (event) => {
setTimeout(this.submitForm.bind(event.currentTarget));
});
$('#user_notified_of_own_activity').on('change', this.submitForm);
......@@ -89,7 +89,7 @@ export default class Profile {
// Enable submit button after requests ends
self.form.find(':input[disabled]').enable();
})
.catch(error => flash(error.message));
.catch((error) => flash(error.message));
}
updateHeaderAvatar() {
......
......@@ -57,7 +57,7 @@ export default class ProjectFindFile {
initEvent() {
// eslint-disable-next-line @gitlab/no-global-event-off
this.inputElement.off('keyup');
this.inputElement.on('keyup', event => {
this.inputElement.on('keyup', (event) => {
const target = $(event.target);
const value = target.val();
const ref = target.data('oldValue');
......
......@@ -33,7 +33,7 @@ const projectSelect = () => {
$(select).select2({
placeholder,
minimumInputLength: 0,
query: query => {
query: (query) => {
let projectsCallback;
const finalCallback = function (projects) {
const data = {
......
......@@ -17,9 +17,9 @@ export default class ProjectSelectComboButton {
bindEvents() {
this.projectSelectInput
.siblings('.new-project-item-select-button')
.on('click', e => this.openDropdown(e));
.on('click', (e) => this.openDropdown(e));
this.newItemBtn.on('click', e => {
this.newItemBtn.on('click', (e) => {
if (!this.getProjectFromLocalStorage()) {
e.preventDefault();
this.openDropdown(e);
......
......@@ -7,7 +7,7 @@ function setVisibilityOptions(namespaceSelector) {
const selectedNamespace = namespaceSelector.options[namespaceSelector.selectedIndex];
const { name, visibility, visibilityLevel, showPath, editPath } = selectedNamespace.dataset;
document.querySelectorAll('.visibility-level-setting .form-check').forEach(option => {
document.querySelectorAll('.visibility-level-setting .form-check').forEach((option) => {
const optionInput = option.querySelector('input[type=radio]');
const optionValue = optionInput ? optionInput.value : 0;
const optionTitle = option.querySelector('.option-title');
......
......@@ -2,7 +2,7 @@ import axios from 'axios';
import { sanitize } from '~/lib/dompurify';
import { __ } from '~/locale';
export const loadBranches = containerEl => {
export const loadBranches = (containerEl) => {
if (!containerEl) {
return;
}
......
......@@ -69,7 +69,7 @@ export default {
commitsSearchInput.addEventListener(
'keyup',
debounce(event => this.setSearchParam(event.target.value), 500), // keyup & time is to match effect of "filter by commit message"
debounce((event) => this.setSearchParam(event.target.value), 500), // keyup & time is to match effect of "filter by commit message"
);
},
methods: {
......
......@@ -5,7 +5,7 @@ import store from './store';
Vue.use(Vuex);
export default el => {
export default (el) => {
if (!el) {
return null;
}
......
......@@ -26,7 +26,7 @@ export default {
},
})
.then(({ data }) => dispatch('receiveAuthorsSuccess', data))
.catch(error => {
.catch((error) => {
Sentry.captureException(error);
dispatch('receiveAuthorsError');
});
......
......@@ -83,11 +83,11 @@ export default {
return PANELS;
}
return PANELS.filter(p => p.name !== CI_CD_PANEL);
return PANELS.filter((p) => p.name !== CI_CD_PANEL);
},
activePanel() {
return PANELS.find(p => p.name === this.activeTab);
return PANELS.find((p) => p.name === this.activeTab);
},
breadcrumbs() {
......@@ -113,7 +113,7 @@ export default {
this.handleLocationHashChange();
this.resetProjectErrors();
});
this.$root.$on('clicked::link', e => {
this.$root.$on('clicked::link', (e) => {
window.location = e.target.href;
});
},
......
......@@ -252,7 +252,7 @@ export default {
},
get chartTitles() {
const today = dateFormat(new Date(), CHART_DATE_FORMAT);
const pastDate = timeScale =>
const pastDate = (timeScale) =>
dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT);
return {
lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), {
......
......@@ -98,7 +98,7 @@ export default {
},
get chartTitles() {
const today = dateFormat(new Date(), CHART_DATE_FORMAT);
const pastDate = timeScale =>
const pastDate = (timeScale) =>
dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT);
return {
lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), {
......
......@@ -10,7 +10,7 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
const mountPipelineChartsApp = el => {
const mountPipelineChartsApp = (el) => {
// Not all of the values will be defined since some them will be
// empty depending on the value of the graphql_pipeline_analytics
// feature flag, once the rollout of the feature flag is completed
......@@ -62,7 +62,7 @@ const mountPipelineChartsApp = el => {
provide: {
projectPath,
},
render: createElement => createElement(ProjectPipelinesCharts, {}),
render: (createElement) => createElement(ProjectPipelinesCharts, {}),
});
}
......@@ -72,7 +72,7 @@ const mountPipelineChartsApp = el => {
components: {
ProjectPipelinesChartsLegacy,
},
render: createElement =>
render: (createElement) =>
createElement(ProjectPipelinesChartsLegacy, {
props: {
counts: {
......
......@@ -39,7 +39,7 @@ const setProjectNamePathHandlers = ($projectNameInput, $projectPathInput) => {
});
};
const deriveProjectPathFromUrl = $projectImportUrl => {
const deriveProjectPathFromUrl = ($projectImportUrl) => {
const $currentProjectName = $projectImportUrl
.parents('.toggle-import-form')
.find('#project_name');
......@@ -89,7 +89,7 @@ const bindEvents = () => {
return;
}
$('.how_to_import_link').on('click', e => {
$('.how_to_import_link').on('click', (e) => {
e.preventDefault();
$(e.currentTarget).next('.modal').show();
});
......@@ -112,7 +112,7 @@ const bindEvents = () => {
$pushNewProjectTipTrigger
.removeAttr('rel')
.removeAttr('target')
.on('click', e => {
.on('click', (e) => {
e.preventDefault();
})
.popover({
......@@ -122,7 +122,7 @@ const bindEvents = () => {
content: $('.push-new-project-tip-template').html(),
})
.on('shown.bs.popover', () => {
$(document).on('click.popover touchstart.popover', event => {
$(document).on('click.popover touchstart.popover', (event) => {
if ($(event.target).closest('.popover').length === 0) {
$pushNewProjectTipTrigger.trigger('click');
}
......
......@@ -46,7 +46,7 @@ export default {
this.isLoading = false;
this.isSharedRunnerEnabled = !this.isSharedRunnerEnabled;
})
.catch(error => {
.catch((error) => {
this.isLoading = false;
this.errorMessage = error.response?.data?.error || DEFAULT_ERROR_MESSAGE;
});
......
......@@ -110,7 +110,7 @@ export default {
this.updatedCustomEmail = data?.service_desk_address;
this.showAlert(__('Changes were successfully made.'), 'success');
})
.catch(err => {
.catch((err) => {
this.showAlert(
sprintf(__('An error occured while making the changes: %{error}'), {
error: err?.response?.data?.message,
......
......@@ -63,7 +63,7 @@ export default {
this.poll = new Poll({
resource: this.service,
method: 'fetchData',
successCallback: response => this.successCallback(response),
successCallback: (response) => this.successCallback(response),
errorCallback: this.errorCallback,
});
......
......@@ -61,7 +61,7 @@ export default {
resetKey() {
axios
.post(this.changeKeyUrl)
.then(res => {
.then((res) => {
this.authorizationKey = res.data.token;
})
.catch(() => {
......
......@@ -65,12 +65,12 @@ export default class CustomMetrics extends PrometheusMetrics {
// eslint-disable-next-line class-methods-use-this
setHidden(els) {
els.forEach(el => el.addClass('hidden'));
els.forEach((el) => el.addClass('hidden'));
}
setVisible(...els) {
this.setHidden(this.$els.filter(el => !els.includes(el)));
els.forEach(el => el.removeClass('hidden'));
this.setHidden(this.$els.filter((el) => !els.includes(el)));
els.forEach((el) => el.removeClass('hidden'));
}
showMonitoringCustomMetricsPanelState(stateName) {
......@@ -98,14 +98,14 @@ export default class CustomMetrics extends PrometheusMetrics {
}
populateCustomMetrics() {
const capitalizeGroup = metric => ({
const capitalizeGroup = (metric) => ({
...metric,
group: capitalizeFirstCharacter(metric.group),
});
const sortedMetrics = sortBy(this.customMetrics.map(capitalizeGroup), ['group', 'title']);
sortedMetrics.forEach(metric => {
sortedMetrics.forEach((metric) => {
this.$monitoredCustomMetricsList.append(CustomMetrics.customMetricTemplate(metric));
});
......@@ -145,7 +145,7 @@ export default class CustomMetrics extends PrometheusMetrics {
this.populateCustomMetrics(customMetrics.data.metrics);
}
})
.catch(customMetricError => {
.catch((customMetricError) => {
this.showFlashMessage(customMetricError);
this.showMonitoringCustomMetricsPanelState(PANEL_STATE.EMPTY);
});
......
......@@ -26,8 +26,8 @@ export default class PrometheusMetrics {
this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('activeMetrics');
this.helpMetricsPath = this.$monitoredMetricsPanel.data('metrics-help-path');
this.$panelToggleRight.on('click', e => this.handlePanelToggle(e));
this.$panelToggleDown.on('click', e => this.handlePanelToggle(e));
this.$panelToggleRight.on('click', (e) => this.handlePanelToggle(e));
this.$panelToggleDown.on('click', (e) => this.handlePanelToggle(e));
}
init() {
......@@ -72,7 +72,7 @@ export default class PrometheusMetrics {
let totalMissingEnvVarMetrics = 0;
let totalExporters = 0;
metrics.forEach(metric => {
metrics.forEach((metric) => {
if (metric.active_metrics > 0) {
totalExporters += 1;
this.$monitoredMetricsList.append(
......@@ -137,7 +137,7 @@ export default class PrometheusMetrics {
})
.catch(stop);
})
.then(res => {
.then((res) => {
if (res && res.data && res.data.length) {
this.populateActiveMetrics(res.data);
} else {
......
......@@ -90,12 +90,12 @@ export default class ProtectedBranchCreate {
},
};
Object.keys(ACCESS_LEVELS).forEach(level => {
Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevel = ACCESS_LEVELS[level];
const selectedItems = this[`${accessLevel}_dropdown`].getSelectedItems();
const levelAttributes = [];
selectedItems.forEach(item => {
selectedItems.forEach((item) => {
if (item.type === LEVEL_TYPES.USER) {
levelAttributes.push({
user_id: item.user_id,
......
......@@ -108,7 +108,7 @@ export default class ProtectedBranchEdit {
.then(({ data }) => {
this.hasChanges = false;
Object.keys(ACCESS_LEVELS).forEach(level => {
Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevelName = ACCESS_LEVELS[level];
// The data coming from server will be the new persisted *state* for each dropdown
......@@ -125,7 +125,7 @@ export default class ProtectedBranchEdit {
}
setSelectedItemsToDropdown(items = [], dropdownName) {
const itemsToAdd = items.map(currentItem => {
const itemsToAdd = items.map((currentItem) => {
if (currentItem.user_id) {
// Do this only for users for now
// get the current data for selected items
......
......@@ -22,7 +22,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger')
if (!triggerEls) return;
triggerEls.forEach(triggerEl => {
triggerEls.forEach((triggerEl) => {
const targetEl = triggerEl.previousElementSibling;
if (!targetEl) {
......@@ -31,7 +31,7 @@ export default function initReadMore(triggerSelector = '.js-read-more-trigger')
triggerEl.addEventListener(
'click',
e => {
(e) => {
targetEl.classList.add('is-expanded');
e.target.remove();
},
......
......@@ -39,7 +39,7 @@ export default {
items: {
type: Array,
required: true,
validator: items => Array.isArray(items) && items.every(item => item.name),
validator: (items) => Array.isArray(items) && items.every((item) => item.name),
},
/**
......
......@@ -50,9 +50,9 @@ export default {
},
computed: {
...mapState({
matches: state => state.matches,
lastQuery: state => state.query,
selectedRef: state => state.selectedRef,
matches: (state) => state.matches,
lastQuery: (state) => state.query,
selectedRef: (state) => state.selectedRef,
}),
...mapGetters(['isLoading', 'isQueryPossiblyASha']),
i18n() {
......
......@@ -18,10 +18,10 @@ export const searchBranches = ({ commit, state }) => {
commit(types.REQUEST_START);
Api.branches(state.projectId, state.query)
.then(response => {
.then((response) => {
commit(types.RECEIVE_BRANCHES_SUCCESS, response);
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_BRANCHES_ERROR, error);
})
.finally(() => {
......@@ -33,10 +33,10 @@ export const searchTags = ({ commit, state }) => {
commit(types.REQUEST_START);
Api.tags(state.projectId, state.query)
.then(response => {
.then((response) => {
commit(types.RECEIVE_TAGS_SUCCESS, response);
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_TAGS_ERROR, error);
})
.finally(() => {
......@@ -50,10 +50,10 @@ export const searchCommits = ({ commit, state, getters }) => {
commit(types.REQUEST_START);
Api.commit(state.projectId, state.query)
.then(response => {
.then((response) => {
commit(types.RECEIVE_COMMITS_SUCCESS, response);
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_COMMITS_ERROR, error);
})
.finally(() => {
......
......@@ -23,7 +23,7 @@ export default {
[types.RECEIVE_BRANCHES_SUCCESS](state, response) {
state.matches.branches = {
list: convertObjectPropsToCamelCase(response.data).map(b => ({
list: convertObjectPropsToCamelCase(response.data).map((b) => ({
name: b.name,
default: b.default,
})),
......@@ -41,7 +41,7 @@ export default {
[types.RECEIVE_TAGS_SUCCESS](state, response) {
state.matches.tags = {
list: convertObjectPropsToCamelCase(response.data).map(b => ({
list: convertObjectPropsToCamelCase(response.data).map((b) => ({
name: b.name,
})),
totalCount: parseInt(response.headers[X_TOTAL_HEADER], 10),
......
......@@ -31,7 +31,7 @@ class RefSelectDropdown {
const $fieldInput = $(`input[name="${$dropdownButton.data('fieldName')}"]`, $dropdownContainer);
const $filterInput = $('input[type="search"]', $dropdownContainer);
$filterInput.on('keyup', e => {
$filterInput.on('keyup', (e) => {
const keyCode = e.keyCode || e.which;
if (keyCode !== 13) return;
......
......@@ -31,10 +31,10 @@ export default {
},
computed: {
hasSelectedItems() {
return this.tags.some(tag => this.selectedItems[tag.name]);
return this.tags.some((tag) => this.selectedItems[tag.name]);
},
showMultiDeleteButton() {
return this.tags.some(tag => tag.canDelete) && !this.isMobile;
return this.tags.some((tag) => tag.canDelete) && !this.isMobile;
},
},
methods: {
......
......@@ -14,10 +14,10 @@ export default {
},
computed: {
parsedCrumbs() {
return this.crumbs.map(c => ({ ...c, innerHTML: sanitize(c.innerHTML) }));
return this.crumbs.map((c) => ({ ...c, innerHTML: sanitize(c.innerHTML) }));
},
rootRoute() {
return this.$router.options.routes.find(r => r.meta.root);
return this.$router.options.routes.find((r) => r.meta.root);
},
isRootRoute() {
return this.$route.name === this.rootRoute.name;
......
......@@ -97,7 +97,7 @@ export default {
},
methods: {
deleteTags(toBeDeleted) {
this.itemsToBeDeleted = this.tags.filter(tag => toBeDeleted[tag.name]);
this.itemsToBeDeleted = this.tags.filter((tag) => toBeDeleted[tag.name]);
this.track('click_button');
this.$refs.deleteModal.show();
},
......@@ -111,7 +111,7 @@ export default {
mutation: deleteContainerRepositoryTagsMutation,
variables: {
id: this.queryVariables.id,
tagNames: itemsToBeDeleted.map(i => i.name),
tagNames: itemsToBeDeleted.map((i) => i.name),
},
awaitRefetchQueries: true,
refetchQueries: [
......
......@@ -33,7 +33,7 @@ export default {
projectPath: this.projectPath,
};
},
update: data => data.project?.containerExpirationPolicy,
update: (data) => data.project?.containerExpirationPolicy,
result({ data }) {
this.workingCopy = { ...get(data, 'project.containerExpirationPolicy', {}) };
},
......
......@@ -96,7 +96,7 @@ export default {
return this.isLoading || this.mutationLoading;
},
fieldsAreValid() {
return Object.values(this.localErrors).every(error => error);
return Object.values(this.localErrors).every((error) => error);
},
isSubmitButtonDisabled() {
return !this.fieldsAreValid || this.showLoadingIcon;
......@@ -121,7 +121,7 @@ export default {
},
methods: {
findDefaultOption(option) {
return this.value[option] || this.$options.formOptions[option].find(f => f.default)?.key;
return this.value[option] || this.$options.formOptions[option].find((f) => f.default)?.key;
},
reset() {
this.track('reset_form');
......@@ -131,7 +131,7 @@ export default {
},
setApiErrors(response) {
this.apiErrors = response.graphQLErrors.reduce((acc, curr) => {
curr.extensions.problems.forEach(item => {
curr.extensions.problems.forEach((item) => {
acc[item.path[0]] = item.message;
});
return acc;
......@@ -163,7 +163,7 @@ export default {
this.$toast.show(UPDATE_SETTINGS_SUCCESS_MESSAGE, { type: 'success' });
}
})
.catch(error => {
.catch((error) => {
this.setApiErrors(error);
this.$toast.show(UPDATE_SETTINGS_ERROR_MESSAGE, { type: 'error' });
})
......
import { produce } from 'immer';
import expirationPolicyQuery from '../queries/get_expiration_policy.query.graphql';
export const updateContainerExpirationPolicy = projectPath => (client, { data: updatedData }) => {
export const updateContainerExpirationPolicy = (projectPath) => (client, { data: updatedData }) => {
const queryAndParams = {
query: expirationPolicyQuery,
variables: { projectPath },
};
const sourceData = client.readQuery(queryAndParams);
const data = produce(sourceData, draftState => {
const data = produce(sourceData, (draftState) => {
// eslint-disable-next-line no-param-reassign
draftState.project.containerExpirationPolicy = {
...updatedData.updateContainerExpirationPolicy.containerExpirationPolicy,
......
import { n__ } from '~/locale';
import { KEEP_N_OPTIONS, CADENCE_OPTIONS, OLDER_THAN_OPTIONS } from './constants';
export const findDefaultOption = options => {
const item = options.find(o => o.default);
export const findDefaultOption = (options) => {
const item = options.find((o) => o.default);
return item ? item.key : null;
};
export const olderThanTranslationGenerator = variable => n__('%d day', '%d days', variable);
export const olderThanTranslationGenerator = (variable) => n__('%d day', '%d days', variable);
export const keepNTranslationGenerator = variable =>
export const keepNTranslationGenerator = (variable) =>
n__('%d tag per image name', '%d tags per image name', variable);
export const optionLabelGenerator = (collection, translationFn) =>
collection.map(option => ({
collection.map((option) => ({
...option,
label: translationFn(option.variable),
}));
......
......@@ -118,7 +118,7 @@ export default {
let position = 0;
const untouchedRawRefs = rawRefs
.filter(ref => {
.filter((ref) => {
let isTouched = false;
if (caretPos >= position && caretPos <= position + ref.length) {
......@@ -130,7 +130,7 @@ export default {
return !isTouched;
})
.filter(ref => ref.trim().length > 0);
.filter((ref) => ref.trim().length > 0);
this.$emit('addIssuableFormInput', {
newValue: value,
......@@ -208,7 +208,7 @@ export default {
:path-id-separator="pathIdSeparator"
event-namespace="pendingIssuable"
@pendingIssuableRemoveRequest="
params => {
(params) => {
$emit('pendingIssuableRemoveRequest', params);
}
"
......
......@@ -90,11 +90,11 @@ export default {
categorisedIssues() {
if (this.showCategorizedIssues) {
return Object.values(linkedIssueTypesMap)
.map(linkType => ({
.map((linkType) => ({
linkType,
issues: this.relatedIssues.filter(issue => issue.linkType === linkType),
issues: this.relatedIssues.filter((issue) => issue.linkType === linkType),
}))
.filter(obj => obj.issues.length > 0);
.filter((obj) => obj.issues.length > 0);
}
return [{ issues: this.relatedIssues }];
......
......@@ -110,7 +110,7 @@ export default {
},
methods: {
findRelatedIssueById(id) {
return this.state.relatedIssues.find(issue => issue.id === id);
return this.state.relatedIssues.find((issue) => issue.id === id);
},
onRelatedIssueRemoveRequest(idToRemove) {
const issueToRemove = this.findRelatedIssueById(idToRemove);
......@@ -120,7 +120,7 @@ export default {
.then(({ data }) => {
this.store.setRelatedIssues(data.issuables);
})
.catch(res => {
.catch((res) => {
if (res && res.status !== 404) {
Flash(relatedIssuesRemoveErrorMap[this.issuableType]);
}
......@@ -219,7 +219,7 @@ export default {
this.processAllReferences(newValue);
},
processAllReferences(value = '') {
const rawReferences = value.split(/\s+/).filter(reference => reference.trim().length > 0);
const rawReferences = value.split(/\s+/).filter((reference) => reference.trim().length > 0);
this.store.addPendingReferences(rawReferences);
this.inputValue = '';
......
......@@ -11,7 +11,7 @@ export default function initRelatedIssues() {
components: {
relatedIssuesRoot: RelatedIssuesRoot,
},
render: createElement =>
render: (createElement) =>
createElement('related-issues-root', {
props: {
endpoint: relatedIssuesRootElement.dataset.endpoint,
......
......@@ -19,7 +19,7 @@ class RelatedIssuesStore {
}
removeRelatedIssue(issue) {
this.state.relatedIssues = this.state.relatedIssues.filter(x => x.id !== issue.id);
this.state.relatedIssues = this.state.relatedIssues.filter((x) => x.id !== issue.id);
}
updateIssueOrder(oldIndex, newIndex) {
......
......@@ -15,7 +15,7 @@ export default function initRelatedMergeRequests() {
RelatedMergeRequests,
},
store: createStore(),
render: createElement =>
render: (createElement) =>
createElement('related-merge-requests', {
props: { endpoint, projectNamespace, projectPath },
}),
......
......@@ -21,7 +21,7 @@ export const fetchMergeRequests = ({ state, dispatch }) => {
return axios
.get(`${state.apiEndpoint}?per_page=${REQUEST_PAGE_COUNT}`)
.then(res => {
.then((res) => {
const { headers, data } = res;
const total = Number(normalizeHeaders(headers)['X-TOTAL']) || 0;
......
......@@ -47,7 +47,7 @@ export default {
sections() {
return [
{
links: get(this.assets, 'sources', []).map(s => ({
links: get(this.assets, 'sources', []).map((s) => ({
url: s.url,
name: sprintf(__('Source code (%{fileExtension})'), { fileExtension: s.format }),
})),
......@@ -73,7 +73,7 @@ export default {
links: this.otherLinks,
iconName: 'link',
},
].filter(section => section.links.length > 0);
].filter((section) => section.links.length > 0);
},
},
methods: {
......@@ -81,7 +81,7 @@ export default {
this.isAssetsExpanded = !this.isAssetsExpanded;
},
linksForType(type) {
return this.assets.links.filter(l => l.linkType === type);
return this.assets.links.filter((l) => l.linkType === type);
},
},
externalLinkTooltipText: __('This link points to external content'),
......
......@@ -64,7 +64,7 @@ export default {
},
issueCounts() {
return this.milestones
.map(m => m.issueStats || {})
.map((m) => m.issueStats || {})
.reduce(
(acc, current) => {
acc.total += current.total || 0;
......@@ -79,11 +79,11 @@ export default {
);
},
showMergeRequestStats() {
return this.milestones.some(m => m.mrStats);
return this.milestones.some((m) => m.mrStats);
},
mergeRequestCounts() {
return this.milestones
.map(m => m.mrStats || {})
.map((m) => m.mrStats || {})
.reduce(
(acc, current) => {
acc.total += current.total || 0;
......
......@@ -11,14 +11,14 @@ export default {
},
computed: {
...mapState('list', {
orderBy: state => state.sorting.orderBy,
sort: state => state.sorting.sort,
orderBy: (state) => state.sorting.orderBy,
sort: (state) => state.sorting.sort,
}),
sortOptions() {
return SORT_OPTIONS;
},
sortText() {
const option = this.sortOptions.find(s => s.orderBy === this.orderBy);
const option = this.sortOptions.find((s) => s.orderBy === this.orderBy);
return option.label;
},
isSortAscending() {
......
......@@ -18,6 +18,6 @@ export default () => {
return new Vue({
el,
store,
render: h => h(ReleaseEditNewApp),
render: (h) => h(ReleaseEditNewApp),
});
};
......@@ -21,6 +21,6 @@ export default () => {
graphqlMilestoneStats: Boolean(gon.features?.graphqlMilestoneStats),
},
}),
render: h => h(ReleaseListApp),
render: (h) => h(ReleaseListApp),
});
};
......@@ -18,6 +18,6 @@ export default () => {
return new Vue({
el,
store,
render: h => h(ReleaseEditNewApp),
render: (h) => h(ReleaseEditNewApp),
});
};
......@@ -21,6 +21,6 @@ export default () => {
return new Vue({
el,
store,
render: h => h(ReleaseShowApp),
render: (h) => h(ReleaseShowApp),
});
};
......@@ -2,7 +2,7 @@
* @returns {Boolean} `true` if all the feature flags
* required to enable the GraphQL endpoint are enabled
*/
export const useGraphQLEndpoint = rootState => {
export const useGraphQLEndpoint = (rootState) => {
return Boolean(
rootState.featureFlags.graphqlReleaseData &&
rootState.featureFlags.graphqlReleasesPage &&
......
......@@ -36,12 +36,12 @@ export const fetchRelease = ({ commit, state, rootState }) => {
tagName: state.tagName,
},
})
.then(response => {
.then((response) => {
const { data: release } = convertOneReleaseGraphQLResponse(response);
commit(types.RECEIVE_RELEASE_SUCCESS, release);
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while getting the release details'));
});
......@@ -52,7 +52,7 @@ export const fetchRelease = ({ commit, state, rootState }) => {
.then(({ data }) => {
commit(types.RECEIVE_RELEASE_SUCCESS, apiJsonToRelease(data));
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while getting the release details'));
});
......@@ -121,7 +121,7 @@ export const createRelease = ({ commit, dispatch, state, getters }) => {
.then(({ data }) => {
dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(data));
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_SAVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while creating a new release'));
});
......@@ -163,7 +163,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
// Delete all links currently associated with this Release
return Promise.all(
getters.releaseLinksToDelete.map(l =>
getters.releaseLinksToDelete.map((l) =>
api.deleteReleaseLink(state.projectId, state.release.tagName, l.id),
),
);
......@@ -171,7 +171,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
.then(() => {
// Create a new link for each link in the form
return Promise.all(
apiJson.assets.links.map(l =>
apiJson.assets.links.map((l) =>
api.createReleaseLink(state.projectId, state.release.tagName, l),
),
);
......@@ -179,7 +179,7 @@ export const updateRelease = ({ commit, dispatch, state, getters }) => {
.then(() => {
dispatch('receiveSaveReleaseSuccess', apiJsonToRelease(updatedRelease));
})
.catch(error => {
.catch((error) => {
commit(types.RECEIVE_SAVE_RELEASE_ERROR, error);
createFlash(s__('Release|Something went wrong while saving the release details'));
})
......
......@@ -5,7 +5,7 @@ import { hasContent } from '~/lib/utils/text_utility';
* @returns {Boolean} `true` if the app is editing an existing release.
* `false` if the app is creating a new release.
*/
export const isExistingRelease = state => {
export const isExistingRelease = (state) => {
return Boolean(state.tagName);
};
......@@ -15,19 +15,19 @@ export const isExistingRelease = state => {
* empty (or whitespace-only) values for both `url` and `name`.
* Otherwise, `false`.
*/
const isEmptyReleaseLink = link => !hasContent(link.url) && !hasContent(link.name);
const isEmptyReleaseLink = (link) => !hasContent(link.url) && !hasContent(link.name);
/** Returns all release links that aren't empty */
export const releaseLinksToCreate = state => {
export const releaseLinksToCreate = (state) => {
if (!state.release) {
return [];
}
return state.release.assets.links.filter(l => !isEmptyReleaseLink(l));
return state.release.assets.links.filter((l) => !isEmptyReleaseLink(l));
};
/** Returns all release links that should be deleted */
export const releaseLinksToDelete = state => {
export const releaseLinksToDelete = (state) => {
if (!state.originalRelease) {
return [];
}
......@@ -36,7 +36,7 @@ export const releaseLinksToDelete = state => {
};
/** Returns all validation errors on the release object */
export const validationErrors = state => {
export const validationErrors = (state) => {
const errors = {
assets: {
links: {},
......@@ -56,7 +56,7 @@ export const validationErrors = state => {
// This is used for detecting duplicate URLs.
const urlToLinksMap = new Map();
state.release.assets.links.forEach(link => {
state.release.assets.links.forEach((link) => {
errors.assets.links[link.id] = {};
// Only validate non-empty URLs
......@@ -81,7 +81,7 @@ export const validationErrors = state => {
// add a validation error for each link that shares this URL
const duplicates = urlToLinksMap.get(normalizedUrl);
duplicates.push(link);
duplicates.forEach(duplicateLink => {
duplicates.forEach((duplicateLink) => {
errors.assets.links[duplicateLink.id].isDuplicate = true;
});
} else {
......
......@@ -3,7 +3,7 @@ import * as getters from './getters';
import mutations from './mutations';
import createState from './state';
export default initialState => ({
export default (initialState) => ({
namespaced: true,
actions,
getters,
......
......@@ -3,7 +3,7 @@ import * as types from './mutation_types';
import { DEFAULT_ASSET_LINK_TYPE } from '../../../constants';
const findReleaseLink = (release, id) => {
return release.assets.links.find(l => l.id === id);
return release.assets.links.find((l) => l.id === id);
};
export default {
......@@ -93,6 +93,6 @@ export default {
},
[types.REMOVE_ASSET_LINK](state, linkIdToRemove) {
state.release.assets.links = state.release.assets.links.filter(l => l.id !== linkIdToRemove);
state.release.assets.links = state.release.assets.links.filter((l) => l.id !== linkIdToRemove);
},
};
......@@ -68,7 +68,7 @@ export const fetchReleasesGraphQl = (
...paginationParams,
},
})
.then(response => {
.then((response) => {
const { data, paginationInfo: graphQlPageInfo } = convertAllReleasesGraphQLResponse(response);
commit(types.RECEIVE_RELEASES_SUCCESS, {
......
......@@ -2,7 +2,7 @@ import createState from './state';
import * as actions from './actions';
import mutations from './mutations';
export default initialState => ({
export default (initialState) => ({
namespaced: true,
actions,
mutations,
......
......@@ -17,7 +17,7 @@ export const releaseToApiJson = (release, createFrom = null) => {
// Milestones may be either a list of milestone objects OR just a list
// of milestone titles. The API requires only the titles be sent.
const milestones = (release.milestones || []).map(m => m.title || m);
const milestones = (release.milestones || []).map((m) => m.title || m);
return convertObjectPropsToSnakeCase(
{
......@@ -37,7 +37,7 @@ export const releaseToApiJson = (release, createFrom = null) => {
* into the structure this Vue application can work with.
* @param {Object} json The JSON object received from the release API
*/
export const apiJsonToRelease = json => {
export const apiJsonToRelease = (json) => {
const release = convertObjectPropsToCamelCase(json, { deep: true });
release.milestones = release.milestones || [];
......@@ -47,7 +47,7 @@ export const apiJsonToRelease = json => {
export const gqClient = createGqClient({}, { fetchPolicy: fetchPolicies.NO_CACHE });
const convertScalarProperties = graphQLRelease =>
const convertScalarProperties = (graphQLRelease) =>
pick(graphQLRelease, [
'name',
'tagName',
......@@ -57,29 +57,29 @@ const convertScalarProperties = graphQLRelease =>
'upcomingRelease',
]);
const convertAssets = graphQLRelease => ({
const convertAssets = (graphQLRelease) => ({
assets: {
count: graphQLRelease.assets.count,
sources: [...graphQLRelease.assets.sources.nodes],
links: graphQLRelease.assets.links.nodes.map(l => ({
links: graphQLRelease.assets.links.nodes.map((l) => ({
...l,
linkType: l.linkType?.toLowerCase(),
})),
},
});
const convertEvidences = graphQLRelease => ({
evidences: graphQLRelease.evidences.nodes.map(e => e),
const convertEvidences = (graphQLRelease) => ({
evidences: graphQLRelease.evidences.nodes.map((e) => e),
});
const convertLinks = graphQLRelease => ({
const convertLinks = (graphQLRelease) => ({
_links: {
...graphQLRelease.links,
self: graphQLRelease.links?.selfUrl,
},
});
const convertCommit = graphQLRelease => {
const convertCommit = (graphQLRelease) => {
if (!graphQLRelease.commit) {
return {};
}
......@@ -93,10 +93,10 @@ const convertCommit = graphQLRelease => {
};
};
const convertAuthor = graphQLRelease => ({ author: graphQLRelease.author });
const convertAuthor = (graphQLRelease) => ({ author: graphQLRelease.author });
const convertMilestones = graphQLRelease => ({
milestones: graphQLRelease.milestones.nodes.map(m => ({
const convertMilestones = (graphQLRelease) => ({
milestones: graphQLRelease.milestones.nodes.map((m) => ({
...m,
webUrl: m.webPath,
webPath: undefined,
......@@ -115,7 +115,7 @@ const convertMilestones = graphQLRelease => ({
*
* @param graphQLRelease The release object returned from a GraphQL query
*/
export const convertGraphQLRelease = graphQLRelease => ({
export const convertGraphQLRelease = (graphQLRelease) => ({
...convertScalarProperties(graphQLRelease),
...convertAssets(graphQLRelease),
...convertEvidences(graphQLRelease),
......@@ -134,7 +134,7 @@ export const convertGraphQLRelease = graphQLRelease => ({
*
* @param response The response received from the GraphQL endpoint
*/
export const convertAllReleasesGraphQLResponse = response => {
export const convertAllReleasesGraphQLResponse = (response) => {
const releases = response.data.project.releases.nodes.map(convertGraphQLRelease);
const paginationInfo = {
......@@ -153,7 +153,7 @@ export const convertAllReleasesGraphQLResponse = response => {
*
* @param response The response received from the GraphQL endpoint
*/
export const convertOneReleaseGraphQLResponse = response => {
export const convertOneReleaseGraphQLResponse = (response) => {
const release = convertGraphQLRelease(response.data.project.release);
return { data: release };
......
import { LOADING, ERROR, SUCCESS, STATUS_FAILED } from '../../constants';
import { s__, n__ } from '~/locale';
export const groupedSummaryText = state => {
export const groupedSummaryText = (state) => {
if (state.isLoading) {
return s__('Reports|Accessibility scanning results are being parsed');
}
......@@ -22,7 +22,7 @@ export const groupedSummaryText = state => {
);
};
export const summaryStatus = state => {
export const summaryStatus = (state) => {
if (state.isLoading) {
return LOADING;
}
......@@ -34,12 +34,12 @@ export const summaryStatus = state => {
return SUCCESS;
};
export const shouldRenderIssuesList = state =>
Object.values(state.report).some(x => Array.isArray(x) && x.length > 0);
export const shouldRenderIssuesList = (state) =>
Object.values(state.report).some((x) => Array.isArray(x) && x.length > 0);
// We could just map state, but we're going to iterate in the future
// to add notes and warnings to these issue lists, so I'm going to
// keep these as getters
export const unresolvedIssues = state => state.report.existing_errors;
export const resolvedIssues = state => state.report.resolved_errors;
export const newIssues = state => state.report.new_errors;
export const unresolvedIssues = (state) => state.report.existing_errors;
export const resolvedIssues = (state) => state.report.resolved_errors;
export const newIssues = (state) => state.report.new_errors;
......@@ -7,11 +7,11 @@ import state from './state';
Vue.use(Vuex);
export const getStoreConfig = initialState => ({
export const getStoreConfig = (initialState) => ({
actions,
getters,
mutations,
state: state(initialState),
});
export default initialState => new Vuex.Store(getStoreConfig(initialState));
export default (initialState) => new Vuex.Store(getStoreConfig(initialState));
......@@ -11,13 +11,13 @@ export const fetchReports = ({ state, dispatch, commit }) => {
return dispatch('receiveReportsError');
}
return Promise.all([axios.get(state.headPath), axios.get(state.basePath)])
.then(results =>
.then((results) =>
doCodeClimateComparison(
parseCodeclimateMetrics(results[0].data, state.headBlobPath),
parseCodeclimateMetrics(results[1].data, state.baseBlobPath),
),
)
.then(data => dispatch('receiveReportsSuccess', data))
.then((data) => dispatch('receiveReportsSuccess', data))
.catch(() => dispatch('receiveReportsError'));
};
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment