Commit af616eea authored by Mike Greiling's avatar Mike Greiling

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

Format files with prettier arrowParens [5/15]

See merge request gitlab-org/gitlab!50531
parents 43b4f5b4 c04bd247
...@@ -365,171 +365,6 @@ app/assets/javascripts/lib/utils/text_markdown.js ...@@ -365,171 +365,6 @@ app/assets/javascripts/lib/utils/text_markdown.js
app/assets/javascripts/lib/utils/text_utility.js app/assets/javascripts/lib/utils/text_utility.js
app/assets/javascripts/lib/utils/type_utility.js app/assets/javascripts/lib/utils/type_utility.js
## zen-robinson
app/assets/javascripts/lib/utils/unit_format/formatter_factory.js
app/assets/javascripts/lib/utils/url_utility.js
app/assets/javascripts/line_highlighter.js
app/assets/javascripts/locale/ensure_single_line.js
app/assets/javascripts/locale/index.js
app/assets/javascripts/locale/sprintf.js
app/assets/javascripts/logs/components/log_advanced_filters.vue
app/assets/javascripts/logs/logs_tracking_helper.js
app/assets/javascripts/logs/stores/actions.js
app/assets/javascripts/logs/stores/getters.js
app/assets/javascripts/logs/utils.js
app/assets/javascripts/main.js
app/assets/javascripts/manual_ordering.js
app/assets/javascripts/member_expiration_date.js
app/assets/javascripts/members.js
app/assets/javascripts/members/components/avatars/user_avatar.vue
app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue
app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue
app/assets/javascripts/members/store/index.js
app/assets/javascripts/members/utils.js
app/assets/javascripts/merge_conflicts/components/diff_file_editor.js
app/assets/javascripts/merge_conflicts/components/inline_conflict_lines.js
app/assets/javascripts/merge_conflicts/components/parallel_conflict_lines.js
app/assets/javascripts/merge_conflicts/merge_conflict_store.js
app/assets/javascripts/merge_request.js
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/milestone.js
app/assets/javascripts/milestone_select.js
app/assets/javascripts/milestones/components/milestone_combobox.vue
app/assets/javascripts/milestones/stores/actions.js
app/assets/javascripts/milestones/stores/mutations.js
## inspiring-lovelace
app/assets/javascripts/mini_pipeline_graph_dropdown.js
app/assets/javascripts/mirrors/mirror_repos.js
app/assets/javascripts/mirrors/ssh_mirror.js
app/assets/javascripts/monitoring/components/alert_widget.vue
app/assets/javascripts/monitoring/components/alert_widget_form.vue
app/assets/javascripts/monitoring/components/charts/annotations.js
app/assets/javascripts/monitoring/components/charts/anomaly.vue
app/assets/javascripts/monitoring/components/charts/bar.vue
app/assets/javascripts/monitoring/components/charts/column.vue
app/assets/javascripts/monitoring/components/charts/heatmap.vue
app/assets/javascripts/monitoring/components/charts/options.js
app/assets/javascripts/monitoring/components/charts/stacked_column.vue
app/assets/javascripts/monitoring/components/charts/time_series.vue
app/assets/javascripts/monitoring/components/dashboard_panel.vue
app/assets/javascripts/monitoring/components/duplicate_dashboard_form.vue
app/assets/javascripts/monitoring/components/duplicate_dashboard_modal.vue
app/assets/javascripts/monitoring/components/embeds/embed_group.vue
app/assets/javascripts/monitoring/components/embeds/metric_embed.vue
app/assets/javascripts/monitoring/components/empty_state.vue
app/assets/javascripts/monitoring/components/variables/dropdown_field.vue
app/assets/javascripts/monitoring/csv_export.js
app/assets/javascripts/monitoring/requests/index.js
app/assets/javascripts/monitoring/services/alerts_service.js
app/assets/javascripts/monitoring/stores/embed_group/getters.js
app/assets/javascripts/monitoring/stores/mutations.js
app/assets/javascripts/monitoring/stores/utils.js
app/assets/javascripts/monitoring/stores/variable_mapping.js
app/assets/javascripts/monitoring/utils.js
app/assets/javascripts/monitoring/validators.js
app/assets/javascripts/mr_notes/init_notes.js
app/assets/javascripts/mr_notes/stores/getters.js
## cool-dirac
app/assets/javascripts/mr_popover/components/mr_popover.vue
app/assets/javascripts/mr_popover/index.js
app/assets/javascripts/namespace_select.js
app/assets/javascripts/network/branch_graph.js
app/assets/javascripts/new_branch_form.js
app/assets/javascripts/notebook/cells/markdown.vue
app/assets/javascripts/notes.js
app/assets/javascripts/notes/components/diff_with_note.vue
app/assets/javascripts/notes/components/discussion_actions.vue
app/assets/javascripts/notes/components/discussion_counter.vue
app/assets/javascripts/notes/components/discussion_filter.vue
app/assets/javascripts/notes/components/multiline_comment_utils.js
app/assets/javascripts/notes/components/note_actions.vue
app/assets/javascripts/notes/components/note_body.vue
app/assets/javascripts/notes/components/note_form.vue
app/assets/javascripts/notes/components/noteable_discussion.vue
app/assets/javascripts/notes/components/noteable_note.vue
app/assets/javascripts/notes/components/notes_app.vue
app/assets/javascripts/notes/components/toggle_replies_widget.vue
app/assets/javascripts/notes/discussion_filters.js
app/assets/javascripts/notes/mixins/diff_line_note_form.js
app/assets/javascripts/notes/mixins/discussion_navigation.js
app/assets/javascripts/notes/mixins/resolvable.js
app/assets/javascripts/notes/sort_discussions.js
app/assets/javascripts/notes/stores/actions.js
app/assets/javascripts/notes/stores/collapse_utils.js
app/assets/javascripts/notes/stores/getters.js
app/assets/javascripts/notes/stores/mutations.js
app/assets/javascripts/notes/stores/utils.js
app/assets/javascripts/notes/utils.js
app/assets/javascripts/notifications_dropdown.js
## practical-cohen
app/assets/javascripts/onboarding_issues/index.js
app/assets/javascripts/operation_settings/store/actions.js
app/assets/javascripts/operation_settings/store/index.js
app/assets/javascripts/packages/details/components/package_files.vue
app/assets/javascripts/packages/list/components/packages_list.vue
app/assets/javascripts/packages/list/components/packages_list_app.vue
app/assets/javascripts/packages/list/components/packages_sort.vue
app/assets/javascripts/packages/list/stores/getters.js
app/assets/javascripts/packages/shared/components/package_tags.vue
app/assets/javascripts/packages/shared/utils.js
app/assets/javascripts/pages/admin/admin.js
app/assets/javascripts/pages/admin/application_settings/payload_previewer.js
app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
app/assets/javascripts/pages/admin/jobs/index/components/stop_jobs_modal.vue
app/assets/javascripts/pages/admin/projects/index.js
app/assets/javascripts/pages/admin/projects/index/index.js
app/assets/javascripts/pages/admin/users/index.js
app/assets/javascripts/pages/admin/users/new/index.js
app/assets/javascripts/pages/dashboard/projects/index/components/customize_homepage_banner.vue
app/assets/javascripts/pages/dashboard/projects/index/init_customize_homepage_banner.js
app/assets/javascripts/pages/groups/new/group_path_validator.js
app/assets/javascripts/pages/groups/shared/group_tabs.js
app/assets/javascripts/pages/milestones/shared/components/delete_milestone_modal.vue
app/assets/javascripts/pages/milestones/shared/components/promote_milestone_modal.vue
app/assets/javascripts/pages/milestones/shared/delete_milestone_modal_init.js
app/assets/javascripts/pages/milestones/shared/promote_milestone_modal_init.js
app/assets/javascripts/pages/profiles/show/index.js
app/assets/javascripts/pages/projects/blob/show/index.js
app/assets/javascripts/pages/projects/graphs/charts/index.js
app/assets/javascripts/pages/projects/graphs/components/code_coverage.vue
app/assets/javascripts/pages/projects/issues/service_desk/filtered_search.js
## vigorous-wiles
app/assets/javascripts/pages/projects/issues/show.js
app/assets/javascripts/pages/projects/jobs/index/index.js
app/assets/javascripts/pages/projects/labels/components/promote_label_modal.vue
app/assets/javascripts/pages/projects/labels/index/index.js
app/assets/javascripts/pages/projects/merge_requests/creations/new/compare.js
app/assets/javascripts/pages/projects/new/index.js
app/assets/javascripts/pages/projects/pages_domains/form.js
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js
app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/timezone_dropdown.js
app/assets/javascripts/pages/projects/pipelines/init_pipelines.js
app/assets/javascripts/pages/projects/project.js
app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
app/assets/javascripts/pages/projects/shared/permissions/external.js
app/assets/javascripts/pages/projects/shared/permissions/index.js
app/assets/javascripts/pages/projects/tags/index/index.js
app/assets/javascripts/pages/search/show/refresh_counts.js
app/assets/javascripts/pages/sessions/new/length_validator.js
app/assets/javascripts/pages/sessions/new/preserve_url_fragment.js
app/assets/javascripts/pages/sessions/new/signin_tabs_memoizer.js
app/assets/javascripts/pages/sessions/new/username_validator.js
app/assets/javascripts/pages/shared/mount_badge_settings.js
app/assets/javascripts/pages/shared/wikis/wikis.js
app/assets/javascripts/pages/users/activity_calendar.js
app/assets/javascripts/pages/users/index.js
app/assets/javascripts/pdf/index.vue
app/assets/javascripts/pdf/page/index.vue
app/assets/javascripts/performance/utils.js
app/assets/javascripts/performance_bar/components/detailed_metric.vue
app/assets/javascripts/performance_bar/components/request_selector.vue
app/assets/javascripts/performance_bar/index.js
app/assets/javascripts/performance_bar/performance_bar_log.js
## musing-khayyam ## musing-khayyam
app/assets/javascripts/performance_bar/services/performance_bar_service.js app/assets/javascripts/performance_bar/services/performance_bar_service.js
app/assets/javascripts/performance_bar/stores/performance_bar_store.js app/assets/javascripts/performance_bar/stores/performance_bar_store.js
......
...@@ -106,7 +106,7 @@ export const scaledSIFormatter = (unit = '', prefixOffset = 0) => { ...@@ -106,7 +106,7 @@ export const scaledSIFormatter = (unit = '', prefixOffset = 0) => {
const multiplicative = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; const multiplicative = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
const symbols = [...fractional, '', ...multiplicative]; const symbols = [...fractional, '', ...multiplicative];
const units = symbols.slice(fractional.length + prefixOffset).map(prefix => { const units = symbols.slice(fractional.length + prefixOffset).map((prefix) => {
return `${prefix}${unit}`; return `${prefix}${unit}`;
}); });
...@@ -126,7 +126,7 @@ export const scaledBinaryFormatter = (unit = '', prefixOffset = 0) => { ...@@ -126,7 +126,7 @@ export const scaledBinaryFormatter = (unit = '', prefixOffset = 0) => {
const multiplicative = ['Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi']; const multiplicative = ['Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
const symbols = ['', ...multiplicative]; const symbols = ['', ...multiplicative];
const units = symbols.slice(prefixOffset).map(prefix => { const units = symbols.slice(prefixOffset).map((prefix) => {
return `${prefix}${unit}`; return `${prefix}${unit}`;
}); });
......
...@@ -112,13 +112,13 @@ export function mergeUrlParams(params, url, options = {}) { ...@@ -112,13 +112,13 @@ export function mergeUrlParams(params, url, options = {}) {
const mergedKeys = sort ? Object.keys(merged).sort() : Object.keys(merged); const mergedKeys = sort ? Object.keys(merged).sort() : Object.keys(merged);
const newQuery = mergedKeys const newQuery = mergedKeys
.filter(key => merged[key] !== null) .filter((key) => merged[key] !== null)
.map(key => { .map((key) => {
let value = merged[key]; let value = merged[key];
const encodedKey = encodeURIComponent(key); const encodedKey = encodeURIComponent(key);
if (spreadArrays && Array.isArray(value)) { if (spreadArrays && Array.isArray(value)) {
value = merged[key] value = merged[key]
.map(arrayValue => encodeURIComponent(arrayValue)) .map((arrayValue) => encodeURIComponent(arrayValue))
.join(`&${encodedKey}[]=`); .join(`&${encodedKey}[]=`);
return `${encodedKey}[]=${value}`; return `${encodedKey}[]=${value}`;
} }
...@@ -150,11 +150,11 @@ export function removeParams(params, url = window.location.href, skipEncoding = ...@@ -150,11 +150,11 @@ export function removeParams(params, url = window.location.href, skipEncoding =
return url; return url;
} }
const removableParams = skipEncoding ? params : params.map(param => encodeURIComponent(param)); const removableParams = skipEncoding ? params : params.map((param) => encodeURIComponent(param));
const updatedQuery = query const updatedQuery = query
.split('&') .split('&')
.filter(paramPair => { .filter((paramPair) => {
const [foundParam] = paramPair.split('='); const [foundParam] = paramPair.split('=');
return removableParams.indexOf(foundParam) < 0; return removableParams.indexOf(foundParam) < 0;
}) })
...@@ -237,7 +237,7 @@ export function redirectTo(url) { ...@@ -237,7 +237,7 @@ export function redirectTo(url) {
return window.location.assign(url); return window.location.assign(url);
} }
export const escapeFileUrl = fileUrl => encodeURIComponent(fileUrl).replace(/%2F/g, '/'); export const escapeFileUrl = (fileUrl) => encodeURIComponent(fileUrl).replace(/%2F/g, '/');
export function webIDEUrl(route = undefined) { export function webIDEUrl(route = undefined) {
let returnUrl = `${gon.relative_url_root || ''}/-/ide/`; let returnUrl = `${gon.relative_url_root || ''}/-/ide/`;
...@@ -396,7 +396,7 @@ export function queryToObject(query, options = {}) { ...@@ -396,7 +396,7 @@ export function queryToObject(query, options = {}) {
*/ */
export function objectToQuery(obj) { export function objectToQuery(obj) {
return Object.keys(obj) return Object.keys(obj)
.map(k => `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`) .map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(obj[k])}`)
.join('&'); .join('&');
} }
...@@ -420,7 +420,7 @@ export const setUrlParams = ( ...@@ -420,7 +420,7 @@ export const setUrlParams = (
const queryString = urlObj.search; const queryString = urlObj.search;
const searchParams = clearParams ? new URLSearchParams('') : new URLSearchParams(queryString); const searchParams = clearParams ? new URLSearchParams('') : new URLSearchParams(queryString);
Object.keys(params).forEach(key => { Object.keys(params).forEach((key) => {
if (params[key] === null || params[key] === undefined) { if (params[key] === null || params[key] === undefined) {
searchParams.delete(key); searchParams.delete(key);
} else if (Array.isArray(params[key])) { } else if (Array.isArray(params[key])) {
......
...@@ -55,7 +55,7 @@ LineHighlighter.prototype.bindEvents = function () { ...@@ -55,7 +55,7 @@ LineHighlighter.prototype.bindEvents = function () {
$fileHolder.on('click', 'a[data-line-number]', this.clickHandler); $fileHolder.on('click', 'a[data-line-number]', this.clickHandler);
$fileHolder.on('highlight:line', this.highlightHash); $fileHolder.on('highlight:line', this.highlightHash);
window.addEventListener('hashchange', e => this.highlightHash(e.target.location.hash)); window.addEventListener('hashchange', (e) => this.highlightHash(e.target.location.hash));
}; };
LineHighlighter.prototype.highlightHash = function (newHash) { LineHighlighter.prototype.highlightHash = function (newHash) {
......
...@@ -18,7 +18,7 @@ module.exports = function ensureSingleLine(str) { ...@@ -18,7 +18,7 @@ module.exports = function ensureSingleLine(str) {
if (str.includes('\n') || str.includes('\r')) { if (str.includes('\n') || str.includes('\r')) {
return str return str
.split(SPLIT_REGEX) .split(SPLIT_REGEX)
.filter(s => s !== '') .filter((s) => s !== '')
.join(' '); .join(' ');
} }
return str; return str;
......
...@@ -11,7 +11,7 @@ delete window.translations; ...@@ -11,7 +11,7 @@ delete window.translations;
@param text The text to be translated @param text The text to be translated
@returns {String} The translated text @returns {String} The translated text
*/ */
const gettext = text => locale.gettext(ensureSingleLine(text)); const gettext = (text) => locale.gettext(ensureSingleLine(text));
/** /**
Translate the text with a number Translate the text with a number
...@@ -56,7 +56,7 @@ const pgettext = (keyOrContext, key) => { ...@@ -56,7 +56,7 @@ const pgettext = (keyOrContext, key) => {
@param formatOptions for available options, please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat @param formatOptions for available options, please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
@returns {Intl.DateTimeFormat} @returns {Intl.DateTimeFormat}
*/ */
const createDateTimeFormat = formatOptions => Intl.DateTimeFormat(languageCode(), formatOptions); const createDateTimeFormat = (formatOptions) => Intl.DateTimeFormat(languageCode(), formatOptions);
export { languageCode }; export { languageCode };
export { gettext as __ }; export { gettext as __ };
......
...@@ -15,7 +15,7 @@ export default (input, parameters, escapeParameters = true) => { ...@@ -15,7 +15,7 @@ export default (input, parameters, escapeParameters = true) => {
let output = input; let output = input;
if (parameters) { if (parameters) {
Object.keys(parameters).forEach(parameterName => { Object.keys(parameters).forEach((parameterName) => {
const parameterValue = parameters[parameterName]; const parameterValue = parameters[parameterName];
const escapedParameterValue = escapeParameters ? escape(parameterValue) : parameterValue; const escapedParameterValue = escapeParameters ? escape(parameterValue) : parameterValue;
output = output.replace(new RegExp(`%{${parameterName}}`, 'g'), escapedParameterValue); output = output.replace(new RegExp(`%{${parameterName}}`, 'g'), escapedParameterValue);
......
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
*/ */
podOptions() { podOptions() {
if (this.pods.options.length) { if (this.pods.options.length) {
return this.pods.options.map(podName => ({ value: podName, title: podName })); return this.pods.options.map((podName) => ({ value: podName, title: podName }));
} }
return null; return null;
}, },
......
...@@ -8,7 +8,7 @@ import Tracking from '~/tracking'; ...@@ -8,7 +8,7 @@ import Tracking from '~/tracking';
* 3. Change the time range * 3. Change the time range
* 4. Use the search bar * 4. Use the search bar
*/ */
const trackLogs = label => const trackLogs = (label) =>
Tracking.event(document.body.dataset.page, 'logs_view', { Tracking.event(document.body.dataset.page, 'logs_view', {
label, label,
property: 'count', property: 'count',
......
...@@ -11,14 +11,14 @@ const requestUntilData = (url, params) => ...@@ -11,14 +11,14 @@ const requestUntilData = (url, params) =>
backOff((next, stop) => { backOff((next, stop) => {
axios axios
.get(url, { params }) .get(url, { params })
.then(res => { .then((res) => {
if (res.status === httpStatusCodes.ACCEPTED) { if (res.status === httpStatusCodes.ACCEPTED) {
next(); next();
return; return;
} }
stop(res); stop(res);
}) })
.catch(err => { .catch((err) => {
stop(err); stop(err);
}); });
}); });
...@@ -66,12 +66,12 @@ const requestLogsUntilData = ({ commit, state }) => { ...@@ -66,12 +66,12 @@ const requestLogsUntilData = ({ commit, state }) => {
const filtersToParams = (filters = []) => { const filtersToParams = (filters = []) => {
// Strings become part of the `search` // Strings become part of the `search`
const search = filters const search = filters
.filter(f => typeof f === 'string') .filter((f) => typeof f === 'string')
.join(' ') .join(' ')
.trim(); .trim();
// null podName to show all pods // null podName to show all pods
const podName = filters.find(f => f?.type === TOKEN_TYPE_POD_NAME)?.value?.data ?? null; const podName = filters.find((f) => f?.type === TOKEN_TYPE_POD_NAME)?.value?.data ?? null;
return { search, podName }; return { search, podName };
}; };
......
...@@ -3,9 +3,9 @@ import { formatDate } from '../utils'; ...@@ -3,9 +3,9 @@ import { formatDate } from '../utils';
const mapTrace = ({ timestamp = null, pod = '', message = '' }) => const mapTrace = ({ timestamp = null, pod = '', message = '' }) =>
[timestamp ? formatDate(timestamp) : '', pod, message].join(' | '); [timestamp ? formatDate(timestamp) : '', pod, message].join(' | ');
export const trace = state => state.logs.lines.map(mapTrace).join('\n'); export const trace = (state) => state.logs.lines.map(mapTrace).join('\n');
export const showAdvancedFilters = state => { export const showAdvancedFilters = (state) => {
if (state.environments.current) { if (state.environments.current) {
const environment = state.environments.options.find( const environment = state.environments.options.find(
({ name }) => name === state.environments.current, ({ name }) => name === state.environments.current,
......
...@@ -22,4 +22,4 @@ export const getTimeRange = (seconds = 0) => { ...@@ -22,4 +22,4 @@ export const getTimeRange = (seconds = 0) => {
}; };
}; };
export const formatDate = timestamp => dateFormat(timestamp, dateFormatMask); export const formatDate = (timestamp) => dateFormat(timestamp, dateFormatMask);
...@@ -298,7 +298,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -298,7 +298,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (flashContainer && flashContainer.children.length) { if (flashContainer && flashContainer.children.length) {
flashContainer flashContainer
.querySelectorAll('.flash-alert, .flash-notice, .flash-success') .querySelectorAll('.flash-alert, .flash-notice, .flash-success')
.forEach(flashEl => { .forEach((flashEl) => {
removeFlashClickListener(flashEl); removeFlashClickListener(flashEl);
}); });
} }
......
...@@ -39,7 +39,7 @@ const initManualOrdering = (draggableSelector = 'li.issue') => { ...@@ -39,7 +39,7 @@ const initManualOrdering = (draggableSelector = 'li.issue') => {
onStart: () => { onStart: () => {
sortableStart(); sortableStart();
}, },
onUpdate: event => { onUpdate: (event) => {
const el = event.item; const el = event.item;
const url = el.getAttribute('url') || el.dataset.url; const url = el.getAttribute('url') || el.dataset.url;
......
...@@ -24,8 +24,8 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d ...@@ -24,8 +24,8 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d
format: 'yyyy-mm-dd', format: 'yyyy-mm-dd',
minDate: new Date(), minDate: new Date(),
container: $input.parent().get(0), container: $input.parent().get(0),
parse: dateString => parsePikadayDate(dateString), parse: (dateString) => parsePikadayDate(dateString),
toString: date => pikadayToString(date), toString: (date) => pikadayToString(date),
onSelect(dateText) { onSelect(dateText) {
$input.val(calendar.toString(dateText)); $input.val(calendar.toString(dateText));
......
...@@ -46,7 +46,7 @@ export default class Members { ...@@ -46,7 +46,7 @@ export default class Members {
return $el.data('id'); return $el.data('id');
}, },
toggleLabel: (selected, $el) => this.dropdownToggleLabel(selected, $el, $btn), toggleLabel: (selected, $el) => this.dropdownToggleLabel(selected, $el, $btn),
clicked: options => this.dropdownClicked(options), clicked: (options) => this.dropdownClicked(options),
}); });
}); });
} }
......
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
return this.member.user; return this.member.user;
}, },
badges() { badges() {
return generateBadges(this.member, this.isCurrentUser).filter(badge => badge.show); return generateBadges(this.member, this.isCurrentUser).filter((badge) => badge.show);
}, },
statusEmoji() { statusEmoji() {
return this.user?.status?.emoji; return this.user?.status?.emoji;
......
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
computed: { computed: {
...mapState(['sourceId', 'filteredSearchBar', 'canManageMembers']), ...mapState(['sourceId', 'filteredSearchBar', 'canManageMembers']),
tokens() { tokens() {
return this.$options.availableTokens.filter(token => { return this.$options.availableTokens.filter((token) => {
if ( if (
Object.prototype.hasOwnProperty.call(token, 'requiredPermissions') && Object.prototype.hasOwnProperty.call(token, 'requiredPermissions') &&
!this[token.requiredPermissions] !this[token.requiredPermissions]
...@@ -61,8 +61,8 @@ export default { ...@@ -61,8 +61,8 @@ export default {
const query = queryToObject(window.location.search); const query = queryToObject(window.location.search);
const tokens = this.tokens const tokens = this.tokens
.filter(token => query[token.type]) .filter((token) => query[token.type])
.map(token => ({ .map((token) => ({
type: token.type, type: token.type,
value: { value: {
data: query[token.type], data: query[token.type],
......
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
return parseSortParam(this.tableSortableFields); return parseSortParam(this.tableSortableFields);
}, },
activeOption() { activeOption() {
return FIELDS.find(field => field.key === this.sort.sortByKey); return FIELDS.find((field) => field.key === this.sort.sortByKey);
}, },
activeOptionLabel() { activeOptionLabel() {
return this.activeOption?.label; return this.activeOption?.label;
...@@ -23,8 +23,9 @@ export default { ...@@ -23,8 +23,9 @@ export default {
return !this.sort.sortDesc; return !this.sort.sortDesc;
}, },
filteredOptions() { filteredOptions() {
return FIELDS.filter(field => this.tableSortableFields.includes(field.key) && field.sort).map( return FIELDS.filter(
field => ({ (field) => this.tableSortableFields.includes(field.key) && field.sort,
).map((field) => ({
key: field.key, key: field.key,
label: field.label, label: field.label,
href: buildSortHref({ href: buildSortHref({
...@@ -33,8 +34,7 @@ export default { ...@@ -33,8 +34,7 @@ export default {
filteredSearchBarTokens: this.filteredSearchBar.tokens, filteredSearchBarTokens: this.filteredSearchBar.tokens,
filteredSearchBarSearchParam: this.filteredSearchBar.searchParam, filteredSearchBarSearchParam: this.filteredSearchBar.searchParam,
}), }),
}), }));
);
}, },
}, },
methods: { methods: {
......
...@@ -2,7 +2,7 @@ import createState from 'ee_else_ce/members/store/state'; ...@@ -2,7 +2,7 @@ import createState from 'ee_else_ce/members/store/state';
import mutations from 'ee_else_ce/members/store/mutations'; import mutations from 'ee_else_ce/members/store/mutations';
import * as actions from 'ee_else_ce/members/store/actions'; import * as actions from 'ee_else_ce/members/store/actions';
export default initialState => ({ export default (initialState) => ({
state: createState(initialState), state: createState(initialState),
actions, actions,
mutations, mutations,
......
...@@ -21,7 +21,7 @@ export const generateBadges = (member, isCurrentUser) => [ ...@@ -21,7 +21,7 @@ export const generateBadges = (member, isCurrentUser) => [
}, },
]; ];
export const isGroup = member => { export const isGroup = (member) => {
return Boolean(member.sharedWithGroup); return Boolean(member.sharedWithGroup);
}; };
...@@ -37,7 +37,7 @@ export const canRemove = (member, sourceId) => { ...@@ -37,7 +37,7 @@ export const canRemove = (member, sourceId) => {
return isDirectMember(member, sourceId) && member.canRemove; return isDirectMember(member, sourceId) && member.canRemove;
}; };
export const canResend = member => { export const canResend = (member) => {
return Boolean(member.invite?.canResend); return Boolean(member.invite?.canResend);
}; };
...@@ -47,11 +47,11 @@ export const canUpdate = (member, currentUserId, sourceId) => { ...@@ -47,11 +47,11 @@ export const canUpdate = (member, currentUserId, sourceId) => {
); );
}; };
export const parseSortParam = sortableFields => { export const parseSortParam = (sortableFields) => {
const sortParam = getParameterByName('sort'); const sortParam = getParameterByName('sort');
const sortedField = FIELDS.filter(field => sortableFields.includes(field.key)).find( const sortedField = FIELDS.filter((field) => sortableFields.includes(field.key)).find(
field => field.sort?.asc === sortParam || field.sort?.desc === sortParam, (field) => field.sort?.asc === sortParam || field.sort?.desc === sortParam,
); );
if (!sortedField) { if (!sortedField) {
...@@ -70,7 +70,7 @@ export const buildSortHref = ({ ...@@ -70,7 +70,7 @@ export const buildSortHref = ({
filteredSearchBarTokens, filteredSearchBarTokens,
filteredSearchBarSearchParam, filteredSearchBarSearchParam,
}) => { }) => {
const sortDefinition = FIELDS.find(field => field.key === sortBy)?.sort; const sortDefinition = FIELDS.find((field) => field.key === sortBy)?.sort;
if (!sortDefinition) { if (!sortDefinition) {
return ''; return '';
......
...@@ -6,7 +6,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -6,7 +6,7 @@ import axios from '~/lib/utils/axios_utils';
import { deprecatedCreateFlash as flash } from '~/flash'; import { deprecatedCreateFlash as flash } from '~/flash';
import { __ } from '~/locale'; import { __ } from '~/locale';
(global => { ((global) => {
global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.diffFileEditor = Vue.extend({ global.mergeConflicts.diffFileEditor = Vue.extend({
......
...@@ -4,7 +4,7 @@ import Vue from 'vue'; ...@@ -4,7 +4,7 @@ import Vue from 'vue';
import actionsMixin from '../mixins/line_conflict_actions'; import actionsMixin from '../mixins/line_conflict_actions';
import utilsMixin from '../mixins/line_conflict_utils'; import utilsMixin from '../mixins/line_conflict_utils';
(global => { ((global) => {
global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.inlineConflictLines = Vue.extend({ global.mergeConflicts.inlineConflictLines = Vue.extend({
......
...@@ -4,7 +4,7 @@ import Vue from 'vue'; ...@@ -4,7 +4,7 @@ import Vue from 'vue';
import actionsMixin from '../mixins/line_conflict_actions'; import actionsMixin from '../mixins/line_conflict_actions';
import utilsMixin from '../mixins/line_conflict_utils'; import utilsMixin from '../mixins/line_conflict_utils';
(global => { ((global) => {
global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts = global.mergeConflicts || {};
global.mergeConflicts.parallelConflictLines = Vue.extend({ global.mergeConflicts.parallelConflictLines = Vue.extend({
......
...@@ -5,7 +5,7 @@ import Vue from 'vue'; ...@@ -5,7 +5,7 @@ import Vue from 'vue';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
(global => { ((global) => {
global.mergeConflicts = global.mergeConflicts || {}; global.mergeConflicts = global.mergeConflicts || {};
const diffViewType = Cookies.get('diff_view'); const diffViewType = Cookies.get('diff_view');
...@@ -48,7 +48,7 @@ import { s__ } from '~/locale'; ...@@ -48,7 +48,7 @@ import { s__ } from '~/locale';
}, },
decorateFiles(files) { decorateFiles(files) {
files.forEach(file => { files.forEach((file) => {
file.content = ''; file.content = '';
file.resolutionData = {}; file.resolutionData = {};
file.promptDiscardConfirmation = false; file.promptDiscardConfirmation = false;
...@@ -72,7 +72,7 @@ import { s__ } from '~/locale'; ...@@ -72,7 +72,7 @@ import { s__ } from '~/locale';
setInlineLine(file) { setInlineLine(file) {
file.inlineLines = []; file.inlineLines = [];
file.sections.forEach(section => { file.sections.forEach((section) => {
let currentLineType = 'new'; let currentLineType = 'new';
const { conflict, lines, id } = section; const { conflict, lines, id } = section;
...@@ -80,7 +80,7 @@ import { s__ } from '~/locale'; ...@@ -80,7 +80,7 @@ import { s__ } from '~/locale';
file.inlineLines.push(this.getHeadHeaderLine(id)); file.inlineLines.push(this.getHeadHeaderLine(id));
} }
lines.forEach(line => { lines.forEach((line) => {
const { type } = line; const { type } = line;
if ((type === 'new' || type === 'old') && currentLineType !== type) { if ((type === 'new' || type === 'old') && currentLineType !== type) {
...@@ -102,7 +102,7 @@ import { s__ } from '~/locale'; ...@@ -102,7 +102,7 @@ import { s__ } from '~/locale';
file.parallelLines = []; file.parallelLines = [];
const linesObj = { left: [], right: [] }; const linesObj = { left: [], right: [] };
file.sections.forEach(section => { file.sections.forEach((section) => {
const { conflict, lines, id } = section; const { conflict, lines, id } = section;
if (conflict) { if (conflict) {
...@@ -110,7 +110,7 @@ import { s__ } from '~/locale'; ...@@ -110,7 +110,7 @@ import { s__ } from '~/locale';
linesObj.right.push(this.getHeadHeaderLine(id)); linesObj.right.push(this.getHeadHeaderLine(id));
} }
lines.forEach(line => { lines.forEach((line) => {
const { type } = line; const { type } = line;
if (conflict) { if (conflict) {
...@@ -156,9 +156,9 @@ import { s__ } from '~/locale'; ...@@ -156,9 +156,9 @@ import { s__ } from '~/locale';
const { files } = this.state.conflictsData; const { files } = this.state.conflictsData;
let count = 0; let count = 0;
files.forEach(file => { files.forEach((file) => {
if (file.type === CONFLICT_TYPES.TEXT) { if (file.type === CONFLICT_TYPES.TEXT) {
file.sections.forEach(section => { file.sections.forEach((section) => {
if (section.conflict) { if (section.conflict) {
count += 1; count += 1;
} }
...@@ -287,14 +287,14 @@ import { s__ } from '~/locale'; ...@@ -287,14 +287,14 @@ import { s__ } from '~/locale';
}, },
restoreFileLinesState(file) { restoreFileLinesState(file) {
file.inlineLines.forEach(line => { file.inlineLines.forEach((line) => {
if (line.hasConflict || line.isHeader) { if (line.hasConflict || line.isHeader) {
line.isSelected = false; line.isSelected = false;
line.isUnselected = false; line.isUnselected = false;
} }
}); });
file.parallelLines.forEach(lines => { file.parallelLines.forEach((lines) => {
const left = lines[0]; const left = lines[0];
const right = lines[1]; const right = lines[1];
const isLeftMatch = left.hasConflict || left.isHeader; const isLeftMatch = left.hasConflict || left.isHeader;
...@@ -362,7 +362,7 @@ import { s__ } from '~/locale'; ...@@ -362,7 +362,7 @@ import { s__ } from '~/locale';
files: [], files: [],
}; };
this.state.conflictsData.files.forEach(file => { this.state.conflictsData.files.forEach((file) => {
const addFile = { const addFile = {
old_path: file.old_path, old_path: file.old_path,
new_path: file.new_path, new_path: file.new_path,
...@@ -388,13 +388,13 @@ import { s__ } from '~/locale'; ...@@ -388,13 +388,13 @@ import { s__ } from '~/locale';
handleSelected(file, sectionId, selection) { handleSelected(file, sectionId, selection) {
Vue.set(file.resolutionData, sectionId, selection); Vue.set(file.resolutionData, sectionId, selection);
file.inlineLines.forEach(line => { file.inlineLines.forEach((line) => {
if (line.id === sectionId && (line.hasConflict || line.isHeader)) { if (line.id === sectionId && (line.hasConflict || line.isHeader)) {
this.markLine(line, selection); this.markLine(line, selection);
} }
}); });
file.parallelLines.forEach(lines => { file.parallelLines.forEach((lines) => {
const left = lines[0]; const left = lines[0];
const right = lines[1]; const right = lines[1];
const hasSameId = right.id === sectionId || left.id === sectionId; const hasSameId = right.id === sectionId || left.id === sectionId;
...@@ -426,7 +426,7 @@ import { s__ } from '~/locale'; ...@@ -426,7 +426,7 @@ import { s__ } from '~/locale';
}, },
fileTextTypePresent() { fileTextTypePresent() {
return this.state.conflictsData.files.some(f => f.type === CONFLICT_TYPES.TEXT); return this.state.conflictsData.files.some((f) => f.type === CONFLICT_TYPES.TEXT);
}, },
}; };
})(window.gl || (window.gl = {})); })(window.gl || (window.gl = {}));
...@@ -31,7 +31,7 @@ function MergeRequest(opts) { ...@@ -31,7 +31,7 @@ function MergeRequest(opts) {
fieldName: 'description', fieldName: 'description',
selector: '.detail-page-description', selector: '.detail-page-description',
lockVersion: this.$el.data('lockVersion'), lockVersion: this.$el.data('lockVersion'),
onSuccess: result => { onSuccess: (result) => {
document.querySelector('#task_status').innerText = result.task_status; document.querySelector('#task_status').innerText = result.task_status;
document.querySelector('#task_status_short').innerText = result.task_status_short; document.querySelector('#task_status_short').innerText = result.task_status_short;
}, },
...@@ -69,8 +69,8 @@ MergeRequest.prototype.initMRBtnListeners = function () { ...@@ -69,8 +69,8 @@ MergeRequest.prototype.initMRBtnListeners = function () {
const draftToggles = document.querySelectorAll('.js-draft-toggle-button'); const draftToggles = document.querySelectorAll('.js-draft-toggle-button');
if (draftToggles.length) { if (draftToggles.length) {
draftToggles.forEach(draftToggle => { draftToggles.forEach((draftToggle) => {
draftToggle.addEventListener('click', e => { draftToggle.addEventListener('click', (e) => {
e.preventDefault(); e.preventDefault();
e.stopImmediatePropagation(); e.stopImmediatePropagation();
...@@ -127,7 +127,7 @@ MergeRequest.prototype.submitNoteForm = function (form, $button) { ...@@ -127,7 +127,7 @@ MergeRequest.prototype.submitNoteForm = function (form, $button) {
}; };
MergeRequest.prototype.initCommitMessageListeners = function () { MergeRequest.prototype.initCommitMessageListeners = function () {
$(document).on('click', 'a.js-with-description-link', e => { $(document).on('click', 'a.js-with-description-link', (e) => {
const textarea = $('textarea.js-commit-message'); const textarea = $('textarea.js-commit-message');
e.preventDefault(); e.preventDefault();
...@@ -136,7 +136,7 @@ MergeRequest.prototype.initCommitMessageListeners = function () { ...@@ -136,7 +136,7 @@ MergeRequest.prototype.initCommitMessageListeners = function () {
$('.js-without-description-hint').show(); $('.js-without-description-hint').show();
}); });
$(document).on('click', 'a.js-without-description-link', e => { $(document).on('click', 'a.js-without-description-link', (e) => {
const textarea = $('textarea.js-commit-message'); const textarea = $('textarea.js-commit-message');
e.preventDefault(); e.preventDefault();
...@@ -180,7 +180,7 @@ MergeRequest.toggleDraftStatus = function (title, isReady) { ...@@ -180,7 +180,7 @@ MergeRequest.toggleDraftStatus = function (title, isReady) {
const draftToggles = document.querySelectorAll('.js-draft-toggle-button'); const draftToggles = document.querySelectorAll('.js-draft-toggle-button');
if (draftToggles.length) { if (draftToggles.length) {
draftToggles.forEach(el => { draftToggles.forEach((el) => {
const draftToggle = el; const draftToggle = el;
const url = setUrlParams( const url = setUrlParams(
{ 'merge_request[wip_event]': isReady ? 'wip' : 'unwip' }, { 'merge_request[wip_event]': isReady ? 'wip' : 'unwip' },
......
...@@ -128,7 +128,7 @@ export default class MergeRequestTabs { ...@@ -128,7 +128,7 @@ export default class MergeRequestTabs {
bindEvents() { bindEvents() {
$('.merge-request-tabs a[data-toggle="tabvue"]').on('click', this.clickTab); $('.merge-request-tabs a[data-toggle="tabvue"]').on('click', this.clickTab);
window.addEventListener('popstate', event => { window.addEventListener('popstate', (event) => {
if (event.state && event.state.action) { if (event.state && event.state.action) {
this.tabShown(event.state.action, event.target.location); this.tabShown(event.state.action, event.target.location);
this.currentAction = event.state.action; this.currentAction = event.state.action;
...@@ -177,14 +177,14 @@ export default class MergeRequestTabs { ...@@ -177,14 +177,14 @@ export default class MergeRequestTabs {
this.currentTab = action; this.currentTab = action;
if (this.mergeRequestTabPanesAll) { if (this.mergeRequestTabPanesAll) {
this.mergeRequestTabPanesAll.forEach(el => { this.mergeRequestTabPanesAll.forEach((el) => {
const tabPane = el; const tabPane = el;
tabPane.style.display = 'none'; tabPane.style.display = 'none';
}); });
} }
if (this.mergeRequestTabsAll) { if (this.mergeRequestTabsAll) {
this.mergeRequestTabsAll.forEach(el => { this.mergeRequestTabsAll.forEach((el) => {
el.classList.remove('active'); el.classList.remove('active');
}); });
} }
......
...@@ -11,7 +11,7 @@ export default class Milestone { ...@@ -11,7 +11,7 @@ export default class Milestone {
} }
bindTabsSwitching() { bindTabsSwitching() {
return $('a[data-toggle="tab"]').on('show.bs.tab', e => { return $('a[data-toggle="tab"]').on('show.bs.tab', (e) => {
const $target = $(e.target); const $target = $(e.target);
window.location.hash = $target.attr('href'); window.location.hash = $target.attr('href');
......
...@@ -89,7 +89,7 @@ export default class MilestoneSelect { ...@@ -89,7 +89,7 @@ export default class MilestoneSelect {
return getMilestones(contextId, reqParams) return getMilestones(contextId, reqParams)
.then(({ data }) => .then(({ data }) =>
data data
.map(m => ({ .map((m) => ({
...m, ...m,
// Public API includes `title` instead of `name`. // Public API includes `title` instead of `name`.
name: m.title, name: m.title,
...@@ -105,7 +105,7 @@ export default class MilestoneSelect { ...@@ -105,7 +105,7 @@ export default class MilestoneSelect {
return 0; return 0;
}), }),
) )
.then(data => { .then((data) => {
const extraOptions = []; const extraOptions = [];
if (showAny) { if (showAny) {
extraOptions.push({ extraOptions.push({
...@@ -146,7 +146,7 @@ export default class MilestoneSelect { ...@@ -146,7 +146,7 @@ export default class MilestoneSelect {
$(`[data-milestone-id="${selectedMilestone}"] > a`).addClass('is-active'); $(`[data-milestone-id="${selectedMilestone}"] > a`).addClass('is-active');
}); });
}, },
renderRow: milestone => { renderRow: (milestone) => {
const milestoneName = milestone.title || milestone.name; const milestoneName = milestone.title || milestone.name;
let milestoneDisplayName = escape(milestoneName); let milestoneDisplayName = escape(milestoneName);
...@@ -178,8 +178,8 @@ export default class MilestoneSelect { ...@@ -178,8 +178,8 @@ export default class MilestoneSelect {
}, },
defaultLabel, defaultLabel,
fieldName: $dropdown.data('fieldName'), fieldName: $dropdown.data('fieldName'),
text: milestone => escape(milestone.title), text: (milestone) => escape(milestone.title),
id: milestone => { id: (milestone) => {
if (milestone !== undefined) { if (milestone !== undefined) {
if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) { if (!useId && !$dropdown.is('.js-issuable-form-dropdown')) {
return milestone.name; return milestone.name;
...@@ -193,7 +193,7 @@ export default class MilestoneSelect { ...@@ -193,7 +193,7 @@ export default class MilestoneSelect {
// display:block overrides the hide-collapse rule // display:block overrides the hide-collapse rule
return $value.css('display', ''); return $value.css('display', '');
}, },
opened: e => { opened: (e) => {
const $el = $(e.currentTarget); const $el = $(e.currentTarget);
if ($dropdown.hasClass('js-issue-board-sidebar') || options.handleClick) { if ($dropdown.hasClass('js-issue-board-sidebar') || options.handleClick) {
selectedMilestone = $dropdown[0].dataset.selected || selectedMilestoneDefault; selectedMilestone = $dropdown[0].dataset.selected || selectedMilestoneDefault;
...@@ -202,7 +202,7 @@ export default class MilestoneSelect { ...@@ -202,7 +202,7 @@ export default class MilestoneSelect {
$(`[data-milestone-id="${selectedMilestone}"] > a`, $el).addClass('is-active'); $(`[data-milestone-id="${selectedMilestone}"] > a`, $el).addClass('is-active');
}, },
vue: $dropdown.hasClass('js-issue-board-sidebar'), vue: $dropdown.hasClass('js-issue-board-sidebar'),
clicked: clickEvent => { clicked: (clickEvent) => {
const { e } = clickEvent; const { e } = clickEvent;
let selected = clickEvent.selectedObj; let selected = clickEvent.selectedObj;
......
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
value: { value: {
immediate: true, immediate: true,
handler() { handler() {
const milestoneTitles = this.value.map(milestone => const milestoneTitles = this.value.map((milestone) =>
milestone.title ? milestone.title : milestone, milestone.title ? milestone.title : milestone,
); );
if (!isEqual(milestoneTitles, this.selectedMilestones)) { if (!isEqual(milestoneTitles, this.selectedMilestones)) {
......
...@@ -41,10 +41,10 @@ export const fetchProjectMilestones = ({ commit, state }) => { ...@@ -41,10 +41,10 @@ export const fetchProjectMilestones = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.projectMilestones(state.projectId) Api.projectMilestones(state.projectId)
.then(response => { .then((response) => {
commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response); commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error); commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -56,10 +56,10 @@ export const fetchGroupMilestones = ({ commit, state }) => { ...@@ -56,10 +56,10 @@ export const fetchGroupMilestones = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.groupMilestones(state.groupId) Api.groupMilestones(state.groupId)
.then(response => { .then((response) => {
commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response); commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error); commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -76,10 +76,10 @@ export const searchProjectMilestones = ({ commit, state }) => { ...@@ -76,10 +76,10 @@ export const searchProjectMilestones = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.projectSearch(state.projectId, options) Api.projectSearch(state.projectId, options)
.then(response => { .then((response) => {
commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response); commit(types.RECEIVE_PROJECT_MILESTONES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error); commit(types.RECEIVE_PROJECT_MILESTONES_ERROR, error);
}) })
.finally(() => { .finally(() => {
...@@ -95,10 +95,10 @@ export const searchGroupMilestones = ({ commit, state }) => { ...@@ -95,10 +95,10 @@ export const searchGroupMilestones = ({ commit, state }) => {
commit(types.REQUEST_START); commit(types.REQUEST_START);
Api.groupMilestones(state.groupId, options) Api.groupMilestones(state.groupId, options)
.then(response => { .then((response) => {
commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response); commit(types.RECEIVE_GROUP_MILESTONES_SUCCESS, response);
}) })
.catch(error => { .catch((error) => {
commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error); commit(types.RECEIVE_GROUP_MILESTONES_ERROR, error);
}) })
.finally(() => { .finally(() => {
......
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
}, },
[types.REMOVE_SELECTED_MILESTONE](state, selectedMilestone) { [types.REMOVE_SELECTED_MILESTONE](state, selectedMilestone) {
const filteredMilestones = state.selectedMilestones.filter( const filteredMilestones = state.selectedMilestones.filter(
milestone => milestone !== selectedMilestone, (milestone) => milestone !== selectedMilestone,
); );
Vue.set(state, 'selectedMilestones', filteredMilestones); Vue.set(state, 'selectedMilestones', filteredMilestones);
}, },
......
...@@ -47,7 +47,7 @@ export default class MiniPipelineGraph { ...@@ -47,7 +47,7 @@ export default class MiniPipelineGraph {
$(document).on( $(document).on(
'click', 'click',
`${this.container} .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item`, `${this.container} .js-builds-dropdown-list a.mini-pipeline-graph-dropdown-item`,
e => { (e) => {
e.stopPropagation(); e.stopPropagation();
}, },
); );
......
...@@ -80,7 +80,7 @@ export default class MirrorRepos { ...@@ -80,7 +80,7 @@ export default class MirrorRepos {
this.debouncedUpdateUrl = debounce(() => this.updateUrl(), 200); this.debouncedUpdateUrl = debounce(() => this.updateUrl(), 200);
this.$urlInput.on('input', () => this.debouncedUpdateUrl()); this.$urlInput.on('input', () => this.debouncedUpdateUrl());
this.$protectedBranchesInput.on('change', () => this.updateProtectedBranches()); this.$protectedBranchesInput.on('change', () => this.updateProtectedBranches());
this.$table.on('click', '.js-delete-mirror', event => this.deleteMirror(event)); this.$table.on('click', '.js-delete-mirror', (event) => this.deleteMirror(event));
} }
togglePassword() { togglePassword() {
......
...@@ -29,10 +29,10 @@ export default class SSHMirror { ...@@ -29,10 +29,10 @@ export default class SSHMirror {
this.handleRepositoryUrlInput(true); this.handleRepositoryUrlInput(true);
this.$repositoryUrl.on('keyup', () => this.handleRepositoryUrlInput()); this.$repositoryUrl.on('keyup', () => this.handleRepositoryUrlInput());
this.$knownHosts.on('keyup', e => this.handleSSHKnownHostsInput(e)); this.$knownHosts.on('keyup', (e) => this.handleSSHKnownHostsInput(e));
this.$dropdownAuthType.on('change', e => this.handleAuthTypeChange(e)); this.$dropdownAuthType.on('change', (e) => this.handleAuthTypeChange(e));
this.$btnDetectHostKeys.on('click', e => this.handleDetectHostKeys(e)); this.$btnDetectHostKeys.on('click', (e) => this.handleDetectHostKeys(e));
this.$btnSSHHostsShowAdvanced.on('click', e => this.handleSSHHostsAdvanced(e)); this.$btnSSHHostsShowAdvanced.on('click', (e) => this.handleSSHHostsAdvanced(e));
} }
/** /**
...@@ -100,7 +100,7 @@ export default class SSHMirror { ...@@ -100,7 +100,7 @@ export default class SSHMirror {
}) })
.catch(stop); .catch(stop);
}) })
.then(res => { .then((res) => {
$btnLoadSpinner.addClass('d-none'); $btnLoadSpinner.addClass('d-none');
// Once data is received, we show verification info along with Host keys and fingerprints // Once data is received, we show verification info along with Host keys and fingerprints
this.$hostKeysInformation this.$hostKeysInformation
...@@ -160,7 +160,7 @@ export default class SSHMirror { ...@@ -160,7 +160,7 @@ export default class SSHMirror {
showSSHInformation(sshHostKeys) { showSSHInformation(sshHostKeys) {
const $fingerprintsList = this.$hostKeysInformation.find('.js-fingerprints-list'); const $fingerprintsList = this.$hostKeysInformation.find('.js-fingerprints-list');
let fingerprints = ''; let fingerprints = '';
sshHostKeys.fingerprints.forEach(fingerprint => { sshHostKeys.fingerprints.forEach((fingerprint) => {
const escFingerprints = escape(fingerprint.fingerprint); const escFingerprints = escape(fingerprint.fingerprint);
fingerprints += `<code>${escFingerprints}</code>`; fingerprints += `<code>${escFingerprints}</code>`;
}); });
......
...@@ -97,12 +97,12 @@ export default { ...@@ -97,12 +97,12 @@ export default {
return Boolean(this.firingAlerts.length); return Boolean(this.firingAlerts.length);
}, },
firingAlerts() { firingAlerts() {
return values(this.alertsToManage).filter(alert => return values(this.alertsToManage).filter((alert) =>
this.passedAlertThreshold(this.getQueryData(alert), alert), this.passedAlertThreshold(this.getQueryData(alert), alert),
); );
}, },
formattedFiringAlerts() { formattedFiringAlerts() {
return this.firingAlerts.map(alert => this.formatAlertSummary(alert.alert_path)); return this.firingAlerts.map((alert) => this.formatAlertSummary(alert.alert_path));
}, },
configuredAlert() { configuredAlert() {
return this.hasAlerts ? values(this.alertsToManage)[0].metricId : ''; return this.hasAlerts ? values(this.alertsToManage)[0].metricId : '';
...@@ -116,13 +116,13 @@ export default { ...@@ -116,13 +116,13 @@ export default {
fetchAlertData() { fetchAlertData() {
this.isLoading = true; this.isLoading = true;
const queriesWithAlerts = this.relevantQueries.filter(query => query.alert_path); const queriesWithAlerts = this.relevantQueries.filter((query) => query.alert_path);
return Promise.all( return Promise.all(
queriesWithAlerts.map(query => queriesWithAlerts.map((query) =>
this.service this.service
.readAlert(query.alert_path) .readAlert(query.alert_path)
.then(alertAttributes => this.setAlert(alertAttributes, query.metricId)), .then((alertAttributes) => this.setAlert(alertAttributes, query.metricId)),
), ),
) )
.then(() => { .then(() => {
...@@ -141,7 +141,7 @@ export default { ...@@ -141,7 +141,7 @@ export default {
}, },
formatAlertSummary(alertPath) { formatAlertSummary(alertPath) {
const alert = this.alertsToManage[alertPath]; const alert = this.alertsToManage[alertPath];
const alertQuery = this.relevantQueries.find(query => query.metricId === alert.metricId); const alertQuery = this.relevantQueries.find((query) => query.metricId === alert.metricId);
return `${alertQuery.label} ${alert.operator} ${alert.threshold}`; return `${alertQuery.label} ${alert.operator} ${alert.threshold}`;
}, },
...@@ -150,19 +150,19 @@ export default { ...@@ -150,19 +150,19 @@ export default {
switch (operator) { switch (operator) {
case OPERATORS.greaterThan: case OPERATORS.greaterThan:
return data.some(value => value > threshold); return data.some((value) => value > threshold);
case OPERATORS.lessThan: case OPERATORS.lessThan:
return data.some(value => value < threshold); return data.some((value) => value < threshold);
case OPERATORS.equalTo: case OPERATORS.equalTo:
return data.some(value => value === threshold); return data.some((value) => value === threshold);
default: default:
return false; return false;
} }
}, },
getQueryData(alert) { getQueryData(alert) {
const alertQuery = this.relevantQueries.find(query => query.metricId === alert.metricId); const alertQuery = this.relevantQueries.find((query) => query.metricId === alert.metricId);
return get(alertQuery, 'result[0].values', []).map(value => get(value, '[1]', null)); return get(alertQuery, 'result[0].values', []).map((value) => get(value, '[1]', null));
}, },
showModal() { showModal() {
this.$root.$emit('bv::show::modal', this.modalId); this.$root.$emit('bv::show::modal', this.modalId);
...@@ -179,7 +179,7 @@ export default { ...@@ -179,7 +179,7 @@ export default {
this.isLoading = true; this.isLoading = true;
this.service this.service
.createAlert(newAlert) .createAlert(newAlert)
.then(alertAttributes => { .then((alertAttributes) => {
this.setAlert(alertAttributes, prometheus_metric_id); this.setAlert(alertAttributes, prometheus_metric_id);
this.isLoading = false; this.isLoading = false;
this.hideModal(); this.hideModal();
...@@ -194,7 +194,7 @@ export default { ...@@ -194,7 +194,7 @@ export default {
this.isLoading = true; this.isLoading = true;
this.service this.service
.updateAlert(alert, updatedAlert) .updateAlert(alert, updatedAlert)
.then(alertAttributes => { .then((alertAttributes) => {
this.setAlert(alertAttributes, this.alertsToManage[alert].metricId); this.setAlert(alertAttributes, this.alertsToManage[alert].metricId);
this.isLoading = false; this.isLoading = false;
this.hideModal(); this.hideModal();
......
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
return this.alertQuery.length ? true : null; return this.alertQuery.length ? true : null;
}, },
currentQuery() { currentQuery() {
return this.relevantQueries.find(query => query.metricId === this.prometheusMetricId) || {}; return this.relevantQueries.find((query) => query.metricId === this.prometheusMetricId) || {};
}, },
formDisabled() { formDisabled() {
// We need a prometheusMetricId to determine whether we're // We need a prometheusMetricId to determine whether we're
...@@ -151,7 +151,7 @@ export default { ...@@ -151,7 +151,7 @@ export default {
}, },
methods: { methods: {
selectQuery(queryId) { selectQuery(queryId) {
const existingAlertPath = findKey(this.alertsToManage, alert => alert.metricId === queryId); const existingAlertPath = findKey(this.alertsToManage, (alert) => alert.metricId === queryId);
const existingAlert = this.alertsToManage[existingAlertPath]; const existingAlert = this.alertsToManage[existingAlertPath];
if (existingAlert) { if (existingAlert) {
......
...@@ -52,7 +52,7 @@ export const annotationsYAxis = { ...@@ -52,7 +52,7 @@ export const annotationsYAxis = {
* @param {Object} annotation object * @param {Object} annotation object
* @returns {Object} markLine object * @returns {Object} markLine object
*/ */
export const parseAnnotations = annotations => export const parseAnnotations = (annotations) =>
annotations.reduce( annotations.reduce(
(acc, annotation) => { (acc, annotation) => {
acc.lines.push({ acc.lines.push({
...@@ -87,7 +87,7 @@ export const parseAnnotations = annotations => ...@@ -87,7 +87,7 @@ export const parseAnnotations = annotations =>
*/ */
export const generateAnnotationsSeries = ({ deployments = [], annotations = [] } = {}) => { export const generateAnnotationsSeries = ({ deployments = [], annotations = [] } = {}) => {
// deployment data points // deployment data points
const data = deployments.map(deployment => { const data = deployments.map((deployment) => {
return { return {
name: 'deployments', name: 'deployments',
value: [deployment.createdAt, annotationsYAxisCoords.pos], value: [deployment.createdAt, annotationsYAxisCoords.pos],
......
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
}, },
computed: { computed: {
series() { series() {
return this.graphData.metrics.map(metric => { return this.graphData.metrics.map((metric) => {
const values = metric.result && metric.result[0] ? metric.result[0].values : []; const values = metric.result && metric.result[0] ? metric.result[0].values : [];
return { return {
label: metric.label, label: metric.label,
...@@ -78,14 +78,14 @@ export default { ...@@ -78,14 +78,14 @@ export default {
* This offset is the lowest value. * This offset is the lowest value.
*/ */
yOffset() { yOffset() {
const values = flattenDeep(this.series.map(ser => ser.data.map(([, y]) => y))); const values = flattenDeep(this.series.map((ser) => ser.data.map(([, y]) => y)));
const min = values.length ? Math.floor(Math.min(...values)) : 0; const min = values.length ? Math.floor(Math.min(...values)) : 0;
return min < 0 ? -min : 0; return min < 0 ? -min : 0;
}, },
metricData() { metricData() {
const originalMetricQuery = this.graphData.metrics[0]; const originalMetricQuery = this.graphData.metrics[0];
const metricQuery = produce(originalMetricQuery, draftQuery => { const metricQuery = produce(originalMetricQuery, (draftQuery) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
draftQuery.result[0].values = draftQuery.result[0].values.map(([x, y]) => [ draftQuery.result[0].values = draftQuery.result[0].values.map(([x, y]) => [
x, x,
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
}, },
showSymbol: true, showSymbol: true,
itemStyle: { itemStyle: {
color: params => { color: (params) => {
if (this.isDatapointAnomaly(params.dataIndex)) { if (this.isDatapointAnomaly(params.dataIndex)) {
return colorValues.anomalySymbol; return colorValues.anomalySymbol;
} }
...@@ -131,7 +131,7 @@ export default { ...@@ -131,7 +131,7 @@ export default {
const yAxisWithOffset = { const yAxisWithOffset = {
axisLabel: { axisLabel: {
formatter: num => roundOffFloat(num - this.yOffset, 3).toString(), formatter: (num) => roundOffFloat(num - this.yOffset, 3).toString(),
}, },
}; };
...@@ -156,7 +156,7 @@ export default { ...@@ -156,7 +156,7 @@ export default {
boundarySeries.push( boundarySeries.push(
this.makeBoundarySeries({ this.makeBoundarySeries({
name: this.formatLegendLabel(upperSeries), name: this.formatLegendLabel(upperSeries),
data: calcOffsetY(upperSeries.data, i => -this.yValue(LOWER, i)), data: calcOffsetY(upperSeries.data, (i) => -this.yValue(LOWER, i)),
areaStyle: { areaStyle: {
color: AREA_COLOR, color: AREA_COLOR,
opacity: AREA_OPACITY, opacity: AREA_OPACITY,
......
...@@ -67,12 +67,12 @@ export default { ...@@ -67,12 +67,12 @@ export default {
}, },
setSvg(name) { setSvg(name) {
getSvgIconPathContent(name) getSvgIconPathContent(name)
.then(path => { .then((path) => {
if (path) { if (path) {
this.$set(this.svgs, name, `path://${path}`); this.$set(this.svgs, name, `path://${path}`);
} }
}) })
.catch(e => { .catch((e) => {
// eslint-disable-next-line no-console, @gitlab/require-i18n-strings // eslint-disable-next-line no-console, @gitlab/require-i18n-strings
console.error('SVG could not be rendered correctly: ', e); console.error('SVG could not be rendered correctly: ', e);
}); });
......
...@@ -90,7 +90,7 @@ export default { ...@@ -90,7 +90,7 @@ export default {
}, },
setSvg(name) { setSvg(name) {
getSvgIconPathContent(name) getSvgIconPathContent(name)
.then(path => { .then((path) => {
if (path) { if (path) {
this.$set(this.svgs, name, `path://${path}`); this.$set(this.svgs, name, `path://${path}`);
} }
......
...@@ -42,10 +42,10 @@ export default { ...@@ -42,10 +42,10 @@ export default {
return this.graphData.y_label || ''; return this.graphData.y_label || '';
}, },
xAxisLabels() { xAxisLabels() {
return this.metrics.result.map(res => Object.values(res.metric)[0]); return this.metrics.result.map((res) => Object.values(res.metric)[0]);
}, },
yAxisLabels() { yAxisLabels() {
return this.result.values.map(val => { return this.result.values.map((val) => {
const [yLabel] = val; const [yLabel] = val;
return formatDate(new Date(yLabel), { return formatDate(new Date(yLabel), {
......
...@@ -51,7 +51,7 @@ const getDataAxisOptions = ({ format, precision, name }) => { ...@@ -51,7 +51,7 @@ const getDataAxisOptions = ({ format, precision, name }) => {
nameLocation: 'center', // same as gitlab-ui's default nameLocation: 'center', // same as gitlab-ui's default
scale: true, scale: true,
axisLabel: { axisLabel: {
formatter: val => formatter(val, precision, maxDataAxisTickLength), formatter: (val) => formatter(val, precision, maxDataAxisTickLength),
}, },
}; };
}; };
...@@ -85,7 +85,7 @@ export const getTimeAxisOptions = ({ ...@@ -85,7 +85,7 @@ export const getTimeAxisOptions = ({
name: __('Time'), name: __('Time'),
type: axisTypes.time, type: axisTypes.time,
axisLabel: { axisLabel: {
formatter: date => formatDate(date, { format, timezone }), formatter: (date) => formatDate(date, { format, timezone }),
}, },
axisPointer: { axisPointer: {
snap: false, snap: false,
...@@ -109,7 +109,7 @@ export const getTooltipFormatter = ({ ...@@ -109,7 +109,7 @@ export const getTooltipFormatter = ({
precision = defaultTooltipPrecision, precision = defaultTooltipPrecision,
} = {}) => { } = {}) => {
const formatter = getFormatter(format); const formatter = getFormatter(format);
return num => formatter(num, precision); return (num) => formatter(num, precision);
}; };
// Thresholds // Thresholds
...@@ -138,9 +138,9 @@ export const getValidThresholds = ({ mode, range = {}, values = [] } = {}) => { ...@@ -138,9 +138,9 @@ export const getValidThresholds = ({ mode, range = {}, values = [] } = {}) => {
const uniqueThresholds = uniq(values); const uniqueThresholds = uniq(values);
const numberThresholds = uniqueThresholds.filter(threshold => isFinite(threshold)); const numberThresholds = uniqueThresholds.filter((threshold) => isFinite(threshold));
const validThresholds = numberThresholds.filter(threshold => { const validThresholds = numberThresholds.filter((threshold) => {
let isValid; let isValid;
if (mode === thresholdModeTypes.PERCENTAGE) { if (mode === thresholdModeTypes.PERCENTAGE) {
...@@ -152,7 +152,7 @@ export const getValidThresholds = ({ mode, range = {}, values = [] } = {}) => { ...@@ -152,7 +152,7 @@ export const getValidThresholds = ({ mode, range = {}, values = [] } = {}) => {
return isValid; return isValid;
}); });
const transformedThresholds = validThresholds.map(threshold => { const transformedThresholds = validThresholds.map((threshold) => {
let transformedThreshold; let transformedThreshold;
if (mode === 'percentage') { if (mode === 'percentage') {
......
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
if (!result || result.length === 0) { if (!result || result.length === 0) {
return []; return [];
} }
return { name, data: result[0].values.map(val => val[1]) }; return { name, data: result[0].values.map((val) => val[1]) };
}) })
.slice(0, 1); .slice(0, 1);
}, },
...@@ -89,7 +89,7 @@ export default { ...@@ -89,7 +89,7 @@ export default {
if (!result || result.length === 0) { if (!result || result.length === 0) {
return []; return [];
} }
return result[0].values.map(val => val[0]); return result[0].values.map((val) => val[0]);
}, },
dataZoomConfig() { dataZoomConfig() {
const handleIcon = this.svgs['scroll-handle']; const handleIcon = this.svgs['scroll-handle'];
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
}; };
}, },
seriesNames() { seriesNames() {
return this.graphData.metrics.map(metric => metric.label); return this.graphData.metrics.map((metric) => metric.label);
}, },
}, },
created() { created() {
...@@ -115,12 +115,12 @@ export default { ...@@ -115,12 +115,12 @@ export default {
methods: { methods: {
setSvg(name) { setSvg(name) {
getSvgIconPathContent(name) getSvgIconPathContent(name)
.then(path => { .then((path) => {
if (path) { if (path) {
this.$set(this.svgs, name, `path://${path}`); this.$set(this.svgs, name, `path://${path}`);
} }
}) })
.catch(e => { .catch((e) => {
// eslint-disable-next-line no-console, @gitlab/require-i18n-strings // eslint-disable-next-line no-console, @gitlab/require-i18n-strings
console.error('SVG could not be rendered correctly: ', e); console.error('SVG could not be rendered correctly: ', e);
}); });
......
...@@ -11,7 +11,7 @@ import { makeDataSeries } from '~/helpers/monitor_helper'; ...@@ -11,7 +11,7 @@ import { makeDataSeries } from '~/helpers/monitor_helper';
import { graphDataValidatorForValues } from '../../utils'; import { graphDataValidatorForValues } from '../../utils';
import { formatDate, timezones } from '../../format_date'; import { formatDate, timezones } from '../../format_date';
export const timestampToISODate = timestamp => new Date(timestamp).toISOString(); export const timestampToISODate = (timestamp) => new Date(timestamp).toISOString();
const THROTTLED_DATAZOOM_WAIT = 1000; // milliseconds const THROTTLED_DATAZOOM_WAIT = 1000; // milliseconds
...@@ -304,7 +304,7 @@ export default { ...@@ -304,7 +304,7 @@ export default {
this.tooltip.content = []; this.tooltip.content = [];
params.seriesData.forEach(dataPoint => { params.seriesData.forEach((dataPoint) => {
if (dataPoint.value) { if (dataPoint.value) {
const [, yVal] = dataPoint.value; const [, yVal] = dataPoint.value;
this.tooltip.type = dataPoint.name; this.tooltip.type = dataPoint.name;
...@@ -327,12 +327,12 @@ export default { ...@@ -327,12 +327,12 @@ export default {
}, },
setSvg(name) { setSvg(name) {
getSvgIconPathContent(name) getSvgIconPathContent(name)
.then(path => { .then((path) => {
if (path) { if (path) {
this.$set(this.svgs, name, `path://${path}`); this.$set(this.svgs, name, `path://${path}`);
} }
}) })
.catch(e => { .catch((e) => {
// eslint-disable-next-line no-console, @gitlab/require-i18n-strings // eslint-disable-next-line no-console, @gitlab/require-i18n-strings
console.error('SVG could not be rendered correctly: ', e); console.error('SVG could not be rendered correctly: ', e);
}); });
......
...@@ -271,8 +271,8 @@ export default { ...@@ -271,8 +271,8 @@ export default {
methods: { methods: {
getGraphAlerts(queries) { getGraphAlerts(queries) {
if (!this.allAlerts) return {}; if (!this.allAlerts) return {};
const metricIdsForChart = queries.map(q => q.metricId); const metricIdsForChart = queries.map((q) => q.metricId);
return pickBy(this.allAlerts, alert => metricIdsForChart.includes(alert.metricId)); return pickBy(this.allAlerts, (alert) => metricIdsForChart.includes(alert.metricId));
}, },
getGraphAlertValues(queries) { getGraphAlertValues(queries) {
return Object.values(this.getGraphAlerts(queries)); return Object.values(this.getGraphAlerts(queries));
...@@ -346,10 +346,10 @@ export default { ...@@ -346,10 +346,10 @@ export default {
} }
}, },
getAlertRunbooks(queries) { getAlertRunbooks(queries) {
const hasRunbook = alert => Boolean(alert.runbookUrl); const hasRunbook = (alert) => Boolean(alert.runbookUrl);
const graphAlertsWithRunbooks = pickBy(this.getGraphAlerts(queries), hasRunbook); const graphAlertsWithRunbooks = pickBy(this.getGraphAlerts(queries), hasRunbook);
const alertToRunbookTransform = alert => { const alertToRunbookTransform = (alert) => {
const alertQuery = queries.find(query => query.metricId === alert.metricId); const alertQuery = queries.find((query) => query.metricId === alert.metricId);
return { return {
key: alert.metricId, key: alert.metricId,
href: alert.runbookUrl, href: alert.runbookUrl,
......
...@@ -3,7 +3,7 @@ import { GlFormGroup, GlFormInput, GlFormRadioGroup, GlFormTextarea } from '@git ...@@ -3,7 +3,7 @@ import { GlFormGroup, GlFormInput, GlFormRadioGroup, GlFormTextarea } from '@git
import { escape as esc } from 'lodash'; import { escape as esc } from 'lodash';
import { __, s__, sprintf } from '~/locale'; import { __, s__, sprintf } from '~/locale';
const defaultFileName = dashboard => dashboard.path.split('/').reverse()[0]; const defaultFileName = (dashboard) => dashboard.path.split('/').reverse()[0];
export default { export default {
components: { components: {
......
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
this.loading = true; this.loading = true;
this.alert = null; this.alert = null;
this.duplicateSystemDashboard(this.form) this.duplicateSystemDashboard(this.form)
.then(createdDashboard => { .then((createdDashboard) => {
this.loading = false; this.loading = false;
this.alert = null; this.alert = null;
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
this.form.branch === this.defaultBranch ? createdDashboard : this.selectedDashboard; this.form.branch === this.defaultBranch ? createdDashboard : this.selectedDashboard;
this.$emit(events.dashboardDuplicated, dashboard); this.$emit(events.dashboardDuplicated, dashboard);
}) })
.catch(error => { .catch((error) => {
this.loading = false; this.loading = false;
this.alert = error; this.alert = error;
}); });
......
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
urls: { urls: {
type: Array, type: Array,
required: true, required: true,
validator: urls => urls.length > 0, validator: (urls) => urls.length > 0,
}, },
}, },
data() { data() {
......
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
}, },
}), }),
chartHasData(chart) { chartHasData(chart) {
return chart.metrics.some(metric => this.metricsWithData.includes(metric.metricId)); return chart.metrics.some((metric) => this.metricsWithData.includes(metric.metricId));
}, },
onSidebarMutation() { onSidebarMutation() {
setTimeout(() => { setTimeout(() => {
......
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
selectedState: { selectedState: {
type: String, type: String,
required: true, required: true,
validator: state => Object.values(dashboardEmptyStates).includes(state), validator: (state) => Object.values(dashboardEmptyStates).includes(state),
}, },
documentationPath: { documentationPath: {
type: String, type: String,
......
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
}, },
computed: { computed: {
text() { text() {
const selectedOpt = this.options.values?.find(opt => opt.value === this.value); const selectedOpt = this.options.values?.find((opt) => opt.value === this.value);
return selectedOpt?.text || this.value; return selectedOpt?.text || this.value;
}, },
}, },
......
...@@ -66,8 +66,8 @@ const csvMetricHeaders = (axisLabel, metrics) => ...@@ -66,8 +66,8 @@ const csvMetricHeaders = (axisLabel, metrics) =>
* *
* @param {Array} metrics - Metrics with results * @param {Array} metrics - Metrics with results
*/ */
const csvMetricValues = metrics => const csvMetricValues = (metrics) =>
metrics.flatMap(({ result }) => result.map(res => res.values || [])); metrics.flatMap(({ result }) => result.map((res) => res.values || []));
/** /**
* Returns headers and rows for csv, sorted by their timestamp. * Returns headers and rows for csv, sorted by their timestamp.
...@@ -99,7 +99,7 @@ const csvData = (metricHeaders, metricValues) => { ...@@ -99,7 +99,7 @@ const csvData = (metricHeaders, metricValues) => {
const rows = Object.keys(rowsByTimestamp) const rows = Object.keys(rowsByTimestamp)
.sort() .sort()
.map(timestamp => { .map((timestamp) => {
// force each row to have the same number of entries // force each row to have the same number of entries
rowsByTimestamp[timestamp].length = metricHeaders.length; rowsByTimestamp[timestamp].length = metricHeaders.length;
// add timestamp as the first entry // add timestamp as the first entry
...@@ -111,7 +111,7 @@ const csvData = (metricHeaders, metricValues) => { ...@@ -111,7 +111,7 @@ const csvData = (metricHeaders, metricValues) => {
// appearing inside a field must be escaped by preceding it with // appearing inside a field must be escaped by preceding it with
// another double quote." // another double quote."
// https://tools.ietf.org/html/rfc4180#page-2 // https://tools.ietf.org/html/rfc4180#page-2
const headers = metricHeaders.map(header => `"${header.replace(/"/g, '""')}"`); const headers = metricHeaders.map((header) => `"${header.replace(/"/g, '""')}"`);
return { return {
headers: ['timestamp', ...headers], headers: ['timestamp', ...headers],
...@@ -125,12 +125,12 @@ const csvData = (metricHeaders, metricValues) => { ...@@ -125,12 +125,12 @@ const csvData = (metricHeaders, metricValues) => {
* @param {Object} graphData - Panel contents * @param {Object} graphData - Panel contents
* @returns {String} * @returns {String}
*/ */
export const graphDataToCsv = graphData => { export const graphDataToCsv = (graphData) => {
const delimiter = ','; const delimiter = ',';
const br = '\r\n'; const br = '\r\n';
const { metrics = [], y_label: axisLabel } = graphData; const { metrics = [], y_label: axisLabel } = graphData;
const metricsWithResults = metrics.filter(metric => metric.result); const metricsWithResults = metrics.filter((metric) => metric.result);
const metricHeaders = csvMetricHeaders(axisLabel, metricsWithResults); const metricHeaders = csvMetricHeaders(axisLabel, metricsWithResults);
const metricValues = csvMetricValues(metricsWithResults); const metricValues = csvMetricValues(metricsWithResults);
const { headers, rows } = csvData(metricHeaders, metricValues); const { headers, rows } = csvData(metricHeaders, metricValues);
...@@ -140,7 +140,7 @@ export const graphDataToCsv = graphData => { ...@@ -140,7 +140,7 @@ export const graphDataToCsv = graphData => {
} }
const headerLine = headers.join(delimiter) + br; const headerLine = headers.join(delimiter) + br;
const lines = rows.map(row => row.join(delimiter)); const lines = rows.map((row) => row.join(delimiter));
return headerLine + lines.join(br) + br; return headerLine + lines.join(br) + br;
}; };
...@@ -3,10 +3,10 @@ import statusCodes from '~/lib/utils/http_status'; ...@@ -3,10 +3,10 @@ import statusCodes from '~/lib/utils/http_status';
import { backOff } from '~/lib/utils/common_utils'; import { backOff } from '~/lib/utils/common_utils';
import { PROMETHEUS_TIMEOUT } from '../constants'; import { PROMETHEUS_TIMEOUT } from '../constants';
const cancellableBackOffRequest = makeRequestCallback => const cancellableBackOffRequest = (makeRequestCallback) =>
backOff((next, stop) => { backOff((next, stop) => {
makeRequestCallback() makeRequestCallback()
.then(resp => { .then((resp) => {
if (resp.status === statusCodes.NO_CONTENT) { if (resp.status === statusCodes.NO_CONTENT) {
next(); next();
} else { } else {
...@@ -16,19 +16,19 @@ const cancellableBackOffRequest = makeRequestCallback => ...@@ -16,19 +16,19 @@ const cancellableBackOffRequest = 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)));
}, PROMETHEUS_TIMEOUT); }, PROMETHEUS_TIMEOUT);
export const getDashboard = (dashboardEndpoint, params) => export const getDashboard = (dashboardEndpoint, params) =>
cancellableBackOffRequest(() => axios.get(dashboardEndpoint, { params })).then( cancellableBackOffRequest(() => axios.get(dashboardEndpoint, { params })).then(
axiosResponse => axiosResponse.data, (axiosResponse) => axiosResponse.data,
); );
export const getPrometheusQueryData = (prometheusEndpoint, params, opts) => export const getPrometheusQueryData = (prometheusEndpoint, params, opts) =>
cancellableBackOffRequest(() => axios.get(prometheusEndpoint, { params, ...opts })) cancellableBackOffRequest(() => axios.get(prometheusEndpoint, { params, ...opts }))
.then(axiosResponse => axiosResponse.data) .then((axiosResponse) => axiosResponse.data)
.then(prometheusResponse => prometheusResponse.data) .then((prometheusResponse) => prometheusResponse.data)
.catch(error => { .catch((error) => {
// Prometheus returns errors in specific cases // Prometheus returns errors in specific cases
// https://prometheus.io/docs/prometheus/latest/querying/api/#format-overview // https://prometheus.io/docs/prometheus/latest/querying/api/#format-overview
const { response = {} } = error; const { response = {} } = error;
......
...@@ -10,7 +10,7 @@ export default class AlertsService { ...@@ -10,7 +10,7 @@ export default class AlertsService {
} }
getAlerts() { getAlerts() {
return axios.get(this.alertsEndpoint).then(resp => mapAlert(resp.data)); return axios.get(this.alertsEndpoint).then((resp) => mapAlert(resp.data));
} }
createAlert({ prometheus_metric_id, operator, threshold, runbookUrl }) { createAlert({ prometheus_metric_id, operator, threshold, runbookUrl }) {
...@@ -21,23 +21,23 @@ export default class AlertsService { ...@@ -21,23 +21,23 @@ export default class AlertsService {
threshold, threshold,
runbook_url: runbookUrl, runbook_url: runbookUrl,
}) })
.then(resp => mapAlert(resp.data)); .then((resp) => mapAlert(resp.data));
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
readAlert(alertPath) { readAlert(alertPath) {
return axios.get(alertPath).then(resp => mapAlert(resp.data)); return axios.get(alertPath).then((resp) => mapAlert(resp.data));
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
updateAlert(alertPath, { operator, threshold, runbookUrl }) { updateAlert(alertPath, { operator, threshold, runbookUrl }) {
return axios return axios
.put(alertPath, { operator, threshold, runbook_url: runbookUrl }) .put(alertPath, { operator, threshold, runbook_url: runbookUrl })
.then(resp => mapAlert(resp.data)); .then((resp) => mapAlert(resp.data));
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
deleteAlert(alertPath) { deleteAlert(alertPath) {
return axios.delete(alertPath).then(resp => resp.data); return axios.delete(alertPath).then((resp) => resp.data);
} }
} }
export const metricsWithData = (state, getters, rootState, rootGetters) => export const metricsWithData = (state, getters, rootState, rootGetters) =>
state.modules.map(module => rootGetters[`${module}/metricsWithData`]().length); state.modules.map((module) => rootGetters[`${module}/metricsWithData`]().length);
...@@ -15,9 +15,9 @@ import { optionsFromSeriesData } from './variable_mapping'; ...@@ -15,9 +15,9 @@ import { optionsFromSeriesData } from './variable_mapping';
*/ */
const findMetricInDashboard = (metricId, dashboard) => { const findMetricInDashboard = (metricId, dashboard) => {
let res = null; let res = null;
dashboard.panelGroups.forEach(group => { dashboard.panelGroups.forEach((group) => {
group.panels.forEach(panel => { group.panels.forEach((panel) => {
panel.metrics.forEach(metric => { panel.metrics.forEach((metric) => {
if (metric.metricId === metricId) { if (metric.metricId === metricId) {
res = metric; res = metric;
} }
...@@ -31,7 +31,7 @@ const findMetricInDashboard = (metricId, dashboard) => { ...@@ -31,7 +31,7 @@ const findMetricInDashboard = (metricId, dashboard) => {
* Maps a backened error state to a `metricStates` constant * Maps a backened error state to a `metricStates` constant
* @param {Object} error - Error from backend response * @param {Object} error - Error from backend response
*/ */
const emptyStateFromError = error => { const emptyStateFromError = (error) => {
if (!error) { if (!error) {
return metricStates.UNKNOWN_ERROR; return metricStates.UNKNOWN_ERROR;
} }
...@@ -53,7 +53,7 @@ const emptyStateFromError = error => { ...@@ -53,7 +53,7 @@ const emptyStateFromError = error => {
return metricStates.UNKNOWN_ERROR; return metricStates.UNKNOWN_ERROR;
}; };
export const metricStateFromData = data => { export const metricStateFromData = (data) => {
if (data?.result?.length) { if (data?.result?.length) {
const result = normalizeQueryResponseData(data); const result = normalizeQueryResponseData(data);
return { state: metricStates.OK, result: Object.freeze(result) }; return { state: metricStates.OK, result: Object.freeze(result) };
...@@ -93,7 +93,7 @@ export default { ...@@ -93,7 +93,7 @@ export default {
state.isUpdatingStarredValue = true; state.isUpdatingStarredValue = true;
}, },
[types.RECEIVE_DASHBOARD_STARRING_SUCCESS](state, { selectedDashboard, newStarredValue }) { [types.RECEIVE_DASHBOARD_STARRING_SUCCESS](state, { selectedDashboard, newStarredValue }) {
const index = state.allDashboards.findIndex(d => d === selectedDashboard); const index = state.allDashboards.findIndex((d) => d === selectedDashboard);
state.isUpdatingStarredValue = false; state.isUpdatingStarredValue = false;
...@@ -196,7 +196,7 @@ export default { ...@@ -196,7 +196,7 @@ export default {
state.showErrorBanner = enabled; state.showErrorBanner = enabled;
}, },
[types.SET_PANEL_GROUP_METRICS](state, payload) { [types.SET_PANEL_GROUP_METRICS](state, payload) {
const panelGroup = state.dashboard.panelGroups.find(pg => payload.key === pg.key); const panelGroup = state.dashboard.panelGroups.find((pg) => payload.key === pg.key);
panelGroup.panels = payload.panels; panelGroup.panels = payload.panels;
}, },
[types.SET_ENVIRONMENTS_FILTER](state, searchTerm) { [types.SET_ENVIRONMENTS_FILTER](state, searchTerm) {
...@@ -207,7 +207,7 @@ export default { ...@@ -207,7 +207,7 @@ export default {
state.expandedPanel.panel = panel; state.expandedPanel.panel = panel;
}, },
[types.UPDATE_VARIABLE_VALUE](state, { name, value }) { [types.UPDATE_VARIABLE_VALUE](state, { name, value }) {
const variable = state.variables.find(v => v.name === name); const variable = state.variables.find((v) => v.name === name);
if (variable) { if (variable) {
Object.assign(variable, { Object.assign(variable, {
value, value,
......
...@@ -40,7 +40,7 @@ export const uniqMetricsId = ({ metric_id, id }) => `${metric_id || NOT_IN_DB_PR ...@@ -40,7 +40,7 @@ export const uniqMetricsId = ({ metric_id, id }) => `${metric_id || NOT_IN_DB_PR
* @param {String} str String with leading slash * @param {String} str String with leading slash
* @returns {String} * @returns {String}
*/ */
export const removeLeadingSlash = str => (str || '').replace(/^\/+/, ''); export const removeLeadingSlash = (str) => (str || '').replace(/^\/+/, '');
/** /**
* GraphQL environments API returns only id and name. * GraphQL environments API returns only id and name.
...@@ -52,7 +52,7 @@ export const removeLeadingSlash = str => (str || '').replace(/^\/+/, ''); ...@@ -52,7 +52,7 @@ export const removeLeadingSlash = str => (str || '').replace(/^\/+/, '');
* @returns {Array} * @returns {Array}
*/ */
export const parseEnvironmentsResponse = (response = [], projectPath) => export const parseEnvironmentsResponse = (response = [], projectPath) =>
(response || []).map(env => { (response || []).map((env) => {
const id = getIdFromGraphQLId(env.id); const id = getIdFromGraphQLId(env.id);
return { return {
...env, ...env,
...@@ -75,11 +75,11 @@ export const parseEnvironmentsResponse = (response = [], projectPath) => ...@@ -75,11 +75,11 @@ export const parseEnvironmentsResponse = (response = [], projectPath) =>
* @param {Array} response annotations response * @param {Array} response annotations response
* @returns {Array} parsed responses * @returns {Array} parsed responses
*/ */
export const parseAnnotationsResponse = response => { export const parseAnnotationsResponse = (response) => {
if (!response) { if (!response) {
return []; return [];
} }
return response.map(annotation => ({ return response.map((annotation) => ({
...annotation, ...annotation,
startingAt: new Date(annotation.startingAt), startingAt: new Date(annotation.startingAt),
endingAt: annotation.endingAt ? new Date(annotation.endingAt) : null, endingAt: annotation.endingAt ? new Date(annotation.endingAt) : null,
...@@ -99,7 +99,7 @@ export const parseAnnotationsResponse = response => { ...@@ -99,7 +99,7 @@ export const parseAnnotationsResponse = response => {
* @param {Array} metrics - Array of prometheus metrics * @param {Array} metrics - Array of prometheus metrics
* @returns {Object} * @returns {Object}
*/ */
const mapToMetricsViewModel = metrics => const mapToMetricsViewModel = (metrics) =>
metrics.map(({ label, id, metric_id, query_range, prometheus_endpoint_path, ...metric }) => ({ metrics.map(({ label, id, metric_id, query_range, prometheus_endpoint_path, ...metric }) => ({
label, label,
queryRange: query_range, queryRange: query_range,
...@@ -230,7 +230,7 @@ const mapToPanelGroupViewModel = ({ group = '', panels = [] }, i) => { ...@@ -230,7 +230,7 @@ const mapToPanelGroupViewModel = ({ group = '', panels = [] }, i) => {
* @param {Object} timeRange * @param {Object} timeRange
* @returns {Object} * @returns {Object}
*/ */
export const convertToGrafanaTimeRange = timeRange => { export const convertToGrafanaTimeRange = (timeRange) => {
const timeRangeType = getRangeType(timeRange); const timeRangeType = getRangeType(timeRange);
if (timeRangeType === DATETIME_RANGE_TYPES.fixed) { if (timeRangeType === DATETIME_RANGE_TYPES.fixed) {
return { return {
...@@ -272,7 +272,7 @@ export const convertTimeRanges = (timeRange, type) => { ...@@ -272,7 +272,7 @@ export const convertTimeRanges = (timeRange, type) => {
* @param {Object} metadata * @param {Object} metadata
* @returns {Function} * @returns {Function}
*/ */
export const addDashboardMetaDataToLink = metadata => link => { export const addDashboardMetaDataToLink = (metadata) => (link) => {
let modifiedLink = { ...link }; let modifiedLink = { ...link };
if (metadata.timeRange) { if (metadata.timeRange) {
modifiedLink = { modifiedLink = {
...@@ -307,7 +307,7 @@ export const mapToDashboardViewModel = ({ ...@@ -307,7 +307,7 @@ export const mapToDashboardViewModel = ({
// Prometheus Results Parsing // Prometheus Results Parsing
const dateTimeFromUnixTime = unixTime => new Date(unixTime * 1000).toISOString(); const dateTimeFromUnixTime = (unixTime) => new Date(unixTime * 1000).toISOString();
const mapScalarValue = ([unixTime, value]) => [dateTimeFromUnixTime(unixTime), Number(value)]; const mapScalarValue = ([unixTime, value]) => [dateTimeFromUnixTime(unixTime), Number(value)];
...@@ -324,7 +324,7 @@ const mapStringValue = ([unixTime, value]) => [dateTimeFromUnixTime(unixTime), v ...@@ -324,7 +324,7 @@ const mapStringValue = ([unixTime, value]) => [dateTimeFromUnixTime(unixTime), v
* @param {array} result * @param {array} result
* @returns {array} * @returns {array}
*/ */
const normalizeScalarResult = result => [ const normalizeScalarResult = (result) => [
{ {
metric: {}, metric: {},
value: mapScalarValue(result), value: mapScalarValue(result),
...@@ -344,7 +344,7 @@ const normalizeScalarResult = result => [ ...@@ -344,7 +344,7 @@ const normalizeScalarResult = result => [
* @param {array} result * @param {array} result
* @returns {array} * @returns {array}
*/ */
const normalizeStringResult = result => [ const normalizeStringResult = (result) => [
{ {
metric: {}, metric: {},
value: mapStringValue(result), value: mapStringValue(result),
...@@ -379,7 +379,7 @@ const normalizeStringResult = result => [ ...@@ -379,7 +379,7 @@ const normalizeStringResult = result => [
* @param {array} result * @param {array} result
* @returns {array} * @returns {array}
*/ */
const normalizeVectorResult = result => const normalizeVectorResult = (result) =>
result.map(({ metric, value }) => { result.map(({ metric, value }) => {
const scalar = mapScalarValue(value); const scalar = mapScalarValue(value);
// Add a single element to `values`, to support matrix // Add a single element to `values`, to support matrix
...@@ -407,7 +407,7 @@ const normalizeVectorResult = result => ...@@ -407,7 +407,7 @@ const normalizeVectorResult = result =>
* @param {array} result * @param {array} result
* @returns {object} Normalized result. * @returns {object} Normalized result.
*/ */
const normalizeResultMatrix = result => const normalizeResultMatrix = (result) =>
result.map(({ metric, values }) => { result.map(({ metric, values }) => {
const mappedValues = values.map(mapScalarValue); const mappedValues = values.map(mapScalarValue);
return { return {
...@@ -440,7 +440,7 @@ const normalizeResultMatrix = result => ...@@ -440,7 +440,7 @@ const normalizeResultMatrix = result =>
* ] * ]
* *
*/ */
export const normalizeQueryResponseData = data => { export const normalizeQueryResponseData = (data) => {
const { resultType, result } = data; const { resultType, result } = data;
if (resultType === 'vector') { if (resultType === 'vector') {
return normalizeVectorResult(result); return normalizeVectorResult(result);
...@@ -466,7 +466,7 @@ export const normalizeQueryResponseData = data => { ...@@ -466,7 +466,7 @@ export const normalizeQueryResponseData = data => {
* @param {String} name Variable key that needs to be prefixed * @param {String} name Variable key that needs to be prefixed
* @returns {String} * @returns {String}
*/ */
export const addPrefixToCustomVariableParams = name => `variables[${name}]`; export const addPrefixToCustomVariableParams = (name) => `variables[${name}]`;
/** /**
* Normalize custom dashboard paths. This method helps support * Normalize custom dashboard paths. This method helps support
......
...@@ -21,7 +21,7 @@ import { VARIABLE_TYPES } from '../constants'; ...@@ -21,7 +21,7 @@ import { VARIABLE_TYPES } from '../constants';
* @param {String|Object} simpleTextVar * @param {String|Object} simpleTextVar
* @returns {Object} * @returns {Object}
*/ */
const textSimpleVariableParser = simpleTextVar => ({ const textSimpleVariableParser = (simpleTextVar) => ({
type: VARIABLE_TYPES.text, type: VARIABLE_TYPES.text,
label: null, label: null,
value: simpleTextVar, value: simpleTextVar,
...@@ -34,7 +34,7 @@ const textSimpleVariableParser = simpleTextVar => ({ ...@@ -34,7 +34,7 @@ const textSimpleVariableParser = simpleTextVar => ({
* @param {Object} advTextVar * @param {Object} advTextVar
* @returns {Object} * @returns {Object}
*/ */
const textAdvancedVariableParser = advTextVar => ({ const textAdvancedVariableParser = (advTextVar) => ({
type: VARIABLE_TYPES.text, type: VARIABLE_TYPES.text,
label: advTextVar.label, label: advTextVar.label,
value: advTextVar.options.default_value, value: advTextVar.options.default_value,
...@@ -62,9 +62,9 @@ const normalizeVariableValues = ({ default: defaultOpt = false, text, value = nu ...@@ -62,9 +62,9 @@ const normalizeVariableValues = ({ default: defaultOpt = false, text, value = nu
* @param {Object} advVariable advanced custom variable * @param {Object} advVariable advanced custom variable
* @returns {Object} * @returns {Object}
*/ */
const customAdvancedVariableParser = advVariable => { const customAdvancedVariableParser = (advVariable) => {
const values = (advVariable?.options?.values ?? []).map(normalizeVariableValues); const values = (advVariable?.options?.values ?? []).map(normalizeVariableValues);
const defaultValue = values.find(opt => opt.default === true) || values[0]; const defaultValue = values.find((opt) => opt.default === true) || values[0];
return { return {
type: VARIABLE_TYPES.custom, type: VARIABLE_TYPES.custom,
label: advVariable.label, label: advVariable.label,
...@@ -82,7 +82,7 @@ const customAdvancedVariableParser = advVariable => { ...@@ -82,7 +82,7 @@ const customAdvancedVariableParser = advVariable => {
* @param {String} opt option from simple custom variable * @param {String} opt option from simple custom variable
* @returns {Object} * @returns {Object}
*/ */
export const parseSimpleCustomValues = opt => ({ text: opt, value: opt }); export const parseSimpleCustomValues = (opt) => ({ text: opt, value: opt });
/** /**
* Custom simple variables are rendered as dropdown elements in the dashboard * Custom simple variables are rendered as dropdown elements in the dashboard
...@@ -96,7 +96,7 @@ export const parseSimpleCustomValues = opt => ({ text: opt, value: opt }); ...@@ -96,7 +96,7 @@ export const parseSimpleCustomValues = opt => ({ text: opt, value: opt });
* @param {Array} customVariable array of options * @param {Array} customVariable array of options
* @returns {Object} * @returns {Object}
*/ */
const customSimpleVariableParser = simpleVar => { const customSimpleVariableParser = (simpleVar) => {
const values = (simpleVar || []).map(parseSimpleCustomValues); const values = (simpleVar || []).map(parseSimpleCustomValues);
return { return {
type: VARIABLE_TYPES.custom, type: VARIABLE_TYPES.custom,
...@@ -126,7 +126,7 @@ const metricLabelValuesVariableParser = ({ label, options = {} }) => ({ ...@@ -126,7 +126,7 @@ const metricLabelValuesVariableParser = ({ label, options = {} }) => ({
* @param {Array|Object} customVar Array if simple, object if advanced * @param {Array|Object} customVar Array if simple, object if advanced
* @returns {Boolean} true if simple, false if advanced * @returns {Boolean} true if simple, false if advanced
*/ */
const isSimpleCustomVariable = customVar => Array.isArray(customVar); const isSimpleCustomVariable = (customVar) => Array.isArray(customVar);
/** /**
* This method returns a parser based on the type of the variable. * This method returns a parser based on the type of the variable.
...@@ -137,7 +137,7 @@ const isSimpleCustomVariable = customVar => Array.isArray(customVar); ...@@ -137,7 +137,7 @@ const isSimpleCustomVariable = customVar => Array.isArray(customVar);
* @param {Array|Object} variable * @param {Array|Object} variable
* @return {Function} parser method * @return {Function} parser method
*/ */
const getVariableParser = variable => { const getVariableParser = (variable) => {
if (isString(variable)) { if (isString(variable)) {
return textSimpleVariableParser; return textSimpleVariableParser;
} else if (isSimpleCustomVariable(variable)) { } else if (isSimpleCustomVariable(variable)) {
...@@ -200,7 +200,7 @@ export const parseTemplatingVariables = (ymlVariables = {}) => ...@@ -200,7 +200,7 @@ export const parseTemplatingVariables = (ymlVariables = {}) =>
*/ */
export const mergeURLVariables = (parsedYmlVariables = []) => { export const mergeURLVariables = (parsedYmlVariables = []) => {
const varsFromURL = templatingVariablesFromUrl(); const varsFromURL = templatingVariablesFromUrl();
parsedYmlVariables.forEach(variable => { parsedYmlVariables.forEach((variable) => {
const { name } = variable; const { name } = variable;
if (Object.prototype.hasOwnProperty.call(varsFromURL, name)) { if (Object.prototype.hasOwnProperty.call(varsFromURL, name)) {
Object.assign(variable, { value: varsFromURL[name] }); Object.assign(variable, { value: varsFromURL[name] });
......
...@@ -81,15 +81,15 @@ export const graphDataValidatorForValues = (isValues, graphData) => { ...@@ -81,15 +81,15 @@ export const graphDataValidatorForValues = (isValues, graphData) => {
const responseValueKeyName = isValues ? 'value' : 'values'; const responseValueKeyName = isValues ? 'value' : 'values';
return ( return (
Array.isArray(graphData.metrics) && Array.isArray(graphData.metrics) &&
graphData.metrics.filter(query => { graphData.metrics.filter((query) => {
if (Array.isArray(query.result)) { if (Array.isArray(query.result)) {
return ( return (
query.result.filter(res => Array.isArray(res[responseValueKeyName])).length === query.result.filter((res) => Array.isArray(res[responseValueKeyName])).length ===
query.result.length query.result.length
); );
} }
return false; return false;
}).length === graphData.metrics.filter(query => query.result).length }).length === graphData.metrics.filter((query) => query.result).length
); );
}; };
...@@ -106,7 +106,7 @@ const isClusterHealthBoard = () => (document.body.dataset.page || '').includes(' ...@@ -106,7 +106,7 @@ const isClusterHealthBoard = () => (document.body.dataset.page || '').includes('
* @param {String} chart link that will be sent as a property for the event * @param {String} chart link that will be sent as a property for the event
* @return {Object} config object for event tracking * @return {Object} config object for event tracking
*/ */
export const generateLinkToChartOptions = chartLink => { export const generateLinkToChartOptions = (chartLink) => {
const isCLusterHealthBoard = isClusterHealthBoard(); const isCLusterHealthBoard = isClusterHealthBoard();
const category = isCLusterHealthBoard const category = isCLusterHealthBoard
...@@ -124,7 +124,7 @@ export const generateLinkToChartOptions = chartLink => { ...@@ -124,7 +124,7 @@ export const generateLinkToChartOptions = chartLink => {
* @param {String} chart title that will be sent as a property for the event * @param {String} chart title that will be sent as a property for the event
* @return {Object} config object for event tracking * @return {Object} config object for event tracking
*/ */
export const downloadCSVOptions = title => { export const downloadCSVOptions = (title) => {
const isCLusterHealthBoard = isClusterHealthBoard(); const isCLusterHealthBoard = isClusterHealthBoard();
const category = isCLusterHealthBoard const category = isCLusterHealthBoard
...@@ -157,7 +157,7 @@ export const getAddMetricTrackingOptions = () => ({ ...@@ -157,7 +157,7 @@ export const getAddMetricTrackingOptions = () => ({
* @param {Object} graphData the graph data response from a prometheus request * @param {Object} graphData the graph data response from a prometheus request
* @returns {boolean} true if the data is valid * @returns {boolean} true if the data is valid
*/ */
export const graphDataValidatorForAnomalyValues = graphData => { export const graphDataValidatorForAnomalyValues = (graphData) => {
const anomalySeriesCount = 3; // metric, upper, lower const anomalySeriesCount = 3; // metric, upper, lower
return ( return (
graphData.metrics && graphData.metrics &&
...@@ -186,7 +186,7 @@ export const timeRangeFromUrl = (search = window.location.search) => { ...@@ -186,7 +186,7 @@ export const timeRangeFromUrl = (search = window.location.search) => {
* @param {String} label label for the template variable * @param {String} label label for the template variable
* @returns {String} * @returns {String}
*/ */
export const addPrefixToLabel = label => `${VARIABLE_PREFIX}${label}`; export const addPrefixToLabel = (label) => `${VARIABLE_PREFIX}${label}`;
/** /**
* Before the templating variables are passed to the backend the * Before the templating variables are passed to the backend the
...@@ -197,7 +197,7 @@ export const addPrefixToLabel = label => `${VARIABLE_PREFIX}${label}`; ...@@ -197,7 +197,7 @@ export const addPrefixToLabel = label => `${VARIABLE_PREFIX}${label}`;
* @param {String} label label to remove prefix from * @param {String} label label to remove prefix from
* @returns {String} * @returns {String}
*/ */
export const removePrefixFromLabel = label => export const removePrefixFromLabel = (label) =>
(label || '').replace(new RegExp(`^${VARIABLE_PREFIX}`), ''); (label || '').replace(new RegExp(`^${VARIABLE_PREFIX}`), '');
/** /**
...@@ -210,7 +210,7 @@ export const removePrefixFromLabel = label => ...@@ -210,7 +210,7 @@ export const removePrefixFromLabel = label =>
* @param {Object} variables * @param {Object} variables
* @returns {Object} * @returns {Object}
*/ */
export const convertVariablesForURL = variables => export const convertVariablesForURL = (variables) =>
variables.reduce((acc, { name, value }) => { variables.reduce((acc, { name, value }) => {
if (value !== null) { if (value !== null) {
acc[addPrefixToLabel(name)] = value; acc[addPrefixToLabel(name)] = value;
...@@ -241,7 +241,7 @@ export const templatingVariablesFromUrl = (search = window.location.search) => { ...@@ -241,7 +241,7 @@ export const templatingVariablesFromUrl = (search = window.location.search) => {
* *
* @param {Object} variables user defined variables * @param {Object} variables user defined variables
*/ */
export const setCustomVariablesFromUrl = variables => { export const setCustomVariablesFromUrl = (variables) => {
// prep the variables to append to URL // prep the variables to append to URL
const parsedVariables = convertVariablesForURL(variables); const parsedVariables = convertVariablesForURL(variables);
// update the URL // update the URL
...@@ -353,7 +353,7 @@ export const panelToUrl = ( ...@@ -353,7 +353,7 @@ export const panelToUrl = (
* @param {Array} values data points * @param {Array} values data points
* @returns {Number} * @returns {Number}
*/ */
const metricValueMapper = values => values[0]?.[1]; const metricValueMapper = (values) => values[0]?.[1];
/** /**
* Get the metric name from metric object * Get the metric name from metric object
...@@ -364,7 +364,7 @@ const metricValueMapper = values => values[0]?.[1]; ...@@ -364,7 +364,7 @@ const metricValueMapper = values => values[0]?.[1];
* @param {Object} metric metric object * @param {Object} metric metric object
* @returns {String} * @returns {String}
*/ */
const metricNameMapper = metric => Object.values(metric)?.[0]; const metricNameMapper = (metric) => Object.values(metric)?.[0];
/** /**
* Parse metric object to extract metric value and name in * Parse metric object to extract metric value and name in
......
import { isSafeURL } from '~/lib/utils/url_utility'; import { isSafeURL } from '~/lib/utils/url_utility';
const isRunbookUrlValid = runbookUrl => { const isRunbookUrlValid = (runbookUrl) => {
if (!runbookUrl) { if (!runbookUrl) {
return true; return true;
} }
...@@ -21,7 +21,7 @@ const isRunbookUrlValid = runbookUrl => { ...@@ -21,7 +21,7 @@ const isRunbookUrlValid = runbookUrl => {
// } // }
// } // }
export function alertsValidator(value) { export function alertsValidator(value) {
return Object.keys(value).every(key => { return Object.keys(value).every((key) => {
const alert = value[key]; const alert = value[key];
return ( return (
alert.alert_path && alert.alert_path &&
...@@ -49,7 +49,7 @@ export function alertsValidator(value) { ...@@ -49,7 +49,7 @@ export function alertsValidator(value) {
// ] // ]
export function queriesValidator(value) { export function queriesValidator(value) {
return value.every( return value.every(
query => (query) =>
query.metricId && typeof query.metricId === 'string' && typeof query.label === 'string', query.metricId && typeof query.metricId === 'string' && typeof query.label === 'string',
); );
} }
...@@ -33,7 +33,7 @@ export default () => { ...@@ -33,7 +33,7 @@ export default () => {
computed: { computed: {
...mapGetters(['discussionTabCounter']), ...mapGetters(['discussionTabCounter']),
...mapState({ ...mapState({
activeTab: state => state.page.activeTab, activeTab: (state) => state.page.activeTab,
}), }),
isShowTabActive() { isShowTabActive() {
return this.activeTab === 'show'; return this.activeTab === 'show';
......
// Note: this getter is important because // Note: this getter is important because
// `noteableData` is namespaced under `notes` for `~/mr_notes/stores` // `noteableData` is namespaced under `notes` for `~/mr_notes/stores`
// while `noteableData` is directly available as `state.noteableData` for `~/notes/stores` // while `noteableData` is directly available as `state.noteableData` for `~/notes/stores`
export const getNoteableData = state => state.notes.noteableData; export const getNoteableData = (state) => state.notes.noteableData;
export default { export default {
isLoggedIn(state, getters) { isLoggedIn(state, getters) {
......
...@@ -72,7 +72,7 @@ export default { ...@@ -72,7 +72,7 @@ export default {
apollo: { apollo: {
mergeRequest: { mergeRequest: {
query, query,
update: data => data.project.mergeRequest, update: (data) => data.project.mergeRequest,
variables() { variables() {
const { projectPath, mergeRequestIID } = this; const { projectPath, mergeRequestIID } = this;
......
...@@ -42,7 +42,7 @@ const handleMRPopoverMount = ({ apolloProvider, projectPath, mrTitle, iid }) => ...@@ -42,7 +42,7 @@ const handleMRPopoverMount = ({ apolloProvider, projectPath, mrTitle, iid }) =>
}, 200); // 200ms delay so not every mouseover triggers Popover + API Call }, 200); // 200ms delay so not every mouseover triggers Popover + API Call
}; };
export default elements => { export default (elements) => {
const mrLinks = elements || [...document.querySelectorAll('.gfm-merge_request')]; const mrLinks = elements || [...document.querySelectorAll('.gfm-merge_request')];
if (mrLinks.length > 0) { if (mrLinks.length > 0) {
Vue.use(VueApollo); Vue.use(VueApollo);
...@@ -52,7 +52,7 @@ export default elements => { ...@@ -52,7 +52,7 @@ export default elements => {
}); });
const listenerAddedAttr = 'data-mr-listener-added'; const listenerAddedAttr = 'data-mr-listener-added';
mrLinks.forEach(el => { mrLinks.forEach((el) => {
const { projectPath, mrTitle, iid } = el.dataset; const { projectPath, mrTitle, iid } = el.dataset;
if (!el.getAttribute(listenerAddedAttr) && projectPath && mrTitle && iid) { if (!el.getAttribute(listenerAddedAttr) && projectPath && mrTitle && iid) {
......
...@@ -25,7 +25,7 @@ export default class NamespaceSelect { ...@@ -25,7 +25,7 @@ export default class NamespaceSelect {
return `${selected.kind}: ${selected.full_path}`; return `${selected.kind}: ${selected.full_path}`;
}, },
data(term, dataCallback) { data(term, dataCallback) {
return Api.namespaces(term, namespaces => { return Api.namespaces(term, (namespaces) => {
if (isFilter) { if (isFilter) {
const anyNamespace = { const anyNamespace = {
text: __('Any namespace'), text: __('Any namespace'),
......
...@@ -66,12 +66,12 @@ export default class BranchGraph { ...@@ -66,12 +66,12 @@ export default class BranchGraph {
collectParents() { collectParents() {
const ref = this.commits; const ref = this.commits;
const results = []; const results = [];
ref.forEach(c => { ref.forEach((c) => {
this.mtime = Math.max(this.mtime, c.time); this.mtime = Math.max(this.mtime, c.time);
this.mspace = Math.max(this.mspace, c.space); this.mspace = Math.max(this.mspace, c.space);
const ref1 = c.parents; const ref1 = c.parents;
const results1 = []; const results1 = [];
ref1.forEach(p => { ref1.forEach((p) => {
this.parents[p[0]] = true; this.parents[p[0]] = true;
results1.push((this.mspace = Math.max(this.mspace, p[1]))); results1.push((this.mspace = Math.max(this.mspace, p[1])));
}); });
......
...@@ -60,7 +60,7 @@ export default class NewBranchForm { ...@@ -60,7 +60,7 @@ export default class NewBranchForm {
return values; return values;
}; };
const formatter = function (values, restriction) { const formatter = function (values, restriction) {
const formatted = values.map(value => { const formatted = values.map((value) => {
switch (false) { switch (false) {
case !/\s/.test(value): case !/\s/.test(value):
return 'spaces'; return 'spaces';
......
...@@ -77,11 +77,11 @@ function renderKatex(t) { ...@@ -77,11 +77,11 @@ function renderKatex(t) {
} }
return [text, numInline > 0]; return [text, numInline > 0];
} }
renderer.paragraph = t => { renderer.paragraph = (t) => {
const [text, inline] = renderKatex(t); const [text, inline] = renderKatex(t);
return `<p class="${inline ? 'inline-katex' : ''}">${text}</p>`; return `<p class="${inline ? 'inline-katex' : ''}">${text}</p>`;
}; };
renderer.listitem = t => { renderer.listitem = (t) => {
const [text, inline] = renderKatex(t); const [text, inline] = renderKatex(t);
return `<li class="${inline ? 'inline-katex' : ''}">${text}</li>`; return `<li class="${inline ? 'inline-katex' : ''}">${text}</li>`;
}; };
......
...@@ -345,7 +345,7 @@ export default class Notes { ...@@ -345,7 +345,7 @@ export default class Notes {
votesBlock = $('.js-awards-block').eq(0); votesBlock = $('.js-awards-block').eq(0);
loadAwardsHandler() loadAwardsHandler()
.then(awardsHandler => { .then((awardsHandler) => {
awardsHandler.addAwardToEmojiBar(votesBlock, noteEntity.commands_changes.emoji_award); awardsHandler.addAwardToEmojiBar(votesBlock, noteEntity.commands_changes.emoji_award);
awardsHandler.scrollToAwards(); awardsHandler.scrollToAwards();
}) })
...@@ -1396,7 +1396,7 @@ export default class Notes { ...@@ -1396,7 +1396,7 @@ export default class Notes {
let tempFormContent; let tempFormContent;
// Identify executed quick actions from `formContent` // Identify executed quick actions from `formContent`
const executedCommands = availableQuickActions.filter(command => { const executedCommands = availableQuickActions.filter((command) => {
const commandRegex = new RegExp(`/${command.name}`); const commandRegex = new RegExp(`/${command.name}`);
return commandRegex.test(formContent); return commandRegex.test(formContent);
}); });
...@@ -1583,7 +1583,7 @@ export default class Notes { ...@@ -1583,7 +1583,7 @@ export default class Notes {
// Make request to submit comment on server // Make request to submit comment on server
return axios return axios
.post(`${formAction}?html=true`, formData) .post(`${formAction}?html=true`, formData)
.then(res => { .then((res) => {
const note = res.data; const note = res.data;
$submitBtn.prop('disabled', false); $submitBtn.prop('disabled', false);
......
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
projectPath: state => state.diffs.projectPath, projectPath: (state) => state.diffs.projectPath,
}), }),
diffMode() { diffMode() {
return getDiffMode(this.discussion.diff_file); return getDiffMode(this.discussion.diff_file);
......
...@@ -42,10 +42,10 @@ export default { ...@@ -42,10 +42,10 @@ export default {
return this.glFeatures.hideJumpToNextUnresolvedInThreads; return this.glFeatures.hideJumpToNextUnresolvedInThreads;
}, },
resolvableNotes() { resolvableNotes() {
return this.discussion.notes.filter(x => x.resolvable); return this.discussion.notes.filter((x) => x.resolvable);
}, },
userCanResolveDiscussion() { userCanResolveDiscussion() {
return this.resolvableNotes.every(note => note.current_user?.can_resolve_discussion); return this.resolvableNotes.every((note) => note.current_user?.can_resolve_discussion);
}, },
}, },
}; };
......
...@@ -32,10 +32,10 @@ export default { ...@@ -32,10 +32,10 @@ export default {
return this.getNoteableData.create_issue_to_resolve_discussions_path; return this.getNoteableData.create_issue_to_resolve_discussions_path;
}, },
toggeableDiscussions() { toggeableDiscussions() {
return this.discussions.filter(discussion => !discussion.individual_note); return this.discussions.filter((discussion) => !discussion.individual_note);
}, },
allExpanded() { allExpanded() {
return this.toggeableDiscussions.every(discussion => discussion.expanded); return this.toggeableDiscussions.every((discussion) => discussion.expanded);
}, },
lineResolveClass() { lineResolveClass() {
return this.allResolved ? 'line-resolve-btn is-active' : 'line-resolve-text'; return this.allResolved ? 'line-resolve-btn is-active' : 'line-resolve-text';
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
...mapActions(['setExpandDiscussions']), ...mapActions(['setExpandDiscussions']),
handleExpandDiscussions() { handleExpandDiscussions() {
this.setExpandDiscussions({ this.setExpandDiscussions({
discussionIds: this.toggeableDiscussions.map(discussion => discussion.id), discussionIds: this.toggeableDiscussions.map((discussion) => discussion.id),
expanded: !this.allExpanded, expanded: !this.allExpanded,
}); });
}, },
......
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
...mapGetters(['getNotesDataByProp', 'timelineEnabled']), ...mapGetters(['getNotesDataByProp', 'timelineEnabled']),
currentFilter() { currentFilter() {
if (!this.currentValue) return this.filters[0]; if (!this.currentValue) return this.filters[0];
return this.filters.find(filter => filter.value === this.currentValue); return this.filters.find((filter) => filter.value === this.currentValue);
}, },
}, },
created() { created() {
......
...@@ -48,11 +48,11 @@ export function getLineClasses(line) { ...@@ -48,11 +48,11 @@ export function getLineClasses(line) {
export function commentLineOptions(diffLines, startingLine, lineCode, side = 'left') { export function commentLineOptions(diffLines, startingLine, lineCode, side = 'left') {
const preferredSide = side === 'left' ? 'old_line' : 'new_line'; const preferredSide = side === 'left' ? 'old_line' : 'new_line';
const fallbackSide = preferredSide === 'new_line' ? 'old_line' : 'new_line'; const fallbackSide = preferredSide === 'new_line' ? 'old_line' : 'new_line';
const notMatchType = l => l.type !== 'match'; const notMatchType = (l) => l.type !== 'match';
const linesCopy = [...diffLines]; // don't mutate the argument const linesCopy = [...diffLines]; // don't mutate the argument
const startingLineCode = startingLine.line_code; const startingLineCode = startingLine.line_code;
const currentIndex = linesCopy.findIndex(line => line.line_code === lineCode); const currentIndex = linesCopy.findIndex((line) => line.line_code === lineCode);
// We're limiting adding comments to only lines above the current line // We're limiting adding comments to only lines above the current line
// to make rendering simpler. Future interations will use a more // to make rendering simpler. Future interations will use a more
...@@ -66,10 +66,10 @@ export function commentLineOptions(diffLines, startingLine, lineCode, side = 'le ...@@ -66,10 +66,10 @@ export function commentLineOptions(diffLines, startingLine, lineCode, side = 'le
// If the selected line is "hidden" in an unchanged line block // If the selected line is "hidden" in an unchanged line block
// or "above" the current group of lines add it to the array so // or "above" the current group of lines add it to the array so
// that the drop down is not defaulted to empty // that the drop down is not defaulted to empty
const selectedIndex = lines.findIndex(line => line.line_code === startingLineCode); const selectedIndex = lines.findIndex((line) => line.line_code === startingLineCode);
if (selectedIndex < 0) lines.unshift(startingLine); if (selectedIndex < 0) lines.unshift(startingLine);
return lines.map(l => { return lines.map((l) => {
const { line_code, type, old_line, new_line } = l; const { line_code, type, old_line, new_line } = l;
return { return {
value: { line_code, type, old_line, new_line }, value: { line_code, type, old_line, new_line },
...@@ -103,7 +103,7 @@ export function getCommentedLines(selectedCommentPosition, diffLines) { ...@@ -103,7 +103,7 @@ export function getCommentedLines(selectedCommentPosition, diffLines) {
}; };
} }
const findLineCodeIndex = line => position => { const findLineCodeIndex = (line) => (position) => {
return [position.line_code, position.left?.line_code, position.right?.line_code].includes( return [position.line_code, position.left?.line_code, position.right?.line_code].includes(
line.line_code, line.line_code,
); );
......
...@@ -206,14 +206,14 @@ export default { ...@@ -206,14 +206,14 @@ export default {
const { project_id, iid } = this.getNoteableData; const { project_id, iid } = this.getNoteableData;
if (this.isUserAssigned) { if (this.isUserAssigned) {
assignees = assignees.filter(assignee => assignee.id !== this.author.id); assignees = assignees.filter((assignee) => assignee.id !== this.author.id);
} else { } else {
assignees.push({ id: this.author.id }); assignees.push({ id: this.author.id });
} }
if (this.targetType === 'issue') { if (this.targetType === 'issue') {
Api.updateIssue(project_id, iid, { Api.updateIssue(project_id, iid, {
assignee_ids: assignees.map(assignee => assignee.id), assignee_ids: assignees.map((assignee) => assignee.id),
}) })
.then(() => this.handleAssigneeUpdate(assignees)) .then(() => this.handleAssigneeUpdate(assignees))
.catch(() => flash(__('Something went wrong while updating assignees'))); .catch(() => flash(__('Something went wrong while updating assignees')));
......
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
return this.getDiscussion(this.note.discussion_id); return this.getDiscussion(this.note.discussion_id);
}, },
...mapState({ ...mapState({
batchSuggestionsInfo: state => state.notes.batchSuggestionsInfo, batchSuggestionsInfo: (state) => state.notes.batchSuggestionsInfo,
}), }),
noteBody() { noteBody() {
return this.note.note; return this.note.note;
......
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
'getUserDataByProp', 'getUserDataByProp',
]), ]),
...mapState({ ...mapState({
withBatchComments: state => state.batchComments?.withBatchComments, withBatchComments: (state) => state.batchComments?.withBatchComments,
}), }),
...mapGetters('batchComments', ['hasDrafts']), ...mapGetters('batchComments', ['hasDrafts']),
showBatchCommentsActions() { showBatchCommentsActions() {
...@@ -126,8 +126,8 @@ export default { ...@@ -126,8 +126,8 @@ export default {
return ( return (
this.discussion?.notes this.discussion?.notes
.filter(n => n.resolvable) .filter((n) => n.resolvable)
.some(n => n.current_user?.can_resolve_discussion) || this.isDraft .some((n) => n.current_user?.can_resolve_discussion) || this.isDraft
); );
}, },
noteHash() { noteHash() {
......
...@@ -201,14 +201,14 @@ export default { ...@@ -201,14 +201,14 @@ export default {
}; };
this.saveNote(replyData) this.saveNote(replyData)
.then(res => { .then((res) => {
if (res.hasFlash !== true) { if (res.hasFlash !== true) {
this.isReplying = false; this.isReplying = false;
clearDraft(this.autosaveKey); clearDraft(this.autosaveKey);
} }
callback(); callback();
}) })
.catch(err => { .catch((err) => {
this.removePlaceholderNotes(); this.removePlaceholderNotes();
const msg = __( const msg = __(
'Your comment could not be submitted! Please check your network connection and try again.', 'Your comment could not be submitted! Please check your network connection and try again.',
......
...@@ -296,7 +296,7 @@ export default { ...@@ -296,7 +296,7 @@ export default {
this.updateSuccess(); this.updateSuccess();
callback(); callback();
}) })
.catch(response => { .catch((response) => {
if (response.status === httpStatusCodes.GONE) { if (response.status === httpStatusCodes.GONE) {
this.removeNote(this.note); this.removeNote(this.note);
this.updateSuccess(); this.updateSuccess();
......
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
const { parentElement } = this.$el; const { parentElement } = this.$el;
if (parentElement && parentElement.classList.contains('js-vue-notes-event')) { if (parentElement && parentElement.classList.contains('js-vue-notes-event')) {
parentElement.addEventListener('toggleAward', event => { parentElement.addEventListener('toggleAward', (event) => {
const { awardName, noteId } = event.detail; const { awardName, noteId } = event.detail;
this.toggleAward({ awardName, noteId }); this.toggleAward({ awardName, noteId });
}); });
...@@ -217,7 +217,7 @@ export default { ...@@ -217,7 +217,7 @@ export default {
const noteId = hash && hash.replace(/^note_/, ''); const noteId = hash && hash.replace(/^note_/, '');
if (noteId) { if (noteId) {
const discussion = this.discussions.find(d => d.notes.some(({ id }) => id === noteId)); const discussion = this.discussions.find((d) => d.notes.some(({ id }) => id === noteId));
if (discussion) { if (discussion) {
this.expandDiscussion({ discussionId: discussion.id }); this.expandDiscussion({ discussionId: discussion.id });
......
...@@ -26,9 +26,9 @@ export default { ...@@ -26,9 +26,9 @@ export default {
return this.replies[this.replies.length - 1]; return this.replies[this.replies.length - 1];
}, },
uniqueAuthors() { uniqueAuthors() {
const authors = this.replies.map(reply => reply.author || {}); const authors = this.replies.map((reply) => reply.author || {});
return uniqBy(authors, author => author.username); return uniqBy(authors, (author) => author.username);
}, },
className() { className() {
return this.collapsed ? 'collapsed' : 'expanded'; return this.collapsed ? 'collapsed' : 'expanded';
......
import Vue from 'vue'; import Vue from 'vue';
import DiscussionFilter from './components/discussion_filter.vue'; import DiscussionFilter from './components/discussion_filter.vue';
export default store => { export default (store) => {
const discussionFilterEl = document.getElementById('js-vue-discussion-filter'); const discussionFilterEl = document.getElementById('js-vue-discussion-filter');
if (discussionFilterEl) { if (discussionFilterEl) {
const { defaultFilter, notesFilters } = discussionFilterEl.dataset; const { defaultFilter, notesFilters } = discussionFilterEl.dataset;
const filterValues = notesFilters ? JSON.parse(notesFilters) : {}; const filterValues = notesFilters ? JSON.parse(notesFilters) : {};
const filters = Object.keys(filterValues).map(entry => ({ const filters = Object.keys(filterValues).map((entry) => ({
title: entry, title: entry,
value: filterValues[entry], value: filterValues[entry],
})); }));
......
...@@ -9,9 +9,9 @@ import { formatLineRange } from '~/notes/components/multiline_comment_utils'; ...@@ -9,9 +9,9 @@ import { formatLineRange } from '~/notes/components/multiline_comment_utils';
export default { export default {
computed: { computed: {
...mapState({ ...mapState({
noteableData: state => state.notes.noteableData, noteableData: (state) => state.notes.noteableData,
notesData: state => state.notes.notesData, notesData: (state) => state.notes.notesData,
withBatchComments: state => state.batchComments?.withBatchComments, withBatchComments: (state) => state.batchComments?.withBatchComments,
}), }),
...mapGetters('diffs', ['getDiffFileByHash']), ...mapGetters('diffs', ['getDiffFileByHash']),
...mapGetters('batchComments', ['shouldRenderDraftRowInDiscussion', 'draftForDiscussion']), ...mapGetters('batchComments', ['shouldRenderDraftRowInDiscussion', 'draftForDiscussion']),
......
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
'getDiscussion', 'getDiscussion',
]), ]),
...mapState({ ...mapState({
currentDiscussionId: state => state.notes.currentDiscussionId, currentDiscussionId: (state) => state.notes.currentDiscussionId,
}), }),
}, },
methods: { methods: {
......
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
if (notes) { if (notes) {
// Decide resolved state using store. Only valid for discussions. // Decide resolved state using store. Only valid for discussions.
return notes.filter(note => !note.system).every(note => note.resolved); return notes.filter((note) => !note.system).every((note) => note.resolved);
} }
return resolved; return resolved;
......
import Vue from 'vue'; import Vue from 'vue';
import SortDiscussion from './components/sort_discussion.vue'; import SortDiscussion from './components/sort_discussion.vue';
export default store => { export default (store) => {
const el = document.getElementById('js-vue-sort-issue-discussions'); const el = document.getElementById('js-vue-sort-issue-discussions');
if (!el) return null; if (!el) return null;
......
...@@ -141,7 +141,7 @@ export const updateNote = ({ commit, dispatch }, { endpoint, note }) => ...@@ -141,7 +141,7 @@ export const updateNote = ({ commit, dispatch }, { endpoint, note }) =>
export const updateOrCreateNotes = ({ commit, state, getters, dispatch }, notes) => { export const updateOrCreateNotes = ({ commit, state, getters, dispatch }, notes) => {
const { notesById } = getters; const { notesById } = getters;
const debouncedFetchDiscussions = isFetching => { const debouncedFetchDiscussions = (isFetching) => {
if (!isFetching) { if (!isFetching) {
commit(types.SET_FETCHING_DISCUSSIONS, true); commit(types.SET_FETCHING_DISCUSSIONS, true);
dispatch('fetchDiscussions', { path: state.notesData.discussionsPath }); dispatch('fetchDiscussions', { path: state.notesData.discussionsPath });
...@@ -159,7 +159,7 @@ export const updateOrCreateNotes = ({ commit, state, getters, dispatch }, notes) ...@@ -159,7 +159,7 @@ export const updateOrCreateNotes = ({ commit, state, getters, dispatch }, notes)
} }
}; };
notes.forEach(note => { notes.forEach((note) => {
if (notesById[note.id]) { if (notesById[note.id]) {
commit(types.UPDATE_NOTE, note); commit(types.UPDATE_NOTE, note);
} else if (note.type === constants.DISCUSSION_NOTE || note.type === constants.DIFF_NOTE) { } else if (note.type === constants.DISCUSSION_NOTE || note.type === constants.DIFF_NOTE) {
...@@ -329,7 +329,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { ...@@ -329,7 +329,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
} }
} }
const processQuickActions = res => { const processQuickActions = (res) => {
const { errors: { commands_only: message } = { commands_only: null } } = res; const { errors: { commands_only: message } = { commands_only: null } } = res;
/* /*
The following reply means that quick actions have been successfully applied: The following reply means that quick actions have been successfully applied:
...@@ -347,7 +347,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { ...@@ -347,7 +347,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
return res; return res;
}; };
const processEmojiAward = res => { const processEmojiAward = (res) => {
const { commands_changes: commandsChanges } = res; const { commands_changes: commandsChanges } = res;
const { emoji_award: emojiAward } = commandsChanges || {}; const { emoji_award: emojiAward } = commandsChanges || {};
if (!emojiAward) { if (!emojiAward) {
...@@ -357,7 +357,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { ...@@ -357,7 +357,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
const votesBlock = $('.js-awards-block').eq(0); const votesBlock = $('.js-awards-block').eq(0);
return loadAwardsHandler() return loadAwardsHandler()
.then(awardsHandler => { .then((awardsHandler) => {
awardsHandler.addAwardToEmojiBar(votesBlock, emojiAward); awardsHandler.addAwardToEmojiBar(votesBlock, emojiAward);
awardsHandler.scrollToAwards(); awardsHandler.scrollToAwards();
}) })
...@@ -371,7 +371,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { ...@@ -371,7 +371,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
.then(() => res); .then(() => res);
}; };
const processTimeTracking = res => { const processTimeTracking = (res) => {
const { commands_changes: commandsChanges } = res; const { commands_changes: commandsChanges } = res;
const { spend_time: spendTime, time_estimate: timeEstimate } = commandsChanges || {}; const { spend_time: spendTime, time_estimate: timeEstimate } = commandsChanges || {};
if (spendTime != null || timeEstimate != null) { if (spendTime != null || timeEstimate != null) {
...@@ -383,7 +383,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { ...@@ -383,7 +383,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
return res; return res;
}; };
const removePlaceholder = res => { const removePlaceholder = (res) => {
if (replyId) { if (replyId) {
commit(types.REMOVE_PLACEHOLDER_NOTES); commit(types.REMOVE_PLACEHOLDER_NOTES);
} }
...@@ -391,7 +391,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => { ...@@ -391,7 +391,7 @@ export const saveNote = ({ commit, dispatch }, noteData) => {
return res; return res;
}; };
const processErrors = error => { const processErrors = (error) => {
if (error.response) { if (error.response) {
const { const {
response: { data = {} }, response: { data = {} },
...@@ -435,7 +435,7 @@ const pollSuccessCallBack = (resp, commit, state, getters, dispatch) => { ...@@ -435,7 +435,7 @@ const pollSuccessCallBack = (resp, commit, state, getters, dispatch) => {
return resp; return resp;
}; };
const getFetchDataParams = state => { const getFetchDataParams = (state) => {
const endpoint = state.notesData.notesPath; const endpoint = state.notesData.notesPath;
const options = { const options = {
headers: { headers: {
...@@ -570,7 +570,7 @@ export const submitSuggestion = ( ...@@ -570,7 +570,7 @@ export const submitSuggestion = (
return Api.applySuggestion(suggestionId) return Api.applySuggestion(suggestionId)
.then(() => commit(types.APPLY_SUGGESTION, { discussionId, noteId, suggestionId })) .then(() => commit(types.APPLY_SUGGESTION, { discussionId, noteId, suggestionId }))
.then(dispatchResolveDiscussion) .then(dispatchResolveDiscussion)
.catch(err => { .catch((err) => {
const defaultMessage = __( const defaultMessage = __(
'Something went wrong while applying the suggestion. Please try again.', 'Something went wrong while applying the suggestion. Please try again.',
); );
...@@ -591,12 +591,12 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { flashContai ...@@ -591,12 +591,12 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { flashContai
const suggestionIds = state.batchSuggestionsInfo.map(({ suggestionId }) => suggestionId); const suggestionIds = state.batchSuggestionsInfo.map(({ suggestionId }) => suggestionId);
const applyAllSuggestions = () => const applyAllSuggestions = () =>
state.batchSuggestionsInfo.map(suggestionInfo => state.batchSuggestionsInfo.map((suggestionInfo) =>
commit(types.APPLY_SUGGESTION, suggestionInfo), commit(types.APPLY_SUGGESTION, suggestionInfo),
); );
const resolveAllDiscussions = () => const resolveAllDiscussions = () =>
state.batchSuggestionsInfo.map(suggestionInfo => { state.batchSuggestionsInfo.map((suggestionInfo) => {
const { discussionId } = suggestionInfo; const { discussionId } = suggestionInfo;
return dispatch('resolveDiscussion', { discussionId }).catch(() => {}); return dispatch('resolveDiscussion', { discussionId }).catch(() => {});
}); });
...@@ -609,7 +609,7 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { flashContai ...@@ -609,7 +609,7 @@ export const submitSuggestionBatch = ({ commit, dispatch, state }, { flashContai
.then(() => Promise.all(applyAllSuggestions())) .then(() => Promise.all(applyAllSuggestions()))
.then(() => Promise.all(resolveAllDiscussions())) .then(() => Promise.all(resolveAllDiscussions()))
.then(() => commit(types.CLEAR_SUGGESTION_BATCH)) .then(() => commit(types.CLEAR_SUGGESTION_BATCH))
.catch(err => { .catch((err) => {
const defaultMessage = __( const defaultMessage = __(
'Something went wrong while applying the batch of suggestions. Please try again.', 'Something went wrong while applying the batch of suggestions. Please try again.',
); );
...@@ -652,10 +652,10 @@ export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersio ...@@ -652,10 +652,10 @@ export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersio
return axios return axios
.get(requestUrl) .get(requestUrl)
.then(res => { .then((res) => {
dispatch('receiveDescriptionVersion', { descriptionVersion: res.data, versionId }); dispatch('receiveDescriptionVersion', { descriptionVersion: res.data, versionId });
}) })
.catch(error => { .catch((error) => {
dispatch('receiveDescriptionVersionError', error); dispatch('receiveDescriptionVersionError', error);
Flash(__('Something went wrong while fetching description changes. Please try again.')); Flash(__('Something went wrong while fetching description changes. Please try again.'));
}); });
...@@ -687,7 +687,7 @@ export const softDeleteDescriptionVersion = ( ...@@ -687,7 +687,7 @@ export const softDeleteDescriptionVersion = (
.then(() => { .then(() => {
dispatch('receiveDeleteDescriptionVersion', versionId); dispatch('receiveDeleteDescriptionVersion', versionId);
}) })
.catch(error => { .catch((error) => {
dispatch('receiveDeleteDescriptionVersionError', error); dispatch('receiveDeleteDescriptionVersionError', error);
Flash(__('Something went wrong while deleting description changes. Please try again.')); Flash(__('Something went wrong while deleting description changes. Please try again.'));
......
...@@ -18,7 +18,7 @@ export const getTimeDifferenceMinutes = (noteBeggining, noteEnd) => { ...@@ -18,7 +18,7 @@ export const getTimeDifferenceMinutes = (noteBeggining, noteEnd) => {
* @param {Object} note * @param {Object} note
* @returns {Boolean} * @returns {Boolean}
*/ */
export const isDescriptionSystemNote = note => note.system && note.note === DESCRIPTION_TYPE; export const isDescriptionSystemNote = (note) => note.system && note.note === DESCRIPTION_TYPE;
/** /**
* Collapses the system notes of a description type, e.g. Changed the description, n minutes ago * Collapses the system notes of a description type, e.g. Changed the description, n minutes ago
...@@ -29,7 +29,7 @@ export const isDescriptionSystemNote = note => note.system && note.note === DESC ...@@ -29,7 +29,7 @@ export const isDescriptionSystemNote = note => note.system && note.note === DESC
* @param {Array} notes * @param {Array} notes
* @returns {Array} * @returns {Array}
*/ */
export const collapseSystemNotes = notes => { export const collapseSystemNotes = (notes) => {
let lastDescriptionSystemNote = null; let lastDescriptionSystemNote = null;
let lastDescriptionSystemNoteIndex = -1; let lastDescriptionSystemNoteIndex = -1;
......
...@@ -2,14 +2,14 @@ import { flattenDeep, clone } from 'lodash'; ...@@ -2,14 +2,14 @@ import { flattenDeep, clone } from 'lodash';
import * as constants from '../constants'; import * as constants from '../constants';
import { collapseSystemNotes } from './collapse_utils'; import { collapseSystemNotes } from './collapse_utils';
export const discussions = state => { export const discussions = (state) => {
let discussionsInState = clone(state.discussions); let discussionsInState = clone(state.discussions);
// NOTE: not testing bc will be removed when backend is finished. // NOTE: not testing bc will be removed when backend is finished.
if (state.isTimelineEnabled) { if (state.isTimelineEnabled) {
discussionsInState = discussionsInState discussionsInState = discussionsInState
.reduce((acc, discussion) => { .reduce((acc, discussion) => {
const transformedToIndividualNotes = discussion.notes.map(note => ({ const transformedToIndividualNotes = discussion.notes.map((note) => ({
...discussion, ...discussion,
id: note.id, id: note.id,
created_at: note.created_at, created_at: note.created_at,
...@@ -29,52 +29,52 @@ export const discussions = state => { ...@@ -29,52 +29,52 @@ export const discussions = state => {
return collapseSystemNotes(discussionsInState); return collapseSystemNotes(discussionsInState);
}; };
export const convertedDisscussionIds = state => state.convertedDisscussionIds; export const convertedDisscussionIds = (state) => state.convertedDisscussionIds;
export const targetNoteHash = state => state.targetNoteHash; export const targetNoteHash = (state) => state.targetNoteHash;
export const getNotesData = state => state.notesData; export const getNotesData = (state) => state.notesData;
export const isNotesFetched = state => state.isNotesFetched; export const isNotesFetched = (state) => state.isNotesFetched;
/* /*
* WARNING: This is an example of an "unnecessary" getter * WARNING: This is an example of an "unnecessary" getter
* more info found here: https://gitlab.com/groups/gitlab-org/-/epics/2913. * more info found here: https://gitlab.com/groups/gitlab-org/-/epics/2913.
*/ */
export const sortDirection = state => state.discussionSortOrder; export const sortDirection = (state) => state.discussionSortOrder;
export const persistSortOrder = state => state.persistSortOrder; export const persistSortOrder = (state) => state.persistSortOrder;
export const timelineEnabled = state => state.isTimelineEnabled; export const timelineEnabled = (state) => state.isTimelineEnabled;
export const isLoading = state => state.isLoading; export const isLoading = (state) => state.isLoading;
export const getNotesDataByProp = state => prop => state.notesData[prop]; export const getNotesDataByProp = (state) => (prop) => state.notesData[prop];
export const getNoteableData = state => state.noteableData; export const getNoteableData = (state) => state.noteableData;
export const getNoteableDataByProp = state => prop => state.noteableData[prop]; export const getNoteableDataByProp = (state) => (prop) => state.noteableData[prop];
export const getBlockedByIssues = state => state.noteableData.blocked_by_issues; export const getBlockedByIssues = (state) => state.noteableData.blocked_by_issues;
export const userCanReply = state => Boolean(state.noteableData.current_user.can_create_note); export const userCanReply = (state) => Boolean(state.noteableData.current_user.can_create_note);
export const openState = state => state.noteableData.state; export const openState = (state) => state.noteableData.state;
export const getUserData = state => state.userData || {}; export const getUserData = (state) => state.userData || {};
export const getUserDataByProp = state => prop => state.userData && state.userData[prop]; export const getUserDataByProp = (state) => (prop) => state.userData && state.userData[prop];
export const descriptionVersions = state => state.descriptionVersions; export const descriptionVersions = (state) => state.descriptionVersions;
export const notesById = state => export const notesById = (state) =>
state.discussions.reduce((acc, note) => { state.discussions.reduce((acc, note) => {
note.notes.every(n => Object.assign(acc, { [n.id]: n })); note.notes.every((n) => Object.assign(acc, { [n.id]: n }));
return acc; return acc;
}, {}); }, {});
export const noteableType = state => { export const noteableType = (state) => {
const { ISSUE_NOTEABLE_TYPE, MERGE_REQUEST_NOTEABLE_TYPE, EPIC_NOTEABLE_TYPE } = constants; const { ISSUE_NOTEABLE_TYPE, MERGE_REQUEST_NOTEABLE_TYPE, EPIC_NOTEABLE_TYPE } = constants;
if (state.noteableData.noteableType === EPIC_NOTEABLE_TYPE) { if (state.noteableData.noteableType === EPIC_NOTEABLE_TYPE) {
...@@ -84,21 +84,21 @@ export const noteableType = state => { ...@@ -84,21 +84,21 @@ export const noteableType = state => {
return state.noteableData.merge_params ? MERGE_REQUEST_NOTEABLE_TYPE : ISSUE_NOTEABLE_TYPE; return state.noteableData.merge_params ? MERGE_REQUEST_NOTEABLE_TYPE : ISSUE_NOTEABLE_TYPE;
}; };
const reverseNotes = array => array.slice(0).reverse(); const reverseNotes = (array) => array.slice(0).reverse();
const isLastNote = (note, state) => const isLastNote = (note, state) =>
!note.system && state.userData && note.author && note.author.id === state.userData.id; !note.system && state.userData && note.author && note.author.id === state.userData.id;
export const getCurrentUserLastNote = state => export const getCurrentUserLastNote = (state) =>
flattenDeep(reverseNotes(state.discussions).map(note => reverseNotes(note.notes))).find(el => flattenDeep(reverseNotes(state.discussions).map((note) => reverseNotes(note.notes))).find((el) =>
isLastNote(el, state), isLastNote(el, state),
); );
export const getDiscussionLastNote = state => discussion => export const getDiscussionLastNote = (state) => (discussion) =>
reverseNotes(discussion.notes).find(el => isLastNote(el, state)); reverseNotes(discussion.notes).find((el) => isLastNote(el, state));
export const unresolvedDiscussionsCount = state => state.unresolvedDiscussionsCount; export const unresolvedDiscussionsCount = (state) => state.unresolvedDiscussionsCount;
export const resolvableDiscussionsCount = state => state.resolvableDiscussionsCount; export const resolvableDiscussionsCount = (state) => state.resolvableDiscussionsCount;
export const showJumpToNextDiscussion = (state, getters) => (mode = 'discussion') => { export const showJumpToNextDiscussion = (state, getters) => (mode = 'discussion') => {
const orderedDiffs = const orderedDiffs =
...@@ -109,20 +109,20 @@ export const showJumpToNextDiscussion = (state, getters) => (mode = 'discussion' ...@@ -109,20 +109,20 @@ export const showJumpToNextDiscussion = (state, getters) => (mode = 'discussion'
return orderedDiffs.length > 1; return orderedDiffs.length > 1;
}; };
export const isDiscussionResolved = (state, getters) => discussionId => export const isDiscussionResolved = (state, getters) => (discussionId) =>
getters.resolvedDiscussionsById[discussionId] !== undefined; getters.resolvedDiscussionsById[discussionId] !== undefined;
export const allResolvableDiscussions = state => export const allResolvableDiscussions = (state) =>
state.discussions.filter(d => !d.individual_note && d.resolvable); state.discussions.filter((d) => !d.individual_note && d.resolvable);
export const resolvedDiscussionsById = state => { export const resolvedDiscussionsById = (state) => {
const map = {}; const map = {};
state.discussions state.discussions
.filter(d => d.resolvable) .filter((d) => d.resolvable)
.forEach(n => { .forEach((n) => {
if (n.notes) { if (n.notes) {
const resolved = n.notes.filter(note => note.resolvable).every(note => note.resolved); const resolved = n.notes.filter((note) => note.resolvable).every((note) => note.resolved);
if (resolved) { if (resolved) {
map[n.id] = n; map[n.id] = n;
...@@ -136,7 +136,7 @@ export const resolvedDiscussionsById = state => { ...@@ -136,7 +136,7 @@ export const resolvedDiscussionsById = state => {
// Gets Discussions IDs ordered by the date of their initial note // Gets Discussions IDs ordered by the date of their initial note
export const unresolvedDiscussionsIdsByDate = (state, getters) => export const unresolvedDiscussionsIdsByDate = (state, getters) =>
getters.allResolvableDiscussions getters.allResolvableDiscussions
.filter(d => !d.resolved) .filter((d) => !d.resolved)
.sort((a, b) => { .sort((a, b) => {
const aDate = new Date(a.notes[0].created_at); const aDate = new Date(a.notes[0].created_at);
const bDate = new Date(b.notes[0].created_at); const bDate = new Date(b.notes[0].created_at);
...@@ -147,7 +147,7 @@ export const unresolvedDiscussionsIdsByDate = (state, getters) => ...@@ -147,7 +147,7 @@ export const unresolvedDiscussionsIdsByDate = (state, getters) =>
return aDate === bDate ? 0 : 1; return aDate === bDate ? 0 : 1;
}) })
.map(d => d.id); .map((d) => d.id);
// Gets Discussions IDs ordered by their position in the diff // Gets Discussions IDs ordered by their position in the diff
// //
...@@ -156,7 +156,7 @@ export const unresolvedDiscussionsIdsByDate = (state, getters) => ...@@ -156,7 +156,7 @@ export const unresolvedDiscussionsIdsByDate = (state, getters) =>
// line numbers. // line numbers.
export const unresolvedDiscussionsIdsByDiff = (state, getters) => export const unresolvedDiscussionsIdsByDiff = (state, getters) =>
getters.allResolvableDiscussions getters.allResolvableDiscussions
.filter(d => !d.resolved && d.active) .filter((d) => !d.resolved && d.active)
.sort((a, b) => { .sort((a, b) => {
if (!a.diff_file || !b.diff_file) { if (!a.diff_file || !b.diff_file) {
return 0; return 0;
...@@ -176,7 +176,7 @@ export const unresolvedDiscussionsIdsByDiff = (state, getters) => ...@@ -176,7 +176,7 @@ export const unresolvedDiscussionsIdsByDiff = (state, getters) =>
? -1 ? -1
: 1; : 1;
}) })
.map(d => d.id); .map((d) => d.id);
export const resolvedDiscussionCount = (state, getters) => { export const resolvedDiscussionCount = (state, getters) => {
const resolvedMap = getters.resolvedDiscussionsById; const resolvedMap = getters.resolvedDiscussionsById;
...@@ -184,16 +184,16 @@ export const resolvedDiscussionCount = (state, getters) => { ...@@ -184,16 +184,16 @@ export const resolvedDiscussionCount = (state, getters) => {
return Object.keys(resolvedMap).length; return Object.keys(resolvedMap).length;
}; };
export const discussionTabCounter = state => export const discussionTabCounter = (state) =>
state.discussions.reduce( state.discussions.reduce(
(acc, discussion) => (acc, discussion) =>
acc + discussion.notes.filter(note => !note.system && !note.placeholder).length, acc + discussion.notes.filter((note) => !note.system && !note.placeholder).length,
0, 0,
); );
// Returns the list of discussion IDs ordered according to given parameter // Returns the list of discussion IDs ordered according to given parameter
// @param {Boolean} diffOrder - is ordered by diff? // @param {Boolean} diffOrder - is ordered by diff?
export const unresolvedDiscussionsIdsOrdered = (state, getters) => diffOrder => { export const unresolvedDiscussionsIdsOrdered = (state, getters) => (diffOrder) => {
if (diffOrder) { if (diffOrder) {
return getters.unresolvedDiscussionsIdsByDiff; return getters.unresolvedDiscussionsIdsByDiff;
} }
...@@ -241,17 +241,17 @@ export const previousUnresolvedDiscussionId = (state, getters) => (discussionId, ...@@ -241,17 +241,17 @@ export const previousUnresolvedDiscussionId = (state, getters) => (discussionId,
getters.findUnresolvedDiscussionIdNeighbor({ discussionId, diffOrder, step: -1 }); getters.findUnresolvedDiscussionIdNeighbor({ discussionId, diffOrder, step: -1 });
// @param {Boolean} diffOrder - is ordered by diff? // @param {Boolean} diffOrder - is ordered by diff?
export const firstUnresolvedDiscussionId = (state, getters) => diffOrder => { export const firstUnresolvedDiscussionId = (state, getters) => (diffOrder) => {
if (diffOrder) { if (diffOrder) {
return getters.unresolvedDiscussionsIdsByDiff[0]; return getters.unresolvedDiscussionsIdsByDiff[0];
} }
return getters.unresolvedDiscussionsIdsByDate[0]; return getters.unresolvedDiscussionsIdsByDate[0];
}; };
export const getDiscussion = state => discussionId => export const getDiscussion = (state) => (discussionId) =>
state.discussions.find(discussion => discussion.id === discussionId); state.discussions.find((discussion) => discussion.id === discussionId);
export const commentsDisabled = state => state.commentsDisabled; export const commentsDisabled = (state) => state.commentsDisabled;
export const suggestionsCount = (state, getters) => export const suggestionsCount = (state, getters) =>
Object.values(getters.notesById).filter(n => n.suggestions.length).length; Object.values(getters.notesById).filter((n) => n.suggestions.length).length;
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
[types.ADD_NEW_NOTE](state, data) { [types.ADD_NEW_NOTE](state, data) {
const note = data.discussion ? data.discussion.notes[0] : data; const note = data.discussion ? data.discussion.notes[0] : data;
const { discussion_id, type } = note; const { discussion_id, type } = note;
const [exists] = state.discussions.filter(n => n.id === note.discussion_id); const [exists] = state.discussions.filter((n) => n.id === note.discussion_id);
const isDiscussion = type === constants.DISCUSSION_NOTE || type === constants.DIFF_NOTE; const isDiscussion = type === constants.DISCUSSION_NOTE || type === constants.DIFF_NOTE;
if (!exists) { if (!exists) {
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
// To support legacy notes, should be very rare case. // To support legacy notes, should be very rare case.
if (discussion.individual_note && discussion.notes.length > 1) { if (discussion.individual_note && discussion.notes.length > 1) {
discussion.notes.forEach(n => { discussion.notes.forEach((n) => {
acc.push({ acc.push({
...discussion, ...discussion,
...diffData, ...diffData,
...@@ -183,7 +183,7 @@ export default { ...@@ -183,7 +183,7 @@ export default {
const { id, name, username } = state.userData; const { id, name, username } = state.userData;
const hasEmojiAwardedByCurrentUser = note.award_emoji.filter( const hasEmojiAwardedByCurrentUser = note.award_emoji.filter(
emoji => `${emoji.name}` === `${data.awardName}` && emoji.user.id === id, (emoji) => `${emoji.name}` === `${data.awardName}` && emoji.user.id === id,
); );
if (hasEmojiAwardedByCurrentUser.length) { if (hasEmojiAwardedByCurrentUser.length) {
...@@ -206,7 +206,7 @@ export default { ...@@ -206,7 +206,7 @@ export default {
[types.SET_EXPAND_DISCUSSIONS](state, { discussionIds, expanded }) { [types.SET_EXPAND_DISCUSSIONS](state, { discussionIds, expanded }) {
if (discussionIds?.length) { if (discussionIds?.length) {
discussionIds.forEach(discussionId => { discussionIds.forEach((discussionId) => {
const discussion = utils.findNoteObjectById(state.discussions, discussionId); const discussion = utils.findNoteObjectById(state.discussions, discussionId);
Object.assign(discussion, { expanded }); Object.assign(discussion, { expanded });
}); });
...@@ -236,7 +236,7 @@ export default { ...@@ -236,7 +236,7 @@ export default {
const noteObj = utils.findNoteObjectById(state.discussions, discussionId); const noteObj = utils.findNoteObjectById(state.discussions, discussionId);
const comment = utils.findNoteObjectById(noteObj.notes, noteId); const comment = utils.findNoteObjectById(noteObj.notes, noteId);
comment.suggestions = comment.suggestions.map(suggestion => ({ comment.suggestions = comment.suggestions.map((suggestion) => ({
...suggestion, ...suggestion,
applied: suggestion.applied || suggestion.id === suggestionId, applied: suggestion.applied || suggestion.id === suggestionId,
appliable: false, appliable: false,
...@@ -244,13 +244,13 @@ export default { ...@@ -244,13 +244,13 @@ export default {
}, },
[types.SET_APPLYING_BATCH_STATE](state, isApplyingBatch) { [types.SET_APPLYING_BATCH_STATE](state, isApplyingBatch) {
state.batchSuggestionsInfo.forEach(suggestionInfo => { state.batchSuggestionsInfo.forEach((suggestionInfo) => {
const { discussionId, noteId, suggestionId } = suggestionInfo; const { discussionId, noteId, suggestionId } = suggestionInfo;
const noteObj = utils.findNoteObjectById(state.discussions, discussionId); const noteObj = utils.findNoteObjectById(state.discussions, discussionId);
const comment = utils.findNoteObjectById(noteObj.notes, noteId); const comment = utils.findNoteObjectById(noteObj.notes, noteId);
comment.suggestions = comment.suggestions.map(suggestion => ({ comment.suggestions = comment.suggestions.map((suggestion) => ({
...suggestion, ...suggestion,
is_applying_batch: suggestion.id === suggestionId && isApplyingBatch, is_applying_batch: suggestion.id === suggestionId && isApplyingBatch,
})); }));
...@@ -278,7 +278,7 @@ export default { ...@@ -278,7 +278,7 @@ export default {
[types.UPDATE_DISCUSSION](state, noteData) { [types.UPDATE_DISCUSSION](state, noteData) {
const note = noteData; const note = noteData;
const selectedDiscussion = state.discussions.find(disc => disc.id === note.id); const selectedDiscussion = state.discussions.find((disc) => disc.id === note.id);
note.expanded = true; // override expand flag to prevent collapse note.expanded = true; // override expand flag to prevent collapse
if (note.diff_file) { if (note.diff_file) {
Object.assign(note, { Object.assign(note, {
...@@ -289,7 +289,7 @@ export default { ...@@ -289,7 +289,7 @@ export default {
}, },
[types.UPDATE_DISCUSSION_POSITION](state, { discussionId, position }) { [types.UPDATE_DISCUSSION_POSITION](state, { discussionId, position }) {
const selectedDiscussion = state.discussions.find(disc => disc.id === discussionId); const selectedDiscussion = state.discussions.find((disc) => disc.id === discussionId);
if (selectedDiscussion) Object.assign(selectedDiscussion.position, { ...position }); if (selectedDiscussion) Object.assign(selectedDiscussion.position, { ...position });
}, },
...@@ -341,13 +341,13 @@ export default { ...@@ -341,13 +341,13 @@ export default {
}, },
[types.UPDATE_RESOLVABLE_DISCUSSIONS_COUNTS](state) { [types.UPDATE_RESOLVABLE_DISCUSSIONS_COUNTS](state) {
state.resolvableDiscussionsCount = state.discussions.filter( state.resolvableDiscussionsCount = state.discussions.filter(
discussion => !discussion.individual_note && discussion.resolvable, (discussion) => !discussion.individual_note && discussion.resolvable,
).length; ).length;
state.unresolvedDiscussionsCount = state.discussions.filter( state.unresolvedDiscussionsCount = state.discussions.filter(
discussion => (discussion) =>
!discussion.individual_note && !discussion.individual_note &&
discussion.resolvable && discussion.resolvable &&
discussion.notes.some(note => note.resolvable && !note.resolved), discussion.notes.some((note) => note.resolvable && !note.resolved),
).length; ).length;
}, },
......
...@@ -6,13 +6,13 @@ import createGqClient, { fetchPolicies } from '~/lib/graphql'; ...@@ -6,13 +6,13 @@ import createGqClient, { fetchPolicies } from '~/lib/graphql';
// factory function because global flag makes RegExp stateful // factory function because global flag makes RegExp stateful
const createQuickActionsRegex = () => /^\/\w+.*$/gm; const createQuickActionsRegex = () => /^\/\w+.*$/gm;
export const findNoteObjectById = (notes, id) => notes.filter(n => n.id === id)[0]; export const findNoteObjectById = (notes, id) => notes.filter((n) => n.id === id)[0];
export const getQuickActionText = note => { export const getQuickActionText = (note) => {
let text = __('Applying command'); let text = __('Applying command');
const quickActions = AjaxCache.get(gl.GfmAutoComplete.dataSources.commands) || []; const quickActions = AjaxCache.get(gl.GfmAutoComplete.dataSources.commands) || [];
const executedCommands = quickActions.filter(command => { const executedCommands = quickActions.filter((command) => {
const commandRegex = new RegExp(`/${command.name}`); const commandRegex = new RegExp(`/${command.name}`);
return commandRegex.test(note); return commandRegex.test(note);
}); });
...@@ -29,12 +29,12 @@ export const getQuickActionText = note => { ...@@ -29,12 +29,12 @@ export const getQuickActionText = note => {
return text; return text;
}; };
export const hasQuickActions = note => createQuickActionsRegex().test(note); export const hasQuickActions = (note) => createQuickActionsRegex().test(note);
export const stripQuickActions = note => note.replace(createQuickActionsRegex(), '').trim(); export const stripQuickActions = (note) => note.replace(createQuickActionsRegex(), '').trim();
export const prepareDiffLines = diffLines => export const prepareDiffLines = (diffLines) =>
diffLines.map(line => ({ ...trimFirstCharOfLineContent(line) })); diffLines.map((line) => ({ ...trimFirstCharOfLineContent(line) }));
export const gqClient = createGqClient( export const gqClient = createGqClient(
{}, {},
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Tracks snowplow event when User toggles timeline view * Tracks snowplow event when User toggles timeline view
* @param {Boolean} enabled that will be send as a property for the event * @param {Boolean} enabled that will be send as a property for the event
*/ */
export const trackToggleTimelineView = enabled => ({ export const trackToggleTimelineView = (enabled) => ({
category: 'Incident Management', category: 'Incident Management',
action: 'toggle_incident_comments_into_timeline_view', action: 'toggle_incident_comments_into_timeline_view',
label: 'Status', label: 'Status',
......
...@@ -23,7 +23,7 @@ export default function notificationsDropdown() { ...@@ -23,7 +23,7 @@ export default function notificationsDropdown() {
Rails.fire(form[0], 'submit'); Rails.fire(form[0], 'submit');
}); });
$(document).on('ajax:success', '.notification-form', e => { $(document).on('ajax:success', '.notification-form', (e) => {
const data = e.detail[0]; const data = e.detail[0];
if (data.saved) { if (data.saved) {
......
...@@ -57,7 +57,7 @@ const showPopover = (el, path, footer, options) => { ...@@ -57,7 +57,7 @@ const showPopover = (el, path, footer, options) => {
.popover('show'); .popover('show');
// The previous popover actions have been taken, don't show those popovers anymore. // The previous popover actions have been taken, don't show those popovers anymore.
Object.keys(settings).forEach(pathSetting => { Object.keys(settings).forEach((pathSetting) => {
if (path !== pathSetting) { if (path !== pathSetting) {
settings[pathSetting] = false; settings[pathSetting] = false;
} else { } else {
...@@ -71,7 +71,7 @@ const showPopover = (el, path, footer, options) => { ...@@ -71,7 +71,7 @@ const showPopover = (el, path, footer, options) => {
} }
}; };
export const showLearnGitLabGroupItemPopover = id => { export const showLearnGitLabGroupItemPopover = (id) => {
const el = document.querySelector(`#group-${id} .group-text a`); const el = document.querySelector(`#group-${id} .group-text a`);
if (!el) return; if (!el) return;
......
...@@ -21,7 +21,7 @@ export const saveChanges = ({ state, dispatch }) => ...@@ -21,7 +21,7 @@ export const saveChanges = ({ state, dispatch }) =>
}, },
}) })
.then(() => dispatch('receiveSaveChangesSuccess')) .then(() => dispatch('receiveSaveChangesSuccess'))
.catch(error => dispatch('receiveSaveChangesError', error)); .catch((error) => dispatch('receiveSaveChangesError', error));
export const receiveSaveChangesSuccess = () => { export const receiveSaveChangesSuccess = () => {
/** /**
......
...@@ -6,7 +6,7 @@ import mutations from './mutations'; ...@@ -6,7 +6,7 @@ import mutations from './mutations';
Vue.use(Vuex); Vue.use(Vuex);
export const createStore = initialState => export const createStore = (initialState) =>
new Vuex.Store({ new Vuex.Store({
state: createState(initialState), state: createState(initialState),
actions, actions,
......
...@@ -25,14 +25,14 @@ export default { ...@@ -25,14 +25,14 @@ export default {
}, },
computed: { computed: {
filesTableRows() { filesTableRows() {
return this.packageFiles.map(pf => ({ return this.packageFiles.map((pf) => ({
...pf, ...pf,
size: this.formatSize(pf.size), size: this.formatSize(pf.size),
pipeline: last(pf.pipelines), pipeline: last(pf.pipelines),
})); }));
}, },
showCommitColumn() { showCommitColumn() {
return this.filesTableRows.some(row => Boolean(row.pipeline?.id)); return this.filesTableRows.some((row) => Boolean(row.pipeline?.id));
}, },
filesTableHeaderFields() { filesTableHeaderFields() {
return [ return [
...@@ -55,7 +55,7 @@ export default { ...@@ -55,7 +55,7 @@ export default {
label: __('Created'), label: __('Created'),
class: 'gl-text-right', class: 'gl-text-right',
}, },
].filter(c => !c.hide); ].filter((c) => !c.hide);
}, },
}, },
methods: { methods: {
......
...@@ -24,10 +24,10 @@ export default { ...@@ -24,10 +24,10 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
perPage: state => state.pagination.perPage, perPage: (state) => state.pagination.perPage,
totalItems: state => state.pagination.total, totalItems: (state) => state.pagination.total,
page: state => state.pagination.page, page: (state) => state.pagination.page,
isGroupPage: state => state.config.isGroupPage, isGroupPage: (state) => state.config.isGroupPage,
isLoading: 'isLoading', isLoading: 'isLoading',
}), }),
...mapGetters({ list: 'getList' }), ...mapGetters({ list: 'getList' }),
......
...@@ -25,12 +25,12 @@ export default { ...@@ -25,12 +25,12 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
emptyListIllustration: state => state.config.emptyListIllustration, emptyListIllustration: (state) => state.config.emptyListIllustration,
emptyListHelpUrl: state => state.config.emptyListHelpUrl, emptyListHelpUrl: (state) => state.config.emptyListHelpUrl,
filterQuery: state => state.filterQuery, filterQuery: (state) => state.filterQuery,
selectedType: state => state.selectedType, selectedType: (state) => state.selectedType,
packageHelpUrl: state => state.config.packageHelpUrl, packageHelpUrl: (state) => state.config.packageHelpUrl,
packagesCount: state => state.pagination?.total, packagesCount: (state) => state.pagination?.total,
}), }),
tabsToRender() { tabsToRender() {
return PACKAGE_REGISTRY_TABS; return PACKAGE_REGISTRY_TABS;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment