Skip to content
Snippets Groups Projects
Commit 80f61b40 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 4ab54c22
No related branches found
No related tags found
No related merge requests found
Showing
with 107 additions and 89 deletions
Loading
Loading
@@ -21,5 +21,4 @@ export default {
resizeCoordinatesToImageElement: utilsHelper.resizeCoordinatesToImageElement,
generateBadgeFromDiscussionDOM: utilsHelper.generateBadgeFromDiscussionDOM,
getTargetSelection: utilsHelper.getTargetSelection,
initImageDiff: utilsHelper.initImageDiff,
};
import ImageDiff from '../image_diff';
import ReplacedImageDiff from '../replaced_image_diff';
import ImageFile from '../../commit/image_file';
function initImageDiff(fileEl, canCreateNote, renderCommentBadge) {
const options = {
canCreateNote,
renderCommentBadge,
};
let diff;
// ImageFile needs to be invoked before initImageDiff so that badges
// can mount to the correct location
new ImageFile(fileEl); // eslint-disable-line no-new
if (fileEl.querySelector('.diff-file .js-single-image')) {
diff = new ImageDiff(fileEl, options);
diff.init();
} else if (fileEl.querySelector('.diff-file .js-replaced-image')) {
diff = new ReplacedImageDiff(fileEl, options);
diff.init();
}
return diff;
}
export default { initImageDiff };
import ImageBadge from '../image_badge';
import ImageDiff from '../image_diff';
import ReplacedImageDiff from '../replaced_image_diff';
import ImageFile from '../../commit/image_file';
 
export function resizeCoordinatesToImageElement(imageEl, meta) {
const { x, y, width, height } = meta;
Loading
Loading
@@ -70,25 +67,3 @@ export function getTargetSelection(event) {
},
};
}
export function initImageDiff(fileEl, canCreateNote, renderCommentBadge) {
const options = {
canCreateNote,
renderCommentBadge,
};
let diff;
// ImageFile needs to be invoked before initImageDiff so that badges
// can mount to the correct location
new ImageFile(fileEl); // eslint-disable-line no-new
if (fileEl.querySelector('.diff-file .js-single-image')) {
diff = new ImageDiff(fileEl, options);
diff.init();
} else if (fileEl.querySelector('.diff-file .js-replaced-image')) {
diff = new ReplacedImageDiff(fileEl, options);
diff.init();
}
return diff;
}
import imageDiffHelper from './helpers/index';
import initImageDiffHelper from './helpers/init_image_diff';
 
