Commit 888002a6 authored by Lukas Eipert's avatar Lukas Eipert

Run prettier on 30 files: 3 of 8

Mandatory not to break master. Automatically created with prettier.
parent c152d514
...@@ -200,8 +200,9 @@ export default class AvailableDropdownMappings { ...@@ -200,8 +200,9 @@ export default class AvailableDropdownMappings {
} }
getMergeRequestTargetBranchesEndpoint() { getMergeRequestTargetBranchesEndpoint() {
const endpoint = `${gon.relative_url_root || const endpoint = `${
''}/autocomplete/merge_request_target_branches.json`; gon.relative_url_root || ''
}/autocomplete/merge_request_target_branches.json`;
const params = { const params = {
group_id: this.getGroupId(), group_id: this.getGroupId(),
......
...@@ -193,7 +193,8 @@ export default class FilteredSearchVisualTokens { ...@@ -193,7 +193,8 @@ export default class FilteredSearchVisualTokens {
}); });
} else if ( } else if (
!isLastVisualTokenValid && !isLastVisualTokenValid &&
(lastVisualToken && !lastVisualToken.querySelector('.operator')) lastVisualToken &&
!lastVisualToken.querySelector('.operator')
) { ) {
const tokensContainer = FilteredSearchContainer.container.querySelector('.tokens-container'); const tokensContainer = FilteredSearchContainer.container.querySelector('.tokens-container');
tokensContainer.removeChild(lastVisualToken); tokensContainer.removeChild(lastVisualToken);
......
...@@ -285,10 +285,7 @@ class GfmAutoComplete { ...@@ -285,10 +285,7 @@ class GfmAutoComplete {
...this.getDefaultCallbacks(), ...this.getDefaultCallbacks(),
beforeSave: membersBeforeSave, beforeSave: membersBeforeSave,
matcher(flag, subtext) { matcher(flag, subtext) {
const subtextNodes = subtext const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
.split(/\n+/g)
.pop()
.split(GfmAutoComplete.regexSubtext);
// Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands. // Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands.
command = subtextNodes.find(node => { command = subtextNodes.find(node => {
...@@ -465,10 +462,7 @@ class GfmAutoComplete { ...@@ -465,10 +462,7 @@ class GfmAutoComplete {
})); }));
}, },
matcher(flag, subtext) { matcher(flag, subtext) {
const subtextNodes = subtext const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
.split(/\n+/g)
.pop()
.split(GfmAutoComplete.regexSubtext);
// Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands. // Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands.
command = subtextNodes.find(node => { command = subtextNodes.find(node => {
......
...@@ -108,14 +108,10 @@ export default class GLForm { ...@@ -108,14 +108,10 @@ export default class GLForm {
addEventListeners() { addEventListeners() {
this.textarea.on('focus', function focusTextArea() { this.textarea.on('focus', function focusTextArea() {
$(this) $(this).closest('.md-area').addClass('is-focused');
.closest('.md-area')
.addClass('is-focused');
}); });
this.textarea.on('blur', function blurTextArea() { this.textarea.on('blur', function blurTextArea() {
$(this) $(this).closest('.md-area').removeClass('is-focused');
.closest('.md-area')
.removeClass('is-focused');
}); });
} }
......
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
/> />
<div <div
:class="{ 'd-sm-flex': !group.isChildrenLoading }" :class="{ 'd-sm-flex': !group.isChildrenLoading }"
class="avatar-container rect-avatar s32 d-none flex-grow-0 flex-shrink-0 " class="avatar-container rect-avatar s32 d-none flex-grow-0 flex-shrink-0"
> >
<a :href="group.relativePath" class="no-expand"> <a :href="group.relativePath" class="no-expand">
<img <img
......
...@@ -65,10 +65,7 @@ export default class GroupFilterableList extends FilterableList { ...@@ -65,10 +65,7 @@ export default class GroupFilterableList extends FilterableList {
setDefaultFilterOption() { setDefaultFilterOption() {
const defaultOption = $.trim( const defaultOption = $.trim(
this.$dropdown this.$dropdown.find('.dropdown-menu li.js-filter-sort-order a').first().text(),
.find('.dropdown-menu li.js-filter-sort-order a')
.first()
.text(),
); );
this.$dropdown.find('.dropdown-label').text(defaultOption); this.$dropdown.find('.dropdown-label').text(defaultOption);
} }
......
...@@ -31,9 +31,7 @@ export default { ...@@ -31,9 +31,7 @@ export default {
}, },
removeDropdownListeners() { removeDropdownListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
$(this.$refs.dropdown) $(this.$refs.dropdown).off('show.bs.dropdown').off('hide.bs.dropdown');
.off('show.bs.dropdown')
.off('hide.bs.dropdown');
}, },
showDropdown() { showDropdown() {
this.isVisibleDropdown = true; this.isVisibleDropdown = true;
......
...@@ -50,5 +50,10 @@ export function getRulesWithTraversal(filePath, getFileContent) { ...@@ -50,5 +50,10 @@ export function getRulesWithTraversal(filePath, getFileContent) {
return Promise.all( return Promise.all(
editorconfigPaths.map(path => getFileContent(path).then(content => ({ path, content }))), editorconfigPaths.map(path => getFileContent(path).then(content => ({ path, content }))),
).then(results => getRulesWithConfigs(filePath, results.filter(x => x.content))); ).then(results =>
getRulesWithConfigs(
filePath,
results.filter(x => x.content),
),
);
} }
...@@ -11,7 +11,11 @@ const conf = { ...@@ -11,7 +11,11 @@ const conf = {
lineComment: '//', lineComment: '//',
blockComment: ['/*', '*/'], blockComment: ['/*', '*/'],
}, },
brackets: [['{', '}'], ['[', ']'], ['(', ')']], brackets: [
['{', '}'],
['[', ']'],
['(', ')'],
],
autoClosingPairs: [ autoClosingPairs: [
{ open: '{', close: '}' }, { open: '{', close: '}' },
{ open: '[', close: ']' }, { open: '[', close: ']' },
...@@ -161,7 +165,11 @@ const language = { ...@@ -161,7 +165,11 @@ const language = {
[/\/\/.*$/, 'comment'], [/\/\/.*$/, 'comment'],
[/#.*$/, 'comment'], [/#.*$/, 'comment'],
], ],
comment: [[/[^\/*]+/, 'comment'], [/\*\//, 'comment', '@pop'], [/[\/*]/, 'comment']], comment: [
[/[^\/*]+/, 'comment'],
[/\*\//, 'comment', '@pop'],
[/[\/*]/, 'comment'],
],
string: [ string: [
[/\$\{/, { token: 'delimiter', next: '@stringExpression' }], [/\$\{/, { token: 'delimiter', next: '@stringExpression' }],
[/[^\\"\$]+/, 'string'], [/[^\\"\$]+/, 'string'],
......
...@@ -37,7 +37,13 @@ const conf = { ...@@ -37,7 +37,13 @@ const conf = {
blockComment: ['{{!--', '--}}'], blockComment: ['{{!--', '--}}'],
}, },
brackets: [['<!--', '-->'], ['<', '>'], ['{{', '}}'], ['{', '}'], ['(', ')']], brackets: [
['<!--', '-->'],
['<', '>'],
['{{', '}}'],
['{', '}'],
['(', ')'],
],
autoClosingPairs: [ autoClosingPairs: [
{ open: '{', close: '}' }, { open: '{', close: '}' },
......
...@@ -254,12 +254,7 @@ export function extractMarkdownImagesFromEntries(mdFile, entries) { ...@@ -254,12 +254,7 @@ export function extractMarkdownImagesFromEntries(mdFile, entries) {
const imageContent = entries[imagePath]?.content || entries[imagePath]?.raw; const imageContent = entries[imagePath]?.content || entries[imagePath]?.raw;
if (!isAbsolute(path) && imageContent) { if (!isAbsolute(path) && imageContent) {
const ext = path.includes('.') const ext = path.includes('.') ? path.split('.').pop().trim() : 'jpeg';
? path
.split('.')
.pop()
.trim()
: 'jpeg';
const src = `data:image/${ext};base64,${imageContent}`; const src = `data:image/${ext};base64,${imageContent}`;
i += 1; i += 1;
const key = `{{${prefix}${i}}}`; const key = `{{${prefix}${i}}}`;
......
...@@ -154,12 +154,7 @@ export function getFileEOL(content = '') { ...@@ -154,12 +154,7 @@ export function getFileEOL(content = '') {
*/ */
export function addNumericSuffix(filename, randomize = false) { export function addNumericSuffix(filename, randomize = false) {
return filename.replace(/([ _-]?)(\d*)(\..+?$|$)/, (_, before, number, after) => { return filename.replace(/([ _-]?)(\d*)(\..+?$|$)/, (_, before, number, after) => {
const n = randomize const n = randomize ? Math.random().toString().substring(2, 7).slice(-5) : Number(number) + 1;
? Math.random()
.toString()
.substring(2, 7)
.slice(-5)
: Number(number) + 1;
return `${before || '-'}${n}${after}`; return `${before || '-'}${n}${after}`;
}); });
} }
......
...@@ -265,9 +265,7 @@ export default { ...@@ -265,9 +265,7 @@ export default {
if (field?.sortKey) { if (field?.sortKey) {
sortKey = field.sortKey; sortKey = field.sortKey;
} else { } else {
sortKey = convertToSnakeCase(sortBy) sortKey = convertToSnakeCase(sortBy).replace(/_.*/, '').toUpperCase();
.replace(/_.*/, '')
.toUpperCase();
} }
this.pagination = initialPaginationState; this.pagination = initialPaginationState;
......
...@@ -195,7 +195,7 @@ export default { ...@@ -195,7 +195,7 @@ export default {
<div class="gl-mt-2"> <div class="gl-mt-2">
<gl-sprintf :message="$options.labels.readMoreText"> <gl-sprintf :message="$options.labels.readMoreText">
<template #link="{content}"> <template #link="{ content }">
<gl-link :href="helpLink" target="_blank">{{ content }}</gl-link> <gl-link :href="helpLink" target="_blank">{{ content }}</gl-link>
</template> </template>
</gl-sprintf> </gl-sprintf>
......
...@@ -37,10 +37,7 @@ class AutoWidthDropdownSelect { ...@@ -37,10 +37,7 @@ class AutoWidthDropdownSelect {
// We have to look at the parent because // We have to look at the parent because
// `offsetParent` on a `display: none;` is `null` // `offsetParent` on a `display: none;` is `null`
const offsetParentWidth = $(this) const offsetParentWidth = $(this).parent().offsetParent().width();
.parent()
.offsetParent()
.width();
// Reset any width to let it naturally flow // Reset any width to let it naturally flow
$dropdown.css('width', 'auto'); $dropdown.css('width', 'auto');
if ($dropdown.outerWidth(false) > offsetParentWidth) { if ($dropdown.outerWidth(false) > offsetParentWidth) {
......
...@@ -52,12 +52,12 @@ export default class IssuableForm { ...@@ -52,12 +52,12 @@ export default class IssuableForm {
/* eslint-disable @gitlab/require-i18n-strings */ /* eslint-disable @gitlab/require-i18n-strings */
this.wipRegex = new RegExp( this.wipRegex = new RegExp(
'^\\s*(' + // Line start, then any amount of leading whitespace '^\\s*(' + // Line start, then any amount of leading whitespace
'draft\\s-\\s' + // Draft_-_ where "_" are *exactly* one whitespace 'draft\\s-\\s' + // Draft_-_ where "_" are *exactly* one whitespace
'|\\[(draft|wip)\\]\\s*' + // [Draft] or [WIP] and any following whitespace '|\\[(draft|wip)\\]\\s*' + // [Draft] or [WIP] and any following whitespace
'|(draft|wip):\\s*' + // Draft: or WIP: and any following whitespace '|(draft|wip):\\s*' + // Draft: or WIP: and any following whitespace
'|(draft|wip)\\s+' + // Draft_ or WIP_ where "_" is at least one whitespace '|(draft|wip)\\s+' + // Draft_ or WIP_ where "_" is at least one whitespace
'|\\(draft\\)\\s*' + // (Draft) and any following whitespace '|\\(draft\\)\\s*' + // (Draft) and any following whitespace
')+' + // At least one repeated match of the preceding parenthetical ')+' + // At least one repeated match of the preceding parenthetical
'\\s*', // Any amount of trailing whitespace '\\s*', // Any amount of trailing whitespace
'i', // Match any case(s) 'i', // Match any case(s)
); );
......
...@@ -21,9 +21,7 @@ export default class IssuableIndex { ...@@ -21,9 +21,7 @@ export default class IssuableIndex {
axios axios
.put($resetToken.attr('href')) .put($resetToken.attr('href'))
.then(({ data }) => { .then(({ data }) => {
$('#issuable_email') $('#issuable_email').val(data.new_address).focus();
.val(data.new_address)
.focus();
$resetToken.text(s__('EmailToken|reset it')); $resetToken.text(s__('EmailToken|reset it'));
}) })
......
...@@ -141,8 +141,7 @@ export default { ...@@ -141,8 +141,7 @@ export default {
:data-supports-quick-actions="enableAutocomplete" :data-supports-quick-actions="enableAutocomplete"
:aria-label="__('Description')" :aria-label="__('Description')"
:placeholder="__('Write a comment or drag your files here…')" :placeholder="__('Write a comment or drag your files here…')"
class="note-textarea js-gfm-input js-autosize markdown-area class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea"
qa-description-textarea"
dir="auto" dir="auto"
@keydown="handleKeydown($event, 'description')" @keydown="handleKeydown($event, 'description')"
></textarea> ></textarea>
......
...@@ -5,7 +5,7 @@ import App from './components/app.vue'; ...@@ -5,7 +5,7 @@ import App from './components/app.vue';
Vue.use(VueApollo); Vue.use(VueApollo);
export default function() { export default function () {
const el = document.getElementById('js-suggestions'); const el = document.getElementById('js-suggestions');
const issueTitle = document.getElementById('issue_title'); const issueTitle = document.getElementById('issue_title');
const { projectPath } = el.dataset; const { projectPath } = el.dataset;
......
...@@ -54,11 +54,7 @@ export default class Issue { ...@@ -54,11 +54,7 @@ export default class Issue {
$(document).trigger('issuable:change', isClosed); $(document).trigger('issuable:change', isClosed);
let numProjectIssues = Number( let numProjectIssues = Number(
projectIssuesCounter projectIssuesCounter.first().text().trim().replace(/[^\d]/, ''),
.first()
.text()
.trim()
.replace(/[^\d]/, ''),
); );
numProjectIssues = isClosed ? numProjectIssues - 1 : numProjectIssues + 1; numProjectIssues = isClosed ? numProjectIssues - 1 : numProjectIssues + 1;
projectIssuesCounter.text(addDelimiter(numProjectIssues)); projectIssuesCounter.text(addDelimiter(numProjectIssues));
......
...@@ -53,8 +53,7 @@ export default { ...@@ -53,8 +53,7 @@ export default {
id="issue-description" id="issue-description"
ref="textarea" ref="textarea"
v-model="formState.description" v-model="formState.description"
class="note-textarea js-gfm-input js-autosize markdown-area class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea"
qa-description-textarea"
dir="auto" dir="auto"
:data-supports-quick-actions="!glFeatures.tributeAutocomplete" :data-supports-quick-actions="!glFeatures.tributeAutocomplete"
:aria-label="__('Description')" :aria-label="__('Description')"
......
...@@ -93,7 +93,10 @@ export default { ...@@ -93,7 +93,10 @@ export default {
this.secretValue = ''; this.secretValue = '';
}, },
deleteVariable(id) { deleteVariable(id) {
this.variables.splice(this.variables.findIndex(el => el.id === id), 1); this.variables.splice(
this.variables.findIndex(el => el.id === id),
1,
);
}, },
}, },
}; };
......
...@@ -135,7 +135,7 @@ export default class LabelManager { ...@@ -135,7 +135,7 @@ export default class LabelManager {
getSortedLabelsIds() { getSortedLabelsIds() {
const sortedIds = []; const sortedIds = [];
this.prioritizedLabels.find('> li').each(function() { this.prioritizedLabels.find('> li').each(function () {
const id = $(this).data('id'); const id = $(this).data('id');
if (id) { if (id) {
......
...@@ -49,7 +49,7 @@ export default class LabelsSelect { ...@@ -49,7 +49,7 @@ export default class LabelsSelect {
const fieldName = $dropdown.data('fieldName'); const fieldName = $dropdown.data('fieldName');
let initialSelected = $selectbox let initialSelected = $selectbox
.find(`input[name="${$dropdown.data('fieldName')}"]`) .find(`input[name="${$dropdown.data('fieldName')}"]`)
.map(function() { .map(function () {
return this.value; return this.value;
}) })
.get(); .get();
...@@ -64,11 +64,11 @@ export default class LabelsSelect { ...@@ -64,11 +64,11 @@ export default class LabelsSelect {
); );
} }
const saveLabelData = function() { const saveLabelData = function () {
const selected = $dropdown const selected = $dropdown
.closest('.selectbox') .closest('.selectbox')
.find(`input[name='${fieldName}']`) .find(`input[name='${fieldName}']`)
.map(function() { .map(function () {
return this.value; return this.value;
}) })
.get(); .get();
...@@ -210,9 +210,7 @@ export default class LabelsSelect { ...@@ -210,9 +210,7 @@ export default class LabelsSelect {
} }
} else { } else {
if (this.id(label)) { if (this.id(label)) {
const dropdownValue = this.id(label) const dropdownValue = this.id(label).toString().replace(/'/g, "\\'");
.toString()
.replace(/'/g, "\\'");
if ( if (
$form.find( $form.find(
...@@ -346,10 +344,7 @@ export default class LabelsSelect { ...@@ -346,10 +344,7 @@ export default class LabelsSelect {
const isMRIndex = page === 'projects:merge_requests:index'; const isMRIndex = page === 'projects:merge_requests:index';
if ($dropdown.parent().find('.is-active:not(.dropdown-clear-active)').length) { if ($dropdown.parent().find('.is-active:not(.dropdown-clear-active)').length) {
$dropdown $dropdown.parent().find('.dropdown-clear-active').removeClass('is-active');
.parent()
.find('.dropdown-clear-active')
.removeClass('is-active');
} }
if ($dropdown.hasClass('js-issuable-form-dropdown')) { if ($dropdown.hasClass('js-issuable-form-dropdown')) {
...@@ -559,7 +554,7 @@ export default class LabelsSelect { ...@@ -559,7 +554,7 @@ export default class LabelsSelect {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
setOriginalDropdownData($container, $dropdown) { setOriginalDropdownData($container, $dropdown) {
const labels = []; const labels = [];
$container.find('[name="label_name[]"]').map(function() { $container.find('[name="label_name[]"]').map(function () {
return labels.push(this.value); return labels.push(this.value);
}); });
$dropdown.data('marked', labels); $dropdown.data('marked', labels);
......
...@@ -68,7 +68,7 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa ...@@ -68,7 +68,7 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa
closestSubmit.disable(); closestSubmit.disable();
} }
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
return field.on(eventName, function() { return field.on(eventName, function () {
if (rstrip($(this).val()) === '') { if (rstrip($(this).val()) === '') {
return closestSubmit.disable(); return closestSubmit.disable();
} }
......
...@@ -14,18 +14,12 @@ function addBlockTags(blockTag, selected) { ...@@ -14,18 +14,12 @@ function addBlockTags(blockTag, selected) {
} }
function lineBefore(text, textarea) { function lineBefore(text, textarea) {
const split = text const split = text.substring(0, textarea.selectionStart).trim().split('\n');
.substring(0, textarea.selectionStart)
.trim()
.split('\n');
return split[split.length - 1]; return split[split.length - 1];
} }
function lineAfter(text, textarea) { function lineAfter(text, textarea) {
return text return text.substring(textarea.selectionEnd).trim().split('\n')[0];
.substring(textarea.selectionEnd)
.trim()
.split('\n')[0];
} }
function convertMonacoSelectionToAceFormat(sel) { function convertMonacoSelectionToAceFormat(sel) {
...@@ -342,7 +336,7 @@ export function addMarkdownListeners(form) { ...@@ -342,7 +336,7 @@ export function addMarkdownListeners(form) {
// eslint-disable-next-line @gitlab/no-global-event-off // eslint-disable-next-line @gitlab/no-global-event-off
const $allToolbarBtns = $('.js-md', form) const $allToolbarBtns = $('.js-md', form)
.off('click') .off('click')
.on('click', function() { .on('click', function () {
const $toolbarBtn = $(this); const $toolbarBtn = $(this);
return updateTextForToolbarBtn($toolbarBtn); return updateTextForToolbarBtn($toolbarBtn);
......
...@@ -32,7 +32,7 @@ import 'vendor/jquery.scrollTo'; ...@@ -32,7 +32,7 @@ import 'vendor/jquery.scrollTo';
// </div> // </div>
// //
const LineHighlighter = function(options = {}) { const LineHighlighter = function (options = {}) {
options.highlightLineClass = options.highlightLineClass || 'hll'; options.highlightLineClass = options.highlightLineClass || 'hll';
options.fileHolderSelector = options.fileHolderSelector || '.file-holder'; options.fileHolderSelector = options.fileHolderSelector || '.file-holder';
options.scrollFileHolder = options.scrollFileHolder || false; options.scrollFileHolder = options.scrollFileHolder || false;
...@@ -50,7 +50,7 @@ const LineHighlighter = function(options = {}) { ...@@ -50,7 +50,7 @@ const LineHighlighter = function(options = {}) {
this.highlightHash(); this.highlightHash();
}; };
LineHighlighter.prototype.bindEvents = function() { LineHighlighter.prototype.bindEvents = function () {
const $fileHolder = $(this.options.fileHolderSelector); const $fileHolder = $(this.options.fileHolderSelector);
$fileHolder.on('click', 'a[data-line-number]', this.clickHandler); $fileHolder.on('click', 'a[data-line-number]', this.clickHandler);
...@@ -58,7 +58,7 @@ LineHighlighter.prototype.bindEvents = function() { ...@@ -58,7 +58,7 @@ LineHighlighter.prototype.bindEvents = function() {
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) {
let range; let range;
if (newHash && typeof newHash === 'string') this._hash = newHash; if (newHash && typeof newHash === 'string') this._hash = newHash;
...@@ -83,13 +83,11 @@ LineHighlighter.prototype.highlightHash = function(newHash) { ...@@ -83,13 +83,11 @@ LineHighlighter.prototype.highlightHash = function(newHash) {
} }
}; };
LineHighlighter.prototype.clickHandler = function(event) { LineHighlighter.prototype.clickHandler = function (event) {
let range; let range;
event.preventDefault(); event.preventDefault();
this.clearHighlight(); this.clearHighlight();
const lineNumber = $(event.target) const lineNumber = $(event.target).closest('a').data('lineNumber');
.closest('a')
.data('lineNumber');
const current = this.hashToRange(this._hash); const current = this.hashToRange(this._hash);
if (!(current[0] && event.shiftKey)) { if (!(current[0] && event.shiftKey)) {
// If there's no current selection, or there is but Shift wasn't held, // If there's no current selection, or there is but Shift wasn't held,
...@@ -107,7 +105,7 @@ LineHighlighter.prototype.clickHandler = function(event) { ...@@ -107,7 +105,7 @@ LineHighlighter.prototype.clickHandler = function(event) {
} }
}; };
LineHighlighter.prototype.clearHighlight = function() { LineHighlighter.prototype.clearHighlight = function () {
return $(`.${this.highlightLineClass}`).removeClass(this.highlightLineClass); return $(`.${this.highlightLineClass}`).removeClass(this.highlightLineClass);
}; };
...@@ -122,7 +120,7 @@ LineHighlighter.prototype.clearHighlight = function() { ...@@ -122,7 +120,7 @@ LineHighlighter.prototype.clearHighlight = function() {
// hashToRange('#foo') # => [null, null] // hashToRange('#foo') # => [null, null]
// //
// Returns an Array // Returns an Array
LineHighlighter.prototype.hashToRange = function(hash) { LineHighlighter.prototype.hashToRange = function (hash) {
// ?L(\d+)(?:-(\d+))?$/) // ?L(\d+)(?:-(\d+))?$/)
const matches = hash.match(/^#?L(\d+)(?:-(\d+))?$/); const matches = hash.match(/^#?L(\d+)(?:-(\d+))?$/);
if (matches && matches.length) { if (matches && matches.length) {
...@@ -136,14 +134,14 @@ LineHighlighter.prototype.hashToRange = function(hash) { ...@@ -136,14 +134,14 @@ LineHighlighter.prototype.hashToRange = function(hash) {
// Highlight a single line // Highlight a single line
// //
// lineNumber - Line number to highlight // lineNumber - Line number to highlight
LineHighlighter.prototype.highlightLine = function(lineNumber) { LineHighlighter.prototype.highlightLine = function (lineNumber) {
return $(`#LC${lineNumber}`).addClass(this.highlightLineClass); return $(`#LC${lineNumber}`).addClass(this.highlightLineClass);
}; };
// Highlight all lines within a range // Highlight all lines within a range
// //
// range - Array containing the starting and ending line numbers // range - Array containing the starting and ending line numbers
LineHighlighter.prototype.highlightRange = function(range) { LineHighlighter.prototype.highlightRange = function (range) {
if (range[1]) { if (range[1]) {
const results = []; const results = [];
const ref = range[0] <= range[1] ? range : range.reverse(); const ref = range[0] <= range[1] ? range : range.reverse();
...@@ -158,7 +156,7 @@ LineHighlighter.prototype.highlightRange = function(range) { ...@@ -158,7 +156,7 @@ LineHighlighter.prototype.highlightRange = function(range) {
}; };
// Set the URL hash string // Set the URL hash string
LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) { LineHighlighter.prototype.setHash = function (firstLineNumber, lastLineNumber) {
let hash; let hash;
if (lastLineNumber) { if (lastLineNumber) {
hash = `#L${firstLineNumber}-${lastLineNumber}`; hash = `#L${firstLineNumber}-${lastLineNumber}`;
...@@ -172,7 +170,7 @@ LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) { ...@@ -172,7 +170,7 @@ LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) {
// Make the actual hash change in the browser // Make the actual hash change in the browser
// //
// This method is stubbed in tests. // This method is stubbed in tests.
LineHighlighter.prototype.__setLocationHash__ = function(value) { LineHighlighter.prototype.__setLocationHash__ = function (value) {
return window.history.pushState( return window.history.pushState(
{ {
url: value, url: value,
......
...@@ -246,9 +246,7 @@ export default { ...@@ -246,9 +246,7 @@ export default {
</div>{{trace}} </div>{{trace}}
</code></pre> </code></pre>
</template> </template>
<template #default <template #default><div></div></template>
><div></div
></template>
</gl-infinite-scroll> </gl-infinite-scroll>
<div ref="logFooter" class="py-2 px-3 text-white bg-secondary-900"> <div ref="logFooter" class="py-2 px-3 text-white bg-secondary-900">
...@@ -262,9 +260,7 @@ export default { ...@@ -262,9 +260,7 @@ export default {
> >
<template #fetched>{{ logs.lines.length }}</template> <template #fetched>{{ logs.lines.length }}</template>
</gl-sprintf> </gl-sprintf>
<template v-else> <template v-else> {{ s__('Environments|Currently showing all results.') }}</template>
{{ s__('Environments|Currently showing all results.') }}</template
>
</div> </div>
</div> </div>
</template> </template>
...@@ -53,7 +53,7 @@ window.$ = jQuery; ...@@ -53,7 +53,7 @@ window.$ = jQuery;
jQuery.ajaxSetup({ jQuery.ajaxSetup({
converters: { converters: {
// eslint-disable-next-line @gitlab/require-i18n-strings, func-names // eslint-disable-next-line @gitlab/require-i18n-strings, func-names
'text script': function(text) { 'text script': function (text) {
jQuery.globalEval(text, { nonce: getCspNonceValue() }); jQuery.globalEval(text, { nonce: getCspNonceValue() });
return text; return text;
}, },
...@@ -137,9 +137,7 @@ function deferredInitialisation() { ...@@ -137,9 +137,7 @@ function deferredInitialisation() {
$('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() { $('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() {
tooltips.dispose(this); tooltips.dispose(this);
$(this) $(this).closest('li').addClass('gl-display-none!');
.closest('li')
.addClass('gl-display-none!');
}); });
$('.js-remove-tr').on('ajax:before', function removeTRAjaxBeforeCallback() { $('.js-remove-tr').on('ajax:before', function removeTRAjaxBeforeCallback() {
...@@ -147,9 +145,7 @@ function deferredInitialisation() { ...@@ -147,9 +145,7 @@ function deferredInitialisation() {
}); });
$('.js-remove-tr').on('ajax:success', function removeTRAjaxSuccessCallback() { $('.js-remove-tr').on('ajax:success', function removeTRAjaxSuccessCallback() {
$(this) $(this).closest('tr').addClass('gl-display-none!');
.closest('tr')
.addClass('gl-display-none!');
}); });
const glTooltipDelay = localStorage.getItem('gl-tooltip-delay'); const glTooltipDelay = localStorage.getItem('gl-tooltip-delay');
...@@ -278,15 +274,9 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -278,15 +274,9 @@ document.addEventListener('DOMContentLoaded', () => {
$this.toggleClass('active'); $this.toggleClass('active');
if ($this.hasClass('active')) { if ($this.hasClass('active')) {
notesHolders notesHolders.show().find('.hide, .content').show();
.show()
.find('.hide, .content')
.show();
} else { } else {
notesHolders notesHolders.hide().find('.content').hide();
.hide()
.find('.content')
.hide();
} }
$(document).trigger('toggle.comments'); $(document).trigger('toggle.comments');
......
...@@ -41,9 +41,7 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d ...@@ -41,9 +41,7 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d
inputs.next('.js-clear-input').on('click', function clicked(event) { inputs.next('.js-clear-input').on('click', function clicked(event) {
event.preventDefault(); event.preventDefault();
const input = $(this) const input = $(this).closest('.clearable-input').find(selector);
.closest('.clearable-input')
.find(selector);
const calendar = input.data('pikaday'); const calendar = input.data('pikaday');
calendar.setDate(null); calendar.setDate(null);
......
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