Commit 66da0984 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 25 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 216f795b
import { addIconStatus, formattedTime } from './utils'; import { addIconStatus, formattedTime } from './utils';
export const getTestSuites = state => { export const getTestSuites = (state) => {
const { test_suites: testSuites = [] } = state.testReports; const { test_suites: testSuites = [] } = state.testReports;
return testSuites.map(suite => ({ return testSuites.map((suite) => ({
...suite, ...suite,
formattedTime: formattedTime(suite.total_time), formattedTime: formattedTime(suite.total_time),
})); }));
}; };
export const getSelectedSuite = state => export const getSelectedSuite = (state) =>
state.testReports?.test_suites?.[state.selectedSuiteIndex] || {}; state.testReports?.test_suites?.[state.selectedSuiteIndex] || {};
export const getSuiteTests = state => { export const getSuiteTests = (state) => {
const { test_cases: testCases = [] } = getSelectedSuite(state); const { test_cases: testCases = [] } = getSelectedSuite(state);
const { page, perPage } = state.pageInfo; const { page, perPage } = state.pageInfo;
const start = (page - 1) * perPage; const start = (page - 1) * perPage;
...@@ -20,4 +20,4 @@ export const getSuiteTests = state => { ...@@ -20,4 +20,4 @@ export const getSuiteTests = state => {
return testCases.map(addIconStatus).slice(start, start + perPage); 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'; ...@@ -7,7 +7,7 @@ import mutations from './mutations';
Vue.use(Vuex); Vue.use(Vuex);
export default initialState => export default (initialState) =>
new Vuex.Store({ new Vuex.Store({
actions, actions,
getters, getters,
......
...@@ -25,7 +25,7 @@ export const formattedTime = (seconds = 0) => { ...@@ -25,7 +25,7 @@ export const formattedTime = (seconds = 0) => {
return sprintf(__('%{seconds}s'), { seconds: seconds.toFixed(2) }); return sprintf(__('%{seconds}s'), { seconds: seconds.toFixed(2) });
}; };
export const addIconStatus = testCase => ({ export const addIconStatus = (testCase) => ({
...testCase, ...testCase,
icon: iconForTestStatus(testCase.status), icon: iconForTestStatus(testCase.status),
formattedTime: formattedTime(testCase.execution_time), formattedTime: formattedTime(testCase.execution_time),
......
import { pickBy } from 'lodash'; import { pickBy } from 'lodash';
import { SUPPORTED_FILTER_PARAMETERS } from './constants'; 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); return pickBy(params, (val, key) => SUPPORTED_FILTER_PARAMETERS.includes(key) && val);
}; };
...@@ -17,10 +17,10 @@ export const createUniqueLinkId = (stageName, jobName) => `${stageName}-${jobNam ...@@ -17,10 +17,10 @@ export const createUniqueLinkId = (stageName, jobName) => `${stageName}-${jobNam
export const createJobsHash = (stages = []) => { export const createJobsHash = (stages = []) => {
const jobsHash = {}; const jobsHash = {};
stages.forEach(stage => { stages.forEach((stage) => {
if (stage.groups.length > 0) { if (stage.groups.length > 0) {
stage.groups.forEach(group => { stage.groups.forEach((group) => {
group.jobs.forEach(job => { group.jobs.forEach((job) => {
jobsHash[job.name] = job; jobsHash[job.name] = job;
}); });
}); });
...@@ -44,13 +44,13 @@ export const generateJobNeedsDict = (jobs = {}) => { ...@@ -44,13 +44,13 @@ export const generateJobNeedsDict = (jobs = {}) => {
const arrOfJobNames = Object.keys(jobs); const arrOfJobNames = Object.keys(jobs);
return arrOfJobNames.reduce((acc, value) => { return arrOfJobNames.reduce((acc, value) => {
const recursiveNeeds = jobName => { const recursiveNeeds = (jobName) => {
if (!jobs[jobName]?.needs) { if (!jobs[jobName]?.needs) {
return []; return [];
} }
return jobs[jobName].needs return jobs[jobName].needs
.map(job => { .map((job) => {
// If we already have the needs of a job in the accumulator, // If we already have the needs of a job in the accumulator,
// then we use the memoized data instead of the recursive call // then we use the memoized data instead of the recursive call
// to save some performance. // to save some performance.
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import { GlPopover } from '@gitlab/ui'; import { GlPopover } from '@gitlab/ui';
import { sanitize } from '~/lib/dompurify'; import { sanitize } from '~/lib/dompurify';
const newPopover = element => { const newPopover = (element) => {
const { content, html, placement, title, triggers = 'focus' } = element.dataset; const { content, html, placement, title, triggers = 'focus' } = element.dataset;
return { return {
...@@ -30,8 +30,8 @@ export default { ...@@ -30,8 +30,8 @@ export default {
}; };
}, },
created() { created() {
this.observer = new MutationObserver(mutations => { this.observer = new MutationObserver((mutations) => {
mutations.forEach(mutation => { mutations.forEach((mutation) => {
mutation.removedNodes.forEach(this.dispose); mutation.removedNodes.forEach(this.dispose);
}); });
}); });
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
if (!target) { if (!target) {
this.popovers = []; this.popovers = [];
} else { } else {
const index = this.popovers.findIndex(popover => popover.target === target); const index = this.popovers.findIndex((popover) => popover.target === target);
if (index > -1) { if (index > -1) {
this.popovers.splice(index, 1); this.popovers.splice(index, 1);
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
} }
}, },
popoverExists(element) { popoverExists(element) {
return this.popovers.some(popover => popover.target === element); return this.popovers.some((popover) => popover.target === element);
}, },
getSafeHtml(html) { getSafeHtml(html) {
return sanitize(html); return sanitize(html);
......
...@@ -32,10 +32,10 @@ const handlePopoverEvent = (rootTarget, e, selector) => { ...@@ -32,10 +32,10 @@ const handlePopoverEvent = (rootTarget, e, selector) => {
}; };
export const initPopovers = () => { export const initPopovers = () => {
['mouseenter', 'focus', 'click'].forEach(event => { ['mouseenter', 'focus', 'click'].forEach((event) => {
document.addEventListener( document.addEventListener(
event, event,
e => handlePopoverEvent(document, e, '[data-toggle="popover"]'), (e) => handlePopoverEvent(document, e, '[data-toggle="popover"]'),
true, true,
); );
}); });
...@@ -43,7 +43,7 @@ export const initPopovers = () => { ...@@ -43,7 +43,7 @@ export const initPopovers = () => {
return getPopoversApp(); return getPopoversApp();
}; };
export const dispose = elements => toArray(elements).forEach(getPopoversApp().dispose); export const dispose = (elements) => toArray(elements).forEach(getPopoversApp().dispose);
export const destroy = () => { export const destroy = () => {
getPopoversApp().$destroy(); getPopoversApp().$destroy();
......
...@@ -84,12 +84,12 @@ Please update your Git repository remotes as soon as possible.`), ...@@ -84,12 +84,12 @@ Please update your Git repository remotes as soon as possible.`),
return axios return axios
.put(this.actionUrl, putData) .put(this.actionUrl, putData)
.then(result => { .then((result) => {
Flash(result.data.message, 'notice'); Flash(result.data.message, 'notice');
this.username = username; this.username = username;
this.isRequestPending = false; this.isRequestPending = false;
}) })
.catch(error => { .catch((error) => {
Flash(error.response.data.message); Flash(error.response.data.message);
this.isRequestPending = false; this.isRequestPending = false;
throw error; throw error;
......
...@@ -12,7 +12,7 @@ export default class AddSshKeyValidation { ...@@ -12,7 +12,7 @@ export default class AddSshKeyValidation {
} }
register() { register() {
this.form.addEventListener('submit', event => this.submit(event)); this.form.addEventListener('submit', (event) => this.submit(event));
this.confirmSubmitElement.addEventListener('click', () => { this.confirmSubmitElement.addEventListener('click', () => {
this.isValid = true; this.isValid = true;
......
...@@ -18,6 +18,6 @@ export default () => { ...@@ -18,6 +18,6 @@ export default () => {
el, el,
name: 'ProfilePreferencesApp', name: 'ProfilePreferencesApp',
provide, provide,
render: createElement => createElement(ProfilePreferences), render: (createElement) => createElement(ProfilePreferences),
}); });
}; };
...@@ -20,7 +20,7 @@ export default class Profile { ...@@ -20,7 +20,7 @@ export default class Profile {
this.timezoneDropdown = new TimezoneDropdown({ this.timezoneDropdown = new TimezoneDropdown({
$inputEl: this.$inputEl, $inputEl: this.$inputEl,
$dropdownEl: $('.js-timezone-dropdown'), $dropdownEl: $('.js-timezone-dropdown'),
displayFormat: selectedItem => formatTimezone(selectedItem), displayFormat: (selectedItem) => formatTimezone(selectedItem),
}); });
} }
...@@ -39,7 +39,7 @@ export default class Profile { ...@@ -39,7 +39,7 @@ export default class Profile {
bindEvents() { bindEvents() {
$('.js-preferences-form').on('change.preference', 'input[type=radio]', this.submitForm); $('.js-preferences-form').on('change.preference', 'input[type=radio]', this.submitForm);
$('.js-group-notification-email').on('change', 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)); setTimeout(this.submitForm.bind(event.currentTarget));
}); });
$('#user_notified_of_own_activity').on('change', this.submitForm); $('#user_notified_of_own_activity').on('change', this.submitForm);
...@@ -89,7 +89,7 @@ export default class Profile { ...@@ -89,7 +89,7 @@ export default class Profile {
// Enable submit button after requests ends // Enable submit button after requests ends
self.form.find(':input[disabled]').enable(); self.form.find(':input[disabled]').enable();
}) })
.catch(error => flash(error.message)); .catch((error) => flash(error.message));
} }
updateHeaderAvatar() { updateHeaderAvatar() {
......
...@@ -57,7 +57,7 @@ export default class ProjectFindFile { ...@@ -57,7 +57,7 @@ export default class ProjectFindFile {
initEvent() { initEvent() {
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
this.inputElement.off('keyup'); this.inputElement.off('keyup');
this.inputElement.on('keyup', event => { this.inputElement.on('keyup', (event) => {
const target = $(event.target); const target = $(event.target);
const value = target.val(); const value = target.val();
const ref = target.data('oldValue'); const ref = target.data('oldValue');
......
...@@ -33,7 +33,7 @@ const projectSelect = () => { ...@@ -33,7 +33,7 @@ const projectSelect = () => {
$(select).select2({ $(select).select2({
placeholder, placeholder,
minimumInputLength: 0, minimumInputLength: 0,
query: query => { query: (query) => {
let projectsCallback; let projectsCallback;
const finalCallback = function (projects) { const finalCallback = function (projects) {
const data = { const data = {
......
...@@ -17,9 +17,9 @@ export default class ProjectSelectComboButton { ...@@ -17,9 +17,9 @@ export default class ProjectSelectComboButton {
bindEvents() { bindEvents() {
this.projectSelectInput this.projectSelectInput
.siblings('.new-project-item-select-button') .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()) { if (!this.getProjectFromLocalStorage()) {
e.preventDefault(); e.preventDefault();
this.openDropdown(e); this.openDropdown(e);
......
...@@ -7,7 +7,7 @@ function setVisibilityOptions(namespaceSelector) { ...@@ -7,7 +7,7 @@ function setVisibilityOptions(namespaceSelector) {
const selectedNamespace = namespaceSelector.options[namespaceSelector.selectedIndex]; const selectedNamespace = namespaceSelector.options[namespaceSelector.selectedIndex];
const { name, visibility, visibilityLevel, showPath, editPath } = selectedNamespace.dataset; 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 optionInput = option.querySelector('input[type=radio]');
const optionValue = optionInput ? optionInput.value : 0; const optionValue = optionInput ? optionInput.value : 0;
const optionTitle = option.querySelector('.option-title'); const optionTitle = option.querySelector('.option-title');
......
...@@ -2,7 +2,7 @@ import axios from 'axios'; ...@@ -2,7 +2,7 @@ import axios from 'axios';
import { sanitize } from '~/lib/dompurify'; import { sanitize } from '~/lib/dompurify';
import { __ } from '~/locale'; import { __ } from '~/locale';
export const loadBranches = containerEl => { export const loadBranches = (containerEl) => {
if (!containerEl) { if (!containerEl) {
return; return;
} }
......
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
commitsSearchInput.addEventListener( commitsSearchInput.addEventListener(
'keyup', '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: { methods: {
......
...@@ -5,7 +5,7 @@ import store from './store'; ...@@ -5,7 +5,7 @@ import store from './store';
Vue.use(Vuex); Vue.use(Vuex);
export default el => { export default (el) => {
if (!el) { if (!el) {
return null; return null;
} }
......
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
}, },
}) })
.then(({ data }) => dispatch('receiveAuthorsSuccess', data)) .then(({ data }) => dispatch('receiveAuthorsSuccess', data))
.catch(error => { .catch((error) => {
Sentry.captureException(error); Sentry.captureException(error);
dispatch('receiveAuthorsError'); dispatch('receiveAuthorsError');
}); });
......
...@@ -83,11 +83,11 @@ export default { ...@@ -83,11 +83,11 @@ export default {
return PANELS; return PANELS;
} }
return PANELS.filter(p => p.name !== CI_CD_PANEL); return PANELS.filter((p) => p.name !== CI_CD_PANEL);
}, },
activePanel() { activePanel() {
return PANELS.find(p => p.name === this.activeTab); return PANELS.find((p) => p.name === this.activeTab);
}, },
breadcrumbs() { breadcrumbs() {
...@@ -113,7 +113,7 @@ export default { ...@@ -113,7 +113,7 @@ export default {
this.handleLocationHashChange(); this.handleLocationHashChange();
this.resetProjectErrors(); this.resetProjectErrors();
}); });
this.$root.$on('clicked::link', e => { this.$root.$on('clicked::link', (e) => {
window.location = e.target.href; window.location = e.target.href;
}); });
}, },
......
...@@ -252,7 +252,7 @@ export default { ...@@ -252,7 +252,7 @@ export default {
}, },
get chartTitles() { get chartTitles() {
const today = dateFormat(new Date(), CHART_DATE_FORMAT); const today = dateFormat(new Date(), CHART_DATE_FORMAT);
const pastDate = timeScale => const pastDate = (timeScale) =>
dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT); dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT);
return { return {
lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), { lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), {
......
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
}, },
get chartTitles() { get chartTitles() {
const today = dateFormat(new Date(), CHART_DATE_FORMAT); const today = dateFormat(new Date(), CHART_DATE_FORMAT);
const pastDate = timeScale => const pastDate = (timeScale) =>
dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT); dateFormat(getDateInPast(new Date(), timeScale), CHART_DATE_FORMAT);
return { return {
lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), { lastWeek: sprintf(__('Pipelines for last week (%{oneWeekAgo} - %{today})'), {
......
...@@ -10,7 +10,7 @@ const apolloProvider = new VueApollo({ ...@@ -10,7 +10,7 @@ const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(), defaultClient: createDefaultClient(),
}); });
const mountPipelineChartsApp = el => { const mountPipelineChartsApp = (el) => {
// Not all of the values will be defined since some them will be // Not all of the values will be defined since some them will be
// empty depending on the value of the graphql_pipeline_analytics // empty depending on the value of the graphql_pipeline_analytics
// feature flag, once the rollout of the feature flag is completed // feature flag, once the rollout of the feature flag is completed
...@@ -62,7 +62,7 @@ const mountPipelineChartsApp = el => { ...@@ -62,7 +62,7 @@ const mountPipelineChartsApp = el => {
provide: { provide: {
projectPath, projectPath,
}, },
render: createElement => createElement(ProjectPipelinesCharts, {}), render: (createElement) => createElement(ProjectPipelinesCharts, {}),
}); });
} }
...@@ -72,7 +72,7 @@ const mountPipelineChartsApp = el => { ...@@ -72,7 +72,7 @@ const mountPipelineChartsApp = el => {
components: { components: {
ProjectPipelinesChartsLegacy, ProjectPipelinesChartsLegacy,
}, },
render: createElement => render: (createElement) =>
createElement(ProjectPipelinesChartsLegacy, { createElement(ProjectPipelinesChartsLegacy, {
props: { props: {
counts: { counts: {
......
...@@ -39,7 +39,7 @@ const setProjectNamePathHandlers = ($projectNameInput, $projectPathInput) => { ...@@ -39,7 +39,7 @@ const setProjectNamePathHandlers = ($projectNameInput, $projectPathInput) => {
}); });
}; };
const deriveProjectPathFromUrl = $projectImportUrl => { const deriveProjectPathFromUrl = ($projectImportUrl) => {
const $currentProjectName = $projectImportUrl const $currentProjectName = $projectImportUrl
.parents('.toggle-import-form') .parents('.toggle-import-form')
.find('#project_name'); .find('#project_name');
...@@ -89,7 +89,7 @@ const bindEvents = () => { ...@@ -89,7 +89,7 @@ const bindEvents = () => {
return; return;
} }
$('.how_to_import_link').on('click', e => { $('.how_to_import_link').on('click', (e) => {
e.preventDefault(); e.preventDefault();
$(e.currentTarget).next('.modal').show(); $(e.currentTarget).next('.modal').show();
}); });
...@@ -112,7 +112,7 @@ const bindEvents = () => { ...@@ -112,7 +112,7 @@ const bindEvents = () => {
$pushNewProjectTipTrigger $pushNewProjectTipTrigger
.removeAttr('rel') .removeAttr('rel')
.removeAttr('target') .removeAttr('target')
.on('click', e => { .on('click', (e) => {
e.preventDefault(); e.preventDefault();
}) })
.popover({ .popover({
...@@ -122,7 +122,7 @@ const bindEvents = () => { ...@@ -122,7 +122,7 @@ const bindEvents = () => {
content: $('.push-new-project-tip-template').html(), content: $('.push-new-project-tip-template').html(),
}) })
.on('shown.bs.popover', () => { .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) { if ($(event.target).closest('.popover').length === 0) {
$pushNewProjectTipTrigger.trigger('click'); $pushNewProjectTipTrigger.trigger('click');
} }
......
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
this.isLoading = false; this.isLoading = false;
this.isSharedRunnerEnabled = !this.isSharedRunnerEnabled; this.isSharedRunnerEnabled = !this.isSharedRunnerEnabled;
}) })
.catch(error => { .catch((error) => {
this.isLoading = false; this.isLoading = false;
this.errorMessage = error.response?.data?.error || DEFAULT_ERROR_MESSAGE; this.errorMessage = error.response?.data?.error || DEFAULT_ERROR_MESSAGE;
}); });
......
...@@ -110,7 +110,7 @@ export default { ...@@ -110,7 +110,7 @@ export default {
this.updatedCustomEmail = data?.service_desk_address; this.updatedCustomEmail = data?.service_desk_address;
this.showAlert(__('Changes were successfully made.'), 'success'); this.showAlert(__('Changes were successfully made.'), 'success');
}) })
.catch(err => { .catch((err) => {
this.showAlert( this.showAlert(
sprintf(__('An error occured while making the changes: %{error}'), { sprintf(__('An error occured while making the changes: %{error}'), {
error: err?.response?.data?.message, error: err?.response?.data?.message,
......
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
this.poll = new Poll({ this.poll = new Poll({
resource: this.service, resource: this.service,
method: 'fetchData', method: 'fetchData',
successCallback: response => this.successCallback(response), successCallback: (response) => this.successCallback(response),
errorCallback: this.errorCallback, errorCallback: this.errorCallback,
}); });
......
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
resetKey() { resetKey() {
axios axios
.post(this.changeKeyUrl) .post(this.changeKeyUrl)
.then(res => { .then((res) => {
this.authorizationKey = res.data.token; this.authorizationKey = res.data.token;
}) })
.catch(() => { .catch(() => {
......
...@@ -65,12 +65,12 @@ export default class CustomMetrics extends PrometheusMetrics { ...@@ -65,12 +65,12 @@ export default class CustomMetrics extends PrometheusMetrics {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
setHidden(els) { setHidden(els) {
els.forEach(el => el.addClass('hidden')); els.forEach((el) => el.addClass('hidden'));
} }
setVisible(...els) { setVisible(...els) {
this.setHidden(this.$els.filter(el => !els.includes(el))); this.setHidden(this.$els.filter((el) => !els.includes(el)));
els.forEach(el => el.removeClass('hidden')); els.forEach((el) => el.removeClass('hidden'));
} }
showMonitoringCustomMetricsPanelState(stateName) { showMonitoringCustomMetricsPanelState(stateName) {
...@@ -98,14 +98,14 @@ export default class CustomMetrics extends PrometheusMetrics { ...@@ -98,14 +98,14 @@ export default class CustomMetrics extends PrometheusMetrics {
} }
populateCustomMetrics() { populateCustomMetrics() {
const capitalizeGroup = metric => ({ const capitalizeGroup = (metric) => ({
...metric, ...metric,
group: capitalizeFirstCharacter(metric.group), group: capitalizeFirstCharacter(metric.group),
}); });
const sortedMetrics = sortBy(this.customMetrics.map(capitalizeGroup), ['group', 'title']); const sortedMetrics = sortBy(this.customMetrics.map(capitalizeGroup), ['group', 'title']);
sortedMetrics.forEach(metric => { sortedMetrics.forEach((metric) => {
this.$monitoredCustomMetricsList.append(CustomMetrics.customMetricTemplate(metric)); this.$monitoredCustomMetricsList.append(CustomMetrics.customMetricTemplate(metric));
}); });
...@@ -145,7 +145,7 @@ export default class CustomMetrics extends PrometheusMetrics { ...@@ -145,7 +145,7 @@ export default class CustomMetrics extends PrometheusMetrics {
this.populateCustomMetrics(customMetrics.data.metrics); this.populateCustomMetrics(customMetrics.data.metrics);
} }
}) })
.catch(customMetricError => { .catch((customMetricError) => {
this.showFlashMessage(customMetricError); this.showFlashMessage(customMetricError);
this.showMonitoringCustomMetricsPanelState(PANEL_STATE.EMPTY); this.showMonitoringCustomMetricsPanelState(PANEL_STATE.EMPTY);
}); });
......
...@@ -26,8 +26,8 @@ export default class PrometheusMetrics { ...@@ -26,8 +26,8 @@ export default class PrometheusMetrics {
this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('activeMetrics'); this.activeMetricsEndpoint = this.$monitoredMetricsPanel.data('activeMetrics');
this.helpMetricsPath = this.$monitoredMetricsPanel.data('metrics-help-path'); this.helpMetricsPath = this.$monitoredMetricsPanel.data('metrics-help-path');
this.$panelToggleRight.on('click', e => this.handlePanelToggle(e)); this.$panelToggleRight.on('click', (e) => this.handlePanelToggle(e));
this.$panelToggleDown.on('click', e => this.handlePanelToggle(e)); this.$panelToggleDown.on('click', (e) => this.handlePanelToggle(e));
} }
init() { init() {
...@@ -72,7 +72,7 @@ export default class PrometheusMetrics { ...@@ -72,7 +72,7 @@ export default class PrometheusMetrics {
let totalMissingEnvVarMetrics = 0; let totalMissingEnvVarMetrics = 0;
let totalExporters = 0; let totalExporters = 0;
metrics.forEach(metric => { metrics.forEach((metric) => {
if (metric.active_metrics > 0) { if (metric.active_metrics > 0) {
totalExporters += 1; totalExporters += 1;
this.$monitoredMetricsList.append( this.$monitoredMetricsList.append(
...@@ -137,7 +137,7 @@ export default class PrometheusMetrics { ...@@ -137,7 +137,7 @@ export default class PrometheusMetrics {
}) })
.catch(stop); .catch(stop);
}) })
.then(res => { .then((res) => {
if (res && res.data && res.data.length) { if (res && res.data && res.data.length) {
this.populateActiveMetrics(res.data); this.populateActiveMetrics(res.data);
} else { } else {
......
...@@ -90,12 +90,12 @@ export default class ProtectedBranchCreate { ...@@ -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 accessLevel = ACCESS_LEVELS[level];
const selectedItems = this[`${accessLevel}_dropdown`].getSelectedItems(); const selectedItems = this[`${accessLevel}_dropdown`].getSelectedItems();
const levelAttributes = []; const levelAttributes = [];
selectedItems.forEach(item => { selectedItems.forEach((item) => {
if (item.type === LEVEL_TYPES.USER) { if (item.type === LEVEL_TYPES.USER) {
levelAttributes.push({ levelAttributes.push({
user_id: item.user_id, user_id: item.user_id,
......
...@@ -108,7 +108,7 @@ export default class ProtectedBranchEdit { ...@@ -108,7 +108,7 @@ export default class ProtectedBranchEdit {
.then(({ data }) => { .then(({ data }) => {
this.hasChanges = false; this.hasChanges = false;
Object.keys(ACCESS_LEVELS).forEach(level => { Object.keys(ACCESS_LEVELS).forEach((level) => {
const accessLevelName = ACCESS_LEVELS[level]; const accessLevelName = ACCESS_LEVELS[level];
// The data coming from server will be the new persisted *state* for each dropdown // The data coming from server will be the new persisted *state* for each dropdown
...@@ -125,7 +125,7 @@ export default class ProtectedBranchEdit { ...@@ -125,7 +125,7 @@ export default class ProtectedBranchEdit {
} }
setSelectedItemsToDropdown(items = [], dropdownName) { setSelectedItemsToDropdown(items = [], dropdownName) {
const itemsToAdd = items.map(currentItem => { const itemsToAdd = items.map((currentItem) => {
if (currentItem.user_id) { if (currentItem.user_id) {
// Do this only for users for now // Do this only for users for now
// get the current data for selected items // get the current data for selected items
......
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