Skip to content
Snippets Groups Projects
Unverified Commit 2bee7515 authored by Mike Greiling's avatar Mike Greiling
Browse files

Prettify additional modules (A through I)

parent d87e88a6
No related branches found
No related tags found
No related merge requests found
Showing
with 597 additions and 512 deletions
Loading
@@ -9,7 +9,7 @@ export default class Activities {
Loading
@@ -9,7 +9,7 @@ export default class Activities {
constructor() { constructor() {
Pager.init(20, true, false, data => data, this.updateTooltips); Pager.init(20, true, false, data => data, this.updateTooltips);
   
$('.event-filter-link').on('click', (e) => { $('.event-filter-link').on('click', e => {
e.preventDefault(); e.preventDefault();
this.toggleFilter(e.currentTarget); this.toggleFilter(e.currentTarget);
this.reloadActivities(); this.reloadActivities();
Loading
Loading
import $ from 'jquery'; import $ from 'jquery';
   
export const addTooltipToEl = (el) => { export const addTooltipToEl = el => {
const textEl = el.querySelector('.js-breadcrumb-item-text'); const textEl = el.querySelector('.js-breadcrumb-item-text');
   
if (textEl && textEl.scrollWidth > textEl.offsetWidth) { if (textEl && textEl.scrollWidth > textEl.offsetWidth) {
Loading
@@ -14,17 +14,18 @@ export default () => {
Loading
@@ -14,17 +14,18 @@ export default () => {
const breadcrumbs = document.querySelector('.js-breadcrumbs-list'); const breadcrumbs = document.querySelector('.js-breadcrumbs-list');
   
if (breadcrumbs) { if (breadcrumbs) {
const topLevelLinks = [...breadcrumbs.children].filter(el => !el.classList.contains('dropdown')) const topLevelLinks = [...breadcrumbs.children]
.filter(el => !el.classList.contains('dropdown'))
.map(el => el.querySelector('a')) .map(el => el.querySelector('a'))
.filter(el => el); .filter(el => el);
const $expander = $('.js-breadcrumbs-collapsed-expander'); const $expander = $('.js-breadcrumbs-collapsed-expander');
   
topLevelLinks.forEach(el => addTooltipToEl(el)); topLevelLinks.forEach(el => addTooltipToEl(el));
   
$expander.closest('.dropdown') $expander.closest('.dropdown').on('show.bs.dropdown hide.bs.dropdown', e => {
.on('show.bs.dropdown hide.bs.dropdown', (e) => { $('.js-breadcrumbs-collapsed-expander', e.currentTarget)
$('.js-breadcrumbs-collapsed-expander', e.currentTarget).toggleClass('open') .toggleClass('open')
.tooltip('hide'); .tooltip('hide');
}); });
} }
}; };
Loading
@@ -12,16 +12,16 @@ export default class BuildArtifacts {
Loading
@@ -12,16 +12,16 @@ export default class BuildArtifacts {
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
disablePropagation() { disablePropagation() {
$('.top-block').on('click', '.download', function (e) { $('.top-block').on('click', '.download', function(e) {
return e.stopPropagation(); return e.stopPropagation();
}); });
return $('.tree-holder').on('click', 'tr[data-link] a', function (e) { return $('.tree-holder').on('click', 'tr[data-link] a', function(e) {
return e.stopImmediatePropagation(); return e.stopImmediatePropagation();
}); });
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
setupEntryClick() { setupEntryClick() {
return $('.tree-holder').on('click', 'tr[data-link]', function () { return $('.tree-holder').on('click', 'tr[data-link]', function() {
visitUrl(this.dataset.link, convertPermissionToBoolean(this.dataset.externalLink)); visitUrl(this.dataset.link, convertPermissionToBoolean(this.dataset.externalLink));
}); });
} }
Loading
@@ -37,11 +37,15 @@ export default class BuildArtifacts {
Loading
@@ -37,11 +37,15 @@ export default class BuildArtifacts {
// We want the tooltip to show if you hover anywhere on the row // We want the tooltip to show if you hover anywhere on the row
// But be placed below and in the middle of the file name // But be placed below and in the middle of the file name
$('.js-artifact-tree-row') $('.js-artifact-tree-row')
.on('mouseenter', (e) => { .on('mouseenter', e => {
$(e.currentTarget).find('.js-artifact-tree-tooltip').tooltip('show'); $(e.currentTarget)
.find('.js-artifact-tree-tooltip')
.tooltip('show');
}) })
.on('mouseleave', (e) => { .on('mouseleave', e => {
$(e.currentTarget).find('.js-artifact-tree-tooltip').tooltip('hide'); $(e.currentTarget)
.find('.js-artifact-tree-tooltip')
.tooltip('hide');
}); });
} }
} }
Loading
@@ -7,11 +7,13 @@ import statusCodes from '../lib/utils/http_status';
Loading
@@ -7,11 +7,13 @@ import statusCodes from '../lib/utils/http_status';
import VariableList from './ci_variable_list'; import VariableList from './ci_variable_list';
   
function generateErrorBoxContent(errors) { function generateErrorBoxContent(errors) {
const errorList = [].concat(errors).map(errorString => ` const errorList = [].concat(errors).map(
errorString => `
<li> <li>
${_.escape(errorString)} ${_.escape(errorString)}
</li> </li>
`); `,
);
   
return ` return `
<p> <p>
Loading
@@ -25,13 +27,7 @@ function generateErrorBoxContent(errors) {
Loading
@@ -25,13 +27,7 @@ function generateErrorBoxContent(errors) {
   
// Used for the variable list on CI/CD projects/groups settings page // Used for the variable list on CI/CD projects/groups settings page
export default class AjaxVariableList { export default class AjaxVariableList {
constructor({ constructor({ container, saveButton, errorBox, formField = 'variables', saveEndpoint }) {
container,
saveButton,
errorBox,
formField = 'variables',
saveEndpoint,
}) {
this.container = container; this.container = container;
this.saveButton = saveButton; this.saveButton = saveButton;
this.errorBox = errorBox; this.errorBox = errorBox;
Loading
@@ -58,18 +54,21 @@ export default class AjaxVariableList {
Loading
@@ -58,18 +54,21 @@ export default class AjaxVariableList {
// to match it up in `updateRowsWithPersistedVariables` // to match it up in `updateRowsWithPersistedVariables`
this.variableList.toggleEnableRow(false); this.variableList.toggleEnableRow(false);
   
return axios.patch(this.saveEndpoint, { return axios
variables_attributes: this.variableList.getAllData(), .patch(
}, { this.saveEndpoint,
// We want to be able to process the `res.data` from a 400 error response {
// and print the validation messages such as duplicate variable keys variables_attributes: this.variableList.getAllData(),
validateStatus: status => ( },
status >= statusCodes.OK && {
status < statusCodes.MULTIPLE_CHOICES // We want to be able to process the `res.data` from a 400 error response
) || // and print the validation messages such as duplicate variable keys
status === statusCodes.BAD_REQUEST, validateStatus: status =>
}) (status >= statusCodes.OK && status < statusCodes.MULTIPLE_CHOICES) ||
.then((res) => { status === statusCodes.BAD_REQUEST,
},
)
.then(res => {
loadingIcon.classList.toggle('hide', true); loadingIcon.classList.toggle('hide', true);
this.variableList.toggleEnableRow(true); this.variableList.toggleEnableRow(true);
   
Loading
@@ -90,18 +89,21 @@ export default class AjaxVariableList {
Loading
@@ -90,18 +89,21 @@ export default class AjaxVariableList {
} }
   
updateRowsWithPersistedVariables(persistedVariables = []) { updateRowsWithPersistedVariables(persistedVariables = []) {
const persistedVariableMap = [].concat(persistedVariables).reduce((variableMap, variable) => ({ const persistedVariableMap = [].concat(persistedVariables).reduce(
...variableMap, (variableMap, variable) => ({
[variable.key]: variable, ...variableMap,
}), {}); [variable.key]: variable,
}),
{},
);
   
this.container.querySelectorAll('.js-row').forEach((row) => { this.container.querySelectorAll('.js-row').forEach(row => {
// If we submitted a row that was destroyed, remove it so we don't try // If we submitted a row that was destroyed, remove it so we don't try
// to destroy it again which would cause a BE error // to destroy it again which would cause a BE error
const destroyInput = row.querySelector('.js-ci-variable-input-destroy'); const destroyInput = row.querySelector('.js-ci-variable-input-destroy');
if (convertPermissionToBoolean(destroyInput.value)) { if (convertPermissionToBoolean(destroyInput.value)) {
row.remove(); row.remove();
// Update the ID input so any future edits and `_destroy` will apply on the BE // Update the ID input so any future edits and `_destroy` will apply on the BE
} else { } else {
const key = row.querySelector('.js-ci-variable-input-key').value; const key = row.querySelector('.js-ci-variable-input-key').value;
const persistedVariable = persistedVariableMap[key]; const persistedVariable = persistedVariableMap[key];
Loading
Loading
Loading
@@ -16,10 +16,7 @@ function createEnvironmentItem(value) {
Loading
@@ -16,10 +16,7 @@ function createEnvironmentItem(value) {
} }
   
export default class VariableList { export default class VariableList {
constructor({ constructor({ container, formField }) {
container,
formField,
}) {
this.$container = $(container); this.$container = $(container);
this.formField = formField; this.formField = formField;
this.environmentDropdownMap = new WeakMap(); this.environmentDropdownMap = new WeakMap();
Loading
@@ -71,7 +68,7 @@ export default class VariableList {
Loading
@@ -71,7 +68,7 @@ export default class VariableList {
this.initRow(rowEl); this.initRow(rowEl);
}); });
   
this.$container.on('click', '.js-row-remove-button', (e) => { this.$container.on('click', '.js-row-remove-button', e => {
e.preventDefault(); e.preventDefault();
this.removeRow($(e.currentTarget).closest('.js-row')); this.removeRow($(e.currentTarget).closest('.js-row'));
}); });
Loading
@@ -81,7 +78,7 @@ export default class VariableList {
Loading
@@ -81,7 +78,7 @@ export default class VariableList {
.join(','); .join(',');
   
// Remove any empty rows except the last row // Remove any empty rows except the last row
this.$container.on('blur', inputSelector, (e) => { this.$container.on('blur', inputSelector, e => {
const $row = $(e.currentTarget).closest('.js-row'); const $row = $(e.currentTarget).closest('.js-row');
   
if ($row.is(':not(:last-child)') && !this.checkIfRowTouched($row)) { if ($row.is(':not(:last-child)') && !this.checkIfRowTouched($row)) {
Loading
@@ -136,7 +133,7 @@ export default class VariableList {
Loading
@@ -136,7 +133,7 @@ export default class VariableList {
$rowClone.removeAttr('data-is-persisted'); $rowClone.removeAttr('data-is-persisted');
   
// Reset the inputs to their defaults // Reset the inputs to their defaults
Object.keys(this.inputMap).forEach((name) => { Object.keys(this.inputMap).forEach(name => {
const entry = this.inputMap[name]; const entry = this.inputMap[name];
$rowClone.find(entry.selector).val(entry.default); $rowClone.find(entry.selector).val(entry.default);
}); });
Loading
@@ -171,7 +168,7 @@ export default class VariableList {
Loading
@@ -171,7 +168,7 @@ export default class VariableList {
} }
   
checkIfRowTouched($row) { checkIfRowTouched($row) {
return Object.keys(this.inputMap).some((name) => { return Object.keys(this.inputMap).some(name => {
const entry = this.inputMap[name]; const entry = this.inputMap[name];
const $el = $row.find(entry.selector); const $el = $row.find(entry.selector);
return $el.length && $el.val() !== entry.default; return $el.length && $el.val() !== entry.default;
Loading
@@ -190,11 +187,14 @@ export default class VariableList {
Loading
@@ -190,11 +187,14 @@ export default class VariableList {
getAllData() { getAllData() {
// Ignore the last empty row because we don't want to try persist // Ignore the last empty row because we don't want to try persist
// a blank variable and run into validation problems. // 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) => { return validRows.map(rowEl => {
const resultant = {}; const resultant = {};
Object.keys(this.inputMap).forEach((name) => { Object.keys(this.inputMap).forEach(name => {
const entry = this.inputMap[name]; const entry = this.inputMap[name];
const $input = $(rowEl).find(entry.selector); const $input = $(rowEl).find(entry.selector);
if ($input.length) { if ($input.length) {
Loading
@@ -207,11 +207,16 @@ export default class VariableList {
Loading
@@ -207,11 +207,16 @@ export default class VariableList {
} }
   
getEnvironmentValues() { getEnvironmentValues() {
const valueMap = this.$container.find(this.inputMap.environment_scope.selector).toArray() const valueMap = this.$container
.reduce((prevValueMap, envInput) => ({ .find(this.inputMap.environment_scope.selector)
...prevValueMap, .toArray()
[envInput.value]: envInput.value, .reduce(
}), {}); (prevValueMap, envInput) => ({
...prevValueMap,
[envInput.value]: envInput.value,
}),
{},
);
   
return Object.keys(valueMap).map(createEnvironmentItem); return Object.keys(valueMap).map(createEnvironmentItem);
} }
Loading
Loading
Loading
@@ -2,10 +2,7 @@ import $ from 'jquery';
Loading
@@ -2,10 +2,7 @@ import $ from 'jquery';
import VariableList from './ci_variable_list'; import VariableList from './ci_variable_list';
   
// Used for the variable list on scheduled pipeline edit page // Used for the variable list on scheduled pipeline edit page
export default function setupNativeFormVariableList({ export default function setupNativeFormVariableList({ container, formField = 'variables' }) {
container,
formField = 'variables',
}) {
const $container = $(container); const $container = $(container);
   
const variableList = new VariableList({ const variableList = new VariableList({
Loading
Loading
<script> <script>
/* eslint-disable vue/require-default-prop */ /* eslint-disable vue/require-default-prop */
import { s__, sprintf } from '../../locale'; import { s__, sprintf } from '../../locale';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import identicon from '../../vue_shared/components/identicon.vue'; import identicon from '../../vue_shared/components/identicon.vue';
import loadingButton from '../../vue_shared/components/loading_button.vue'; import loadingButton from '../../vue_shared/components/loading_button.vue';
import { import {
APPLICATION_STATUS, APPLICATION_STATUS,
REQUEST_LOADING, REQUEST_LOADING,
REQUEST_SUCCESS, REQUEST_SUCCESS,
REQUEST_FAILURE, REQUEST_FAILURE,
} from '../constants'; } from '../constants';
   
export default { export default {
components: { components: {
loadingButton, loadingButton,
identicon, identicon,
},
props: {
id: {
type: String,
required: true,
}, },
props: { title: {
id: { type: String,
type: String, required: true,
required: true,
},
title: {
type: String,
required: true,
},
titleLink: {
type: String,
required: false,
},
manageLink: {
type: String,
required: false,
},
logoUrl: {
type: String,
required: false,
default: null,
},
disabled: {
type: Boolean,
required: false,
default: false,
},
status: {
type: String,
required: false,
},
statusReason: {
type: String,
required: false,
},
requestStatus: {
type: String,
required: false,
},
requestReason: {
type: String,
required: false,
},
installApplicationRequestParams: {
type: Object,
required: false,
default: () => ({}),
},
}, },
computed: { titleLink: {
isUnknownStatus() { type: String,
return !this.isKnownStatus && this.status !== null; required: false,
}, },
isKnownStatus() { manageLink: {
return Object.values(APPLICATION_STATUS).includes(this.status); type: String,
}, required: false,
isInstalled() { },
return ( logoUrl: {
this.status === APPLICATION_STATUS.INSTALLED || this.status === APPLICATION_STATUS.UPDATED type: String,
); required: false,
}, default: null,
hasLogo() { },
return !!this.logoUrl; disabled: {
}, type: Boolean,
identiconId() { required: false,
// generate a deterministic integer id for the identicon background default: false,
return this.id.charCodeAt(0); },
}, status: {
rowJsClass() { type: String,
return `js-cluster-application-row-${this.id}`; required: false,
}, },
installButtonLoading() { statusReason: {
return !this.status || type: String,
this.status === APPLICATION_STATUS.SCHEDULED || required: false,
this.status === APPLICATION_STATUS.INSTALLING || },
this.requestStatus === REQUEST_LOADING; requestStatus: {
}, type: String,
installButtonDisabled() { required: false,
// Avoid the potential for the real-time data to say APPLICATION_STATUS.INSTALLABLE but },
// we already made a request to install and are just waiting for the real-time requestReason: {
// to sync up. type: String,
return ((this.status !== APPLICATION_STATUS.INSTALLABLE required: false,
&& this.status !== APPLICATION_STATUS.ERROR) || },
installApplicationRequestParams: {
type: Object,
required: false,
default: () => ({}),
},
},
computed: {
isUnknownStatus() {
return !this.isKnownStatus && this.status !== null;
},
isKnownStatus() {
return Object.values(APPLICATION_STATUS).includes(this.status);
},
isInstalled() {
return (
this.status === APPLICATION_STATUS.INSTALLED || this.status === APPLICATION_STATUS.UPDATED
);
},
hasLogo() {
return !!this.logoUrl;
},
identiconId() {
// generate a deterministic integer id for the identicon background
return this.id.charCodeAt(0);
},
rowJsClass() {
return `js-cluster-application-row-${this.id}`;
},
installButtonLoading() {
return (
!this.status ||
this.status === APPLICATION_STATUS.SCHEDULED ||
this.status === APPLICATION_STATUS.INSTALLING ||
this.requestStatus === REQUEST_LOADING
);
},
installButtonDisabled() {
// Avoid the potential for the real-time data to say APPLICATION_STATUS.INSTALLABLE but
// we already made a request to install and are just waiting for the real-time
// to sync up.
return (
((this.status !== APPLICATION_STATUS.INSTALLABLE &&
this.status !== APPLICATION_STATUS.ERROR) ||
this.requestStatus === REQUEST_LOADING || this.requestStatus === REQUEST_LOADING ||
this.requestStatus === REQUEST_SUCCESS) && this.isKnownStatus; this.requestStatus === REQUEST_SUCCESS) &&
}, this.isKnownStatus
installButtonLabel() { );
let label; },
if ( installButtonLabel() {
this.status === APPLICATION_STATUS.NOT_INSTALLABLE || let label;
this.status === APPLICATION_STATUS.INSTALLABLE || if (
this.status === APPLICATION_STATUS.ERROR || this.status === APPLICATION_STATUS.NOT_INSTALLABLE ||
this.isUnknownStatus this.status === APPLICATION_STATUS.INSTALLABLE ||
) { this.status === APPLICATION_STATUS.ERROR ||
label = s__('ClusterIntegration|Install'); this.isUnknownStatus
} else if (this.status === APPLICATION_STATUS.SCHEDULED || ) {
this.status === APPLICATION_STATUS.INSTALLING) { label = s__('ClusterIntegration|Install');
label = s__('ClusterIntegration|Installing'); } else if (
} else if (this.status === APPLICATION_STATUS.INSTALLED || this.status === APPLICATION_STATUS.SCHEDULED ||
this.status === APPLICATION_STATUS.UPDATED) { this.status === APPLICATION_STATUS.INSTALLING
label = s__('ClusterIntegration|Installed'); ) {
} label = s__('ClusterIntegration|Installing');
} else if (
this.status === APPLICATION_STATUS.INSTALLED ||
this.status === APPLICATION_STATUS.UPDATED
) {
label = s__('ClusterIntegration|Installed');
}
   
return label; return label;
}, },
showManageButton() { showManageButton() {
return this.manageLink && this.status === APPLICATION_STATUS.INSTALLED; return this.manageLink && this.status === APPLICATION_STATUS.INSTALLED;
}, },
manageButtonLabel() { manageButtonLabel() {
return s__('ClusterIntegration|Manage'); return s__('ClusterIntegration|Manage');
}, },
hasError() { hasError() {
return this.status === APPLICATION_STATUS.ERROR || return this.status === APPLICATION_STATUS.ERROR || this.requestStatus === REQUEST_FAILURE;
this.requestStatus === REQUEST_FAILURE; },
}, generalErrorDescription() {
generalErrorDescription() { return sprintf(s__('ClusterIntegration|Something went wrong while installing %{title}'), {
return sprintf( title: this.title,
s__('ClusterIntegration|Something went wrong while installing %{title}'), { });
title: this.title,
},
);
},
}, },
methods: { },
installClicked() { methods: {
eventHub.$emit('installApplication', { installClicked() {
id: this.id, eventHub.$emit('installApplication', {
params: this.installApplicationRequestParams, id: this.id,
}); params: this.installApplicationRequestParams,
}, });
}, },
}; },
};
</script> </script>
   
<template> <template>
Loading
Loading
Loading
@@ -76,12 +76,8 @@ export default class ClusterStore {
Loading
@@ -76,12 +76,8 @@ export default class ClusterStore {
this.state.status = serverState.status; this.state.status = serverState.status;
this.state.statusReason = serverState.status_reason; this.state.statusReason = serverState.status_reason;
   
serverState.applications.forEach((serverAppEntry) => { serverState.applications.forEach(serverAppEntry => {
const { const { name: appId, status, status_reason: statusReason } = serverAppEntry;
name: appId,
status,
status_reason: statusReason,
} = serverAppEntry;
   
this.state.applications[appId] = { this.state.applications[appId] = {
...(this.state.applications[appId] || {}), ...(this.state.applications[appId] || {}),
Loading
Loading
Loading
@@ -24,36 +24,44 @@ class CommentTypeToggle {
Loading
@@ -24,36 +24,44 @@ class CommentTypeToggle {
   
setConfig() { setConfig() {
const config = { const config = {
InputSetter: [{ InputSetter: [
input: this.noteTypeInput, {
valueAttribute: 'data-value', input: this.noteTypeInput,
}, valueAttribute: 'data-value',
{ },
input: this.submitButton, {
valueAttribute: 'data-submit-text', input: this.submitButton,
}], valueAttribute: 'data-submit-text',
},
],
}; };
   
if (this.closeButton) { if (this.closeButton) {
config.InputSetter.push({ config.InputSetter.push(
input: this.closeButton, {
valueAttribute: 'data-close-text', input: this.closeButton,
}, { valueAttribute: 'data-close-text',
input: this.closeButton, },
valueAttribute: 'data-close-text', {
inputAttribute: 'data-alternative-text', input: this.closeButton,
}); valueAttribute: 'data-close-text',
inputAttribute: 'data-alternative-text',
},
);
} }
   
if (this.reopenButton) { if (this.reopenButton) {
config.InputSetter.push({ config.InputSetter.push(
input: this.reopenButton, {
valueAttribute: 'data-reopen-text', input: this.reopenButton,
}, { valueAttribute: 'data-reopen-text',
input: this.reopenButton, },
valueAttribute: 'data-reopen-text', {
inputAttribute: 'data-alternative-text', input: this.reopenButton,
}); valueAttribute: 'data-reopen-text',
inputAttribute: 'data-alternative-text',
},
);
} }
   
return config; return config;
Loading
Loading
Loading
@@ -9,44 +9,60 @@ const viewModes = ['two-up', 'swipe'];
Loading
@@ -9,44 +9,60 @@ const viewModes = ['two-up', 'swipe'];
export default class ImageFile { export default class ImageFile {
constructor(file) { constructor(file) {
this.file = file; this.file = file;
this.requestImageInfo($('.two-up.view .frame.deleted img', this.file), (function(_this) { this.requestImageInfo(
return function(deletedWidth, deletedHeight) { $('.two-up.view .frame.deleted img', this.file),
return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), function(width, height) { (function(_this) {
_this.initViewModes(); return function(deletedWidth, deletedHeight) {
return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), function(
// Load two-up view after images are loaded width,
// so that we can display the correct width and height information height,
const $images = $('.two-up.view img', _this.file); ) {
_this.initViewModes();
$images.waitForImages(function() {
_this.initView('two-up'); // Load two-up view after images are loaded
// so that we can display the correct width and height information
const $images = $('.two-up.view img', _this.file);
$images.waitForImages(function() {
_this.initView('two-up');
});
}); });
}); };
}; })(this),
})(this)); );
} }
   
initViewModes() { initViewModes() {
const viewMode = viewModes[0]; const viewMode = viewModes[0];
$('.view-modes', this.file).removeClass('hide'); $('.view-modes', this.file).removeClass('hide');
$('.view-modes-menu', this.file).on('click', 'li', (function(_this) { $('.view-modes-menu', this.file).on(
return function(event) { 'click',
if (!$(event.currentTarget).hasClass('active')) { 'li',
return _this.activateViewMode(event.currentTarget.className); (function(_this) {
} return function(event) {
}; if (!$(event.currentTarget).hasClass('active')) {
})(this)); return _this.activateViewMode(event.currentTarget.className);
}
};
})(this),
);
return this.activateViewMode(viewMode); return this.activateViewMode(viewMode);
} }
   
activateViewMode(viewMode) { activateViewMode(viewMode) {
$('.view-modes-menu li', this.file).removeClass('active').filter("." + viewMode).addClass('active'); $('.view-modes-menu li', this.file)
return $(".view:visible:not(." + viewMode + ")", this.file).fadeOut(200, (function(_this) { .removeClass('active')
return function() { .filter('.' + viewMode)
$(".view." + viewMode, _this.file).fadeIn(200); .addClass('active');
return _this.initView(viewMode); return $('.view:visible:not(.' + viewMode + ')', this.file).fadeOut(
}; 200,
})(this)); (function(_this) {
return function() {
$('.view.' + viewMode, _this.file).fadeIn(200);
return _this.initView(viewMode);
};
})(this),
);
} }
   
initView(viewMode) { initView(viewMode) {
Loading
@@ -63,135 +79,154 @@ export default class ImageFile {
Loading
@@ -63,135 +79,154 @@ export default class ImageFile {
$body.css('user-select', 'none'); $body.css('user-select', 'none');
}); });
   
$body.off('mouseup').off('mousemove').on('mouseup', function() { $body
dragging = false; .off('mouseup')
$body.css('user-select', ''); .off('mousemove')
}) .on('mouseup', function() {
.on('mousemove', function(e) { dragging = false;
var left; $body.css('user-select', '');
if (!dragging) return; })
.on('mousemove', function(e) {
left = e.pageX - ($offsetEl.offset().left + padding); var left;
if (!dragging) return;
callback(e, left);
}); left = e.pageX - ($offsetEl.offset().left + padding);
callback(e, left);
});
} }
   
prepareFrames(view) { prepareFrames(view) {
var maxHeight, maxWidth; var maxHeight, maxWidth;
maxWidth = 0; maxWidth = 0;
maxHeight = 0; maxHeight = 0;
$('.frame', view).each((function(_this) { $('.frame', view)
return function(index, frame) { .each(
var height, width; (function(_this) {
width = $(frame).width(); return function(index, frame) {
height = $(frame).height(); var height, width;
maxWidth = width > maxWidth ? width : maxWidth; width = $(frame).width();
return maxHeight = height > maxHeight ? height : maxHeight; height = $(frame).height();
}; maxWidth = width > maxWidth ? width : maxWidth;
})(this)).css({ return (maxHeight = height > maxHeight ? height : maxHeight);
width: maxWidth, };
height: maxHeight })(this),
}); )
.css({
width: maxWidth,
height: maxHeight,
});
return [maxWidth, maxHeight]; return [maxWidth, maxHeight];
} }
   
views = { views = {
'two-up': function() { 'two-up': function() {
return $('.two-up.view .wrap', this.file).each((function(_this) { return $('.two-up.view .wrap', this.file).each(
return function(index, wrap) { (function(_this) {
$('img', wrap).each(function() { return function(index, wrap) {
var currentWidth; $('img', wrap).each(function() {
currentWidth = $(this).width(); var currentWidth;
if (currentWidth > availWidth / 2) { currentWidth = $(this).width();
return $(this).width(availWidth / 2); if (currentWidth > availWidth / 2) {
} return $(this).width(availWidth / 2);
}); }
return _this.requestImageInfo($('img', wrap), function(width, height) { });
$('.image-info .meta-width', wrap).text(width + "px"); return _this.requestImageInfo($('img', wrap), function(width, height) {
$('.image-info .meta-height', wrap).text(height + "px"); $('.image-info .meta-width', wrap).text(width + 'px');
return $('.image-info', wrap).removeClass('hide'); $('.image-info .meta-height', wrap).text(height + 'px');
}); return $('.image-info', wrap).removeClass('hide');
}; });
})(this)); };
})(this),
);
}, },
'swipe': function() { swipe() {
var maxHeight, maxWidth; var maxHeight, maxWidth;
maxWidth = 0; maxWidth = 0;
maxHeight = 0; maxHeight = 0;
return $('.swipe.view', this.file).each((function(_this) { return $('.swipe.view', this.file).each(
return function(index, view) { (function(_this) {
var $swipeWrap, $swipeBar, $swipeFrame, wrapPadding, ref; return function(index, view) {
ref = _this.prepareFrames(view), [maxWidth, maxHeight] = ref; var $swipeWrap, $swipeBar, $swipeFrame, wrapPadding, ref;
$swipeFrame = $('.swipe-frame', view); (ref = _this.prepareFrames(view)), ([maxWidth, maxHeight] = ref);
$swipeWrap = $('.swipe-wrap', view); $swipeFrame = $('.swipe-frame', view);
$swipeBar = $('.swipe-bar', view); $swipeWrap = $('.swipe-wrap', view);
$swipeBar = $('.swipe-bar', view);
$swipeFrame.css({
width: maxWidth + 16, $swipeFrame.css({
height: maxHeight + 28 width: maxWidth + 16,
}); height: maxHeight + 28,
$swipeWrap.css({ });
width: maxWidth + 1, $swipeWrap.css({
height: maxHeight + 2 width: maxWidth + 1,
}); height: maxHeight + 2,
// Set swipeBar left position to match image frame });
$swipeBar.css({ // Set swipeBar left position to match image frame
left: 1 $swipeBar.css({
}); left: 1,
});
wrapPadding = parseInt($swipeWrap.css('right').replace('px', ''), 10);
wrapPadding = parseInt($swipeWrap.css('right').replace('px', ''), 10);
_this.initDraggable($swipeBar, wrapPadding, function(e, left) {
if (left > 0 && left < $swipeFrame.width() - (wrapPadding * 2)) { _this.initDraggable($swipeBar, wrapPadding, function(e, left) {
$swipeWrap.width((maxWidth + 1) - left); if (left > 0 && left < $swipeFrame.width() - wrapPadding * 2) {
$swipeBar.css('left', left); $swipeWrap.width(maxWidth + 1 - left);
} $swipeBar.css('left', left);
}); }
}; });
})(this)); };
})(this),
);
}, },
'onion-skin': function() { 'onion-skin': function() {
var dragTrackWidth, maxHeight, maxWidth; var dragTrackWidth, maxHeight, maxWidth;
maxWidth = 0; maxWidth = 0;
maxHeight = 0; maxHeight = 0;
dragTrackWidth = $('.drag-track', this.file).width() - $('.dragger', this.file).width(); dragTrackWidth = $('.drag-track', this.file).width() - $('.dragger', this.file).width();
return $('.onion-skin.view', this.file).each((function(_this) { return $('.onion-skin.view', this.file).each(
return function(index, view) { (function(_this) {
var $frame, $track, $dragger, $frameAdded, framePadding, ref, dragging = false; return function(index, view) {
ref = _this.prepareFrames(view), [maxWidth, maxHeight] = ref; var $frame,
$frame = $('.onion-skin-frame', view); $track,
$frameAdded = $('.frame.added', view); $dragger,
$track = $('.drag-track', view); $frameAdded,
$dragger = $('.dragger', $track); framePadding,
ref,
$frame.css({ dragging = false;
width: maxWidth + 16, (ref = _this.prepareFrames(view)), ([maxWidth, maxHeight] = ref);
height: maxHeight + 28 $frame = $('.onion-skin-frame', view);
}); $frameAdded = $('.frame.added', view);
$('.swipe-wrap', view).css({ $track = $('.drag-track', view);
width: maxWidth + 1, $dragger = $('.dragger', $track);
height: maxHeight + 2
}); $frame.css({
$dragger.css({ width: maxWidth + 16,
left: dragTrackWidth height: maxHeight + 28,
}); });
$('.swipe-wrap', view).css({
$frameAdded.css('opacity', 1); width: maxWidth + 1,
framePadding = parseInt($frameAdded.css('right').replace('px', ''), 10); height: maxHeight + 2,
});
_this.initDraggable($dragger, framePadding, function(e, left) { $dragger.css({
var opacity = left / dragTrackWidth; left: dragTrackWidth,
});
if (opacity >= 0 && opacity <= 1) {
$dragger.css('left', left); $frameAdded.css('opacity', 1);
$frameAdded.css('opacity', opacity); framePadding = parseInt($frameAdded.css('right').replace('px', ''), 10);
}
}); _this.initDraggable($dragger, framePadding, function(e, left) {
}; var opacity = left / dragTrackWidth;
})(this));
} if (opacity >= 0 && opacity <= 1) {
} $dragger.css('left', left);
$frameAdded.css('opacity', opacity);
}
});
};
})(this),
);
},
};
   
requestImageInfo(img, callback) { requestImageInfo(img, callback) {
const domImg = img.get(0); const domImg = img.get(0);
Loading
@@ -199,11 +234,14 @@ export default class ImageFile {
Loading
@@ -199,11 +234,14 @@ export default class ImageFile {
if (domImg.complete) { if (domImg.complete) {
return callback.call(this, domImg.naturalWidth, domImg.naturalHeight); return callback.call(this, domImg.naturalWidth, domImg.naturalHeight);
} else { } else {
return img.on('load', (function(_this) { return img.on(
return function() { 'load',
return callback.call(_this, domImg.naturalWidth, domImg.naturalHeight); (function(_this) {
}; return function() {
})(this)); return callback.call(_this, domImg.naturalWidth, domImg.naturalHeight);
};
})(this),
);
} }
} }
} }
Loading
Loading
Loading
@@ -19,11 +19,13 @@ export default () => {
Loading
@@ -19,11 +19,13 @@ export default () => {
const pipelineTableViewEl = document.querySelector('#commit-pipeline-table-view'); const pipelineTableViewEl = document.querySelector('#commit-pipeline-table-view');
   
if (pipelineTableViewEl) { if (pipelineTableViewEl) {
// Update MR and Commits tabs // Update MR and Commits tabs
pipelineTableViewEl.addEventListener('update-pipelines-count', (event) => { pipelineTableViewEl.addEventListener('update-pipelines-count', event => {
if (event.detail.pipelines && if (
event.detail.pipelines &&
event.detail.pipelines.count && event.detail.pipelines.count &&
event.detail.pipelines.count.all) { event.detail.pipelines.count.all
) {
const badge = document.querySelector('.js-pipelines-mr-count'); const badge = document.querySelector('.js-pipelines-mr-count');
   
badge.textContent = event.detail.pipelines.count.all; badge.textContent = event.detail.pipelines.count.all;
Loading
Loading
<script> <script>
import PipelinesService from '../../pipelines/services/pipelines_service'; import PipelinesService from '../../pipelines/services/pipelines_service';
import PipelineStore from '../../pipelines/stores/pipelines_store'; import PipelineStore from '../../pipelines/stores/pipelines_store';
import pipelinesMixin from '../../pipelines/mixins/pipelines'; import pipelinesMixin from '../../pipelines/mixins/pipelines';
   
export default { export default {
mixins: [ mixins: [pipelinesMixin],
pipelinesMixin, props: {
], endpoint: {
props: { type: String,
endpoint: { required: true,
type: String,
required: true,
},
helpPagePath: {
type: String,
required: true,
},
autoDevopsHelpPath: {
type: String,
required: true,
},
errorStateSvgPath: {
type: String,
required: true,
},
viewType: {
type: String,
required: false,
default: 'child',
},
}, },
helpPagePath: {
type: String,
required: true,
},
autoDevopsHelpPath: {
type: String,
required: true,
},
errorStateSvgPath: {
type: String,
required: true,
},
viewType: {
type: String,
required: false,
default: 'child',
},
},
   
data() { data() {
const store = new PipelineStore(); const store = new PipelineStore();
   
return { return {
store, store,
state: store.state, state: store.state,
}; };
}, },
   
computed: { computed: {
shouldRenderTable() { shouldRenderTable() {
return !this.isLoading && return !this.isLoading && this.state.pipelines.length > 0 && !this.hasError;
this.state.pipelines.length > 0 &&
!this.hasError;
},
shouldRenderErrorState() {
return this.hasError && !this.isLoading;
},
}, },
created() { shouldRenderErrorState() {
this.service = new PipelinesService(this.endpoint); return this.hasError && !this.isLoading;
}, },
methods: { },
successCallback(resp) { created() {
// depending of the endpoint the response can either bring a `pipelines` key or not. this.service = new PipelinesService(this.endpoint);
const pipelines = resp.data.pipelines || resp.data; },
this.setCommonData(pipelines); methods: {
successCallback(resp) {
// depending of the endpoint the response can either bring a `pipelines` key or not.
const pipelines = resp.data.pipelines || resp.data;
this.setCommonData(pipelines);
   
const updatePipelinesEvent = new CustomEvent('update-pipelines-count', { const updatePipelinesEvent = new CustomEvent('update-pipelines-count', {
detail: { detail: {
pipelines: resp.data, pipelines: resp.data,
}, },
}); });
   
// notifiy to update the count in tabs // notifiy to update the count in tabs
if (this.$el.parentElement) { if (this.$el.parentElement) {
this.$el.parentElement.dispatchEvent(updatePipelinesEvent); this.$el.parentElement.dispatchEvent(updatePipelinesEvent);
} }
},
}, },
}; },
};
</script> </script>
<template> <template>
<div class="content-list pipelines"> <div class="content-list pipelines">
Loading
Loading
Loading
@@ -50,7 +50,7 @@ export function createContent(mergeRequests) {
Loading
@@ -50,7 +50,7 @@ export function createContent(mergeRequests) {
if (mergeRequests.length === 0) { if (mergeRequests.length === 0) {
$content.text(s__('Commits|No related merge requests found')); $content.text(s__('Commits|No related merge requests found'));
} else { } else {
mergeRequests.forEach((mergeRequest) => { mergeRequests.forEach(mergeRequest => {
const $header = createHeader($content.children().length, mergeRequests.length); const $header = createHeader($content.children().length, mergeRequests.length);
const $item = createItem(mergeRequest); const $item = createItem(mergeRequest);
$content.append($header); $content.append($header);
Loading
@@ -64,8 +64,9 @@ export function createContent(mergeRequests) {
Loading
@@ -64,8 +64,9 @@ export function createContent(mergeRequests) {
export function fetchCommitMergeRequests() { export function fetchCommitMergeRequests() {
const $container = $('.merge-requests'); const $container = $('.merge-requests');
   
axios.get($container.data('projectCommitPath')) axios
.then((response) => { .get($container.data('projectCommitPath'))
.then(response => {
const $content = createContent(response.data); const $content = createContent(response.data);
   
$container.html($content); $container.html($content);
Loading
Loading
Loading
@@ -32,22 +32,31 @@ export default class CommitsList {
Loading
@@ -32,22 +32,31 @@ export default class CommitsList {
if (search === this.lastSearch) return Promise.resolve(); if (search === this.lastSearch) return Promise.resolve();
const commitsUrl = `${form.attr('action')}?${form.serialize()}`; const commitsUrl = `${form.attr('action')}?${form.serialize()}`;
this.content.fadeTo('fast', 0.5); this.content.fadeTo('fast', 0.5);
const params = form.serializeArray().reduce((acc, obj) => Object.assign(acc, { const params = form.serializeArray().reduce(
[obj.name]: obj.value, (acc, obj) =>
}), {}); Object.assign(acc, {
[obj.name]: obj.value,
}),
{},
);
   
return axios.get(form.attr('action'), { return axios
params, .get(form.attr('action'), {
}) params,
})
.then(({ data }) => { .then(({ data }) => {
this.lastSearch = search; this.lastSearch = search;
this.content.html(data.html); this.content.html(data.html);
this.content.fadeTo('fast', 1.0); this.content.fadeTo('fast', 1.0);
   
// Change url so if user reload a page - search results are saved // Change url so if user reload a page - search results are saved
window.history.replaceState({ window.history.replaceState(
page: commitsUrl, {
}, document.title, commitsUrl); page: commitsUrl,
},
document.title,
commitsUrl,
);
}) })
.catch(() => { .catch(() => {
this.content.fadeTo('fast', 1.0); this.content.fadeTo('fast', 1.0);
Loading
@@ -75,8 +84,15 @@ export default class CommitsList {
Loading
@@ -75,8 +84,15 @@ export default class CommitsList {
processedData = $processedData.not(`li.js-commit-header[data-day='${loadedShownDayFirst}']`); processedData = $processedData.not(`li.js-commit-header[data-day='${loadedShownDayFirst}']`);
   
// Update commits count in the previous commits header. // Update commits count in the previous commits header.
commitsCount += Number($(processedData).nextUntil('li.js-commit-header').first().find('li.commit').length); commitsCount += Number(
$commitsHeadersLast.find('span.commits-count').text(`${commitsCount} ${pluralize('commit', commitsCount)}`); $(processedData)
.nextUntil('li.js-commit-header')
.first()
.find('li.commit').length,
);
$commitsHeadersLast
.find('span.commits-count')
.text(`${commitsCount} ${pluralize('commit', commitsCount)}`);
} }
   
localTimeAgo($processedData.find('.js-timeago')); localTimeAgo($processedData.find('.js-timeago'));
Loading
Loading
Loading
@@ -5,6 +5,14 @@ import 'bootstrap';
Loading
@@ -5,6 +5,14 @@ import 'bootstrap';
   
// custom jQuery functions // custom jQuery functions
$.fn.extend({ $.fn.extend({
disable() { return $(this).prop('disabled', true).addClass('disabled'); }, disable() {
enable() { return $(this).prop('disabled', false).removeClass('disabled'); }, return $(this)
.prop('disabled', true)
.addClass('disabled');
},
enable() {
return $(this)
.prop('disabled', false)
.removeClass('disabled');
},
}); });
Loading
@@ -13,19 +13,23 @@ function openConfirmDangerModal($form, text) {
Loading
@@ -13,19 +13,23 @@ function openConfirmDangerModal($form, text) {
$submit.disable(); $submit.disable();
$input.focus(); $input.focus();
   
$('.js-confirm-danger-input').off('input').on('input', function handleInput() { $('.js-confirm-danger-input')
const confirmText = rstrip($(this).val()); .off('input')
if (confirmText === confirmTextMatch) { .on('input', function handleInput() {
$submit.enable(); const confirmText = rstrip($(this).val());
} else { if (confirmText === confirmTextMatch) {
$submit.disable(); $submit.enable();
} } else {
}); $submit.disable();
$('.js-confirm-danger-submit').off('click').on('click', () => $form.submit()); }
});
$('.js-confirm-danger-submit')
.off('click')
.on('click', () => $form.submit());
} }
   
export default function initConfirmDangerModal() { export default function initConfirmDangerModal() {
$(document).on('click', '.js-confirm-danger', (e) => { $(document).on('click', '.js-confirm-danger', e => {
e.preventDefault(); e.preventDefault();
const $btn = $(e.target); const $btn = $(e.target);
const $form = $btn.closest('form'); const $form = $btn.closest('form');
Loading
Loading
Loading
@@ -20,8 +20,11 @@ export default class ContextualSidebar {
Loading
@@ -20,8 +20,11 @@ export default class ContextualSidebar {
} }
   
bindEvents() { bindEvents() {
document.addEventListener('click', (e) => { document.addEventListener('click', e => {
if (!e.target.closest('.nav-sidebar') && (bp.getBreakpointSize() === 'sm' || bp.getBreakpointSize() === 'md')) { if (
!e.target.closest('.nav-sidebar') &&
(bp.getBreakpointSize() === 'sm' || bp.getBreakpointSize() === 'md')
) {
this.toggleCollapsedSidebar(true); this.toggleCollapsedSidebar(true);
} }
}); });
Loading
Loading
Loading
@@ -36,7 +36,7 @@ export default class CreateItemDropdown {
Loading
@@ -36,7 +36,7 @@ export default class CreateItemDropdown {
}, },
selectable: true, selectable: true,
toggleLabel(selected) { toggleLabel(selected) {
return (selected && 'id' in selected) ? _.escape(selected.title) : this.defaultToggleLabel; return selected && 'id' in selected ? _.escape(selected.title) : this.defaultToggleLabel;
}, },
fieldName: this.fieldName, fieldName: this.fieldName,
text(item) { text(item) {
Loading
@@ -46,7 +46,7 @@ export default class CreateItemDropdown {
Loading
@@ -46,7 +46,7 @@ export default class CreateItemDropdown {
return _.escape(item.id); return _.escape(item.id);
}, },
onFilter: this.toggleCreateNewButton.bind(this), onFilter: this.toggleCreateNewButton.bind(this),
clicked: (options) => { clicked: options => {
options.e.preventDefault(); options.e.preventDefault();
this.onSelect(); this.onSelect();
}, },
Loading
@@ -77,9 +77,8 @@ export default class CreateItemDropdown {
Loading
@@ -77,9 +77,8 @@ export default class CreateItemDropdown {
getData(term, callback) { getData(term, callback) {
this.getDataOption(term, (data = []) => { this.getDataOption(term, (data = []) => {
// Ensure the selected item isn't already in the data to avoid duplicates // Ensure the selected item isn't already in the data to avoid duplicates
const alreadyHasSelectedItem = this.selectedItem && data.some(item => const alreadyHasSelectedItem =
item.id === this.selectedItem.id, this.selectedItem && data.some(item => item.id === this.selectedItem.id);
);
   
let uniqueData = data; let uniqueData = data;
if (!alreadyHasSelectedItem) { if (!alreadyHasSelectedItem) {
Loading
@@ -106,9 +105,7 @@ export default class CreateItemDropdown {
Loading
@@ -106,9 +105,7 @@ export default class CreateItemDropdown {
if (newValue) { if (newValue) {
this.selectedItem = this.createNewItemFromValue(newValue); this.selectedItem = this.createNewItemFromValue(newValue);
   
this.$dropdownContainer this.$dropdownContainer.find('.js-dropdown-create-new-item code').text(newValue);
.find('.js-dropdown-create-new-item code')
.text(newValue);
} }
   
this.toggleFooter(!newValue); this.toggleFooter(!newValue);
Loading
Loading
Loading
@@ -37,7 +37,7 @@ export default class CreateLabelDropdown {
Loading
@@ -37,7 +37,7 @@ export default class CreateLabelDropdown {
addBinding() { addBinding() {
const self = this; const self = this;
   
this.$colorSuggestions.on('click', function (e) { this.$colorSuggestions.on('click', function(e) {
const $this = $(this); const $this = $(this);
self.addColorValue(e, $this); self.addColorValue(e, $this);
}); });
Loading
@@ -47,7 +47,7 @@ export default class CreateLabelDropdown {
Loading
@@ -47,7 +47,7 @@ export default class CreateLabelDropdown {
   
this.$dropdownBack.on('click', this.resetForm.bind(this)); this.$dropdownBack.on('click', this.resetForm.bind(this));
   
this.$cancelButton.on('click', function (e) { this.$cancelButton.on('click', function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
   
Loading
@@ -79,13 +79,9 @@ export default class CreateLabelDropdown {
Loading
@@ -79,13 +79,9 @@ export default class CreateLabelDropdown {
} }
   
resetForm() { resetForm() {
this.$newLabelField this.$newLabelField.val('').trigger('change');
.val('')
.trigger('change');
   
this.$newColorField this.$newColorField.val('').trigger('change');
.val('')
.trigger('change');
   
this.$colorPreview this.$colorPreview
.css('background-color', '') .css('background-color', '')
Loading
@@ -97,31 +93,34 @@ export default class CreateLabelDropdown {
Loading
@@ -97,31 +93,34 @@ export default class CreateLabelDropdown {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
   
Api.newLabel(this.namespacePath, this.projectPath, { Api.newLabel(
title: this.$newLabelField.val(), this.namespacePath,
color: this.$newColorField.val(), this.projectPath,
}, (label) => { {
this.$newLabelCreateButton.enable(); title: this.$newLabelField.val(),
color: this.$newColorField.val(),
if (label.message) { },
let errors; label => {
this.$newLabelCreateButton.enable();
if (typeof label.message === 'string') {
errors = label.message; if (label.message) {
let errors;
if (typeof label.message === 'string') {
errors = label.message;
} else {
errors = Object.keys(label.message)
.map(key => `${humanize(key)} ${label.message[key].join(', ')}`)
.join('<br/>');
}
this.$newLabelError.html(errors).show();
} else { } else {
errors = Object.keys(label.message).map(key => this.$dropdownBack.trigger('click');
`${humanize(key)} ${label.message[key].join(', ')}`,
).join('<br/>');
}
   
this.$newLabelError $(document).trigger('created.label', label);
.html(errors) }
.show(); },
} else { );
this.$dropdownBack.trigger('click');
$(document).trigger('created.label', label);
}
});
} }
} }
Loading
@@ -95,8 +95,10 @@ export default {
Loading
@@ -95,8 +95,10 @@ export default {
.catch(() => new Flash(s__('DeployKeys|Error enabling deploy key'))); .catch(() => new Flash(s__('DeployKeys|Error enabling deploy key')));
}, },
disableKey(deployKey, callback) { disableKey(deployKey, callback) {
// eslint-disable-next-line no-alert if (
if (window.confirm(s__('DeployKeys|You are going to remove this deploy key. Are you sure?'))) { // eslint-disable-next-line no-alert
window.confirm(s__('DeployKeys|You are going to remove this deploy key. Are you sure?'))
) {
this.service this.service
.disableKey(deployKey.id) .disableKey(deployKey.id)
.then(this.fetchKeys) .then(this.fetchKeys)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment