Commit 281cc730 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 31 files - 8 of 73

Part of our prettier migration; changing the arrow-parens style.
parent 1877bf55
......@@ -10,40 +10,6 @@ doc/api/graphql/reference/gitlab_schema.graphql
*.scss
*.md
## keen-chatelet
app/assets/javascripts/boards/components/board_assignee_dropdown.vue
app/assets/javascripts/boards/components/board_card_layout.vue
app/assets/javascripts/boards/components/board_form.vue
app/assets/javascripts/boards/components/board_list.vue
app/assets/javascripts/boards/components/board_list_new.vue
app/assets/javascripts/boards/components/board_new_issue_new.vue
app/assets/javascripts/boards/components/board_sidebar.js
app/assets/javascripts/boards/components/boards_selector.vue
app/assets/javascripts/boards/components/modal/footer.vue
app/assets/javascripts/boards/components/modal/index.vue
app/assets/javascripts/boards/components/project_select.vue
app/assets/javascripts/boards/components/sidebar/board_sidebar_labels_select.vue
app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue
app/assets/javascripts/boards/filtered_search_boards.js
app/assets/javascripts/boards/filters/due_date_filters.js
app/assets/javascripts/boards/index.js
app/assets/javascripts/boards/mixins/sortable_default_options.js
app/assets/javascripts/boards/models/issue.js
app/assets/javascripts/boards/models/list.js
app/assets/javascripts/boards/stores/actions.js
app/assets/javascripts/boards/stores/boards_store.js
app/assets/javascripts/boards/stores/getters.js
app/assets/javascripts/boards/stores/modal_store.js
app/assets/javascripts/boards/stores/mutations.js
app/assets/javascripts/branches/divergence_graph.js
app/assets/javascripts/breadcrumb.js
app/assets/javascripts/broadcast_notification.js
app/assets/javascripts/build_artifacts.js
app/assets/javascripts/ci_settings_pipeline_triggers/index.js
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_variable_table.vue
## relaxed-kilby
app/assets/javascripts/ci_variable_list/store/actions.js
app/assets/javascripts/ci_variable_list/store/getters.js
......
......@@ -119,7 +119,7 @@ export default {
this.selected = this.selected.concat(name);
},
unselect(name) {
this.selected = this.selected.filter(user => user.username !== name);
this.selected = this.selected.filter((user) => user.username !== name);
},
saveAssignees() {
this.setAssignees(this.selectedUserNames);
......
......@@ -43,7 +43,7 @@ export default {
},
computed: {
multiSelectVisible() {
return this.multiSelect.list.findIndex(issue => issue.id === this.issue.id) > -1;
return this.multiSelect.list.findIndex((issue) => issue.id === this.issue.id) > -1;
},
},
methods: {
......
......@@ -143,7 +143,7 @@ export default {
// For each list we check if the destination list is
// a the list were we should clone the issue
const shouldClone = Object.entries(cloneActions).some(
entry => fromBoardType === entry[0] && entry[1].includes(toBoardType),
(entry) => fromBoardType === entry[0] && entry[1].includes(toBoardType),
);
if (shouldClone) {
......@@ -156,7 +156,7 @@ export default {
},
revertClone: true,
},
onStart: e => {
onStart: (e) => {
const card = this.$refs.issue[e.oldIndex];
card.showDetail = false;
......@@ -171,15 +171,15 @@ export default {
sortableStart();
},
onAdd: e => {
onAdd: (e) => {
const { items = [], newIndicies = [] } = e;
if (items.length) {
// Not using e.newIndex here instead taking a min of all
// the newIndicies. Basically we have to find that during
// a drop what is the index we're going to start putting
// all the dropped elements from.
const newIndex = Math.min(...newIndicies.map(obj => obj.index).filter(i => i !== -1));
const issues = items.map(item =>
const newIndex = Math.min(...newIndicies.map((obj) => obj.index).filter((i) => i !== -1));
const issues = items.map((item) =>
boardsStore.moving.list.findIssue(Number(item.dataset.issueId)),
);
......@@ -201,23 +201,23 @@ export default {
});
}
},
onUpdate: e => {
const sortedArray = this.sortable.toArray().filter(id => id !== '-1');
onUpdate: (e) => {
const sortedArray = this.sortable.toArray().filter((id) => id !== '-1');
const { items = [], newIndicies = [], oldIndicies = [] } = e;
if (items.length) {
const newIndex = Math.min(...newIndicies.map(obj => obj.index));
const issues = items.map(item =>
const newIndex = Math.min(...newIndicies.map((obj) => obj.index));
const issues = items.map((item) =>
boardsStore.moving.list.findIssue(Number(item.dataset.issueId)),
);
boardsStore.moveMultipleIssuesInList({
list: this.list,
issues,
oldIndicies: oldIndicies.map(obj => obj.index),
oldIndicies: oldIndicies.map((obj) => obj.index),
newIndex,
idArray: sortedArray,
});
e.items.forEach(el => {
e.items.forEach((el) => {
Sortable.utils.deselect(el);
});
boardsStore.clearMultiSelect();
......@@ -232,7 +232,7 @@ export default {
sortedArray,
);
},
onEnd: e => {
onEnd: (e) => {
const { items = [], clones = [], to } = e;
// This is not a multi select operation
......@@ -253,14 +253,14 @@ export default {
*/
const isSameList = toList && toList.id === this.list.id;
if (toList && !isSameList && boardsStore.shouldRemoveIssue(this.list, toList)) {
const issues = items.map(item => this.list.findIssue(Number(item.dataset.issueId)));
const issues = items.map((item) => this.list.findIssue(Number(item.dataset.issueId)));
if (
issues.filter(Boolean).length &&
!boardsStore.issuesAreContiguous(this.list, issues)
) {
const indexes = [];
const ids = this.list.issues.map(i => i.id);
issues.forEach(issue => {
const ids = this.list.issues.map((i) => i.id);
issues.forEach((issue) => {
const index = ids.indexOf(issue.id);
if (index > -1) {
indexes.push(index);
......@@ -270,7 +270,7 @@ export default {
// Descending sort because splice would cause index discrepancy otherwise
const sortedIndexes = indexes.sort((a, b) => (a < b ? 1 : -1));
sortedIndexes.forEach(i => {
sortedIndexes.forEach((i) => {
/**
* **setTimeout and splice each element one-by-one in a loop
* is intended.**
......@@ -301,14 +301,14 @@ export default {
// Since Vue's list does not re-render the same keyed item, we'll
// remove `multi-select` class to express it's unselected
if (clones && clones.length) {
clones.forEach(el => el.classList.remove('multi-select'));
clones.forEach((el) => el.classList.remove('multi-select'));
}
// Due to some bug which I am unable to figure out
// Sortable does not deselect some pending items from the
// source list.
// We'll just do it forcefully here.
Array.from(document.querySelectorAll('.js-multi-select') || []).forEach(item => {
Array.from(document.querySelectorAll('.js-multi-select') || []).forEach((item) => {
Sortable.utils.deselect(item);
});
......@@ -322,7 +322,7 @@ export default {
*/
this.$nextTick(() => {
if (items && items.length) {
items.forEach(item => {
items.forEach((item) => {
item.remove();
});
}
......@@ -346,7 +346,7 @@ export default {
Sortable.utils.deselect(e.item);
}
},
onDeselect: e => {
onDeselect: (e) => {
const {
item: { dataset, classList },
} = e;
......
......@@ -153,7 +153,7 @@ export default {
let moveBeforeId;
let moveAfterId;
const getIssueId = el => Number(el.dataset.issueId);
const getIssueId = (el) => Number(el.dataset.issueId);
// If issue is being moved within the same list
if (from === to) {
......
......@@ -65,8 +65,8 @@ export default {
return this.addListNewIssue({
issueInput: {
title,
labelIds: labels?.map(l => l.id),
assigneeIds: assignees?.map(a => a?.id),
labelIds: labels?.map((l) => l.id),
assigneeIds: assignees?.map((a) => a?.id),
milestoneId: milestone?.id,
projectPath: this.selectedProject.path,
weight: weight >= 0 ? weight : null,
......
......@@ -68,7 +68,7 @@ export default Vue.extend({
: __('Label');
},
selectedLabels() {
return this.hasLabels ? this.issue.labels.map(l => l.title).join(',') : '';
return this.hasLabels ? this.issue.labels.map((l) => l.title).join(',') : '';
},
},
watch: {
......
......@@ -118,7 +118,7 @@ export default {
return this.state.currentPage;
},
filteredBoards() {
return this.boards.filter(board =>
return this.boards.filter((board) =>
board.name.toLowerCase().includes(this.filterTerm.toLowerCase()),
);
},
......@@ -181,10 +181,10 @@ export default {
this.loadingRecentBoards = true;
boardsStore
.recentBoards()
.then(res => {
.then((res) => {
this.recentBoards = res.data;
})
.catch(err => {
.catch((err) => {
/**
* If user is unauthorized we'd still want to resolve the
* request to display all boards.
......
......@@ -40,21 +40,21 @@ export default {
const firstListIndex = 1;
const list = this.modal.selectedList || this.state.lists[firstListIndex];
const selectedIssues = ModalStore.getSelectedIssues();
const issueIds = selectedIssues.map(issue => issue.id);
const issueIds = selectedIssues.map((issue) => issue.id);
const req = this.buildUpdateRequest(list);
// Post the data to the backend
boardsStore.bulkUpdate(issueIds, req).catch(() => {
Flash(__('Failed to update issues, please try again.'));
selectedIssues.forEach(issue => {
selectedIssues.forEach((issue) => {
list.removeIssue(issue);
list.issuesSize -= 1;
});
});
// Add the issues on the frontend
selectedIssues.forEach(issue => {
selectedIssues.forEach((issue) => {
list.addIssue(issue);
list.issuesSize += 1;
});
......
......@@ -100,13 +100,13 @@ export default {
page: this.page,
per: this.perPage,
})
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
if (clearIssues) {
this.issues = [];
}
data.issues.forEach(issueObj => {
data.issues.forEach((issueObj) => {
const issue = new ListIssue(issueObj);
const foundSelectedIssue = ModalStore.findSelectedIssue(issue);
issue.selected = Boolean(foundSelectedIssue);
......
......@@ -84,7 +84,7 @@ export default {
try {
const projects = await Api.groupProjects(this.groupId, this.searchTerm, this.fetchOptions);
this.projects = projects.map(project => {
this.projects = projects.map((project) => {
return {
id: project.id,
name: project.name,
......@@ -99,7 +99,7 @@ export default {
}
},
selectProject(projectId) {
this.selectedProject = this.projects.find(project => project.id === projectId);
this.selectedProject = this.projects.find((project) => project.id === projectId);
/*
TODO Remove eventhub, use Vuex for BoardNewIssue and GraphQL for BoardNewIssueNew
......
......@@ -25,7 +25,7 @@ export default {
selectedLabels() {
const { labels = [] } = this.activeIssue;
return labels.map(label => ({
return labels.map((label) => ({
...label,
id: getIdFromGraphQLId(label.id),
}));
......@@ -33,7 +33,7 @@ export default {
issueLabels() {
const { labels = [] } = this.activeIssue;
return labels.map(label => ({
return labels.map((label) => ({
...label,
scoped: isScopedLabel(label),
}));
......@@ -46,10 +46,10 @@ export default {
this.$refs.sidebarItem.collapse();
try {
const addLabelIds = payload.filter(label => label.set).map(label => label.id);
const addLabelIds = payload.filter((label) => label.set).map((label) => label.id);
const removeLabelIds = this.selectedLabels
.filter(label => !payload.find(selected => selected.id === label.id))
.map(label => label.id);
.filter((label) => !payload.find((selected) => selected.id === label.id))
.map((label) => label.id);
const input = { addLabelIds, removeLabelIds, projectPath: this.projectPathForActiveIssue };
await this.setActiveIssueLabels(input);
......
......@@ -50,7 +50,7 @@ export default {
},
update(data) {
const edges = data?.group?.milestones?.edges ?? [];
return edges.map(item => item.node);
return edges.map((item) => item.node);
},
error() {
createFlash({ message: this.$options.i18n.fetchMilestonesError });
......
......@@ -23,8 +23,8 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
// Issue boards is slightly different, we handle all the requests async
// instead or reloading the page, we just re-fire the list ajax requests
this.isHandledAsync = true;
this.cantEdit = cantEdit.filter(i => typeof i === 'string');
this.cantEditWithValue = cantEdit.filter(i => typeof i === 'object');
this.cantEdit = cantEdit.filter((i) => typeof i === 'string');
this.cantEditWithValue = cantEdit.filter((i) => typeof i === 'object');
if (vuexstore.getters.shouldUseGraphQL && vuexstore.state.boardConfig) {
const boardConfigPath = transformBoardConfig(vuexstore.state.boardConfig);
......@@ -55,7 +55,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
const tokens = FilteredSearchContainer.container.querySelectorAll('.js-visual-token');
// Remove all the tokens as they will be replaced by the search manager
[].forEach.call(tokens, el => {
[].forEach.call(tokens, (el) => {
el.parentNode.removeChild(el);
});
......@@ -75,7 +75,7 @@ export default class FilteredSearchBoards extends FilteredSearchManager {
if (this.cantEdit.includes(tokenName)) return false;
return (
this.cantEditWithValue.findIndex(
token => token.name === tokenName && token.value === tokenValue,
(token) => token.name === tokenName && token.value === tokenValue,
) === -1
);
}
......
import Vue from 'vue';
import dateFormat from 'dateformat';
Vue.filter('due-date', value => {
Vue.filter('due-date', (value) => {
const date = new Date(value);
return dateFormat(date, 'mmm d, yyyy', true);
});
......@@ -55,7 +55,7 @@ export default () => {
const $boardApp = document.getElementById('board-app');
// check for browser back and trigger a hard reload to circumvent browser caching.
window.addEventListener('pageshow', event => {
window.addEventListener('pageshow', (event) => {
const isNavTypeBackForward =
window.performance && window.performance.navigation.type === NavigationType.TYPE_BACK_FORWARD;
......@@ -174,9 +174,9 @@ export default () => {
initialBoardLoad() {
boardsStore
.all()
.then(res => res.data)
.then(lists => {
lists.forEach(list => boardsStore.addList(list));
.then((res) => res.data)
.then((lists) => {
lists.forEach((list) => boardsStore.addList(list));
this.loading = false;
})
.catch(() => {
......@@ -194,8 +194,8 @@ export default () => {
setEpicFetchingState(newIssue, true);
boardsStore
.getIssueInfo(sidebarInfoEndpoint)
.then(res => res.data)
.then(data => {
.then((res) => res.data)
.then((data) => {
const {
subscribed,
totalTimeSpent,
......@@ -305,7 +305,7 @@ export default () => {
if (!this.store) {
return true;
}
return !this.store.lists.filter(list => !list.preset).length;
return !this.store.lists.filter((list) => !list.preset).length;
},
},
methods: {
......
......@@ -24,7 +24,7 @@ export function getBoardSortableDefaultOptions(obj) {
onEnd: sortableEnd,
};
Object.keys(obj).forEach(key => {
Object.keys(obj).forEach((key) => {
defaultSortOptions[key] = obj[key];
});
return defaultSortOptions;
......
......@@ -70,7 +70,7 @@ class ListIssue {
}
getLists() {
return boardsStore.state.lists.filter(list => list.findIssue(this.id));
return boardsStore.state.lists.filter((list) => list.findIssue(this.id));
}
updateData(newData) {
......
......@@ -134,7 +134,7 @@ class List {
updateMultipleIssues(issues, listFrom, moveBeforeId, moveAfterId) {
boardsStore
.moveMultipleIssues({
ids: issues.map(issue => issue.id),
ids: issues.map((issue) => issue.id),
fromListId: listFrom.id,
toListId: this.id,
moveBeforeId,
......
......@@ -97,7 +97,7 @@ export default {
const { lists, hideBacklogList } = data[boardType]?.board;
commit(types.RECEIVE_BOARD_LISTS_SUCCESS, formatBoardLists(lists));
// Backlog list needs to be created if it doesn't exist and it's not hidden
if (!lists.nodes.find(l => l.listType === ListType.backlog) && !hideBacklogList) {
if (!lists.nodes.find((l) => l.listType === ListType.backlog) && !hideBacklogList) {
dispatch('createList', { backlog: true });
}
})
......@@ -390,7 +390,7 @@ export default {
commit(types.ADD_ISSUE_TO_LIST, { list, issue, position: 0 });
dispatch('createNewIssue', issueInput)
.then(res => {
.then((res) => {
commit(types.ADD_ISSUE_TO_LIST, {
list,
issue: formatIssue({ ...res, id: getIdFromGraphQLId(res.id) }),
......
......@@ -2,18 +2,18 @@ import { find } from 'lodash';
import { inactiveId } from '../constants';
export default {
isSidebarOpen: state => state.activeId !== inactiveId,
isSidebarOpen: (state) => state.activeId !== inactiveId,
isSwimlanesOn: () => false,
getIssueById: state => id => {
getIssueById: (state) => (id) => {
return state.issues[id] || {};
},
getIssuesByList: (state, getters) => listId => {
getIssuesByList: (state, getters) => (listId) => {
const listIssueIds = state.issuesByListId[listId] || [];
return listIssueIds.map(id => getters.getIssueById(id));
return listIssueIds.map((id) => getters.getIssueById(id));
},
activeIssue: state => {
activeIssue: (state) => {
return state.issues[state.activeId] || {};
},
......@@ -22,12 +22,12 @@ export default {
return referencePath.slice(0, referencePath.indexOf('#'));
},
getListByLabelId: state => labelId => {
return find(state.boardLists, l => l.label?.id === labelId);
getListByLabelId: (state) => (labelId) => {
return find(state.boardLists, (l) => l.label?.id === labelId);
},
getListByTitle: state => title => {
return find(state.boardLists, l => l.title === title);
getListByTitle: (state) => (title) => {
return find(state.boardLists, (l) => l.title === title);
},
shouldUseGraphQL: () => {
......
......@@ -40,7 +40,7 @@ class ModalStore {
toggleAll() {
const select = this.selectedCount() !== this.store.issues.length;
this.store.issues.forEach(issue => {
this.store.issues.forEach((issue) => {
const issueUpdate = issue;
if (issueUpdate.selected !== select) {
......@@ -56,7 +56,7 @@ class ModalStore {
}
getSelectedIssues() {
return this.store.selectedIssues.filter(issue => issue.selected);
return this.store.selectedIssues.filter((issue) => issue.selected);
}
addSelectedIssue(issue) {
......@@ -70,13 +70,13 @@ class ModalStore {
removeSelectedIssue(issue, forcePurge = false) {
if (this.store.activeTab === 'all' || forcePurge) {
this.store.selectedIssues = this.store.selectedIssues.filter(
fIssue => fIssue.id !== issue.id,
(fIssue) => fIssue.id !== issue.id,
);
}
}
purgeUnselectedIssues() {
this.store.selectedIssues.forEach(issue => {
this.store.selectedIssues.forEach((issue) => {
if (!issue.selected) {
this.removeSelectedIssue(issue, true);
}
......@@ -88,7 +88,7 @@ class ModalStore {
}
findSelectedIssue(issue) {
return this.store.selectedIssues.filter(filteredIssue => filteredIssue.id === issue.id)[0];
return this.store.selectedIssues.filter((filteredIssue) => filteredIssue.id === issue.id)[0];
}
}
......
......@@ -44,7 +44,7 @@ export default {
state.boardLists = lists;
},
[mutationTypes.RECEIVE_BOARD_LISTS_FAILURE]: state => {
[mutationTypes.RECEIVE_BOARD_LISTS_FAILURE]: (state) => {
state.error = s__(
'Boards|An error occurred while fetching the board lists. Please reload the page.',
);
......@@ -59,15 +59,15 @@ export default {
state.filterParams = filterParams;
},
[mutationTypes.CREATE_LIST_FAILURE]: state => {
[mutationTypes.CREATE_LIST_FAILURE]: (state) => {
state.error = s__('Boards|An error occurred while creating the list. Please try again.');
},
[mutationTypes.RECEIVE_LABELS_FAILURE]: state => {
[mutationTypes.RECEIVE_LABELS_FAILURE]: (state) => {
state.error = s__('Boards|An error occurred while fetching labels. Please reload the page.');
},
[mutationTypes.GENERATE_DEFAULT_LISTS_FAILURE]: state => {
[mutationTypes.GENERATE_DEFAULT_LISTS_FAILURE]: (state) => {
state.error = s__('Boards|An error occurred while generating lists. Please reload the page.');
},
......@@ -129,8 +129,8 @@ export default {
Vue.set(state.listsFlags, listId, { isLoading: false, isLoadingMore: false });
},
[mutationTypes.RESET_ISSUES]: state => {
Object.keys(state.issuesByListId).forEach(listId => {
[mutationTypes.RESET_ISSUES]: (state) => {
Object.keys(state.issuesByListId).forEach((listId) => {
Vue.set(state.issuesByListId, listId, []);
});
},
......@@ -206,7 +206,7 @@ export default {
notImplemented();
},
[mutationTypes.CREATE_ISSUE_FAILURE]: state => {
[mutationTypes.CREATE_ISSUE_FAILURE]: (state) => {
state.error = s__('Boards|An error occurred while creating the issue. Please try again.');
},
......
......@@ -21,7 +21,7 @@ export function createGraphVueApp(el, data, maxCommits) {
});
}
export default endpoint => {
export default (endpoint) => {
const names = [...document.querySelectorAll('.js-branch-item')].map(
({ dataset }) => dataset.name,
);
......
import $ from 'jquery';
import { hide } from '~/tooltips';
export const addTooltipToEl = el => {
export const addTooltipToEl = (el) => {
const textEl = el.querySelector('.js-breadcrumb-item-text');
if (textEl && textEl.scrollWidth > textEl.offsetWidth) {
......@@ -16,14 +16,14 @@ export default () => {
if (breadcrumbs) {
const topLevelLinks = [...breadcrumbs.children]
.filter(el => !el.classList.contains('dropdown'))
.map(el => el.querySelector('a'))
.filter(el => el);
.filter((el) => !el.classList.contains('dropdown'))
.map((el) => el.querySelector('a'))
.filter((el) => el);
const $expander = $('.js-breadcrumbs-collapsed-expander');
topLevelLinks.forEach(el => addTooltipToEl(el));
topLevelLinks.forEach((el) => addTooltipToEl(el));
$expander.closest('.dropdown').on('show.bs.dropdown hide.bs.dropdown', e => {
$expander.closest('.dropdown').on('show.bs.dropdown hide.bs.dropdown', (e) => {
const $el = $('.js-breadcrumbs-collapsed-expander', e.currentTarget);
$el.toggleClass('open');
......
......@@ -15,5 +15,5 @@ const handleOnDismiss = ({ currentTarget }) => {
export default () => {
document
.querySelectorAll('.js-dismiss-current-broadcast-notification')
.forEach(dismissButton => dismissButton.addEventListener('click', handleOnDismiss));
.forEach((dismissButton) => dismissButton.addEventListener('click', handleOnDismiss));
};
......@@ -14,10 +14,10 @@ export default class BuildArtifacts {
// eslint-disable-next-line class-methods-use-this
disablePropagation() {
$('.top-block').on('click', '.download', e => {
$('.top-block').on('click', '.download', (e) => {
e.stopPropagation();
});
return $('.tree-holder').on('click', 'tr[data-link] a', e => {
return $('.tree-holder').on('click', 'tr[data-link] a', (e) => {
e.stopImmediatePropagation();
});
}
......@@ -41,12 +41,12 @@ export default class BuildArtifacts {
// We want the tooltip to show if you hover anywhere on the row
// But be placed below and in the middle of the file name
$('.js-artifact-tree-row')
.on('mouseenter', e => {
.on('mouseenter', (e) => {
const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip');
show($el);
})
.on('mouseleave', e => {
.on('mouseleave', (e) => {
const $el = $(e.currentTarget).find('.js-artifact-tree-tooltip');
hide($el);
......
......@@ -2,7 +2,7 @@ import Vue from 'vue';
import TriggersList from './components/triggers_list.vue';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
const parseJsonArray = triggers => {
const parseJsonArray = (triggers) => {
try {
return convertObjectPropsToCamelCase(JSON.parse(triggers), { deep: true });
} catch {
......
......@@ -81,17 +81,17 @@ export default class VariableList {
this.initRow(rowEl);
});
this.$container.on('click', '.js-row-remove-button', e => {
this.$container.on('click', '.js-row-remove-button', (e) => {
e.preventDefault();
this.removeRow($(e.currentTarget).closest('.js-row'));
});
const inputSelector = Object.keys(this.inputMap)
.map(name => this.inputMap[name].selector)
.map((name) => this.inputMap[name].selector)
.join(',');
// Remove any empty rows except the last row
this.$container.on('blur', inputSelector, e => {
this.$container.on('blur', inputSelector, (e) => {
const $row = $(e.currentTarget).closest('.js-row');
if ($row.is(':not(:last-child)') && !this.checkIfRowTouched($row)) {
......@@ -99,7 +99,7 @@ export default class VariableList {
}
});
this.$container.on('input trigger-change', inputSelector, e => {
this.$container.on('input trigger-change', inputSelector, (e) => {
// Always make sure there is an empty last row
const $lastRow = this.$container.find('.js-row').last();
......@@ -149,7 +149,7 @@ export default class VariableList {
$rowClone.removeAttr('data-is-persisted');
// Reset the inputs to their defaults
Object.keys(this.inputMap).forEach(name => {
Object.keys(this.inputMap).forEach((name) => {
const entry = this.inputMap[name];
$rowClone.find(entry.selector).val(entry.default);
});
......@@ -184,7 +184,7 @@ export default class VariableList {
}
checkIfRowTouched($row) {
return Object.keys(this.inputMap).some(name => {
return Object.keys(this.inputMap).some((name) => {
// Row should not qualify as touched if only switches have been touched
if (['protected', 'masked'].includes(name)) return false;
......@@ -225,9 +225,9 @@ export default class VariableList {
// a blank variable and run into validation problems.
const validRows = this.$container.find('.js-row').toArray().slice(0, -1);
return validRows.map(rowEl => {
return validRows.map((rowEl) => {
const resultant = {};
Object.keys(this.inputMap).forEach(name => {
Object.keys(this.inputMap).forEach((name) => {
const entry = this.inputMap[name];
const $input = $(rowEl).find(entry.selector);
if ($input.length) {
......
......@@ -33,7 +33,7 @@ export default {
},
filteredResults() {
const lowerCasedSearchTerm = this.searchTerm.toLowerCase();
return this.joinedEnvironments.filter(resultString =>
return this.joinedEnvironments.filter((resultString) =>
resultString.toLowerCase().includes(lowerCasedSearchTerm),
);
},
......
......@@ -69,7 +69,7 @@ export default {
},
fields() {
if (this.isGroup) {
return this.$options.fields.filter(field => field.key !== 'environment_scope');
return this.$options.fields.filter((field) => field.key !== 'environment_scope');
}
return this.$options.fields;
},
......
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