export default () => {
// Always pass can-create-note as false because a user
Loading
Loading
@@ -8,6 +8,6 @@ export default () => {
 
const diffFileEls = document.querySelectorAll('.timeline-content .diff-file.js-image-file');
[...diffFileEls].forEach(diffFileEl =>
imageDiffHelper.initImageDiff(diffFileEl, canCreateNote, renderCommentBadge),
initImageDiffHelper.initImageDiff(diffFileEl, canCreateNote, renderCommentBadge),
);
};
Loading
Loading
@@ -102,10 +102,10 @@ export default {
required: false,
default: '',
},
issuableTemplates: {
type: Array,
issuableTemplateNamesPath: {
type: String,
required: false,
default: () => [],
default: '',
},
markdownPreviewPath: {
type: String,
Loading
Loading
@@ -156,9 +156,13 @@ export default {
store,
state: store.state,
showForm: false,
templatesRequested: false,
};
},
computed: {
issuableTemplates() {
return this.store.formState.issuableTemplates;
},
formState() {
return this.store.formState;
},
Loading
Loading
@@ -233,6 +237,7 @@ export default {
}
return undefined;
},
updateStoreState() {
return this.service
.getData()
Loading
Loading
@@ -245,7 +250,7 @@ export default {
});
},
 
openForm() {
updateAndShowForm(templates = []) {
if (!this.showForm) {
this.showForm = true;
this.store.setFormState({
Loading
Loading
@@ -254,9 +259,32 @@ export default {
lock_version: this.state.lock_version,
lockedWarningVisible: false,
updateLoading: false,
issuableTemplates: templates,
});
}
},
requestTemplatesAndShowForm() {
return this.service
.loadTemplates(this.issuableTemplateNamesPath)
.then(res => {
this.updateAndShowForm(res.data);
})
.catch(() => {
createFlash(this.defaultErrorMessage);
this.updateAndShowForm();
});
},
openForm() {
if (!this.templatesRequested) {
this.templatesRequested = true;
this.requestTemplatesAndShowForm();
} else {
this.updateAndShowForm(this.issuableTemplates);
}
},
closeForm() {
this.showForm = false;
},
Loading
Loading
Loading
Loading
@@ -17,4 +17,13 @@ export default class Service {
updateIssuable(data) {
return axios.put(this.endpoint, data);
}
// eslint-disable-next-line class-methods-use-this
loadTemplates(templateNamesEndpoint) {
if (!templateNamesEndpoint) {
return Promise.resolve([]);
}
return axios.get(templateNamesEndpoint);
}
}
Loading
Loading
@@ -9,6 +9,7 @@ export default class Store {
lockedWarningVisible: false,
updateLoading: false,
lock_version: 0,
issuableTemplates: [],
};
}
 
Loading
Loading
/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, prefer-template, no-new, consistent-return, object-shorthand, no-shadow, no-param-reassign, vars-on-top, no-lonely-if, no-else-return, dot-notation, no-empty */
/* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, prefer-template, no-new, consistent-return, no-shadow, no-param-reassign, vars-on-top, no-lonely-if, no-else-return, dot-notation, no-empty */
/* global Issuable */
/* global ListLabel */
 
Loading
Loading
@@ -197,8 +197,8 @@ export default class LabelsSelect {
.catch(() => flash(__('Error saving label update.')));
};
$dropdown.glDropdown({
showMenuAbove: showMenuAbove,
data: function(term, callback) {
showMenuAbove,
data(term, callback) {
labelUrl = $dropdown.attr('data-labels');
axios
.get(labelUrl)
Loading
Loading
@@ -231,7 +231,7 @@ export default class LabelsSelect {
})
.catch(() => flash(__('Error fetching labels.')));
},
renderRow: function(label) {
renderRow(label) {
var linkEl,
listItemEl,
colorEl,
Loading
Loading
@@ -316,7 +316,7 @@ export default class LabelsSelect {
selectable: true,
filterable: true,
selected: $dropdown.data('selected') || [],
toggleLabel: function(selected, el) {
toggleLabel(selected, el) {
var $dropdownParent = $dropdown.parent();
var $dropdownInputField = $dropdownParent.find('.dropdown-input-field');
var isSelected = el !== null ? el.hasClass('is-active') : false;
Loading
Loading
@@ -350,7 +350,7 @@ export default class LabelsSelect {
}
},
fieldName: $dropdown.data('fieldName'),
id: function(label) {
id(label) {
if (label.id <= 0) return label.title;
 
if ($dropdown.hasClass('js-issuable-form-dropdown')) {
Loading
Loading
@@ -363,7 +363,7 @@ export default class LabelsSelect {
return label.id;
}
},
hidden: function() {
hidden() {
var isIssueIndex, isMRIndex, page;
page = $('body').attr('data-page');
isIssueIndex = page === 'projects:issues:index';
Loading
Loading
@@ -394,7 +394,7 @@ export default class LabelsSelect {
},
multiSelect: $dropdown.hasClass('js-multiselect'),
vue: $dropdown.hasClass('js-issue-board-sidebar'),
clicked: function(clickEvent) {
clicked(clickEvent) {
const { $el, e, isMarking } = clickEvent;
const label = clickEvent.selectedObj;
 
Loading
Loading
@@ -478,7 +478,7 @@ export default class LabelsSelect {
}
}
},
opened: function() {
opened() {
if ($dropdown.hasClass('js-issue-board-sidebar')) {
const previousSelection = $dropdown.attr('data-selected');
this.selected = previousSelection ? previousSelection.split(',') : [];
Loading
Loading
Loading
Loading
@@ -92,7 +92,7 @@ export default class LazyLoader {
onIntersection = entries => {
entries.forEach(entry => {
// We are using `intersectionRatio > 0` over `isIntersecting`, as some browsers did not ship the latter
// See: https://gitlab.com/gitlab-org/gitlab-ce/issues/54407
// See: https://gitlab.com/gitlab-org/gitlab-foss/issues/54407
if (entry.intersectionRatio > 0) {
this.intersectionObserver.unobserve(entry.target);
this.lazyImages.push(entry.target);
Loading
Loading
/* eslint-disable func-names, no-var, consistent-return, prefer-arrow-callback, no-return-assign, object-shorthand */
/* eslint-disable func-names, no-var, consistent-return, prefer-arrow-callback, no-return-assign */
 
function notificationGranted(message, opts, onclick) {
var notification;
Loading
Loading
@@ -21,8 +21,8 @@ function notifyPermissions() {
function notifyMe(message, body, icon, onclick) {
var opts;
opts = {
body: body,
icon: icon,
body,
icon,
};
// Let's check if the browser supports notifications
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@ import _ from 'underscore';
@returns {String} the text with parameters replaces (e.g. '5 users use us')
 
@see https://ruby-doc.org/core-2.3.3/Kernel.html#method-i-sprintf
@see https://gitlab.com/gitlab-org/gitlab-ce/issues/37992
@see https://gitlab.com/gitlab-org/gitlab-foss/issues/37992
*/
export default (input, parameters, escapeParameters = true) => {
let output = input;
Loading
Loading
Loading
Loading
@@ -37,6 +37,7 @@ import GlFieldErrors from './gl_field_errors';
import initUserPopovers from './user_popovers';
import { initUserTracking } from './tracking';
import { __ } from './locale';
import initPrivacyPolicyUpdateCallout from './privacy_policy_update_callout';
 
import 'ee_else_ce/main_ee';
 
Loading
Loading
@@ -96,6 +97,7 @@ function deferredInitialisation() {
initUsagePingConsent();
initUserPopovers();
initUserTracking();
initPrivacyPolicyUpdateCallout();
 
if (document.querySelector('.search')) initSearchAutocomplete();
 
Loading
Loading
/* eslint-disable no-useless-computed-key, object-shorthand, no-param-reassign */
/* eslint-disable no-param-reassign */
/* global ace */
 
import Vue from 'vue';
Loading
Loading
@@ -42,7 +42,7 @@ import getModeByFileExtension from '~/lib/utils/ace_utils';
},
},
watch: {
['file.showEditor'](val) {
'file.showEditor': function showEditorWatcher(val) {
this.resetEditorContent();
 
if (!val || this.fileLoaded || this.loading) {
Loading
Loading
/* eslint-disable object-shorthand, no-param-reassign, camelcase, no-nested-ternary, no-continue */
/* eslint-disable no-param-reassign, camelcase, no-nested-ternary, no-continue */
 
import $ from 'jquery';
import Vue from 'vue';
Loading
Loading
@@ -31,7 +31,7 @@ import { s__ } from '~/locale';
hasError: false,
isSubmitting: false,
isParallel: diffViewType === VIEW_TYPES.PARALLEL,
diffViewType: diffViewType,
diffViewType,
conflictsData: {},
},
 
Loading
Loading
@@ -188,7 +188,7 @@ import { s__ } from '~/locale';
 
getHeadHeaderLine(id) {
return {
id: id,
id,
richText: HEAD_HEADER_TEXT,
buttonTitle: HEAD_BUTTON_TITLE,
type: 'new',
Loading
Loading
@@ -233,7 +233,7 @@ import { s__ } from '~/locale';
 
getOriginHeaderLine(id) {
return {
id: id,
id,
richText: ORIGIN_HEADER_TEXT,
buttonTitle: ORIGIN_BUTTON_TITLE,
type: 'old',
Loading
Loading
/* eslint-disable one-var, object-shorthand, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */
/* eslint-disable one-var, no-else-return, no-self-compare, consistent-return, no-param-reassign, no-shadow */
/* global Issuable */
/* global ListMilestone */
 
Loading
Loading
@@ -65,7 +65,7 @@ export default class MilestoneSelect {
milestoneLinkNoneTemplate = `<span class="no-value">${__('None')}</span>`;
}
return $dropdown.glDropdown({
showMenuAbove: showMenuAbove,
showMenuAbove,
data: (term, callback) =>
axios.get(milestonesUrl).then(({ data }) => {
const extraOptions = [];
Loading
Loading
@@ -126,7 +126,7 @@ export default class MilestoneSelect {
return defaultLabel;
}
},
defaultLabel: defaultLabel,
defaultLabel,
fieldName: $dropdown.data('fieldName'),
text: milestone => _.escape(milestone.title),
id: milestone => {
Loading
Loading
<script>
import { __ } from '~/locale';
import { mapState } from 'vuex';
import { GlLink, GlButton } from '@gitlab/ui';
import { GlAreaChart, GlLineChart, GlChartSeriesLabel } from '@gitlab/ui/dist/charts';
import dateFormat from 'dateformat';
Loading
Loading
@@ -70,7 +69,6 @@ export default {
};
},
computed: {
...mapState('monitoringDashboard', ['exportMetricsToCsvEnabled']),
chartData() {
// Transforms & supplements query data to render appropriate labels & styles
// Input: [{ queryAttributes1 }, { queryAttributes2 }]
Loading
Loading
@@ -190,18 +188,6 @@ export default {
yAxisLabel() {
return `${this.graphData.y_label}`;
},
csvText() {
const chartData = this.chartData[0].data;
const header = `timestamp,${this.graphData.y_label}\r\n`; // eslint-disable-line @gitlab/i18n/no-non-i18n-strings
return chartData.reduce((csv, data) => {
const row = data.join(',');
return `${csv}${row}\r\n`;
}, header);
},
downloadLink() {
const data = new Blob([this.csvText], { type: 'text/plain' });
return window.URL.createObjectURL(data);
},
},
watch: {
containerWidth: 'onResize',
Loading
Loading
@@ -270,16 +256,6 @@ export default {
<div class="prometheus-graph">
<div class="prometheus-graph-header">
<h5 class="prometheus-graph-title js-graph-title">{{ graphData.title }}</h5>
<gl-button
v-if="exportMetricsToCsvEnabled"
:href="downloadLink"
:title="__('Download CSV')"
:aria-label="__('Download CSV')"
style="margin-left: 200px;"
download="chart_metrics.csv"
>
{{ __('Download CSV') }}
</gl-button>
<div class="prometheus-graph-widgets js-graph-widgets">
<slot></slot>
</div>
Loading
Loading
Loading
Loading
@@ -262,7 +262,7 @@ export default {
return window.URL.createObjectURL(data);
},
// TODO: BEGIN, Duplicated code with panel_type until feature flag is removed
// Issue number: https://gitlab.com/gitlab-org/gitlab-ce/issues/63845
// Issue number: https://gitlab.com/gitlab-org/gitlab-foss/issues/63845
getGraphAlerts(queries) {
if (!this.allAlerts) return {};
const metricIdsForChart = queries.map(q => q.metricId);
Loading
Loading
/* eslint-disable func-names, object-shorthand, no-else-return, prefer-template, prefer-arrow-callback */
/* eslint-disable func-names, no-else-return, prefer-template, prefer-arrow-callback */
 
import $ from 'jquery';
import Api from './api';
Loading
Loading
@@ -18,15 +18,15 @@ export default class NamespaceSelect {
search: {
fields: ['path'],
},
fieldName: fieldName,
toggleLabel: function(selected) {
fieldName,
toggleLabel(selected) {
if (selected.id == null) {
return selected.text;
} else {
return selected.kind + ': ' + selected.full_path;
}
},
data: function(term, dataCallback) {
data(term, dataCallback) {
return Api.namespaces(term, function(namespaces) {
if (isFilter) {
const anyNamespace = {
Loading
Loading
@@ -39,7 +39,7 @@ export default class NamespaceSelect {
return dataCallback(namespaces);
});
},
text: function(namespace) {
text(namespace) {
if (namespace.id == null) {
return namespace.text;
} else {
Loading
Loading
Loading
Loading
@@ -36,10 +36,11 @@ export default {
},
},
computed: {
resolvableNotes() {
return this.discussion.notes.filter(x => x.resolvable);
},
userCanResolveDiscussion() {
return this.discussion.notes.every(
note => note.current_user && note.current_user.can_resolve,
);
return this.resolvableNotes.every(note => note.current_user && note.current_user.can_resolve);
},
},
};
Loading
Loading
Loading
Loading
@@ -98,7 +98,7 @@ export default {
// We need to do this to ensure we have the correct sentence order
// when translating this as the sentence order may change from one
// language to the next. See:
// https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24427#note_133713771
// https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/24427#note_133713771
const { id, url } = this.commit;
const commitLink = `<a class="commit-sha monospace" href="${escape(url)}">${truncateSha(
id,
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