Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-12-23 12:10:26 +00:00
parent 65fdda8d39
commit 5c9f6c66fa
429 changed files with 2154 additions and 2914 deletions

View file

@ -1,5 +1,6 @@
{
"printWidth": 100,
"singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "all"
}

View file

@ -36,7 +36,7 @@ export default {
)
"
>
<template #docLink="{content}">
<template #docLink="{ content }">
<gl-link :href="docsLink" target="_blank">{{ content }}</gl-link>
</template>
<template #strong="{ content }"

View file

@ -35,7 +35,7 @@ export default {
)
"
>
<template #docLink="{content}">
<template #docLink="{ content }">
<gl-link :href="docsLink" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>

View file

@ -2,7 +2,7 @@ import Vue from 'vue';
import StatisticsPanelApp from './components/app.vue';
import createStore from './store';
export default function(el) {
export default function (el) {
if (!el) {
return false;
}

View file

@ -2,7 +2,7 @@ import Vue from 'vue';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import AdminUsersApp from './components/app.vue';
export default function(el = document.querySelector('#js-admin-users-app')) {
export default function (el = document.querySelector('#js-admin-users-app')) {
if (!el) {
return false;
}

View file

@ -194,14 +194,20 @@ export default {
projectPath: this.projectPath,
},
})
.then(({ data: { createAlertIssue: { errors, issue } } }) => {
if (errors?.length) {
[this.createIncidentError] = errors;
this.incidentCreationInProgress = false;
} else if (issue) {
visitUrl(this.incidentPath(issue.iid));
}
})
.then(
({
data: {
createAlertIssue: { errors, issue },
},
}) => {
if (errors?.length) {
[this.createIncidentError] = errors;
this.incidentCreationInProgress = false;
} else if (issue) {
visitUrl(this.incidentPath(issue.iid));
}
},
)
.catch(error => {
this.createIncidentError = error;
this.incidentCreationInProgress = false;

View file

@ -192,7 +192,7 @@ export default {
</script>
<template>
<div class="block alert-assignees ">
<div class="block alert-assignees">
<div ref="assignees" class="sidebar-collapsed-icon" @click="$emit('toggle-sidebar')">
<gl-icon name="user" :size="14" />
<gl-loading-icon v-if="isUpdating" />

View file

@ -98,10 +98,7 @@ export class AwardsHandler {
showEmojiMenu($addBtn) {
if ($addBtn.hasClass('js-note-emoji')) {
$addBtn
.closest('.note')
.find('.js-awards-block')
.addClass('current');
$addBtn.closest('.note').find('.js-awards-block').addClass('current');
} else {
$addBtn.closest('.js-awards-block').addClass('current');
}
@ -531,9 +528,7 @@ export class AwardsHandler {
const $search = $('.js-emoji-menu-search');
this.registerEventListener('on', $search, 'input', e => {
const term = $(e.target)
.val()
.trim();
const term = $(e.target).val().trim();
this.searchEmojis(term);
});
@ -556,17 +551,11 @@ export class AwardsHandler {
// Generate a search result block
const h5 = $('<h5 class="emoji-search-title"/>').text('Search results');
const foundEmojis = this.findMatchingEmojiElements(term).show();
const ul = $('<ul>')
.addClass('emoji-menu-list emoji-menu-search')
.append(foundEmojis);
const ul = $('<ul>').addClass('emoji-menu-list emoji-menu-search').append(foundEmojis);
$('.emoji-menu-content ul, .emoji-menu-content h5').hide();
$('.emoji-menu-content')
.append(h5)
.append(ul);
$('.emoji-menu-content').append(h5).append(ul);
} else {
$('.emoji-menu-content')
.children()
.show();
$('.emoji-menu-content').children().show();
}
}

View file

@ -98,9 +98,7 @@ export default {
{{ titleText }}
</span>
<template v-if="showLinePosition">
<template v-if="!glFeatures.multilineComments"
>:{{ linePosition }}</template
>
<template v-if="!glFeatures.multilineComments">:{{ linePosition }}</template>
<template v-else-if="startLineNumber === endLineNumber">
:<span :class="getLineClasses(startLineNumber)">{{ startLineNumber }}</span>
</template>

View file

@ -23,7 +23,7 @@ MarkdownPreview.prototype.emptyMessage = __('Nothing to preview.');
MarkdownPreview.prototype.ajaxCache = {};
MarkdownPreview.prototype.showPreview = function($form) {
MarkdownPreview.prototype.showPreview = function ($form) {
const preview = $form.find('.js-md-preview');
const url = preview.data('url');
if (preview.hasClass('md-preview-loading')) {
@ -60,7 +60,7 @@ MarkdownPreview.prototype.showPreview = function($form) {
}
};
MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) {
MarkdownPreview.prototype.fetchMarkdownPreview = function (text, url, success) {
if (!url) {
return;
}
@ -82,11 +82,11 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) {
.catch(() => flash(__('An error occurred while fetching markdown preview')));
};
MarkdownPreview.prototype.hideReferencedUsers = function($form) {
MarkdownPreview.prototype.hideReferencedUsers = function ($form) {
$form.find('.referenced-users').hide();
};
MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) {
MarkdownPreview.prototype.renderReferencedUsers = function (users, $form) {
const referencedUsers = $form.find('.referenced-users');
if (referencedUsers.length) {
if (users.length >= this.referenceThreshold) {
@ -98,11 +98,11 @@ MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) {
}
};
MarkdownPreview.prototype.hideReferencedCommands = function($form) {
MarkdownPreview.prototype.hideReferencedCommands = function ($form) {
$form.find('.referenced-commands').hide();
};
MarkdownPreview.prototype.renderReferencedCommands = function(commands, $form) {
MarkdownPreview.prototype.renderReferencedCommands = function (commands, $form) {
const referencedCommands = $form.find('.referenced-commands');
if (commands.length > 0) {
referencedCommands.html(commands);
@ -120,7 +120,7 @@ const writeButtonSelector = '.js-md-write-button';
lastTextareaPreviewed = null;
const markdownToolbar = $('.md-header-toolbar');
$.fn.setupMarkdownPreview = function() {
$.fn.setupMarkdownPreview = function () {
const $form = $(this);
$form.find('textarea.markdown-area').on('input', () => {
markdownPreview.hideReferencedUsers($form);
@ -136,14 +136,8 @@ $(document).on('markdown-preview:show', (e, $form) => {
lastTextareaHeight = lastTextareaPreviewed.height();
// toggle tabs
$form
.find(writeButtonSelector)
.parent()
.removeClass('active');
$form
.find(previewButtonSelector)
.parent()
.addClass('active');
$form.find(writeButtonSelector).parent().removeClass('active');
$form.find(previewButtonSelector).parent().addClass('active');
// toggle content
$form.find('.md-write-holder').hide();
@ -163,14 +157,8 @@ $(document).on('markdown-preview:hide', (e, $form) => {
}
// toggle tabs
$form
.find(writeButtonSelector)
.parent()
.addClass('active');
$form
.find(previewButtonSelector)
.parent()
.removeClass('active');
$form.find(writeButtonSelector).parent().addClass('active');
$form.find(previewButtonSelector).parent().removeClass('active');
// toggle content
$form.find('.md-write-holder').show();
@ -194,13 +182,13 @@ $(document).on('markdown-preview:toggle', (e, keyboardEvent) => {
}
});
$(document).on('click', previewButtonSelector, function(e) {
$(document).on('click', previewButtonSelector, function (e) {
e.preventDefault();
const $form = $(this).closest('form');
$(document).triggerHandler('markdown-preview:show', [$form]);
});
$(document).on('click', writeButtonSelector, function(e) {
$(document).on('click', writeButtonSelector, function (e) {
e.preventDefault();
const $form = $(this).closest('form');
$(document).triggerHandler('markdown-preview:hide', [$form]);

View file

@ -98,9 +98,7 @@ export default class Shortcuts {
});
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-shortcuts-modal-trigger')
.off('click')
.on('click', this.onToggleHelp);
$('.js-shortcuts-modal-trigger').off('click').on('click', this.onToggleHelp);
if (shouldDisableShortcuts()) {
disableShortcuts();

View file

@ -43,16 +43,14 @@ export default class BlobFileDropzone {
previewsContainer: '.dropzone-previews',
headers: csrf.headers,
init() {
this.on('processing', function() {
this.on('processing', function () {
this.options.url = form.attr('action');
});
this.on('addedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false);
dropzoneMessage.addClass(HIDDEN_CLASS);
$('.dropzone-alerts')
.html('')
.hide();
$('.dropzone-alerts').html('').hide();
});
this.on('removedfile', () => {
toggleLoading(submitButton, submitButtonLoadingIcon, false);
@ -62,7 +60,7 @@ export default class BlobFileDropzone {
$('#modal-upload-blob').modal('hide');
visitUrl(response.filePath);
});
this.on('maxfilesexceeded', function(file) {
this.on('maxfilesexceeded', function (file) {
dropzoneMessage.addClass(HIDDEN_CLASS);
this.removeFile(file);
});
@ -74,9 +72,7 @@ export default class BlobFileDropzone {
},
// Override behavior of adding error underneath preview
error(file, errorMessage) {
const stripped = $('<div/>')
.html(errorMessage)
.text();
const stripped = $('<div/>').html(errorMessage).text();
$('.dropzone-alerts')
.html(sprintf(__('Error uploading file: %{stripped}'), { stripped }))
.show();

View file

@ -98,7 +98,7 @@ export default {
</template>
<p>
<gl-sprintf :message="$options.i18n.bodyMessage">
<template #codeQualityLink="{content}">
<template #codeQualityLink="{ content }">
<gl-link :href="codeQualityLink" target="_blank" class="font-size-inherit">{{
content
}}</gl-link>
@ -106,12 +106,12 @@ export default {
</gl-sprintf>
</p>
<gl-sprintf :message="$options.i18n.helpMessage">
<template #beginnerLink="{content}">
<template #beginnerLink="{ content }">
<gl-link :href="$options.beginnerLink" target="_blank">
{{ content }}
</gl-link>
</template>
<template #exampleLink="{content}">
<template #exampleLink="{ content }">
<gl-link :href="exampleLink" target="_blank">
{{ content }}
</gl-link>

View file

@ -82,9 +82,7 @@ export default Vue.extend({
});
$('.js-issue-board-sidebar', this.$el).each((i, el) => {
$(el)
.data('deprecatedJQueryDropdown')
.clearMenu();
$(el).data('deprecatedJQueryDropdown').clearMenu();
});
}

View file

@ -65,9 +65,7 @@ export default {
this.loading = false;
};
this.loadIssues()
.then(loadingDone)
.catch(loadingDone);
this.loadIssues().then(loadingDone).catch(loadingDone);
} else if (!this.showAddIssuesModal) {
this.issues = [];
this.selectedIssues = [];
@ -83,9 +81,7 @@ export default {
this.filterLoading = false;
};
this.loadIssues(true)
.then(loadingDone)
.catch(loadingDone);
this.loadIssues(true).then(loadingDone).catch(loadingDone);
}
},
deep: true,

View file

@ -40,7 +40,7 @@ $(document)
});
export default function initNewListDropdown() {
$('.js-new-board-list').each(function() {
$('.js-new-board-list').each(function () {
const $dropdownToggle = $(this);
const $dropdown = $dropdownToggle.closest('.dropdown');
new CreateLabelDropdown(

View file

@ -212,11 +212,17 @@ export default {
listId,
},
})
.then(({ data: { destroyBoardList: { errors } } }) => {
if (errors.length > 0) {
commit(types.REMOVE_LIST_FAILURE, listsBackup);
}
})
.then(
({
data: {
destroyBoardList: { errors },
},
}) => {
if (errors.length > 0) {
commit(types.REMOVE_LIST_FAILURE, listsBackup);
}
},
)
.catch(() => {
commit(types.REMOVE_LIST_FAILURE, listsBackup);
});

View file

@ -24,7 +24,7 @@ export default class BuildArtifacts {
// eslint-disable-next-line class-methods-use-this
setupEntryClick() {
return $('.tree-holder').on('click', 'tr[data-link]', function() {
return $('.tree-holder').on('click', 'tr[data-link]', function () {
visitUrl(this.dataset.link, parseBoolean(this.dataset.externalLink));
});
}

View file

@ -111,7 +111,7 @@ export default {
<gl-form-checkbox v-model="dryRun"
>{{ __('Simulate a pipeline created for the default branch') }}
<gl-link :href="pipelineSimulationHelpPagePath" target="_blank"
><gl-icon class="gl-text-blue-600" name="question-o"/></gl-link
><gl-icon class="gl-text-blue-600" name="question-o" /></gl-link
></gl-form-checkbox>
</div>
<gl-button data-testid="ci-lint-clear" @click="clear">{{ __('Clear') }}</gl-button>

View file

@ -61,7 +61,7 @@ export default {
class="triggers-list"
responsive
>
<template #cell(token)="{item}">
<template #cell(token)="{ item }">
{{ item.token }}
<clipboard-button
v-if="item.hasTokenExposed"
@ -82,7 +82,7 @@ export default {
</gl-badge>
</div>
</template>
<template #cell(description)="{item}">
<template #cell(description)="{ item }">
<tooltip-on-truncate
:title="item.description"
truncate-target="child"
@ -92,7 +92,7 @@ export default {
<div class="gl-flex-fill-1 gl-text-truncate">{{ item.description }}</div>
</tooltip-on-truncate>
</template>
<template #cell(owner)="{item}">
<template #cell(owner)="{ item }">
<span class="trigger-owner sr-only">{{ item.owner.name }}</span>
<user-avatar-link
v-if="item.owner"
@ -102,11 +102,11 @@ export default {
:img-alt="item.owner.name"
/>
</template>
<template #cell(lastUsed)="{item}">
<template #cell(lastUsed)="{ item }">
<time-ago-tooltip v-if="item.lastUsed" :time="item.lastUsed" />
<span v-else>{{ __('Never') }}</span>
</template>
<template #cell(actions)="{item}">
<template #cell(actions)="{ item }">
<gl-button
:title="s__('Pipelines|Edit')"
icon="pencil"

View file

@ -223,10 +223,7 @@ export default class VariableList {
getAllData() {
// Ignore the last empty row because we don't want to try persist
// a blank variable and run into validation problems.
const validRows = this.$container
.find('.js-row')
.toArray()
.slice(0, -1);
const validRows = this.$container.find('.js-row').toArray().slice(0, -1);
return validRows.map(rowEl => {
const resultant = {};

View file

@ -461,7 +461,7 @@ export default {
)
"
>
<template #code="{content}">
<template #code="{ content }">
<code>{{ content }}</code>
</template>
<template #link="{ content }">

View file

@ -254,9 +254,7 @@ export default {
<template #freeSpacePercentage>{{
totalCpuAndUsage(item.nodes).freeSpacePercentage
}}</template>
<template #percentSymbol
>%</template
>
<template #percentSymbol>%</template>
</gl-sprintf>
</span>
@ -277,9 +275,7 @@ export default {
<template #freeSpacePercentage>{{
totalMemoryAndUsage(item.nodes).freeSpacePercentage
}}</template>
<template #percentSymbol
>%</template
>
<template #percentSymbol>%</template>
</gl-sprintf>
</span>
@ -293,7 +289,7 @@ export default {
/>
</template>
<template #cell(cluster_type)="{value}">
<template #cell(cluster_type)="{ value }">
<gl-badge variant="muted">
{{ value }}
</gl-badge>

View file

@ -56,15 +56,15 @@ export default class ImageFile {
let dragging = false;
const $body = $('body');
const $offsetEl = $el.parent();
const dragStart = function() {
const dragStart = function () {
dragging = true;
$body.css('user-select', 'none');
};
const dragStop = function() {
const dragStop = function () {
dragging = false;
$body.css('user-select', '');
};
const dragMove = function(e) {
const dragMove = function (e) {
const moveX = e.pageX || e.touches[0].pageX;
const left = moveX - ($offsetEl.offset().left + padding);
if (!dragging) return;
@ -73,11 +73,7 @@ export default class ImageFile {
};
// eslint-disable-next-line @gitlab/no-global-event-off
$el
.off('mousedown')
.off('touchstart')
.on('mousedown', dragStart)
.on('touchstart', dragStart);
$el.off('mousedown').off('touchstart').on('mousedown', dragStart).on('touchstart', dragStart);
// eslint-disable-next-line @gitlab/no-global-event-off
$body
@ -109,9 +105,9 @@ export default class ImageFile {
}
views = {
'two-up': function() {
'two-up': function () {
return $('.two-up.view .wrap', this.file).each((index, wrap) => {
$('img', wrap).each(function() {
$('img', wrap).each(function () {
const currentWidth = $(this).width();
if (currentWidth > availWidth / 2) {
return $(this).width(availWidth / 2);
@ -157,7 +153,7 @@ export default class ImageFile {
});
});
},
'onion-skin': function() {
'onion-skin': function () {
let maxHeight, maxWidth;
maxWidth = 0;
maxHeight = 0;

View file

@ -85,10 +85,7 @@ export default class CommitsList {
// Update commits count in the previous commits header.
commitsCount += Number(
$(processedData)
.nextUntil('li.js-commit-header')
.first()
.find('li.commit').length,
$(processedData).nextUntil('li.js-commit-header').first().find('li.commit').length,
);
$commitsHeadersLast

View file

@ -13,14 +13,10 @@ import 'bootstrap/js/dist/tab';
// custom jQuery functions
$.fn.extend({
disable() {
return $(this)
.prop('disabled', true)
.addClass('disabled');
return $(this).prop('disabled', true).addClass('disabled');
},
enable() {
return $(this)
.prop('disabled', false)
.removeClass('disabled');
return $(this).prop('disabled', false).removeClass('disabled');
},
});

View file

@ -9,7 +9,7 @@ import { fixTitle } from '~/tooltips';
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
export default function initCompareAutocomplete(limitTo = null, clickHandler = () => {}) {
$('.js-compare-dropdown').each(function() {
$('.js-compare-dropdown').each(function () {
const $dropdown = $(this);
const selected = $dropdown.data('selected');
const $dropdownContainer = $dropdown.closest('.dropdown');
@ -51,9 +51,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
.text(ref)
.attr('data-ref', ref);
if (ref.header != null) {
return $('<li />')
.addClass('dropdown-header')
.text(ref.header);
return $('<li />').addClass('dropdown-header').text(ref.header);
}
return $('<li />').append(link);
},

View file

@ -43,7 +43,10 @@ export default class ContextualSidebar {
$(document).trigger('content.resize');
});
$(window).on('resize', debounce(() => this.render(), 100));
$(window).on(
'resize',
debounce(() => this.render(), 100),
);
}
// See documentation: https://design.gitlab.com/regions/navigation#contextual-navigation

View file

@ -57,9 +57,7 @@ export default {
if (this.hasZone) {
this.isLoading = true;
this.fetchMachineTypes()
.then(this.fetchSuccessHandler)
.catch(this.fetchFailureHandler);
this.fetchMachineTypes().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler);
}
},
},

View file

@ -99,9 +99,7 @@ export default {
created() {
this.isLoading = true;
this.fetchProjects()
.then(this.fetchSuccessHandler)
.catch(this.fetchFailureHandler);
this.fetchProjects().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler);
},
methods: {
...mapActions(['fetchProjects', 'setIsValidatingProjectBilling', 'validateProjectBilling']),
@ -175,9 +173,7 @@ export default {
<gl-sprintf :message="helpText">
<template #linkToBilling="{ content }">
<gl-link
:href="
'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral'
"
:href="'https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral'"
target="_blank"
>{{ content }} <gl-icon name="external-link"
/></gl-link>

View file

@ -46,9 +46,7 @@ export default {
if (!isValidating && this.projectHasBillingEnabled) {
this.isLoading = true;
this.fetchZones()
.then(this.fetchSuccessHandler)
.catch(this.fetchFailureHandler);
this.fetchZones().then(this.fetchSuccessHandler).catch(this.fetchFailureHandler);
}
},
},

View file

@ -46,7 +46,7 @@ export default class CreateLabelDropdown {
addBinding() {
const self = this;
this.$colorSuggestions.on('click', function(e) {
this.$colorSuggestions.on('click', function (e) {
const $this = $(this);
self.addColorValue(e, $this);
});
@ -72,10 +72,7 @@ export default class CreateLabelDropdown {
e.stopPropagation();
this.$newColorField.val($this.data('color')).trigger('change');
this.$colorPreview
.css('background-color', $this.data('color'))
.parent()
.addClass('is-active');
this.$colorPreview.css('background-color', $this.data('color')).parent().addClass('is-active');
}
enableLabelCreateButton() {
@ -94,10 +91,7 @@ export default class CreateLabelDropdown {
this.$addList.prop('checked', this.addListDefault);
this.$colorPreview
.css('background-color', '')
.parent()
.removeClass('is-active');
this.$colorPreview.css('background-color', '').parent().removeClass('is-active');
}
saveLabel(e) {

View file

@ -30,8 +30,6 @@ export default {
{{ time.seconds }} <span> {{ s__('Time|s') }} </span>
</template>
</template>
<template v-else>
--
</template>
<template v-else> -- </template>
</span>
</template>

View file

@ -123,10 +123,7 @@ export class GitLabDropdown {
if ($(this.el).is('input')) {
currentIndex = -1;
} else {
$(selector, this.dropdown)
.first()
.find('a')
.addClass('is-focused');
$(selector, this.dropdown).first().find('a').addClass('is-focused');
currentIndex = 0;
}
}
@ -493,10 +490,7 @@ export class GitLabDropdown {
if (!this.options.multiSelect || el.hasClass('dropdown-clear-active')) {
this.dropdown.find(`.${ACTIVE_CLASS}`).removeClass(ACTIVE_CLASS);
if (!isInput) {
this.dropdown
.parent()
.find(`input[name='${fieldName}']`)
.remove();
this.dropdown.parent().find(`input[name='${fieldName}']`).remove();
}
}
if (field && field.length && value == null) {
@ -536,10 +530,7 @@ export class GitLabDropdown {
$(`input[name="${fieldName}"]`).remove();
}
const $input = $('<input>')
.attr('type', 'hidden')
.attr('name', fieldName)
.val(value);
const $input = $('<input>').attr('type', 'hidden').attr('name', fieldName).val(value);
if (this.options.inputId != null) {
$input.attr('id', this.options.inputId);
}
@ -678,9 +669,7 @@ export class GitLabDropdown {
toggleText = this.options.updateLabel;
}
return $(this.el)
.find('.dropdown-toggle-text')
.text(toggleText);
return $(this.el).find('.dropdown-toggle-text').text(toggleText);
}
// eslint-disable-next-line class-methods-use-this

View file

@ -22,10 +22,7 @@ export class GitLabDropdownFilter {
// Clear click
e.preventDefault();
e.stopPropagation();
return this.input
.val('')
.trigger('input')
.focus();
return this.input.val('').trigger('input').focus();
});
// Key events
timeout = '';
@ -113,7 +110,7 @@ export class GitLabDropdownFilter {
const elements = this.options.elements();
if (searchText) {
// eslint-disable-next-line func-names
elements.each(function() {
elements.each(function () {
const $el = $(this);
const matches = fuzzaldrinPlus.match($el.text().trim(), searchText);
if (!$el.is('.dropdown-header')) {

View file

@ -9,10 +9,7 @@ export class GitLabDropdownInput {
// Clear click
e.preventDefault();
e.stopPropagation();
return this.input
.val('')
.trigger('input')
.focus();
return this.input.val('').trigger('input').focus();
});
this.input
@ -31,10 +28,7 @@ export class GitLabDropdownInput {
.toLowerCase() // replace non alphanumeric
.replace(/(-)\1+/g, '-'); // replace repeated dashes
this.cb(this.options.fieldName, val, {}, true);
this.input
.closest('.dropdown')
.find('.dropdown-toggle-text')
.text(val);
this.input.closest('.dropdown').find('.dropdown-toggle-text').text(val);
});
}

View file

@ -3,7 +3,7 @@ import { GitLabDropdown } from './gl_dropdown';
export default function initDeprecatedJQueryDropdown($el, opts) {
// eslint-disable-next-line func-names
return $el.each(function() {
return $el.each(function () {
if (!$.data(this, 'deprecatedJQueryDropdown')) {
$.data(this, 'deprecatedJQueryDropdown', new GitLabDropdown(this, opts));
}

View file

@ -32,12 +32,7 @@ export default {
},
},
methods: {
updateStoreAfterDelete(
store,
{
data: { designManagementDelete },
},
) {
updateStoreAfterDelete(store, { data: { designManagementDelete } }) {
updateStoreAfterDesignsDelete(
store,
designManagementDelete,

View file

@ -116,12 +116,7 @@ export default {
variables: {
id,
},
update(
store,
{
data: { todoMarkDone },
},
) {
update(store, { data: { todoMarkDone } }) {
const todoMarkDoneFirstError = (todoMarkDone.errors || [])[0];
if (todoMarkDoneFirstError) {
this.$emit('error', Error(todoMarkDoneFirstError));

View file

@ -167,12 +167,7 @@ export default {
next();
},
methods: {
addImageDiffNoteToStore(
store,
{
data: { createImageDiffNote },
},
) {
addImageDiffNoteToStore(store, { data: { createImageDiffNote } }) {
updateStoreAfterAddImageDiffNote(
store,
createImageDiffNote,
@ -180,12 +175,7 @@ export default {
this.designVariables,
);
},
updateImageDiffNoteInStore(
store,
{
data: { repositionImageDiffNote },
},
) {
updateImageDiffNoteInStore(store, { data: { repositionImageDiffNote } }) {
return updateStoreAfterRepositionImageDiffNote(
store,
repositionImageDiffNote,

View file

@ -187,12 +187,7 @@ export default {
.then(res => this.onUploadDesignDone(res))
.catch(() => this.onUploadDesignError());
},
afterUploadDesign(
store,
{
data: { designManagementUpload },
},
) {
afterUploadDesign(store, { data: { designManagementUpload } }) {
updateStoreAfterUploadDesign(store, designManagementUpload, this.projectQueryBody);
},
onUploadDesignDone(res) {

View file

@ -13,13 +13,7 @@ export default [
name: DESIGN_ROUTE_NAME,
path: '/designs/:id',
component: DesignDetail,
beforeEnter(
{
params: { id },
},
_,
next,
) {
beforeEnter({ params: { id } }, _, next) {
if (typeof id === 'string') {
next();
}

View file

@ -24,9 +24,7 @@ export default class Diff {
if (!tab || (tab && tab.dataset && tab.dataset.isLocked !== ''))
FilesCommentButton.init($diffFile);
const firstFile = $('.files')
.first()
.get(0);
const firstFile = $('.files').first().get(0);
const canCreateNote = firstFile && firstFile.hasAttribute('data-can-create-note');
$diffFile.each((index, file) => initImageDiffHelper.initImageDiff(file, canCreateNote));

View file

@ -281,12 +281,7 @@ export default {
const id = window?.location?.hash;
if (id && id.indexOf('#note') !== 0) {
this.setHighlightedRow(
id
.split('diff-content')
.pop()
.slice(1),
);
this.setHighlightedRow(id.split('diff-content').pop().slice(1));
}
},
beforeCreate() {
@ -404,10 +399,7 @@ export default {
},
setDiscussions() {
requestIdleCallback(
() =>
this.assignDiscussionsToDiff()
.then(this.$nextTick)
.then(this.startTaskList),
() => this.assignDiscussionsToDiff().then(this.$nextTick).then(this.startTaskList),
{ timeout: 1000 },
);
},

View file

@ -139,7 +139,7 @@ export default {
return !this.isCollapsed || this.automaticallyCollapsed;
},
showWarning() {
return this.isCollapsed && (this.automaticallyCollapsed && !this.viewDiffsFileByFile);
return this.isCollapsed && this.automaticallyCollapsed && !this.viewDiffsFileByFile;
},
showContent() {
return !this.isCollapsed && !this.isFileTooLarge;

View file

@ -58,9 +58,9 @@ export default {
class="code diff-wrap-lines js-syntax-highlight text-file js-diff-inline-view"
>
<colgroup>
<col style="width: 50px;" />
<col style="width: 50px;" />
<col style="width: 8px;" />
<col style="width: 50px" />
<col style="width: 50px" />
<col style="width: 8px" />
<col />
</colgroup>
<tbody>

View file

@ -57,11 +57,11 @@ export default {
class="code diff-wrap-lines js-syntax-highlight text-file"
>
<colgroup>
<col style="width: 50px;" />
<col style="width: 8px;" />
<col style="width: 50px" />
<col style="width: 8px" />
<col />
<col style="width: 50px;" />
<col style="width: 8px;" />
<col style="width: 50px" />
<col style="width: 8px" />
<col />
</colgroup>
<tbody>

View file

@ -307,7 +307,8 @@ export const startRenderDiffsQueue = ({ state, commit }) => {
const nextFile = state.diffFiles.find(
file =>
!file.renderIt &&
(file.viewer && (!isCollapsed(file) || file.viewer.name !== diffViewerModes.text)),
file.viewer &&
(!isCollapsed(file) || file.viewer.name !== diffViewerModes.text),
);
if (nextFile) {

View file

@ -138,7 +138,10 @@ export const fileLineCoverage = state => (file, line) => {
* @returns {number}
*/
export const currentDiffIndex = state =>
Math.max(0, state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId));
Math.max(
0,
state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId),
);
export const diffLines = state => (file, unifiedDiffComponents) => {
if (!unifiedDiffComponents && state.diffViewType === INLINE_DIFF_VIEW_TYPE) {

View file

@ -2,7 +2,7 @@
import { ACTIVE_CLASS } from './constants';
const Keyboard = function() {
const Keyboard = function () {
var currentKey;
var currentFocus;
var isUpArrow = false;

View file

@ -46,7 +46,7 @@ const Ajax = {
.then(data => self._loadData(data, config, self))
.catch(config.onError);
},
destroy: function() {
destroy: function () {
this.destroyed = true;
},
};

View file

@ -2,7 +2,7 @@
import AjaxCache from '../../lib/utils/ajax_cache';
const AjaxFilter = {
init: function(hook) {
init: function (hook) {
this.destroyed = false;
this.hook = hook;
this.notLoading();
@ -93,9 +93,9 @@ const AjaxFilter = {
list.currentIndex = 0;
},
buildParams: function(params) {
buildParams: function (params) {
if (!params) return '';
var paramsArray = Object.keys(params).map(function(param) {
var paramsArray = Object.keys(params).map(function (param) {
return param + '=' + (params[param] || '');
});
return '?' + paramsArray.join('&');

View file

@ -1,7 +1,7 @@
/* eslint-disable */
const Filter = {
keydown: function(e) {
keydown: function (e) {
if (this.destroyed) return;
var hiddenCount = 0;
@ -21,22 +21,22 @@ const Filter = {
if (config && config.filterFunction && typeof config.filterFunction === 'function') {
filterFunction = config.filterFunction;
} else {
filterFunction = function(o) {
filterFunction = function (o) {
// cheap string search
o.droplab_hidden = o[config.template].toLowerCase().indexOf(value) === -1;
return o;
};
}
dataHiddenCount = data.filter(function(o) {
dataHiddenCount = data.filter(function (o) {
return !o.droplab_hidden;
}).length;
matches = data.map(function(o) {
matches = data.map(function (o) {
return filterFunction(o, value);
});
hiddenCount = matches.filter(function(o) {
hiddenCount = matches.filter(function (o) {
return !o.droplab_hidden;
}).length;

View file

@ -5,12 +5,7 @@ import { DATA_TRIGGER, DATA_DROPDOWN, TEMPLATE_REGEX } from './constants';
const utils = {
toCamelCase(attr) {
return this.camelize(
attr
.split('-')
.slice(1)
.join(' '),
);
return this.camelize(attr.split('-').slice(1).join(' '));
},
template(templateString, data) {

View file

@ -219,12 +219,8 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) {
const caretStart = textarea.selectionStart;
const caretEnd = textarea.selectionEnd;
const textEnd = $(child).val().length;
const beforeSelection = $(child)
.val()
.substring(0, caretStart);
const afterSelection = $(child)
.val()
.substring(caretEnd, textEnd);
const beforeSelection = $(child).val().substring(0, caretStart);
const afterSelection = $(child).val().substring(caretEnd, textEnd);
$(child).val(beforeSelection + formattedText + afterSelection);
textarea.setSelectionRange(caretStart + formattedText.length, caretEnd + formattedText.length);
textarea.style.height = `${textarea.scrollHeight}px`;
@ -289,10 +285,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) {
form.find('.markdown-selector').click(function onMarkdownClick(e) {
e.preventDefault();
$(this)
.closest('.gfm-form')
.find('.div-dropzone')
.click();
$(this).closest('.gfm-form').find('.div-dropzone').click();
formTextarea.focus();
});

View file

@ -197,9 +197,7 @@ export default class DueDateSelectors {
$('.js-clear-due-date,.js-clear-start-date').on('click', e => {
e.preventDefault();
const calendar = $(e.target)
.siblings('.datepicker')
.data('pikaday');
const calendar = $(e.target).siblings('.datepicker').data('pikaday');
calendar.setDate(null);
});
}

View file

@ -22,9 +22,7 @@ export class CiSchemaExtension extends EditorLiteExtension {
.replace(':project_path', projectPath)
.replace(':ref', ref)
.replace(':filename', EXTENSION_CI_SCHEMA_FILE_NAME_MATCH);
const modelFileName = this.getModel()
.uri.path.split('/')
.pop();
const modelFileName = this.getModel().uri.path.split('/').pop();
registerSchema({
uri: ciSchemaUri,

View file

@ -242,8 +242,9 @@ export function getEmojiInfo(query) {
export function emojiFallbackImageSrc(inputName) {
const { name } = getEmojiInfo(inputName);
return `${gon.asset_host || ''}${gon.relative_url_root ||
''}/-/emojis/${EMOJI_VERSION}/${name}.png`;
return `${gon.asset_host || ''}${
gon.relative_url_root || ''
}/-/emojis/${EMOJI_VERSION}/${name}.png`;
}
export function emojiImageTag(name, src) {

View file

@ -100,7 +100,7 @@ export default {
/>
<gl-sprintf v-if="errorFn" :message="__('%{spanStart}in%{spanEnd} %{errorFn}')">
<template #span="{content}">
<template #span="{ content }">
<span class="gl-text-gray-200">{{ content }}&nbsp;</span>
</template>
<template #errorFn>
@ -109,7 +109,7 @@ export default {
</gl-sprintf>
<gl-sprintf :message="__('%{spanStart}at line%{spanEnd} %{errorLine}%{errorColumn}')">
<template #span="{content}">
<template #span="{ content }">
<span class="gl-text-gray-200">{{ content }}&nbsp;</span>
</template>
<template #errorLine>

View file

@ -30,7 +30,7 @@ export default {
},
computed: {
strategyComponent() {
return STRATEGIES[(this.strategy?.name)];
return STRATEGIES[this.strategy?.name];
},
},
methods: {

View file

@ -74,12 +74,7 @@ export default {
state.isRotating = true;
state.hasRotateError = false;
},
[types.RECEIVE_ROTATE_INSTANCE_ID_SUCCESS](
state,
{
data: { token },
},
) {
[types.RECEIVE_ROTATE_INSTANCE_ID_SUCCESS](state, { data: { token } }) {
state.isRotating = false;
state.instanceId = token;
state.hasRotateError = false;

View file

@ -200,8 +200,9 @@ export default class AvailableDropdownMappings {
}
getMergeRequestTargetBranchesEndpoint() {
const endpoint = `${gon.relative_url_root ||
''}/autocomplete/merge_request_target_branches.json`;
const endpoint = `${
gon.relative_url_root || ''
}/autocomplete/merge_request_target_branches.json`;
const params = {
group_id: this.getGroupId(),

View file

@ -193,7 +193,8 @@ export default class FilteredSearchVisualTokens {
});
} else if (
!isLastVisualTokenValid &&
(lastVisualToken && !lastVisualToken.querySelector('.operator'))
lastVisualToken &&
!lastVisualToken.querySelector('.operator')
) {
const tokensContainer = FilteredSearchContainer.container.querySelector('.tokens-container');
tokensContainer.removeChild(lastVisualToken);

View file

@ -285,10 +285,7 @@ class GfmAutoComplete {
...this.getDefaultCallbacks(),
beforeSave: membersBeforeSave,
matcher(flag, subtext) {
const subtextNodes = subtext
.split(/\n+/g)
.pop()
.split(GfmAutoComplete.regexSubtext);
const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
// Check if @ is followed by '/assign', '/reassign', '/unassign' or '/cc' commands.
command = subtextNodes.find(node => {
@ -465,10 +462,7 @@ class GfmAutoComplete {
}));
},
matcher(flag, subtext) {
const subtextNodes = subtext
.split(/\n+/g)
.pop()
.split(GfmAutoComplete.regexSubtext);
const subtextNodes = subtext.split(/\n+/g).pop().split(GfmAutoComplete.regexSubtext);
// Check if ~ is followed by '/label', '/relabel' or '/unlabel' commands.
command = subtextNodes.find(node => {

View file

@ -108,14 +108,10 @@ export default class GLForm {
addEventListeners() {
this.textarea.on('focus', function focusTextArea() {
$(this)
.closest('.md-area')
.addClass('is-focused');
$(this).closest('.md-area').addClass('is-focused');
});
this.textarea.on('blur', function blurTextArea() {
$(this)
.closest('.md-area')
.removeClass('is-focused');
$(this).closest('.md-area').removeClass('is-focused');
});
}

View file

@ -126,7 +126,7 @@ export default {
/>
<div
: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">
<img

View file

@ -65,10 +65,7 @@ export default class GroupFilterableList extends FilterableList {
setDefaultFilterOption() {
const defaultOption = $.trim(
this.$dropdown
.find('.dropdown-menu li.js-filter-sort-order a')
.first()
.text(),
this.$dropdown.find('.dropdown-menu li.js-filter-sort-order a').first().text(),
);
this.$dropdown.find('.dropdown-label').text(defaultOption);
}

View file

@ -31,9 +31,7 @@ export default {
},
removeDropdownListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off
$(this.$refs.dropdown)
.off('show.bs.dropdown')
.off('hide.bs.dropdown');
$(this.$refs.dropdown).off('show.bs.dropdown').off('hide.bs.dropdown');
},
showDropdown() {
this.isVisibleDropdown = true;

View file

@ -50,5 +50,10 @@ export function getRulesWithTraversal(filePath, getFileContent) {
return Promise.all(
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),
),
);
}

View file

@ -11,7 +11,11 @@ const conf = {
lineComment: '//',
blockComment: ['/*', '*/'],
},
brackets: [['{', '}'], ['[', ']'], ['(', ')']],
brackets: [
['{', '}'],
['[', ']'],
['(', ')'],
],
autoClosingPairs: [
{ open: '{', close: '}' },
{ open: '[', close: ']' },
@ -161,7 +165,11 @@ const language = {
[/\/\/.*$/, 'comment'],
[/#.*$/, 'comment'],
],
comment: [[/[^\/*]+/, 'comment'], [/\*\//, 'comment', '@pop'], [/[\/*]/, 'comment']],
comment: [
[/[^\/*]+/, 'comment'],
[/\*\//, 'comment', '@pop'],
[/[\/*]/, 'comment'],
],
string: [
[/\$\{/, { token: 'delimiter', next: '@stringExpression' }],
[/[^\\"\$]+/, 'string'],

View file

@ -37,7 +37,13 @@ const conf = {
blockComment: ['{{!--', '--}}'],
},
brackets: [['<!--', '-->'], ['<', '>'], ['{{', '}}'], ['{', '}'], ['(', ')']],
brackets: [
['<!--', '-->'],
['<', '>'],
['{{', '}}'],
['{', '}'],
['(', ')'],
],
autoClosingPairs: [
{ open: '{', close: '}' },

View file

@ -254,12 +254,7 @@ export function extractMarkdownImagesFromEntries(mdFile, entries) {
const imageContent = entries[imagePath]?.content || entries[imagePath]?.raw;
if (!isAbsolute(path) && imageContent) {
const ext = path.includes('.')
? path
.split('.')
.pop()
.trim()
: 'jpeg';
const ext = path.includes('.') ? path.split('.').pop().trim() : 'jpeg';
const src = `data:image/${ext};base64,${imageContent}`;
i += 1;
const key = `{{${prefix}${i}}}`;

View file

@ -154,12 +154,7 @@ export function getFileEOL(content = '') {
*/
export function addNumericSuffix(filename, randomize = false) {
return filename.replace(/([ _-]?)(\d*)(\..+?$|$)/, (_, before, number, after) => {
const n = randomize
? Math.random()
.toString()
.substring(2, 7)
.slice(-5)
: Number(number) + 1;
const n = randomize ? Math.random().toString().substring(2, 7).slice(-5) : Number(number) + 1;
return `${before || '-'}${n}${after}`;
});
}

View file

@ -265,9 +265,7 @@ export default {
if (field?.sortKey) {
sortKey = field.sortKey;
} else {
sortKey = convertToSnakeCase(sortBy)
.replace(/_.*/, '')
.toUpperCase();
sortKey = convertToSnakeCase(sortBy).replace(/_.*/, '').toUpperCase();
}
this.pagination = initialPaginationState;

View file

@ -195,7 +195,7 @@ export default {
<div class="gl-mt-2">
<gl-sprintf :message="$options.labels.readMoreText">
<template #link="{content}">
<template #link="{ content }">
<gl-link :href="helpLink" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>

View file

@ -37,10 +37,7 @@ class AutoWidthDropdownSelect {
// We have to look at the parent because
// `offsetParent` on a `display: none;` is `null`
const offsetParentWidth = $(this)
.parent()
.offsetParent()
.width();
const offsetParentWidth = $(this).parent().offsetParent().width();
// Reset any width to let it naturally flow
$dropdown.css('width', 'auto');
if ($dropdown.outerWidth(false) > offsetParentWidth) {

View file

@ -52,12 +52,12 @@ export default class IssuableForm {
/* eslint-disable @gitlab/require-i18n-strings */
this.wipRegex = new RegExp(
'^\\s*(' + // Line start, then any amount of leading 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_ where "_" is at least one whitespace
'|\\(draft\\)\\s*' + // (Draft) and any following whitespace
')+' + // At least one repeated match of the preceding parenthetical
'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_ where "_" is at least one whitespace
'|\\(draft\\)\\s*' + // (Draft) and any following whitespace
')+' + // At least one repeated match of the preceding parenthetical
'\\s*', // Any amount of trailing whitespace
'i', // Match any case(s)
);

View file

@ -21,9 +21,7 @@ export default class IssuableIndex {
axios
.put($resetToken.attr('href'))
.then(({ data }) => {
$('#issuable_email')
.val(data.new_address)
.focus();
$('#issuable_email').val(data.new_address).focus();
$resetToken.text(s__('EmailToken|reset it'));
})

View file

@ -141,8 +141,7 @@ export default {
:data-supports-quick-actions="enableAutocomplete"
:aria-label="__('Description')"
:placeholder="__('Write a comment or drag your files here…')"
class="note-textarea js-gfm-input js-autosize markdown-area
qa-description-textarea"
class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea"
dir="auto"
@keydown="handleKeydown($event, 'description')"
></textarea>

View file

@ -5,7 +5,7 @@ import App from './components/app.vue';
Vue.use(VueApollo);
export default function() {
export default function () {
const el = document.getElementById('js-suggestions');
const issueTitle = document.getElementById('issue_title');
const { projectPath } = el.dataset;

View file

@ -54,11 +54,7 @@ export default class Issue {
$(document).trigger('issuable:change', isClosed);
let numProjectIssues = Number(
projectIssuesCounter
.first()
.text()
.trim()
.replace(/[^\d]/, ''),
projectIssuesCounter.first().text().trim().replace(/[^\d]/, ''),
);
numProjectIssues = isClosed ? numProjectIssues - 1 : numProjectIssues + 1;
projectIssuesCounter.text(addDelimiter(numProjectIssues));

View file

@ -53,8 +53,7 @@ export default {
id="issue-description"
ref="textarea"
v-model="formState.description"
class="note-textarea js-gfm-input js-autosize markdown-area
qa-description-textarea"
class="note-textarea js-gfm-input js-autosize markdown-area qa-description-textarea"
dir="auto"
:data-supports-quick-actions="!glFeatures.tributeAutocomplete"
:aria-label="__('Description')"

View file

@ -93,7 +93,10 @@ export default {
this.secretValue = '';
},
deleteVariable(id) {
this.variables.splice(this.variables.findIndex(el => el.id === id), 1);
this.variables.splice(
this.variables.findIndex(el => el.id === id),
1,
);
},
},
};

View file

@ -135,7 +135,7 @@ export default class LabelManager {
getSortedLabelsIds() {
const sortedIds = [];
this.prioritizedLabels.find('> li').each(function() {
this.prioritizedLabels.find('> li').each(function () {
const id = $(this).data('id');
if (id) {

View file

@ -49,7 +49,7 @@ export default class LabelsSelect {
const fieldName = $dropdown.data('fieldName');
let initialSelected = $selectbox
.find(`input[name="${$dropdown.data('fieldName')}"]`)
.map(function() {
.map(function () {
return this.value;
})
.get();
@ -64,11 +64,11 @@ export default class LabelsSelect {
);
}
const saveLabelData = function() {
const saveLabelData = function () {
const selected = $dropdown
.closest('.selectbox')
.find(`input[name='${fieldName}']`)
.map(function() {
.map(function () {
return this.value;
})
.get();
@ -210,9 +210,7 @@ export default class LabelsSelect {
}
} else {
if (this.id(label)) {
const dropdownValue = this.id(label)
.toString()
.replace(/'/g, "\\'");
const dropdownValue = this.id(label).toString().replace(/'/g, "\\'");
if (
$form.find(
@ -346,10 +344,7 @@ export default class LabelsSelect {
const isMRIndex = page === 'projects:merge_requests:index';
if ($dropdown.parent().find('.is-active:not(.dropdown-clear-active)').length) {
$dropdown
.parent()
.find('.dropdown-clear-active')
.removeClass('is-active');
$dropdown.parent().find('.dropdown-clear-active').removeClass('is-active');
}
if ($dropdown.hasClass('js-issuable-form-dropdown')) {
@ -559,7 +554,7 @@ export default class LabelsSelect {
// eslint-disable-next-line class-methods-use-this
setOriginalDropdownData($container, $dropdown) {
const labels = [];
$container.find('[name="label_name[]"]').map(function() {
$container.find('[name="label_name[]"]').map(function () {
return labels.push(this.value);
});
$dropdown.data('marked', labels);

View file

@ -68,7 +68,7 @@ export const disableButtonIfEmptyField = (fieldSelector, buttonSelector, eventNa
closestSubmit.disable();
}
// eslint-disable-next-line func-names
return field.on(eventName, function() {
return field.on(eventName, function () {
if (rstrip($(this).val()) === '') {
return closestSubmit.disable();
}

View file

@ -14,18 +14,12 @@ function addBlockTags(blockTag, selected) {
}
function lineBefore(text, textarea) {
const split = text
.substring(0, textarea.selectionStart)
.trim()
.split('\n');
const split = text.substring(0, textarea.selectionStart).trim().split('\n');
return split[split.length - 1];
}
function lineAfter(text, textarea) {
return text
.substring(textarea.selectionEnd)
.trim()
.split('\n')[0];
return text.substring(textarea.selectionEnd).trim().split('\n')[0];
}
function convertMonacoSelectionToAceFormat(sel) {
@ -342,7 +336,7 @@ export function addMarkdownListeners(form) {
// eslint-disable-next-line @gitlab/no-global-event-off
const $allToolbarBtns = $('.js-md', form)
.off('click')
.on('click', function() {
.on('click', function () {
const $toolbarBtn = $(this);
return updateTextForToolbarBtn($toolbarBtn);

View file

@ -32,7 +32,7 @@ import 'vendor/jquery.scrollTo';
// </div>
//
const LineHighlighter = function(options = {}) {
const LineHighlighter = function (options = {}) {
options.highlightLineClass = options.highlightLineClass || 'hll';
options.fileHolderSelector = options.fileHolderSelector || '.file-holder';
options.scrollFileHolder = options.scrollFileHolder || false;
@ -50,7 +50,7 @@ const LineHighlighter = function(options = {}) {
this.highlightHash();
};
LineHighlighter.prototype.bindEvents = function() {
LineHighlighter.prototype.bindEvents = function () {
const $fileHolder = $(this.options.fileHolderSelector);
$fileHolder.on('click', 'a[data-line-number]', this.clickHandler);
@ -58,7 +58,7 @@ LineHighlighter.prototype.bindEvents = function() {
window.addEventListener('hashchange', e => this.highlightHash(e.target.location.hash));
};
LineHighlighter.prototype.highlightHash = function(newHash) {
LineHighlighter.prototype.highlightHash = function (newHash) {
let range;
if (newHash && typeof newHash === 'string') this._hash = newHash;
@ -83,13 +83,11 @@ LineHighlighter.prototype.highlightHash = function(newHash) {
}
};
LineHighlighter.prototype.clickHandler = function(event) {
LineHighlighter.prototype.clickHandler = function (event) {
let range;
event.preventDefault();
this.clearHighlight();
const lineNumber = $(event.target)
.closest('a')
.data('lineNumber');
const lineNumber = $(event.target).closest('a').data('lineNumber');
const current = this.hashToRange(this._hash);
if (!(current[0] && event.shiftKey)) {
// If there's no current selection, or there is but Shift wasn't held,
@ -107,7 +105,7 @@ LineHighlighter.prototype.clickHandler = function(event) {
}
};
LineHighlighter.prototype.clearHighlight = function() {
LineHighlighter.prototype.clearHighlight = function () {
return $(`.${this.highlightLineClass}`).removeClass(this.highlightLineClass);
};
@ -122,7 +120,7 @@ LineHighlighter.prototype.clearHighlight = function() {
// hashToRange('#foo') # => [null, null]
//
// Returns an Array
LineHighlighter.prototype.hashToRange = function(hash) {
LineHighlighter.prototype.hashToRange = function (hash) {
// ?L(\d+)(?:-(\d+))?$/)
const matches = hash.match(/^#?L(\d+)(?:-(\d+))?$/);
if (matches && matches.length) {
@ -136,14 +134,14 @@ LineHighlighter.prototype.hashToRange = function(hash) {
// Highlight a single line
//
// lineNumber - Line number to highlight
LineHighlighter.prototype.highlightLine = function(lineNumber) {
LineHighlighter.prototype.highlightLine = function (lineNumber) {
return $(`#LC${lineNumber}`).addClass(this.highlightLineClass);
};
// Highlight all lines within a range
//
// range - Array containing the starting and ending line numbers
LineHighlighter.prototype.highlightRange = function(range) {
LineHighlighter.prototype.highlightRange = function (range) {
if (range[1]) {
const results = [];
const ref = range[0] <= range[1] ? range : range.reverse();
@ -158,7 +156,7 @@ LineHighlighter.prototype.highlightRange = function(range) {
};
// Set the URL hash string
LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) {
LineHighlighter.prototype.setHash = function (firstLineNumber, lastLineNumber) {
let hash;
if (lastLineNumber) {
hash = `#L${firstLineNumber}-${lastLineNumber}`;
@ -172,7 +170,7 @@ LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) {
// Make the actual hash change in the browser
//
// This method is stubbed in tests.
LineHighlighter.prototype.__setLocationHash__ = function(value) {
LineHighlighter.prototype.__setLocationHash__ = function (value) {
return window.history.pushState(
{
url: value,

View file

@ -246,9 +246,7 @@ export default {
</div>{{trace}}
</code></pre>
</template>
<template #default
><div></div
></template>
<template #default><div></div></template>
</gl-infinite-scroll>
<div ref="logFooter" class="py-2 px-3 text-white bg-secondary-900">
@ -262,9 +260,7 @@ export default {
>
<template #fetched>{{ logs.lines.length }}</template>
</gl-sprintf>
<template v-else>
{{ s__('Environments|Currently showing all results.') }}</template
>
<template v-else> {{ s__('Environments|Currently showing all results.') }}</template>
</div>
</div>
</template>

View file

@ -53,7 +53,7 @@ window.$ = jQuery;
jQuery.ajaxSetup({
converters: {
// eslint-disable-next-line @gitlab/require-i18n-strings, func-names
'text script': function(text) {
'text script': function (text) {
jQuery.globalEval(text, { nonce: getCspNonceValue() });
return text;
},
@ -137,9 +137,7 @@ function deferredInitialisation() {
$('.remove-row').on('ajax:success', function removeRowAjaxSuccessCallback() {
tooltips.dispose(this);
$(this)
.closest('li')
.addClass('gl-display-none!');
$(this).closest('li').addClass('gl-display-none!');
});
$('.js-remove-tr').on('ajax:before', function removeTRAjaxBeforeCallback() {
@ -147,9 +145,7 @@ function deferredInitialisation() {
});
$('.js-remove-tr').on('ajax:success', function removeTRAjaxSuccessCallback() {
$(this)
.closest('tr')
.addClass('gl-display-none!');
$(this).closest('tr').addClass('gl-display-none!');
});
const glTooltipDelay = localStorage.getItem('gl-tooltip-delay');
@ -278,15 +274,9 @@ document.addEventListener('DOMContentLoaded', () => {
$this.toggleClass('active');
if ($this.hasClass('active')) {
notesHolders
.show()
.find('.hide, .content')
.show();
notesHolders.show().find('.hide, .content').show();
} else {
notesHolders
.hide()
.find('.content')
.hide();
notesHolders.hide().find('.content').hide();
}
$(document).trigger('toggle.comments');

View file

@ -41,9 +41,7 @@ export default function memberExpirationDate(selector = '.js-access-expiration-d
inputs.next('.js-clear-input').on('click', function clicked(event) {
event.preventDefault();
const input = $(this)
.closest('.clearable-input')
.find(selector);
const input = $(this).closest('.clearable-input').find(selector);
const calendar = input.data('pikaday');
calendar.setDate(null);

View file

@ -12,13 +12,9 @@ export default class Members {
addListeners() {
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-member-update-control')
.off('change')
.on('change', this.formSubmit.bind(this));
$('.js-member-update-control').off('change').on('change', this.formSubmit.bind(this));
// eslint-disable-next-line @gitlab/no-global-event-off
$('.js-edit-member-form')
.off('ajax:success')
.on('ajax:success', this.formSuccess.bind(this));
$('.js-edit-member-form').off('ajax:success').on('ajax:success', this.formSuccess.bind(this));
disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change');
}

View file

@ -60,19 +60,28 @@ import { __ } from '~/locale';
const DataPromise = axios.get(this.file.content_path);
Promise.all([EditorPromise, DataPromise])
.then(([{ default: EditorLite }, { data: { content, new_path: path } }]) => {
const contentEl = this.$el.querySelector('.editor');
.then(
([
{ default: EditorLite },
{
data: { content, new_path: path },
},
]) => {
const contentEl = this.$el.querySelector('.editor');
this.originalContent = content;
this.fileLoaded = true;
this.originalContent = content;
this.fileLoaded = true;
this.editor = new EditorLite().createInstance({
el: contentEl,
blobPath: path,
blobContent: content,
});
this.editor.onDidChangeModelContent(debounce(this.saveDiffResolution.bind(this), 250));
})
this.editor = new EditorLite().createInstance({
el: contentEl,
blobPath: path,
blobContent: content,
});
this.editor.onDidChangeModelContent(
debounce(this.saveDiffResolution.bind(this), 250),
);
},
)
.catch(() => {
flash(__('An error occurred while loading the file'));
});

View file

@ -47,11 +47,11 @@ function MergeRequest(opts) {
}
// Local jQuery finder
MergeRequest.prototype.$ = function(selector) {
MergeRequest.prototype.$ = function (selector) {
return this.$el.find(selector);
};
MergeRequest.prototype.initTabs = function() {
MergeRequest.prototype.initTabs = function () {
if (window.mrTabs) {
window.mrTabs.unbindEvents();
}
@ -59,12 +59,12 @@ MergeRequest.prototype.initTabs = function() {
window.mrTabs = new MergeRequestTabs(this.opts);
};
MergeRequest.prototype.showAllCommits = function() {
MergeRequest.prototype.showAllCommits = function () {
this.$('.first-commits').remove();
return this.$('.all-commits').removeClass('hide');
};
MergeRequest.prototype.initMRBtnListeners = function() {
MergeRequest.prototype.initMRBtnListeners = function () {
const _this = this;
const draftToggles = document.querySelectorAll('.js-draft-toggle-button');
@ -99,7 +99,7 @@ MergeRequest.prototype.initMRBtnListeners = function() {
});
}
return $('.btn-close, .btn-reopen').on('click', function(e) {
return $('.btn-close, .btn-reopen').on('click', function (e) {
const $this = $(this);
const shouldSubmit = $this.hasClass('btn-comment');
if (shouldSubmit && $this.data('submitted')) {
@ -117,7 +117,7 @@ MergeRequest.prototype.initMRBtnListeners = function() {
});
};
MergeRequest.prototype.submitNoteForm = function(form, $button) {
MergeRequest.prototype.submitNoteForm = function (form, $button) {
const noteText = form.find('textarea.js-note-text').val();
if (noteText.trim().length > 0) {
form.submit();
@ -126,7 +126,7 @@ MergeRequest.prototype.submitNoteForm = function(form, $button) {
}
};
MergeRequest.prototype.initCommitMessageListeners = function() {
MergeRequest.prototype.initCommitMessageListeners = function () {
$(document).on('click', 'a.js-with-description-link', e => {
const textarea = $('textarea.js-commit-message');
e.preventDefault();
@ -146,7 +146,7 @@ MergeRequest.prototype.initCommitMessageListeners = function() {
});
};
MergeRequest.setStatusBoxToMerged = function() {
MergeRequest.setStatusBoxToMerged = function () {
$('.detail-page-header .status-box')
.removeClass('status-box-open')
.addClass('status-box-mr-merged')
@ -154,20 +154,20 @@ MergeRequest.setStatusBoxToMerged = function() {
.text(__('Merged'));
};
MergeRequest.decreaseCounter = function(by = 1) {
MergeRequest.decreaseCounter = function (by = 1) {
const $el = $('.js-merge-counter');
const count = Math.max(parseInt($el.text().replace(/[^\d]/, ''), 10) - by, 0);
$el.text(addDelimiter(count));
};
MergeRequest.hideCloseButton = function() {
MergeRequest.hideCloseButton = function () {
const el = document.querySelector('.merge-request .js-issuable-actions');
// Dropdown for mobile screen
el.querySelector('li.js-close-item').classList.add('hidden');
};
MergeRequest.toggleDraftStatus = function(title, isReady) {
MergeRequest.toggleDraftStatus = function (title, isReady) {
if (isReady) {
createFlash(__('The merge request can now be merged.'), 'notice');
}

View file

@ -92,11 +92,7 @@ export default class MiniPipelineGraph {
})
.catch(() => {
this.toggleLoading(button);
if (
$(button)
.parent()
.hasClass('open')
) {
if ($(button).parent().hasClass('open')) {
$(button).dropdown('toggle');
}
flash(__('An error occurred while fetching the builds.'), 'alert');

View file

@ -146,7 +146,7 @@ export default {
)
"
>
<template #code="{content}">
<template #code="{ content }">
<code>{{ content }}</code>
</template>
</gl-sprintf>

View file

@ -243,11 +243,11 @@ export default class BranchGraph {
})
.click(() => window.open(options.commit_url.replace('%s', commit.id), '_blank'))
.hover(
function() {
function () {
this.tooltip = r.commitTooltip(x + 5, y, commit);
return top.push(this.tooltip.insertBefore(this));
},
function() {
function () {
return this.tooltip && this.tooltip.remove() && delete this.tooltip;
},
);

View file

@ -53,13 +53,13 @@ export default class NewBranchForm {
const { indexOf } = [];
this.branchNameError.empty();
const unique = function(values, value) {
const unique = function (values, value) {
if (indexOf.call(values, value) === -1) {
values.push(value);
}
return values;
};
const formatter = function(values, restriction) {
const formatter = function (values, restriction) {
const formatted = values.map(value => {
switch (false) {
case !/\s/.test(value):

View file

@ -108,10 +108,7 @@ export default class Notes {
// We are in the Merge Requests page so we need another edit form for Changes tab
if (getPagePath(1) === 'merge_requests') {
$('.note-edit-form')
.clone()
.addClass('mr-note-edit-form')
.insertAfter('.note-edit-form');
$('.note-edit-form').clone().addClass('mr-note-edit-form').insertAfter('.note-edit-form');
}
const hash = getLocationHash();
@ -427,12 +424,7 @@ export default class Notes {
} else if (Notes.isUpdatedNote(noteEntity, $note)) {
// The server can send the same update multiple times so we need to make sure to only update once per actual update.
const isEditing = $note.hasClass('is-editing');
const initialContent = normalizeNewlines(
$note
.find('.original-note-content')
.text()
.trim(),
);
const initialContent = normalizeNewlines($note.find('.original-note-content').text().trim());
const $textarea = $note.find('.js-note-text');
const currentContent = $textarea.val();
// There can be CRLF vs LF mismatches if we don't sanitize and compare the same way
@ -541,14 +533,8 @@ export default class Notes {
form.find('.js-errors').remove();
// reset text and preview
form.find('.js-md-write-button').click();
form
.find('.js-note-text')
.val('')
.trigger('input');
form
.find('.js-note-text')
.data('autosave')
.reset();
form.find('.js-note-text').val('').trigger('input');
form.find('.js-note-text').data('autosave').reset();
const event = document.createEvent('Event');
event.initEvent('autosize:update', true, false);
@ -690,10 +676,7 @@ export default class Notes {
}
checkContentToAllowEditing($el) {
const initialContent = $el
.find('.original-note-content')
.text()
.trim();
const initialContent = $el.find('.original-note-content').text().trim();
const currentContent = $el.find('.js-note-text').val();
let isAllowed = true;
@ -877,10 +860,7 @@ export default class Notes {
const form = this.cleanForm(this.formClone.clone());
const replyLink = $(target).closest('.js-discussion-reply-button');
// insert the form after the button
replyLink
.closest('.discussion-reply-holder')
.hide()
.after(form);
replyLink.closest('.discussion-reply-holder').hide().after(form);
// show the form
return this.setupDiscussionNoteForm(replyLink, form);
}
@ -1069,10 +1049,7 @@ export default class Notes {
const row = form.closest('tr');
const glForm = form.data('glForm');
glForm.destroy();
form
.find('.js-note-text')
.data('autosave')
.reset();
form.find('.js-note-text').data('autosave').reset();
// show the reply button (will only work for replies)
form.prev('.discussion-reply-holder').show();
if (row.is('.js-temp-notes-holder')) {
@ -1181,16 +1158,10 @@ export default class Notes {
this.glForm = new GLForm($editForm.find('form'), this.enableGFM);
$editForm
.find('form')
.attr('action', `${postUrl}?html=true`)
.attr('data-remote', 'true');
$editForm.find('form').attr('action', `${postUrl}?html=true`).attr('data-remote', 'true');
$editForm.find('.js-form-target-id').val(targetId);
$editForm.find('.js-form-target-type').val(targetType);
$editForm
.find('.js-note-text')
.focus()
.val(originalContent);
$editForm.find('.js-note-text').focus().val(originalContent);
$editForm.find('.js-md-write-button').trigger('click');
$editForm.find('.referenced-users').hide();
}
@ -1306,9 +1277,7 @@ export default class Notes {
* intrusive.
*/
collapseLongCommitList() {
const systemNotes = $('#notes-list')
.find('li.system-note')
.has('ul');
const systemNotes = $('#notes-list').find('li.system-note').has('ul');
$.each(systemNotes, (index, systemNote) => {
const $systemNote = $(systemNote);
@ -1365,11 +1334,7 @@ export default class Notes {
// There can be CRLF vs LF mismatches if we don't sanitize and compare the same way
const sanitizedNoteEntityText = normalizeNewlines(noteEntity.note.trim());
const currentNoteText = normalizeNewlines(
$note
.find('.original-note-content')
.first()
.text()
.trim(),
$note.find('.original-note-content').first().text().trim(),
);
return sanitizedNoteEntityText !== currentNoteText;
}
@ -1545,10 +1510,7 @@ export default class Notes {
let $form = $submitBtn.parents('form');
const $closeBtn = $form.find('.js-note-target-close');
const isDiscussionNote =
$submitBtn
.parent()
.find('li.droplab-item-selected')
.attr('id') === 'discussion';
$submitBtn.parent().find('li.droplab-item-selected').attr('id') === 'discussion';
const isMainForm = $form.hasClass('js-main-target-form');
const isDiscussionForm = $form.hasClass('js-discussion-note-form');
const isDiscussionResolve = $submitBtn.hasClass('js-comment-resolve-button');

View file

@ -77,8 +77,8 @@ export default {
<div
v-if="
!hideJumpToNextUnresolvedInThreads &&
discussion.resolvable &&
shouldShowJumpToNextDiscussion
discussion.resolvable &&
shouldShowJumpToNextDiscussion
"
class="btn-group discussion-actions ml-sm-2"
>

Some files were not shown because too many files have changed in this diff Show more