Commit 333bad89 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 14 of 73

Part of our prettier migration; changing the arrow-parens style.
parent b1f29131
......@@ -19,7 +19,7 @@ class RecentSearchesStore {
}
setRecentSearches(searches = []) {
const trimmedSearches = searches.map(search =>
const trimmedSearches = searches.map((search) =>
typeof search === 'string' ? search.trim() : search,
);
......
......@@ -40,7 +40,7 @@ export default class VisualTokenValue {
return (
UsersCache.retrieve(username)
.then(user => {
.then((user) => {
if (!user) {
return;
}
......@@ -68,9 +68,9 @@ export default class VisualTokenValue {
);
return AjaxCache.retrieve(labelsEndpointWithParams)
.then(labels => {
.then((labels) => {
const matchingLabel = (labels || []).find(
label => `~${DropdownUtils.getEscapedText(label.title)}` === tokenValue,
(label) => `~${DropdownUtils.getEscapedText(label.title)}` === tokenValue,
);
if (!matchingLabel) {
......@@ -96,8 +96,8 @@ export default class VisualTokenValue {
);
return AjaxCache.retrieve(epicsEndpointWithParams)
.then(epics => {
const matchingEpic = (epics || []).find(epic => epic.id === Number(tokenValue));
.then((epics) => {
const matchingEpic = (epics || []).find((epic) => epic.id === Number(tokenValue));
if (!matchingEpic) {
return;
......
......@@ -34,7 +34,7 @@ const hideFlash = (flashEl, fadeTransition = true) => {
if (!fadeTransition) flashEl.dispatchEvent(new Event('transitionend'));
};
const createAction = config => `
const createAction = (config) => `
<a
href="${config.href || '#'}"
class="flash-action"
......@@ -97,7 +97,7 @@ const deprecatedCreateFlash = function deprecatedCreateFlash(
if (actionConfig.clickHandler) {
flashEl
.querySelector('.flash-action')
.addEventListener('click', e => actionConfig.clickHandler(e));
.addEventListener('click', (e) => actionConfig.clickHandler(e));
}
}
......@@ -151,7 +151,7 @@ const createFlash = function createFlash({
if (actionConfig.clickHandler) {
flashEl
.querySelector('.flash-action')
.addEventListener('click', e => actionConfig.clickHandler(e));
.addEventListener('click', (e) => actionConfig.clickHandler(e));
}
}
......
......@@ -12,7 +12,7 @@ let sidebar;
export const mousePos = [];
export const setSidebar = el => {
export const setSidebar = (el) => {
sidebar = el;
};
export const getOpenMenu = () => currentOpenMenu;
......@@ -32,7 +32,7 @@ const setHeaderHeight = () => {
export const isSidebarCollapsed = () =>
sidebar && sidebar.classList.contains(SIDEBAR_COLLAPSED_CLASS);
export const canShowActiveSubItems = el => {
export const canShowActiveSubItems = (el) => {
if (el.classList.contains('active') && !isSidebarCollapsed()) {
return false;
}
......@@ -71,7 +71,7 @@ export const calculateTop = (boundingRect, outerHeight) => {
: boundingRect.top;
};
export const hideMenu = el => {
export const hideMenu = (el) => {
if (!el) return;
const parentEl = el.parentNode;
......@@ -112,7 +112,7 @@ export const moveSubItemsToPosition = (el, subItems) => {
}
};
export const showSubLevelItems = el => {
export const showSubLevelItems = (el) => {
const subItems = el.querySelector('.sidebar-sub-level-items');
const isIconOnly = subItems && subItems.classList.contains('is-fly-out-only');
......@@ -139,7 +139,7 @@ export const mouseEnterTopItems = (el, timeout = getHideSubItemsInterval()) => {
}, timeout);
};
export const mouseLeaveTopItem = el => {
export const mouseLeaveTopItem = (el) => {
const subItems = el.querySelector('.sidebar-sub-level-items');
if (
......@@ -152,7 +152,7 @@ export const mouseLeaveTopItem = el => {
el.classList.remove(IS_OVER_CLASS);
};
export const documentMouseMove = e => {
export const documentMouseMove = (e) => {
mousePos.push({
x: e.clientX,
y: e.clientY,
......@@ -161,7 +161,7 @@ export const documentMouseMove = e => {
if (mousePos.length > 6) mousePos.shift();
};
export const subItemsMouseLeave = relatedTarget => {
export const subItemsMouseLeave = (relatedTarget) => {
clearTimeout(timeoutId);
if (relatedTarget && !relatedTarget.closest(`.${IS_OVER_CLASS}`)) {
......@@ -189,15 +189,15 @@ export default () => {
requestIdleCallback(setHeaderHeight);
items.forEach(el => {
items.forEach((el) => {
const subItems = el.querySelector('.sidebar-sub-level-items');
if (subItems) {
subItems.addEventListener('mouseleave', e => subItemsMouseLeave(e.relatedTarget));
subItems.addEventListener('mouseleave', (e) => subItemsMouseLeave(e.relatedTarget));
}
el.addEventListener('mouseenter', e => mouseEnterTopItems(e.currentTarget));
el.addEventListener('mouseleave', e => mouseLeaveTopItem(e.currentTarget));
el.addEventListener('mouseenter', (e) => mouseEnterTopItems(e.currentTarget));
el.addEventListener('mouseleave', (e) => mouseLeaveTopItem(e.currentTarget));
});
document.addEventListener('mousemove', documentMouseMove);
......
......@@ -77,7 +77,7 @@ export default {
// Check if item already exists in list
const itemMatchIndex = storedFrequentItems.findIndex(
frequentItem => frequentItem.id === item.id,
(frequentItem) => frequentItem.id === item.id,
);
if (itemMatchIndex > -1) {
......
......@@ -18,7 +18,7 @@ const frequentItemDropdowns = [
];
export default function initFrequentItemDropdowns() {
frequentItemDropdowns.forEach(dropdown => {
frequentItemDropdowns.forEach((dropdown) => {
const { namespace, key } = dropdown;
const el = document.getElementById(`js-${namespace}-dropdown`);
const navEl = document.getElementById(`nav-${namespace}-dropdown`);
......
......@@ -59,7 +59,7 @@ export const fetchSearchedItems = ({ state, dispatch }, searchQuery) => {
}
return Api[state.namespace](searchQuery, params)
.then(results => {
.then((results) => {
dispatch('receiveSearchedItemsSuccess', results);
})
.catch(() => {
......
export const hasSearchQuery = state => state.searchQuery !== '';
export const hasSearchQuery = (state) => state.searchQuery !== '';
......@@ -50,7 +50,7 @@ export default {
[types.RECEIVE_SEARCHED_ITEMS_SUCCESS](state, results) {
const rawItems = results.data ? results.data : results; // Api.groups returns array, Api.projects returns object
Object.assign(state, {
items: rawItems.map(rawItem => ({
items: rawItems.map((rawItem) => ({
id: rawItem.id,
name: rawItem.name,
namespace: rawItem.name_with_namespace || rawItem.full_name,
......
......@@ -5,7 +5,7 @@ import { FREQUENT_ITEMS, HOUR_IN_MS } from './constants';
export const isMobile = () => ['md', 'sm', 'xs'].includes(bp.getBreakpointSize());
export const getTopFrequentItems = items => {
export const getTopFrequentItems = (items) => {
if (!items) {
return [];
}
......@@ -13,7 +13,7 @@ export const getTopFrequentItems = items => {
? FREQUENT_ITEMS.LIST_COUNT_MOBILE
: FREQUENT_ITEMS.LIST_COUNT_DESKTOP;
const frequentItems = items.filter(item => item.frequency >= FREQUENT_ITEMS.ELIGIBLE_FREQUENCY);
const frequentItems = items.filter((item) => item.frequency >= FREQUENT_ITEMS.ELIGIBLE_FREQUENCY);
if (!frequentItems || frequentItems.length === 0) {
return [];
......@@ -45,9 +45,9 @@ export const updateExistingFrequentItem = (frequentItem, item) => {
};
};
export const sanitizeItem = item => {
export const sanitizeItem = (item) => {
// Only sanitize if the key exists on the item
const maybeSanitize = key => {
const maybeSanitize = (key) => {
if (!Object.prototype.hasOwnProperty.call(item, key)) {
return {};
}
......
......@@ -15,7 +15,7 @@ function sanitize(str) {
}
export function membersBeforeSave(members) {
return members.map(member => {
return members.map((member) => {
const GROUP_TYPE = 'Group';
let title = '';
......@@ -156,7 +156,7 @@ class GfmAutoComplete {
...this.getDefaultCallbacks(),
beforeSave(commands) {
if (GfmAutoComplete.isLoading(commands)) return commands;
return $.map(commands, c => {
return $.map(commands, (c) => {
let search = c.name;
if (c.aliases.length > 0) {
search = `${search} ${c.aliases.join(' ')}`;
......@@ -237,7 +237,7 @@ class GfmAutoComplete {
});
// return to the form atwho wants
return results.map(name => ({ name }));
return results.map((name) => ({ name }));
},
},
});
......@@ -288,7 +288,7 @@ class GfmAutoComplete {
const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
// Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands.
command = subtextNodes.find(node => {
command = subtextNodes.find((node) => {
if (Object.values(MEMBER_COMMAND).includes(node)) {
return node;
}
......@@ -298,7 +298,7 @@ class GfmAutoComplete {
// Cache assignees list for easier filtering later
assignees =
SidebarMediator.singleton?.store?.assignees?.map(
assignee => `${assignee.username} ${assignee.name}`,
(assignee) => `${assignee.username} ${assignee.name}`,
) || [];
const match = GfmAutoComplete.defaultMatcher(flag, subtext, this.app.controllers);
......@@ -316,10 +316,10 @@ class GfmAutoComplete {
if (command === MEMBER_COMMAND.ASSIGN) {
// Only include members which are not assigned to Issuable currently
return data.filter(member => !assignees.includes(member.search));
return data.filter((member) => !assignees.includes(member.search));
} else if (command === MEMBER_COMMAND.UNASSIGN) {
// Only include members which are assigned to Issuable currently
return data.filter(member => assignees.includes(member.search));
return data.filter((member) => assignees.includes(member.search));
}
return data;
......@@ -346,7 +346,7 @@ class GfmAutoComplete {
callbacks: {
...this.getDefaultCallbacks(),
beforeSave(issues) {
return $.map(issues, i => {
return $.map(issues, (i) => {
if (i.title == null) {
return i;
}
......@@ -380,7 +380,7 @@ class GfmAutoComplete {
callbacks: {
...this.getDefaultCallbacks(),
beforeSave(milestones) {
return $.map(milestones, m => {
return $.map(milestones, (m) => {
if (m.title == null) {
return m;
}
......@@ -413,7 +413,7 @@ class GfmAutoComplete {
callbacks: {
...this.getDefaultCallbacks(),
beforeSave(merges) {
return $.map(merges, m => {
return $.map(merges, (m) => {
if (m.title == null) {
return m;
}
......@@ -454,7 +454,7 @@ class GfmAutoComplete {
...this.getDefaultCallbacks(),
beforeSave(merges) {
if (GfmAutoComplete.isLoading(merges)) return merges;
return $.map(merges, m => ({
return $.map(merges, (m) => ({
title: sanitize(m.title),
color: m.color,
search: m.title,
......@@ -465,7 +465,7 @@ class GfmAutoComplete {
const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
// Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands.
command = subtextNodes.find(node => {
command = subtextNodes.find((node) => {
if (
node === LABEL_COMMAND.LABEL ||
node === LABEL_COMMAND.RELABEL ||
......@@ -486,7 +486,7 @@ class GfmAutoComplete {
return null;
}
const lastCandidate = subtext.split(flag).pop();
if (labels.find(label => label.title.startsWith(lastCandidate))) {
if (labels.find((label) => label.title.startsWith(lastCandidate))) {
return lastCandidate;
}
} else {
......@@ -513,10 +513,10 @@ class GfmAutoComplete {
// because we want to return all the labels (unfiltered) for that command.
if (command === LABEL_COMMAND.LABEL) {
// Return labels with set: undefined.
return data.filter(label => !label.set);
return data.filter((label) => !label.set);
} else if (command === LABEL_COMMAND.UNLABEL) {
// Return labels with set: true.
return data.filter(label => label.set);
return data.filter((label) => label.set);
}
return data;
......@@ -543,7 +543,7 @@ class GfmAutoComplete {
callbacks: {
...this.getDefaultCallbacks(),
beforeSave(snippets) {
return $.map(snippets, m => {
return $.map(snippets, (m) => {
if (m.title == null) {
return m;
}
......@@ -648,7 +648,7 @@ class GfmAutoComplete {
this.loadEmojiData($input, at).catch(() => {});
} else if (dataSource) {
AjaxCache.retrieve(dataSource, true)
.then(data => {
.then((data) => {
this.loadData($input, at, data);
})
.catch(() => {
......@@ -690,11 +690,11 @@ class GfmAutoComplete {
}
lookup[key].push({ kind, emoji });
};
Object.values(emojis).forEach(emoji => {
Object.values(emojis).forEach((emoji) => {
add(emoji.name, 'name', emoji);
add(emoji.d, 'description', emoji);
add(emoji.e, 'unicode', emoji);
emoji.aliases.forEach(a => add(a, 'alias', emoji));
emoji.aliases.forEach((a) => add(a, 'alias', emoji));
});
this.emojiLookup = lookup;
......@@ -766,7 +766,7 @@ GfmAutoComplete.atTypeMap = {
};
GfmAutoComplete.typesWithBackendFiltering = ['vulnerabilities'];
GfmAutoComplete.isTypeWithBackendFiltering = type =>
GfmAutoComplete.isTypeWithBackendFiltering = (type) =>
GfmAutoComplete.typesWithBackendFiltering.includes(GfmAutoComplete.atTypeMap[type]);
function findEmoji(name) {
......
......@@ -16,14 +16,14 @@ export default class GlFieldErrors {
initValidators() {
// register selectors here as needed
const validateSelectors = [':text', ':password', '[type=email]', '[type=url]', '[type=number]']
.map(selector => `input${selector}`)
.map((selector) => `input${selector}`)
.join(',');
this.state.inputs = this.form
.find(validateSelectors)
.toArray()
.filter(input => !input.classList.contains(customValidationFlag))
.map(input => new GlFieldError({ input, formErrors: this }));
.filter((input) => !input.classList.contains(customValidationFlag))
.map((input) => new GlFieldError({ input, formErrors: this }));
this.form.on('submit', GlFieldErrors.catchInvalidFormSubmit);
}
......@@ -45,7 +45,7 @@ export default class GlFieldErrors {
/* Public method for triggering validity updates manually */
updateFormValidityState() {
this.state.inputs.forEach(field => {
this.state.inputs.forEach((field) => {
if (field.state.submitted) {
field.updateValidity();
}
......
......@@ -20,7 +20,7 @@ export default class GLForm {
// Disable autocomplete for keywords which do not have dataSources available
const dataSources = (gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources) || {};
Object.keys(this.enableGFM).forEach(item => {
Object.keys(this.enableGFM).forEach((item) => {
if (item !== 'emojis' && !dataSources[item]) {
this.enableGFM[item] = false;
}
......
......@@ -28,7 +28,7 @@ export default class GpgBadges {
return axios
.get(endpoint, { params })
.then(({ data }) => {
data.signatures.forEach(signature => {
data.signatures.forEach((signature) => {
badges.filter(`[data-commit-sha="${signature.commit_sha}"]`).replaceWith(signature.html);
});
})
......
......@@ -24,7 +24,7 @@ export const updateGrafanaIntegration = ({ state, dispatch }) =>
},
})
.then(() => dispatch('receiveGrafanaIntegrationUpdateSuccess'))
.catch(error => dispatch('receiveGrafanaIntegrationUpdateError', error));
.catch((error) => dispatch('receiveGrafanaIntegrationUpdateError', error));
export const receiveGrafanaIntegrationUpdateSuccess = () => {
/**
......
......@@ -6,7 +6,7 @@ import mutations from './mutations';
Vue.use(Vuex);
export const createStore = initialState =>
export const createStore = (initialState) =>
new Vuex.Store({
state: createState(initialState),
actions,
......
......@@ -51,4 +51,4 @@ export const convertToGraphQLId = (type, id) => {
* @param {Array} ids An array of id values
* @returns {Array}
*/
export const convertToGraphQLIds = (type, ids) => ids.map(id => convertToGraphQLId(type, id));
export const convertToGraphQLIds = (type, ids) => ids.map((id) => convertToGraphQLId(type, id));
......@@ -12,7 +12,7 @@ export default class Group {
this.resetHandler = this.reset.bind(this);
this.updateGroupPathSlugHandler = this.updateGroupPathSlug.bind(this);
this.groupNames.forEach(groupName => {
this.groupNames.forEach((groupName) => {
if (groupName.value === '') {
groupName.addEventListener('keyup', this.updateHandler);
......@@ -22,7 +22,7 @@ export default class Group {
}
});
this.groupPaths.forEach(groupPath => {
this.groupPaths.forEach((groupPath) => {
groupPath.addEventListener('keydown', this.resetHandler);
});
}
......@@ -30,21 +30,21 @@ export default class Group {
update({ currentTarget: { value: updatedValue } }) {
const slug = slugify(updatedValue);
this.groupNames.forEach(element => {
this.groupNames.forEach((element) => {
element.value = updatedValue;
});
this.groupPaths.forEach(element => {
this.groupPaths.forEach((element) => {
element.value = slug;
});
}
reset() {
this.groupNames.forEach(groupName => {
this.groupNames.forEach((groupName) => {
groupName.removeEventListener('keyup', this.updateHandler);
groupName.removeEventListener('blur', this.checkPathHandler);
});
this.groupPaths.forEach(groupPath => {
this.groupPaths.forEach((groupPath) => {
groupPath.removeEventListener('keydown', this.resetHandler);
});
}
......@@ -59,7 +59,7 @@ export default class Group {
if (exists && suggests.length) {
const [suggestedSlug] = suggests;
this.groupPaths.forEach(element => {
this.groupPaths.forEach((element) => {
element.value = suggestedSlug;
});
} else if (exists && !suggests.length) {
......
......@@ -82,7 +82,7 @@ export default {
.then(() => {
this.isLoading = false;
})
.catch(error => {
.catch((error) => {
const message = [
error.response?.data?.error || __('An error occurred while updating configuration.'),
ERROR_MESSAGE,
......
......@@ -108,7 +108,7 @@ export default {
fetchGroups({ parentId, page, filterGroupsBy, sortBy, archived, updatePagination }) {
return this.service
.getGroups(parentId, page, filterGroupsBy, sortBy, archived)
.then(res => {
.then((res) => {
if (updatePagination) {
this.updatePagination(res.headers);
}
......@@ -135,7 +135,7 @@ export default {
sortBy,
archived,
updatePagination: true,
}).then(res => {
}).then((res) => {
this.isLoading = false;
this.updateGroups(res, Boolean(filterGroupsBy));
});
......@@ -149,7 +149,7 @@ export default {
sortBy,
archived,
updatePagination: true,
}).then(res => {
}).then((res) => {
this.isLoading = false;
$.scrollTo(0);
......@@ -173,7 +173,7 @@ export default {
this.fetchGroups({
parentId: parentGroup.id,
})
.then(res => {
.then((res) => {
this.store.setGroupChildren(parentGroup, res);
})
.catch(() => {
......@@ -194,12 +194,12 @@ export default {
this.targetGroup.isBeingRemoved = true;
this.service
.leaveGroup(this.targetGroup.leavePath)
.then(res => {
.then((res) => {
$.scrollTo(0);
this.store.removeGroup(this.targetGroup, this.targetParentGroup);
this.$toast.show(res.data.notice);
})
.catch(err => {
.catch((err) => {
let message = COMMON_STR.FAILURE;
if (err.status === 403) {
message = COMMON_STR.LEAVE_FORBIDDEN;
......
......@@ -23,7 +23,7 @@ export default {
},
methods: {
getDefaultOption() {
return this.visibilityLevelOptions.find(option => option.level === this.defaultLevel);
return this.visibilityLevelOptions.find((option) => option.level === this.defaultLevel);
},
onClick(option) {
this.selectedOption = option;
......
......@@ -18,6 +18,6 @@ export default function initInviteMembersBanner() {
isDismissedKey,
trackLabel,
},
render: createElement => createElement(InviteMembersBanner),
render: (createElement) => createElement(InviteMembersBanner),
});
}
......@@ -38,6 +38,6 @@ export const initGroupMembersApp = (
el,
components: { App },
store,
render: createElement => createElement('app'),
render: (createElement) => createElement('app'),
});
};
......@@ -7,7 +7,7 @@ import {
GROUP_LINK_ACCESS_LEVEL_PROPERTY_NAME,
} from './constants';
export const parseDataAttributes = el => {
export const parseDataAttributes = (el) => {
const { members, groupId, memberPath, canManageMembers } = el.dataset;
return {
......
......@@ -12,15 +12,15 @@ export default class GroupsStore {
setGroups(rawGroups) {
if (rawGroups && rawGroups.length) {
this.state.groups = rawGroups.map(rawGroup => this.formatGroupItem(rawGroup));
this.state.groups = rawGroups.map((rawGroup) => this.formatGroupItem(rawGroup));
} else {
this.state.groups = [];
}
}
setSearchedGroups(rawGroups) {
const formatGroups = groups =>
groups.map(group => {
const formatGroups = (groups) =>
groups.map((group) => {
const formattedGroup = this.formatGroupItem(group);
if (formattedGroup.children && formattedGroup.children.length) {
formattedGroup.children = formatGroups(formattedGroup.children);
......@@ -37,7 +37,7 @@ export default class GroupsStore {
setGroupChildren(parentGroup, children) {
const updatedParentGroup = parentGroup;
updatedParentGroup.children = children.map(rawChild => this.formatGroupItem(rawChild));
updatedParentGroup.children = children.map((rawChild) => this.formatGroupItem(rawChild));
updatedParentGroup.isOpen = true;
updatedParentGroup.isChildrenLoading = false;
}
......@@ -103,9 +103,9 @@ export default class GroupsStore {
removeGroup(group, parentGroup) {
const updatedParentGroup = parentGroup;
if (updatedParentGroup.children && updatedParentGroup.children.length) {
updatedParentGroup.children = parentGroup.children.filter(child => group.id !== child.id);
updatedParentGroup.children = parentGroup.children.filter((child) => group.id !== child.id);
} else {
this.state.groups = this.state.groups.filter(child => group.id !== child.id);
this.state.groups = this.state.groups.filter((child) => group.id !== child.id);
}
}
}
......@@ -20,11 +20,11 @@ export default class TransferDropdown {
initDeprecatedJQueryDropdown(this.groupDropdown, {
selectable: true,
filterable: true,
toggleLabel: item => item.text,
toggleLabel: (item) => item.text,
search: { fields: ['text'] },
data: extraOptions.concat(this.data),
text: item => item.text,
clicked: options => {
text: (item) => item.text,
clicked: (options) => {
const { e } = options;
e.preventDefault();
this.assignSelected(options.selectedObj);
......
......@@ -6,11 +6,11 @@ import { normalizeHeaders } from './lib/utils/common_utils';
import { __ } from '~/locale';
import { loadCSSFile } from './lib/utils/css_utils';
const fetchGroups = params => {
const fetchGroups = (params) => {
axios[params.type.toLowerCase()](params.url, {
params: params.data,
})
.then(res => {
.then((res) => {
const results = res.data || [];
const headers = normalizeHeaders(res.headers);
const currentPage = parseInt(headers['X-PAGE'], 10) || 0;
......@@ -67,7 +67,7 @@ const groupsSelect = () => {
const groups = data.length ? data : data.results || [];
const more = data.pagination ? data.pagination.more : false;
const results = groups.filter(group => skipGroups.indexOf(group.id) === -1);
const results = groups.filter((group) => skipGroups.indexOf(group.id) === -1);
return {
results,
......
......@@ -45,7 +45,7 @@ class EventHub {
$off(type, handler) {
const handlers = this.$_all.get(type) || [];
const newHandlers = handler ? handlers.filter(x => x !== handler) : [];
const newHandlers = handler ? handlers.filter((x) => x !== handler) : [];
if (newHandlers.length) {
this.$_all.set(type, newHandlers);
......@@ -77,7 +77,7 @@ class EventHub {
$emit(type, ...args) {
const handlers = this.$_all.get(type) || [];
handlers.forEach(handler => {
handlers.forEach((handler) => {
handler(...args);
});
}
......
......@@ -38,7 +38,7 @@ const templatedLabel = (queryLabel, metricAttributes) => {
* @example
* multiMetricLabel('', {__name__: "up", app: "prometheus"}) -> "__name__: up, app: prometheus"
*/
const multiMetricLabel = metricAttributes => {
const multiMetricLabel = (metricAttributes) => {
return Object.entries(metricAttributes)
.map(([templateVar, label]) => `${templateVar}: ${label}`)
.join(', ');
......@@ -64,7 +64,7 @@ export const getSeriesLabel = (queryLabel, metricAttributes) => {
* @returns {Array} The formatted values
*/
export const makeDataSeries = (queryResults, defaultConfig) =>
queryResults.map(result => {
queryResults.map((result) => {
return {
...defaultConfig,
data: result.values,
......
......@@ -23,13 +23,13 @@ const handleStartupEvents = () => {
/* For `waitForCSSLoaded` methods, see docs.gitlab.com/ee/development/fe_guide/performance.html#important-considerations */
export const waitForCSSLoaded = (action = () => {}) => {
if (!gon?.features?.startupCss || allLinksLoaded()) {
return new Promise(resolve => {
return new Promise((resolve) => {
action();
resolve();
});
}
return new Promise(resolve => {
return new Promise((resolve) => {
document.addEventListener(CSS_LOADED_EVENT, resolve, { once: true });
document.addEventListener(STARTUP_LINK_LOADED_EVENT, handleStartupEvents);
}).then(action);
......
import { commitItemIconMap } from './constants';
export default file => {
export default (file) => {
if (file.deleted) {
return commitItemIconMap.deleted;
} else if (file.tempFile && !file.prevPath) {
......
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