Commit 02fad0bc authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 33 files - 10 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 16d4df3c
...@@ -162,41 +162,6 @@ app/assets/javascripts/ci_variable_list/ci_variable_list.js ...@@ -162,41 +162,6 @@ app/assets/javascripts/ci_variable_list/ci_variable_list.js
app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue app/assets/javascripts/ci_variable_list/components/ci_environments_dropdown.vue
app/assets/javascripts/ci_variable_list/components/ci_variable_table.vue app/assets/javascripts/ci_variable_list/components/ci_variable_table.vue
## lucid-lederberg
app/assets/javascripts/create_cluster/eks_cluster/store/actions.js
app/assets/javascripts/create_cluster/eks_cluster/store/state.js
app/assets/javascripts/create_cluster/gke_cluster/components/gke_dropdown_mixin.js
app/assets/javascripts/create_cluster/gke_cluster/components/gke_project_id_dropdown.vue
app/assets/javascripts/create_cluster/gke_cluster/index.js
app/assets/javascripts/create_cluster/gke_cluster/store/actions.js
app/assets/javascripts/create_cluster/gke_cluster/store/getters.js
app/assets/javascripts/create_cluster/gke_cluster_namespace/index.js
app/assets/javascripts/create_cluster/init_create_cluster.js
app/assets/javascripts/create_cluster/store/cluster_dropdown/actions.js
app/assets/javascripts/create_item_dropdown.js
app/assets/javascripts/create_label.js
app/assets/javascripts/create_merge_request_dropdown.js
app/assets/javascripts/custom_metrics/components/custom_metrics_form_fields.vue
app/assets/javascripts/custom_metrics/constants.js
app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js
app/assets/javascripts/cycle_analytics/cycle_analytics_service.js
app/assets/javascripts/cycle_analytics/cycle_analytics_store.js
app/assets/javascripts/deploy_freeze/store/actions.js
app/assets/javascripts/deploy_freeze/store/index.js
app/assets/javascripts/deploy_freeze/store/mutations.js
app/assets/javascripts/deploy_keys/components/app.vue
app/assets/javascripts/deploy_keys/components/key.vue
app/assets/javascripts/deploy_keys/service/index.js
app/assets/javascripts/deploy_keys/store/index.js
app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js
app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js
app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js
app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_remote.js
app/assets/javascripts/design_management/components/design_notes/design_discussion.vue
app/assets/javascripts/design_management/components/design_presentation.vue
app/assets/javascripts/design_management/components/design_sidebar.vue
app/assets/javascripts/design_management/components/design_todo_button.vue
## loving-feistel ## loving-feistel
app/assets/javascripts/design_management/components/toolbar/design_navigation.vue app/assets/javascripts/design_management/components/toolbar/design_navigation.vue
app/assets/javascripts/design_management/components/toolbar/index.vue app/assets/javascripts/design_management/components/toolbar/index.vue
......
...@@ -5,7 +5,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -5,7 +5,7 @@ import axios from '~/lib/utils/axios_utils';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
const getErrorMessage = data => { const getErrorMessage = (data) => {
const errorKey = Object.keys(data)[0]; const errorKey = Object.keys(data)[0];
return data[errorKey][0]; return data[errorKey][0];
...@@ -42,7 +42,7 @@ export const createRole = ({ dispatch, state: { createRolePath } }, payload) => ...@@ -42,7 +42,7 @@ export const createRole = ({ dispatch, state: { createRolePath } }, payload) =>
dispatch('createRoleSuccess', awsData); dispatch('createRoleSuccess', awsData);
}) })
.catch(error => { .catch((error) => {
let message = error; let message = error;
if (error?.response?.data?.message) { if (error?.response?.data?.message) {
message = error.response.data.message; message = error.response.data.message;
......
import { KUBERNETES_VERSIONS } from '../constants'; import { KUBERNETES_VERSIONS } from '../constants';
const kubernetesVersion = KUBERNETES_VERSIONS.find(version => version.default).value; const kubernetesVersion = KUBERNETES_VERSIONS.find((version) => version.default).value;
export default () => ({ export default () => ({
createRolePath: null, createRolePath: null,
......
...@@ -42,13 +42,13 @@ export default { ...@@ -42,13 +42,13 @@ export default {
return []; return [];
} }
return this.items.filter(item => item.name.toLowerCase().indexOf(this.searchQuery) > -1); return this.items.filter((item) => item.name.toLowerCase().indexOf(this.searchQuery) > -1);
}, },
}, },
methods: { methods: {
fetchSuccessHandler() { fetchSuccessHandler() {
if (this.defaultValue) { if (this.defaultValue) {
const itemToSelect = this.items.find(item => item.name === this.defaultValue); const itemToSelect = this.items.find((item) => item.name === this.defaultValue);
if (itemToSelect) { if (itemToSelect) {
this.setItem(itemToSelect.name); this.setItem(itemToSelect.name);
......
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
...mapActions({ setItem: 'setProject' }), ...mapActions({ setItem: 'setProject' }),
fetchSuccessHandler() { fetchSuccessHandler() {
if (this.defaultValue) { if (this.defaultValue) {
const projectToSelect = this.items.find(item => item.projectId === this.defaultValue); const projectToSelect = this.items.find((item) => item.projectId === this.defaultValue);
if (projectToSelect) { if (projectToSelect) {
this.setItem(projectToSelect); this.setItem(projectToSelect);
......
...@@ -22,7 +22,7 @@ const mountComponent = (entryPoint, component, componentName, extraProps = {}) = ...@@ -22,7 +22,7 @@ const mountComponent = (entryPoint, component, componentName, extraProps = {}) =
components: { components: {
[componentName]: component, [componentName]: component,
}, },
render: createElement => render: (createElement) =>
createElement(componentName, { createElement(componentName, {
props: { props: {
fieldName: hiddenInput.getAttribute('name'), fieldName: hiddenInput.getAttribute('name'),
......
...@@ -6,14 +6,14 @@ const gapiResourceListRequest = ({ resource, params, commit, mutation, payloadKe ...@@ -6,14 +6,14 @@ const gapiResourceListRequest = ({ resource, params, commit, mutation, payloadKe
const request = resource.list(params); const request = resource.list(params);
return request.then( return request.then(
resp => { (resp) => {
const { result } = resp; const { result } = resp;
commit(mutation, result[payloadKey]); commit(mutation, result[payloadKey]);
resolve(); resolve();
}, },
resp => { (resp) => {
reject(resp); reject(resp);
}, },
); );
...@@ -54,14 +54,14 @@ export const validateProjectBilling = ({ dispatch, commit, state }) => ...@@ -54,14 +54,14 @@ export const validateProjectBilling = ({ dispatch, commit, state }) =>
commit(types.SET_MACHINE_TYPE, ''); commit(types.SET_MACHINE_TYPE, '');
return request.then( return request.then(
resp => { (resp) => {
const { billingEnabled } = resp.result; const { billingEnabled } = resp.result;
commit(types.SET_PROJECT_BILLING_STATUS, Boolean(billingEnabled)); commit(types.SET_PROJECT_BILLING_STATUS, Boolean(billingEnabled));
dispatch('setIsValidatingProjectBilling', false); dispatch('setIsValidatingProjectBilling', false);
resolve(); resolve();
}, },
resp => { (resp) => {
dispatch('setIsValidatingProjectBilling', false); dispatch('setIsValidatingProjectBilling', false);
reject(resp); reject(resp);
}, },
......
export const hasProject = state => Boolean(state.selectedProject.projectId); export const hasProject = (state) => Boolean(state.selectedProject.projectId);
export const hasZone = state => Boolean(state.selectedZone); export const hasZone = (state) => Boolean(state.selectedZone);
export const hasMachineType = state => Boolean(state.selectedMachineType); export const hasMachineType = (state) => Boolean(state.selectedMachineType);
export const hasValidData = (state, getters) => export const hasValidData = (state, getters) =>
Boolean(state.projectHasBillingEnabled) && getters.hasZone && getters.hasMachineType; Boolean(state.projectHasBillingEnabled) && getters.hasZone && getters.hasMachineType;
...@@ -12,7 +12,7 @@ const setDisabled = (el, isDisabled) => { ...@@ -12,7 +12,7 @@ const setDisabled = (el, isDisabled) => {
} }
}; };
const setState = glManagedCheckbox => { const setState = (glManagedCheckbox) => {
const glManaged = document.querySelector('.js-namespace-prefixed'); const glManaged = document.querySelector('.js-namespace-prefixed');
const selfManaged = document.querySelector('.js-namespace'); const selfManaged = document.querySelector('.js-namespace');
......
...@@ -4,11 +4,11 @@ import PersistentUserCallout from '~/persistent_user_callout'; ...@@ -4,11 +4,11 @@ import PersistentUserCallout from '~/persistent_user_callout';
const newClusterViews = [':clusters:new', ':clusters:create_gcp', ':clusters:create_user']; const newClusterViews = [':clusters:new', ':clusters:create_gcp', ':clusters:create_user'];
const isProjectLevelCluster = page => page.startsWith('project:clusters'); const isProjectLevelCluster = (page) => page.startsWith('project:clusters');
export default document => { export default (document) => {
const { page } = document.body.dataset; const { page } = document.body.dataset;
const isNewClusterView = newClusterViews.some(view => page.endsWith(view)); const isNewClusterView = newClusterViews.some((view) => page.endsWith(view));
if (!isNewClusterView) { if (!isNewClusterView) {
return; return;
......
import * as types from './mutation_types'; import * as types from './mutation_types';
export default fetchItems => ({ export default (fetchItems) => ({
requestItems: ({ commit }) => commit(types.REQUEST_ITEMS), requestItems: ({ commit }) => commit(types.REQUEST_ITEMS),
receiveItemsSuccess: ({ commit }, payload) => commit(types.RECEIVE_ITEMS_SUCCESS, payload), receiveItemsSuccess: ({ commit }, payload) => commit(types.RECEIVE_ITEMS_SUCCESS, payload),
receiveItemsError: ({ commit }, payload) => commit(types.RECEIVE_ITEMS_ERROR, payload), receiveItemsError: ({ commit }, payload) => commit(types.RECEIVE_ITEMS_ERROR, payload),
...@@ -8,7 +8,7 @@ export default fetchItems => ({ ...@@ -8,7 +8,7 @@ export default fetchItems => ({
dispatch('requestItems'); dispatch('requestItems');
return fetchItems(payload) return fetchItems(payload)
.then(items => dispatch('receiveItemsSuccess', { items })) .then((items) => dispatch('receiveItemsSuccess', { items }))
.catch(error => dispatch('receiveItemsError', { error })); .catch((error) => dispatch('receiveItemsError', { error }));
}, },
}); });
...@@ -47,7 +47,7 @@ export default class CreateItemDropdown { ...@@ -47,7 +47,7 @@ export default class CreateItemDropdown {
return escape(item.id); return escape(item.id);
}, },
onFilter: this.toggleCreateNewButton.bind(this), onFilter: this.toggleCreateNewButton.bind(this),
clicked: options => { clicked: (options) => {
options.e.preventDefault(); options.e.preventDefault();
this.onSelect(); this.onSelect();
}, },
...@@ -79,7 +79,7 @@ export default class CreateItemDropdown { ...@@ -79,7 +79,7 @@ export default class CreateItemDropdown {
this.getDataOption(term, (data = []) => { this.getDataOption(term, (data = []) => {
// Ensure the selected item isn't already in the data to avoid duplicates // Ensure the selected item isn't already in the data to avoid duplicates
const alreadyHasSelectedItem = const alreadyHasSelectedItem =
this.selectedItem && data.some(item => item.id === this.selectedItem.id); this.selectedItem && data.some((item) => item.id === this.selectedItem.id);
let uniqueData = data; let uniqueData = data;
if (!alreadyHasSelectedItem) { if (!alreadyHasSelectedItem) {
......
...@@ -56,7 +56,7 @@ export default class CreateLabelDropdown { ...@@ -56,7 +56,7 @@ export default class CreateLabelDropdown {
this.$dropdownBack.on('click', this.resetForm.bind(this)); this.$dropdownBack.on('click', this.resetForm.bind(this));
this.$cancelButton.on('click', e => { this.$cancelButton.on('click', (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
...@@ -105,7 +105,7 @@ export default class CreateLabelDropdown { ...@@ -105,7 +105,7 @@ export default class CreateLabelDropdown {
title: this.$newLabelField.val(), title: this.$newLabelField.val(),
color: this.$newColorField.val(), color: this.$newColorField.val(),
}, },
label => { (label) => {
this.$newLabelCreateButton.enable(); this.$newLabelCreateButton.enable();
if (label.message) { if (label.message) {
...@@ -115,7 +115,7 @@ export default class CreateLabelDropdown { ...@@ -115,7 +115,7 @@ export default class CreateLabelDropdown {
errors = label.message; errors = label.message;
} else { } else {
errors = Object.keys(label.message) errors = Object.keys(label.message)
.map(key => `${humanize(key)} ${label.message[key].join(', ')}`) .map((key) => `${humanize(key)} ${label.message[key].join(', ')}`)
.join('<br/>'); .join('<br/>');
} }
......
...@@ -191,7 +191,7 @@ export default class CreateMergeRequestDropdown { ...@@ -191,7 +191,7 @@ export default class CreateMergeRequestDropdown {
static findByValue(objects, ref, returnFirstMatch = false) { static findByValue(objects, ref, returnFirstMatch = false) {
if (!objects || !objects.length) return false; if (!objects || !objects.length) return false;
if (objects.indexOf(ref) > -1) return ref; if (objects.indexOf(ref) > -1) return ref;
if (returnFirstMatch) return objects.find(item => new RegExp(`^${ref}`).test(item)); if (returnFirstMatch) return objects.find((item) => new RegExp(`^${ref}`).test(item));
return false; return false;
} }
...@@ -356,7 +356,7 @@ export default class CreateMergeRequestDropdown { ...@@ -356,7 +356,7 @@ export default class CreateMergeRequestDropdown {
event.preventDefault(); event.preventDefault();
if (isConfidentialIssue() && !event.target.classList.contains('js-create-target')) { if (isConfidentialIssue() && !event.target.classList.contains('js-create-target')) {
this.droplab.hooks.forEach(hook => hook.list.toggle()); this.droplab.hooks.forEach((hook) => hook.list.toggle());
return; return;
} }
...@@ -404,8 +404,8 @@ export default class CreateMergeRequestDropdown { ...@@ -404,8 +404,8 @@ export default class CreateMergeRequestDropdown {
const inputClasses = ['gl-field-error-outline', 'gl-field-success-outline']; const inputClasses = ['gl-field-error-outline', 'gl-field-success-outline'];
const messageClasses = ['text-muted', 'text-danger', 'text-success']; const messageClasses = ['text-muted', 'text-danger', 'text-success'];
inputClasses.forEach(cssClass => input.classList.remove(cssClass)); inputClasses.forEach((cssClass) => input.classList.remove(cssClass));
messageClasses.forEach(cssClass => message.classList.remove(cssClass)); messageClasses.forEach((cssClass) => message.classList.remove(cssClass));
message.style.display = 'none'; message.style.display = 'none';
} }
......
...@@ -22,7 +22,7 @@ let cancelTokenSource; ...@@ -22,7 +22,7 @@ let cancelTokenSource;
function backOffRequest(makeRequestCallback) { function backOffRequest(makeRequestCallback) {
return backOff((next, stop) => { return backOff((next, stop) => {
makeRequestCallback() makeRequestCallback()
.then(resp => { .then((resp) => {
if (resp.status === statusCodes.OK) { if (resp.status === statusCodes.OK) {
stop(resp); stop(resp);
} else { } else {
...@@ -32,7 +32,7 @@ function backOffRequest(makeRequestCallback) { ...@@ -32,7 +32,7 @@ function backOffRequest(makeRequestCallback) {
// If the request is cancelled by axios // If the request is cancelled by axios
// then consider it as noop so that its not // then consider it as noop so that its not
// caught by subsequent catches // caught by subsequent catches
.catch(thrown => (axios.isCancel(thrown) ? undefined : stop(thrown))); .catch((thrown) => (axios.isCancel(thrown) ? undefined : stop(thrown)));
}, VALIDATION_REQUEST_TIMEOUT); }, VALIDATION_REQUEST_TIMEOUT);
} }
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
// as well. // as well.
cancelTokenSource = axiosCancelToken.source(); cancelTokenSource = axiosCancelToken.source();
this.requestValidation(this.query, cancelTokenSource.token) this.requestValidation(this.query, cancelTokenSource.token)
.then(res => { .then((res) => {
const response = res.data; const response = res.data;
const { valid, error } = response.query; const { valid, error } = response.query;
if (response.success) { if (response.success) {
......
...@@ -4,9 +4,9 @@ export const queryTypes = { ...@@ -4,9 +4,9 @@ export const queryTypes = {
system: 'system', system: 'system',
}; };
export const formDataValidator = val => { export const formDataValidator = (val) => {
const fieldNames = Object.keys(val); const fieldNames = Object.keys(val);
const requiredFields = ['title', 'query', 'yLabel', 'unit', 'group', 'legend']; const requiredFields = ['title', 'query', 'yLabel', 'unit', 'group', 'legend'];
return requiredFields.every(name => fieldNames.includes(name)); return requiredFields.every((name) => fieldNames.includes(name));
}; };
...@@ -78,7 +78,7 @@ export default () => { ...@@ -78,7 +78,7 @@ export default () => {
$dropdown $dropdown
.find('li a') .find('li a')
.off('click') .off('click')
.on('click', e => { .on('click', (e) => {
e.preventDefault(); e.preventDefault();
const $target = $(e.currentTarget); const $target = $(e.currentTarget);
this.startDate = $target.data('value'); this.startDate = $target.data('value');
...@@ -94,7 +94,7 @@ export default () => { ...@@ -94,7 +94,7 @@ export default () => {
this.service this.service
.fetchCycleAnalyticsData(fetchOptions) .fetchCycleAnalyticsData(fetchOptions)
.then(response => { .then((response) => {
this.store.setCycleAnalyticsData(response); this.store.setCycleAnalyticsData(response);
this.selectDefaultStage(); this.selectDefaultStage();
this.initDropdown(); this.initDropdown();
...@@ -128,7 +128,7 @@ export default () => { ...@@ -128,7 +128,7 @@ export default () => {
startDate: this.startDate, startDate: this.startDate,
projectIds: this.selectedProjectIds, projectIds: this.selectedProjectIds,
}) })
.then(response => { .then((response) => {
this.isEmptyStage = !response.events.length; this.isEmptyStage = !response.events.length;
this.store.setStageEvents(response.events, stage); this.store.setStageEvents(response.events, stage);
this.isLoadingStage = false; this.isLoadingStage = false;
......
...@@ -17,7 +17,7 @@ export default class CycleAnalyticsService { ...@@ -17,7 +17,7 @@ export default class CycleAnalyticsService {
'cycle_analytics[project_ids]': projectIds, 'cycle_analytics[project_ids]': projectIds,
}, },
}) })
.then(x => x.data); .then((x) => x.data);
} }
fetchStageData(options) { fetchStageData(options) {
...@@ -30,6 +30,6 @@ export default class CycleAnalyticsService { ...@@ -30,6 +30,6 @@ export default class CycleAnalyticsService {
'cycle_analytics[project_ids]': projectIds, 'cycle_analytics[project_ids]': projectIds,
}, },
}) })
.then(x => x.data); .then((x) => x.data);
} }
} }
...@@ -42,11 +42,11 @@ export default { ...@@ -42,11 +42,11 @@ export default {
newData.stages = data.stats || []; newData.stages = data.stats || [];
newData.summary = data.summary || []; newData.summary = data.summary || [];
newData.summary.forEach(item => { newData.summary.forEach((item) => {
item.value = item.value || '-'; item.value = item.value || '-';
}); });
newData.stages.forEach(item => { newData.stages.forEach((item) => {
const stageSlug = dasherize(item.name.toLowerCase()); const stageSlug = dasherize(item.name.toLowerCase());
item.active = false; item.active = false;
item.isUserAllowed = data.permissions[stageSlug]; item.isUserAllowed = data.permissions[stageSlug];
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
this.state.hasError = state; this.state.hasError = state;
}, },
deactivateAllStages() { deactivateAllStages() {
this.state.stages.forEach(stage => { this.state.stages.forEach((stage) => {
stage.active = false; stage.active = false;
}); });
}, },
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
decorateEvents(events, stage) { decorateEvents(events, stage) {
const newEvents = []; const newEvents = [];
events.forEach(item => { events.forEach((item) => {
if (!item) return; if (!item) return;
const eventItem = { ...DEFAULT_EVENT_OBJECTS[stage.slug], ...item }; const eventItem = { ...DEFAULT_EVENT_OBJECTS[stage.slug], ...item };
...@@ -107,6 +107,6 @@ export default { ...@@ -107,6 +107,6 @@ export default {
return newEvents; return newEvents;
}, },
currentActiveStage() { currentActiveStage() {
return this.state.stages.find(stage => stage.active); return this.state.stages.find((stage) => stage.active);
}, },
}; };
...@@ -28,7 +28,7 @@ export const addFreezePeriod = ({ state, dispatch, commit }) => { ...@@ -28,7 +28,7 @@ export const addFreezePeriod = ({ state, dispatch, commit }) => {
commit(types.RESET_MODAL); commit(types.RESET_MODAL);
dispatch('fetchFreezePeriods'); dispatch('fetchFreezePeriods');
}) })
.catch(error => { .catch((error) => {
createFlash(__('Error: Unable to create deploy freeze')); createFlash(__('Error: Unable to create deploy freeze'));
dispatch('receiveAddFreezePeriodError', error); dispatch('receiveAddFreezePeriodError', error);
}); });
......
...@@ -6,7 +6,7 @@ import createState from './state'; ...@@ -6,7 +6,7 @@ import createState from './state';
Vue.use(Vuex); Vue.use(Vuex);
export default initialState => export default (initialState) =>
new Vuex.Store({ new Vuex.Store({
actions, actions,
mutations, mutations,
......
...@@ -4,7 +4,7 @@ import * as types from './mutation_types'; ...@@ -4,7 +4,7 @@ import * as types from './mutation_types';
const formatTimezoneName = (freezePeriod, timezoneList) => const formatTimezoneName = (freezePeriod, timezoneList) =>
convertObjectPropsToCamelCase({ convertObjectPropsToCamelCase({
...freezePeriod, ...freezePeriod,
cron_timezone: timezoneList.find(tz => tz.identifier === freezePeriod.cron_timezone)?.name, cron_timezone: timezoneList.find((tz) => tz.identifier === freezePeriod.cron_timezone)?.name,
}); });
export default { export default {
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
[types.RECEIVE_FREEZE_PERIODS_SUCCESS](state, freezePeriods) { [types.RECEIVE_FREEZE_PERIODS_SUCCESS](state, freezePeriods) {
state.isLoading = false; state.isLoading = false;
state.freezePeriods = freezePeriods.map(freezePeriod => state.freezePeriods = freezePeriods.map((freezePeriod) =>
formatTimezoneName(freezePeriod, state.timezoneData), formatTimezoneName(freezePeriod, state.timezoneData),
); );
}, },
......
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
}, },
computed: { computed: {
tabs() { tabs() {
return Object.keys(this.$options.scopes).map(scope => { return Object.keys(this.$options.scopes).map((scope) => {
const count = Array.isArray(this.keys[scope]) ? this.keys[scope].length : null; const count = Array.isArray(this.keys[scope]) ? this.keys[scope].length : null;
return { return {
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
return this.service return this.service
.getKeys() .getKeys()
.then(data => { .then((data) => {
this.isLoading = false; this.isLoading = false;
this.store.keys = data; this.store.keys = data;
}) })
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
if (this.projectId !== null) { if (this.projectId !== null) {
const indexOfCurrentProject = projects.findIndex( const indexOfCurrentProject = projects.findIndex(
project => (project) =>
project && project &&
project.project && project.project &&
project.project.id && project.project.id &&
......
...@@ -6,14 +6,14 @@ export default class DeployKeysService { ...@@ -6,14 +6,14 @@ export default class DeployKeysService {
} }
getKeys() { getKeys() {
return axios.get(this.endpoint).then(response => response.data); return axios.get(this.endpoint).then((response) => response.data);
} }
enableKey(id) { enableKey(id) {
return axios.put(`${this.endpoint}/${id}/enable`).then(response => response.data); return axios.put(`${this.endpoint}/${id}/enable`).then((response) => response.data);
} }
disableKey(id) { disableKey(id) {
return axios.put(`${this.endpoint}/${id}/disable`).then(response => response.data); return axios.put(`${this.endpoint}/${id}/disable`).then((response) => response.data);
} }
} }
...@@ -4,6 +4,6 @@ export default class DeployKeysStore { ...@@ -4,6 +4,6 @@ export default class DeployKeysStore {
} }
isEnabled(id) { isEnabled(id) {
return this.keys.enabled_keys.some(key => key.id === id); return this.keys.enabled_keys.some((key) => key.id === id);
} }
} }
...@@ -68,7 +68,7 @@ export class GitLabDropdown { ...@@ -68,7 +68,7 @@ export class GitLabDropdown {
this.remote = new GitLabDropdownRemote(this.options.data, { this.remote = new GitLabDropdownRemote(this.options.data, {
dataType: this.options.dataType, dataType: this.options.dataType,
beforeSend: this.toggleLoading.bind(this), beforeSend: this.toggleLoading.bind(this),
success: data => { success: (data) => {
this.fullData = data; this.fullData = data;
this.parseData(this.fullData); this.parseData(this.fullData);
this.focusTextInput(); this.focusTextInput();
...@@ -113,7 +113,7 @@ export class GitLabDropdown { ...@@ -113,7 +113,7 @@ export class GitLabDropdown {
return $(selector, this.dropdown); return $(selector, this.dropdown);
}, },
data: () => this.fullData, data: () => this.fullData,
callback: data => { callback: (data) => {
this.parseData(data); this.parseData(data);
if (this.filterInput.val() !== '') { if (this.filterInput.val() !== '') {
selector = SELECTABLE_CLASSES; selector = SELECTABLE_CLASSES;
...@@ -135,13 +135,13 @@ export class GitLabDropdown { ...@@ -135,13 +135,13 @@ export class GitLabDropdown {
this.dropdown.on('hidden.bs.dropdown', this.hidden); this.dropdown.on('hidden.bs.dropdown', this.hidden);
$(this.el).on('update.label', this.updateLabel); $(this.el).on('update.label', this.updateLabel);
this.dropdown.on('click', '.dropdown-menu, .dropdown-menu-close', this.shouldPropagate); this.dropdown.on('click', '.dropdown-menu, .dropdown-menu-close', this.shouldPropagate);
this.dropdown.on('keyup', e => { this.dropdown.on('keyup', (e) => {
// Escape key // Escape key
if (e.which === 27) { if (e.which === 27) {
return $('.dropdown-menu-close', this.dropdown).trigger('click'); return $('.dropdown-menu-close', this.dropdown).trigger('click');
} }
}); });
this.dropdown.on('blur', 'a', e => { this.dropdown.on('blur', 'a', (e) => {
let $dropdownMenu; let $dropdownMenu;
let $relatedTarget; let $relatedTarget;
if (e.relatedTarget != null) { if (e.relatedTarget != null) {
...@@ -153,7 +153,7 @@ export class GitLabDropdown { ...@@ -153,7 +153,7 @@ export class GitLabDropdown {
} }
}); });
if (this.dropdown.find('.dropdown-toggle-page').length) { if (this.dropdown.find('.dropdown-toggle-page').length) {
this.dropdown.find('.dropdown-toggle-page, .dropdown-menu-back').on('click', e => { this.dropdown.find('.dropdown-toggle-page, .dropdown-menu-back').on('click', (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
return this.togglePage(); return this.togglePage();
...@@ -164,7 +164,7 @@ export class GitLabDropdown { ...@@ -164,7 +164,7 @@ export class GitLabDropdown {
if (this.dropdown.find('.dropdown-toggle-page').length) { if (this.dropdown.find('.dropdown-toggle-page').length) {
selector = '.dropdown-page-one .dropdown-content a'; selector = '.dropdown-page-one .dropdown-content a';
} }
this.dropdown.on('click', selector, e => { this.dropdown.on('click', selector, (e) => {
const $el = $(e.currentTarget); const $el = $(e.currentTarget);
const selected = self.rowClicked($el); const selected = self.rowClicked($el);
const selectedObj = selected ? selected[0] : null; const selectedObj = selected ? selected[0] : null;
...@@ -221,7 +221,7 @@ export class GitLabDropdown { ...@@ -221,7 +221,7 @@ export class GitLabDropdown {
else if (isObject(data)) { else if (isObject(data)) {
html = []; html = [];
Object.keys(data).forEach(name => { Object.keys(data).forEach((name) => {
groupData = data[name]; groupData = data[name];
html.push( html.push(
this.renderItem( this.renderItem(
...@@ -232,7 +232,7 @@ export class GitLabDropdown { ...@@ -232,7 +232,7 @@ export class GitLabDropdown {
name, name,
), ),
); );
this.renderData(groupData, name).map(item => html.push(item)); this.renderData(groupData, name).map((item) => html.push(item));
}); });
} else { } else {
// Render each row // Render each row
...@@ -271,7 +271,7 @@ export class GitLabDropdown { ...@@ -271,7 +271,7 @@ export class GitLabDropdown {
filteredFullData() { filteredFullData() {
return this.fullData.filter( return this.fullData.filter(
r => (r) =>
typeof r === 'object' && typeof r === 'object' &&
!Object.prototype.hasOwnProperty.call(r, 'beforeDivider') && !Object.prototype.hasOwnProperty.call(r, 'beforeDivider') &&
!Object.prototype.hasOwnProperty.call(r, 'header'), !Object.prototype.hasOwnProperty.call(r, 'header'),
...@@ -389,7 +389,7 @@ export class GitLabDropdown { ...@@ -389,7 +389,7 @@ export class GitLabDropdown {
...this.options, ...this.options,
icon: this.icon, icon: this.icon,
highlight: this.highlight, highlight: this.highlight,
highlightText: text => this.highlightTextMatches(text, this.filterInput.val()), highlightText: (text) => this.highlightTextMatches(text, this.filterInput.val()),
highlightTemplate: this.highlightTemplate.bind(this), highlightTemplate: this.highlightTemplate.bind(this),
parent, parent,
}, },
...@@ -536,7 +536,7 @@ export class GitLabDropdown { ...@@ -536,7 +536,7 @@ export class GitLabDropdown {
} }
if (this.options.multiSelect) { if (this.options.multiSelect) {
Object.keys(selectedObject).forEach(attribute => { Object.keys(selectedObject).forEach((attribute) => {
$input.attr(`data-${attribute}`, selectedObject[attribute]); $input.attr(`data-${attribute}`, selectedObject[attribute]);
}); });
} }
...@@ -577,7 +577,7 @@ export class GitLabDropdown { ...@@ -577,7 +577,7 @@ export class GitLabDropdown {
if (this.dropdown.find('.dropdown-toggle-page').length) { if (this.dropdown.find('.dropdown-toggle-page').length) {
selector = `.dropdown-page-one ${selector}`; selector = `.dropdown-page-one ${selector}`;
} }
return $('body').on('keydown', e => { return $('body').on('keydown', (e) => {
let $listItems; let $listItems;
let PREV_INDEX; let PREV_INDEX;
const currentKeyCode = e.which; const currentKeyCode = e.which;
......
...@@ -18,7 +18,7 @@ export class GitLabDropdownFilter { ...@@ -18,7 +18,7 @@ export class GitLabDropdownFilter {
this.filterInputBlur = (ref = this.options.filterInputBlur) != null ? ref : true; this.filterInputBlur = (ref = this.options.filterInputBlur) != null ? ref : true;
const $inputContainer = this.input.parent(); const $inputContainer = this.input.parent();
const $clearButton = $inputContainer.find('.js-dropdown-input-clear'); const $clearButton = $inputContainer.find('.js-dropdown-input-clear');
$clearButton.on('click', e => { $clearButton.on('click', (e) => {
// Clear click // Clear click
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
...@@ -27,7 +27,7 @@ export class GitLabDropdownFilter { ...@@ -27,7 +27,7 @@ export class GitLabDropdownFilter {
// Key events // Key events
timeout = ''; timeout = '';
this.input this.input
.on('keydown', e => { .on('keydown', (e) => {
const keyCode = e.which; const keyCode = e.which;
if (keyCode === 13 && !options.elIsInput) { if (keyCode === 13 && !options.elIsInput) {
e.preventDefault(); e.preventDefault();
...@@ -46,7 +46,7 @@ export class GitLabDropdownFilter { ...@@ -46,7 +46,7 @@ export class GitLabDropdownFilter {
return (timeout = setTimeout(() => { return (timeout = setTimeout(() => {
$inputContainer.parent().addClass('is-loading'); $inputContainer.parent().addClass('is-loading');
return this.options.query(this.input.val(), data => { return this.options.query(this.input.val(), (data) => {
$inputContainer.parent().removeClass('is-loading'); $inputContainer.parent().removeClass('is-loading');
return this.options.callback(data); return this.options.callback(data);
}); });
...@@ -94,13 +94,13 @@ export class GitLabDropdownFilter { ...@@ -94,13 +94,13 @@ export class GitLabDropdownFilter {
// } // }
else if (isObject(data)) { else if (isObject(data)) {
results = {}; results = {};
Object.keys(data).forEach(key => { Object.keys(data).forEach((key) => {
group = data[key]; group = data[key];
tmp = fuzzaldrinPlus.filter(group, searchText, { tmp = fuzzaldrinPlus.filter(group, searchText, {
key: this.options.keys, key: this.options.keys,
}); });
if (tmp.length) { if (tmp.length) {
results[key] = tmp.map(item => item); results[key] = tmp.map((item) => item);
} }
}); });
} }
......
...@@ -5,7 +5,7 @@ export class GitLabDropdownInput { ...@@ -5,7 +5,7 @@ export class GitLabDropdownInput {
this.fieldName = this.options.fieldName || 'field-name'; this.fieldName = this.options.fieldName || 'field-name';
const $inputContainer = this.input.parent(); const $inputContainer = this.input.parent();
const $clearButton = $inputContainer.find('.js-dropdown-input-clear'); const $clearButton = $inputContainer.find('.js-dropdown-input-clear');
$clearButton.on('click', e => { $clearButton.on('click', (e) => {
// Clear click // Clear click
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
...@@ -13,13 +13,13 @@ export class GitLabDropdownInput { ...@@ -13,13 +13,13 @@ export class GitLabDropdownInput {
}); });
this.input this.input
.on('keydown', e => { .on('keydown', (e) => {
const keyCode = e.which; const keyCode = e.which;
if (keyCode === 13 && !options.elIsInput) { if (keyCode === 13 && !options.elIsInput) {
e.preventDefault(); e.preventDefault();
} }
}) })
.on('input', e => { .on('input', (e) => {
let val = e.currentTarget.value || this.options.inputFieldName; let val = e.currentTarget.value || this.options.inputFieldName;
val = val val = val
.split(' ') .split(' ')
......
...@@ -15,7 +15,7 @@ export class GitLabDropdownRemote { ...@@ -15,7 +15,7 @@ export class GitLabDropdownRemote {
if (this.options.beforeSend) { if (this.options.beforeSend) {
this.options.beforeSend(); this.options.beforeSend();
} }
return this.dataEndpoint('', data => { return this.dataEndpoint('', (data) => {
// Fetch the data by calling the data function // Fetch the data by calling the data function
if (this.options.success) { if (this.options.success) {
this.options.success(data); this.options.success(data);
......
...@@ -171,7 +171,7 @@ export default { ...@@ -171,7 +171,7 @@ export default {
this.$emit('resolve-discussion-error', data.errors[0]); this.$emit('resolve-discussion-error', data.errors[0]);
} }
}) })
.catch(err => { .catch((err) => {
this.$emit('resolve-discussion-error', err); this.$emit('resolve-discussion-error', err);
}) })
.finally(() => { .finally(() => {
......
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
}, },
computed: { computed: {
discussionStartingNotes() { discussionStartingNotes() {
return this.discussions.map(discussion => ({ return this.discussions.map((discussion) => ({
...discussion.notes[0], ...discussion.notes[0],
index: discussion.index, index: discussion.index,
})); }));
......
...@@ -63,10 +63,10 @@ export default { ...@@ -63,10 +63,10 @@ export default {
return extractParticipants(this.issue.participants.nodes); return extractParticipants(this.issue.participants.nodes);
}, },
resolvedDiscussions() { resolvedDiscussions() {
return this.discussions.filter(discussion => discussion.resolved); return this.discussions.filter((discussion) => discussion.resolved);
}, },
unresolvedDiscussions() { unresolvedDiscussions() {
return this.discussions.filter(discussion => !discussion.resolved); return this.discussions.filter((discussion) => !discussion.resolved);
}, },
resolvedCommentsToggleIcon() { resolvedCommentsToggleIcon() {
return this.resolvedDiscussionsExpanded ? 'chevron-down' : 'chevron-right'; return this.resolvedDiscussionsExpanded ? 'chevron-down' : 'chevron-right';
......
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
.then(() => { .then(() => {
this.incrementGlobalTodoCount(); this.incrementGlobalTodoCount();
}) })
.catch(err => { .catch((err) => {
this.$emit('error', Error(CREATE_DESIGN_TODO_ERROR)); this.$emit('error', Error(CREATE_DESIGN_TODO_ERROR));
throw err; throw err;
}) })
...@@ -133,7 +133,7 @@ export default { ...@@ -133,7 +133,7 @@ export default {
.then(() => { .then(() => {
this.decrementGlobalTodoCount(); this.decrementGlobalTodoCount();
}) })
.catch(err => { .catch((err) => {
this.$emit('error', Error(DELETE_DESIGN_TODO_ERROR)); this.$emit('error', Error(DELETE_DESIGN_TODO_ERROR));
throw err; throw err;
}) })
......
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