Commit bf213f07 authored by 🤖 GitLab Bot 🤖's avatar 🤖 GitLab Bot 🤖
Browse files

Add latest changes from gitlab-org/gitlab@master

parent dd2da214
......@@ -23,6 +23,3 @@ export const receiveStatisticsError = ({ commit }, error) => {
commit(types.RECEIVE_STATISTICS_ERROR, error);
createFlash(s__('AdminDashboard|Error loading the statistics. Please try again'));
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -3,6 +3,7 @@
* and returns an array of the following form:
* [{ key: "forks", label: "Forks", value: 50 }]
*/
// eslint-disable-next-line import/prefer-default-export
export const getStatistics = state => labels =>
Object.keys(labels).map(key => {
const result = {
......@@ -12,6 +13,3 @@ export const getStatistics = state => labels =>
};
return result;
});
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -146,6 +146,3 @@ export const expandAllDiscussions = ({ dispatch, state }) =>
export const toggleResolveDiscussion = ({ commit }, draftId) => {
commit(types.TOGGLE_RESOLVE_DISCUSSION, draftId);
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -82,6 +82,3 @@ export const isPublishingDraft = state => draftId =>
state.currentlyPublishingDrafts.indexOf(draftId) !== -1;
export const sortedDrafts = state => [...state.drafts].sort((a, b) => a.id > b.id);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -76,6 +76,3 @@ export const fetchClusters = ({ state, commit, dispatch }) => {
export const setPage = ({ commit }, page) => {
commit(types.SET_PAGE, page);
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -3,6 +3,7 @@ import { __ } from '~/locale';
import service from '../services/contributors_service';
import * as types from './mutation_types';
// eslint-disable-next-line import/prefer-default-export
export const fetchChartData = ({ commit }, endpoint) => {
commit(types.SET_LOADING_STATE, true);
......@@ -15,6 +16,3 @@ export const fetchChartData = ({ commit }, endpoint) => {
})
.catch(() => flash(__('An error occurred while loading chart data')));
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -28,6 +28,3 @@ export const parsedData = state => {
byAuthorEmail,
};
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -90,6 +90,3 @@ export const fetchMachineTypes = ({ commit, state }) =>
mutation: types.SET_MACHINE_TYPES,
payloadKey: 'items',
});
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -246,28 +246,28 @@ export default {
this.onUploadDesign([newFile]);
}
},
toggleOnPasteListener(route) {
if (route === DESIGNS_ROUTE_NAME) {
document.addEventListener('paste', this.onDesignPaste);
} else {
document.removeEventListener('paste', this.onDesignPaste);
}
toggleOnPasteListener() {
document.addEventListener('paste', this.onDesignPaste);
},
toggleOffPasteListener() {
document.removeEventListener('paste', this.onDesignPaste);
},
},
beforeRouteUpdate(to, from, next) {
this.toggleOnPasteListener(to.name);
this.selectedDesigns = [];
next();
},
beforeRouteLeave(to, from, next) {
this.toggleOnPasteListener(to.name);
next();
},
};
</script>
<template>
<div data-testid="designs-root" class="gl-mt-5">
<div
data-testid="designs-root"
class="gl-mt-5"
:class="{ 'designs-root': !isDesignListEmpty }"
@mouseenter="toggleOnPasteListener"
@mouseleave="toggleOffPasteListener"
>
<header v-if="showToolbar" class="row-content-block border-top-0 p-2 d-flex">
<div class="gl-display-flex gl-justify-content-space-between gl-align-items-center gl-w-full">
<div>
......
......@@ -759,6 +759,3 @@ export const navigateToDiffFileIndex = ({ commit, state }, index) => {
commit(types.UPDATE_CURRENT_DIFF_FILE_ID, fileHash);
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -74,7 +74,6 @@ export const getDiffFileDiscussions = (state, getters, rootState, rootGetters) =
discussion => discussion.diff_discussion && discussion.diff_file.file_hash === diff.file_hash,
) || [];
// prevent babel-plugin-rewire from generating an invalid default during karma∂ tests
export const getDiffFileByHash = state => fileHash =>
state.diffFiles.find(file => file.file_hash === fileHash);
......@@ -130,6 +129,3 @@ export const fileLineCoverage = state => (file, line) => {
*/
export const currentDiffIndex = state =>
Math.max(0, state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId));
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -34,5 +34,3 @@ export const updateIgnoreStatus = ({ commit, dispatch }, params) => {
commit(types.SET_UPDATING_IGNORE_STATUS, false);
});
};
export default () => {};
......@@ -10,6 +10,7 @@ const stopPolling = poll => {
if (poll) poll.stop();
};
// eslint-disable-next-line import/prefer-default-export
export function startPollingStacktrace({ commit }, endpoint) {
stackTracePoll = new Poll({
resource: service,
......@@ -32,5 +33,3 @@ export function startPollingStacktrace({ commit }, endpoint) {
stackTracePoll.makeRequest();
}
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const stacktrace = state =>
state.stacktraceData.stack_trace_entries
? state.stacktraceData.stack_trace_entries.reverse()
: [];
export default () => {};
......@@ -102,5 +102,3 @@ export const fetchPaginatedResults = ({ commit, dispatch }, cursor) => {
export const removeIgnoredResolvedErrors = ({ commit }, error) => {
commit(types.REMOVE_IGNORED_RESOLVED_ERRORS, error);
};
export default () => {};
......@@ -89,6 +89,3 @@ export const updateSelectedProject = ({ commit }, selectedProject) => {
export const setInitialState = ({ commit }, data) => {
commit(types.SET_INITIAL_STATE, data);
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -39,6 +39,3 @@ export const projectSelectionLabel = state => {
}
return s__('ErrorTracking|To enable project selection, enter a valid Auth Token');
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -14,5 +14,3 @@ export const transformFrontendSettings = ({ apiHost, enabled, token, selectedPro
};
export const getDisplayName = project => `${project.organizationName} | ${project.slug}`;
export default () => {};
......@@ -76,6 +76,3 @@ export const setSearchQuery = ({ commit, dispatch }, query) => {
dispatch('fetchFrequentItems');
}
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const hasSearchQuery = state => state.searchQuery !== '';
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -49,7 +49,7 @@ const multiMetricLabel = metricAttributes => {
* @param {Object} metricAttributes - Default metric attribute values (e.g. method, instance)
* @returns {String} The formatted query label
*/
const getSeriesLabel = (queryLabel, metricAttributes) => {
export const getSeriesLabel = (queryLabel, metricAttributes) => {
return (
singleAttributeLabel(queryLabel, metricAttributes) ||
templatedLabel(queryLabel, metricAttributes) ||
......@@ -63,7 +63,6 @@ const getSeriesLabel = (queryLabel, metricAttributes) => {
* @param {Object} defaultConfig - Default chart config values (e.g. lineStyle, name)
* @returns {Array} The formatted values
*/
// eslint-disable-next-line import/prefer-default-export
export const makeDataSeries = (queryResults, defaultConfig) =>
queryResults.map(result => {
return {
......
......@@ -32,5 +32,3 @@ export const fetchBranches = ({ dispatch, rootGetters }, { search = '' }) => {
};
export const resetBranches = ({ commit }) => commit(types.RESET_BRANCHES);
export default () => {};
......@@ -23,5 +23,3 @@ export const templateTypes = () => [
export const showFileTemplatesBar = (_, getters, rootState) => name =>
getters.templateTypes.find(t => t.name === name) &&
rootState.currentActivityView === leftSidebarViews.edit.name;
export default () => {};
......@@ -41,5 +41,3 @@ export const fetchMergeRequests = (
};
export const resetMergeRequests = ({ commit }) => commit(types.RESET_MERGE_REQUESTS);
export default () => {};
......@@ -149,5 +149,3 @@ export const resetLatestPipeline = ({ commit }) => {
commit(types.RECEIVE_LASTEST_PIPELINE_SUCCESS, null);
commit(types.SET_DETAIL_JOB, null);
};
export default () => {};
......@@ -20,5 +20,3 @@ export const failedJobsCount = state =>
);
export const jobsCount = state => state.stages.reduce((acc, stage) => acc + stage.jobs.length, 0);
export default () => {};
......@@ -2,4 +2,3 @@ export * from './setup';
export * from './checks';
export * from './session_controls';
export * from './session_status';
export default () => {};
// eslint-disable-next-line import/prefer-default-export
export const allCheck = state => {
const checks = Object.values(state.checks);
......@@ -15,5 +16,3 @@ export const allCheck = state => {
message,
};
};
export default () => {};
......@@ -128,6 +128,3 @@ export const fetchJobs = ({ state, commit, dispatch }) => {
}
});
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -85,9 +85,6 @@ export default {
dueDateWords() {
return this.dueDate ? dateInWords(this.dueDate, true) : undefined;
},
hasNoComments() {
return !this.userNotesCount;
},
isOverdue() {
return this.dueDate ? this.dueDate < new Date() : false;
},
......@@ -148,32 +145,51 @@ export default {
time_ago: escape(getTimeago().format(this.issuable.updated_at)),
});
},
userNotesCount() {
return this.issuable.user_notes_count;
},
issuableMeta() {
return [
{
key: 'merge-requests',
visible: this.issuable.merge_requests_count > 0,
value: this.issuable.merge_requests_count,
title: __('Related merge requests'),
class: 'js-merge-requests',
dataTestId: 'merge-requests',
icon: 'merge-request',
},
{
key: 'upvotes',
visible: this.issuable.upvotes > 0,
value: this.issuable.upvotes,
title: __('Upvotes'),
class: 'js-upvotes',
dataTestId: 'upvotes',
icon: 'thumb-up',
},
{
key: 'downvotes',
visible: this.issuable.downvotes > 0,
value: this.issuable.downvotes,
title: __('Downvotes'),
class: 'js-downvotes',
dataTestId: 'downvotes',
icon: 'thumb-down',
},
{
key: 'blocking-issues',
visible: this.issuable.blocking_issues_count > 0,
value: this.issuable.blocking_issues_count,
title: __('Blocking issues'),
dataTestId: 'blocking-issues',
href: `${this.issuable.web_url}#related-issues`,
icon: 'issue-block',
},
{
key: 'comments-count',
visible: !this.isJiraIssue,
value: this.issuable.user_notes_count,
title: __('Comments'),
dataTestId: 'notes-count',
href: `${this.issuable.web_url}#notes`,
class: !this.issuable.user_notes_count ? 'no-comments' : '',
icon: 'comments',
},
];
},
},
......@@ -202,6 +218,9 @@ export default {
selected: ev.target.checked,
});
},
issuableMetaComponent(href) {
return href ? 'gl-link' : 'span';
},
},
confidentialTooltipText: __('Confidential'),
......@@ -216,9 +235,9 @@ export default {
:data-labels="labelIdsString"
:data-url="issuable.web_url"
>
<div class="d-flex">
<div class="gl-display-flex">
<!-- Bulk edit checkbox -->
<div v-if="isBulkEditing" class="mr-2">
<div v-if="isBulkEditing" class="gl-mr-3">
<input
:checked="selected"
class="selected-issuable"
......@@ -230,7 +249,7 @@ export default {
<!-- Issuable info container -->
<!-- Issuable main info -->
<div class="flex-grow-1">
<div class="gl-flex-grow-1">
<div class="title">
<span class="issue-title-text">
<gl-icon
......@@ -251,7 +270,10 @@ export default {
/>
</gl-link>
</span>
<span v-if="issuable.has_tasks" class="ml-1 task-status d-none d-sm-inline-block">
<span
v-if="issuable.has_tasks"
class="gl-ml-2 task-status gl-display-none d-sm-inline-block"
>
{{ issuable.task_status }}
</span>
</div>
......@@ -267,7 +289,7 @@ export default {
{{ referencePath }}
</span>
<span data-testid="openedByMessage" class="d-none d-sm-inline-block mr-1">
<span data-testid="openedByMessage" class="gl-display-none d-sm-inline-block gl-mr-2">
&middot;
<gl-sprintf
:message="isJiraIssue ? $options.i18n.openedAgoJira : $options.i18n.openedAgo"
......@@ -291,7 +313,7 @@ export default {
<gl-link
v-if="issuable.milestone"
v-gl-tooltip
class="d-none d-sm-inline-block mr-1 js-milestone"
class="gl-display-none d-sm-inline-block gl-mr-2 js-milestone"
:href="milestoneLink"
:title="milestoneTooltipText"
>
......@@ -302,7 +324,7 @@ export default {
<span
v-if="dueDate"
v-gl-tooltip
class="d-none d-sm-inline-block mr-1 js-due-date"
class="gl-display-none d-sm-inline-block gl-mr-2 js-due-date"
:class="{ cred: isOverdue }"
:title="__('Due date')"
>
......@@ -321,7 +343,7 @@ export default {
:title="label.name"
:scoped="isScoped(label)"
size="sm"
class="mr-1"
class="gl-mr-2"
>{{ label.name }}</gl-label
>
......@@ -329,7 +351,7 @@ export default {
v-if="hasWeight"
v-gl-tooltip
:title="__('Weight')"
class="d-none d-sm-inline-block js-weight"
class="gl-display-none d-sm-inline-block"
data-testid="weight"
>
<gl-icon name="weight" class="align-text-bottom" />
......@@ -339,43 +361,37 @@ export default {
</div>
<!-- Issuable meta -->
<div class="flex-shrink-0 d-flex flex-column align-items-end justify-content-center">
<div class="controls d-flex">
<div
class="gl-flex-shrink-0 gl-display-flex gl-flex-direction-column align-items-end gl-justify-content-center"
>
<div class="controls gl-display-flex">
<span v-if="isJiraIssue" data-testid="issuable-status">{{ issuable.status }}</span>
<span v-else-if="isClosed" class="issuable-status">{{ __('CLOSED') }}</span>
<issue-assignees
:assignees="issuable.assignees"
class="align-items-center d-flex ml-2"
class="gl-align-items-center gl-display-flex gl-ml-3"
:icon-size="16"
img-css-classes="mr-1"
img-css-classes="gl-mr-2!"
:max-visible="4"
/>
<template v-for="meta in issuableMeta">
<span
v-if="meta.value"
v-if="meta.visible"
:key="meta.key"
v-gl-tooltip
:class="['d-none d-sm-inline-block ml-2 vertical-align-middle', meta.class]"
class="gl-display-none gl-display-sm-flex gl-align-items-center gl-ml-3"
:class="meta.class"
:data-testid="meta.dataTestId"
:title="meta.title"
>
<gl-icon v-if="meta.icon" :name="meta.icon" />
{{ meta.value }}
<component :is="issuableMetaComponent(meta.href)" :href="meta.href">
<gl-icon v-if="meta.icon" :name="meta.icon" />
{{ meta.value }}
</component>
</span>
</template>
<gl-link
v-if="!isJiraIssue"
v-gl-tooltip
class="ml-2 js-notes"
:href="`${issuable.web_url}#notes`"
:title="__('Comments')"
:class="{ 'no-comments': hasNoComments }"
>
<gl-icon name="comments" class="gl-vertical-align-text-bottom" />
{{ userNotesCount }}
</gl-link>
</div>
<div v-gl-tooltip class="issuable-updated-at" :title="updatedDateString">
{{ updatedDateAgo }}
......
......@@ -247,6 +247,3 @@ export const triggerManualJob = ({ state }, variables) => {
})
.catch(() => flash(__('An error occurred while triggering the job.')));
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -46,6 +46,3 @@ export const isScrollingDown = state => isScrolledToBottom() && !state.isTraceCo
export const hasRunnersForProject = state =>
state.job.runners.available && !state.job.runners.online;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -200,6 +200,3 @@ export const dismissRequestLogsError = ({ commit }) => {
export const dismissInvalidTimeRangeWarning = ({ commit }) => {
commit(types.HIDE_TIME_RANGE_INVALID_WARNING);
};
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -36,7 +36,7 @@ export default {
);
},
xAxisName() {
return this.graphData.x_label || '';
return this.graphData.xLabel || '';
},
yAxisName() {
return this.graphData.y_label || '';
......
......@@ -30,6 +30,7 @@ import MonitorStackedColumnChart from './charts/stacked_column.vue';
import TrackEventDirective from '~/vue_shared/directives/track_event';
import AlertWidget from './alert_widget.vue';
import { timeRangeToUrl, downloadCSVOptions, generateLinkToChartOptions } from '../utils';
import { graphDataToCsv } from '../csv_export';
const events = {
timeRangeZoom: 'timerangezoom',
......@@ -148,13 +149,10 @@ export default {
return null;
},
csvText() {
const chartData = this.graphData?.metrics[0].result[0].values || [];
const yLabel = this.graphData.y_label;
const header = `timestamp,${yLabel}\r\n`; // eslint-disable-line @gitlab/require-i18n-strings
return chartData.reduce((csv, data) => {
const row = data.join(',');