From b8d021cb606ac86f41a0ef9dacd133a9677f8414 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 23 Dec 2020 18:10:19 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../components/alert_management_table.vue | 2 +- .../alert_management/components/alert_status.vue | 2 +- .../graphql/fragments/alert_note.fragment.graphql | 17 ------ .../graphql/fragments/detail_item.fragment.graphql | 4 +- .../graphql/fragments/list_item.fragment.graphql | 17 ------ .../mutations/alert_set_assignees.mutation.graphql | 2 +- .../mutations/update_alert_status.mutation.graphql | 17 ------ .../graphql/queries/get_alerts.query.graphql | 36 ------------- .../components/alerts_settings_wrapper.vue | 4 +- .../behaviors/markdown/paste_markdown_table.js | 13 ++--- .../boards/components/sidebar/remove_issue.vue | 10 ++-- .../javascripts/diffs/components/diff_row.vue | 4 +- app/assets/javascripts/diffs/store/getters.js | 62 +++++++++++----------- app/assets/javascripts/dropzone_input.js | 23 ++++---- .../feature_flags/components/strategy.vue | 8 +-- .../fragments/alert.fragment.graphql | 17 ++++++ .../fragments/alert_note.fragment.graphql | 17 ++++++ .../mutations/update_alert_status.mutation.graphql | 17 ++++++ .../queries/get_alerts.query.graphql | 36 +++++++++++++ app/assets/javascripts/ide/lib/create_diff.js | 16 +++--- .../ide/stores/modules/pipelines/getters.js | 19 +++---- .../members/components/table/members_table.vue | 6 ++- app/assets/javascripts/members/store/utils.js | 3 +- .../monitoring/components/charts/anomaly.vue | 13 +++-- .../javascripts/monitoring/stores/actions.js | 54 ++++++++++--------- .../javascripts/monitoring/stores/getters.js | 38 ++++++------- app/assets/javascripts/packages/list/utils.js | 3 +- .../forks/new/components/fork_groups_list.vue | 6 ++- app/assets/javascripts/pages/users/user_tabs.js | 20 +++---- .../projects/settings/access_dropdown.js | 34 ++++++------ .../components/list_page/registry_header.vue | 11 +++- .../javascripts/registry/explorer/pages/list.vue | 1 + app/assets/javascripts/repository/log_tree.js | 8 +-- app/assets/javascripts/repository/utils/dom.js | 4 +- .../sidebar/components/labels/sidebar_labels.vue | 12 +++-- app/assets/javascripts/user_lists/store/utils.js | 7 +-- .../vue_shared/components/alert_details_table.vue | 3 +- .../vue_shared/components/registry/title_area.vue | 32 ++++++++--- .../components/upload_dropzone/upload_dropzone.vue | 4 +- app/assets/javascripts/vue_shared/constants.js | 5 +- app/graphql/mutations/releases/update.rb | 8 +-- .../resolvers/projects/jira_projects_resolver.rb | 5 +- .../resolvers/release_milestones_resolver.rb | 13 +++++ app/graphql/types/release_type.rb | 3 +- app/models/milestone.rb | 1 + app/models/release.rb | 2 +- 46 files changed, 361 insertions(+), 278 deletions(-) delete mode 100644 app/assets/javascripts/alert_management/graphql/fragments/alert_note.fragment.graphql delete mode 100644 app/assets/javascripts/alert_management/graphql/fragments/list_item.fragment.graphql delete mode 100644 app/assets/javascripts/alert_management/graphql/mutations/update_alert_status.mutation.graphql delete mode 100644 app/assets/javascripts/alert_management/graphql/queries/get_alerts.query.graphql create mode 100644 app/assets/javascripts/graphql_shared/fragments/alert.fragment.graphql create mode 100644 app/assets/javascripts/graphql_shared/fragments/alert_note.fragment.graphql create mode 100644 app/assets/javascripts/graphql_shared/mutations/update_alert_status.mutation.graphql create mode 100644 app/assets/javascripts/graphql_shared/queries/get_alerts.query.graphql create mode 100644 app/graphql/resolvers/release_milestones_resolver.rb (limited to 'app') diff --git a/app/assets/javascripts/alert_management/components/alert_management_table.vue b/app/assets/javascripts/alert_management/components/alert_management_table.vue index f287b425826..f49f0c52ce6 100644 --- a/app/assets/javascripts/alert_management/components/alert_management_table.vue +++ b/app/assets/javascripts/alert_management/components/alert_management_table.vue @@ -23,7 +23,7 @@ import { } from '~/vue_shared/components/paginated_table_with_search_and_tabs/constants'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; import { convertToSnakeCase } from '~/lib/utils/text_utility'; -import getAlerts from '../graphql/queries/get_alerts.query.graphql'; +import getAlerts from '~/graphql_shared/queries/get_alerts.query.graphql'; import getAlertsCountByStatus from '../graphql/queries/get_count_by_status.query.graphql'; import { ALERTS_STATUS_TABS, diff --git a/app/assets/javascripts/alert_management/components/alert_status.vue b/app/assets/javascripts/alert_management/components/alert_status.vue index 3083a85cbd9..d7c5aa26370 100644 --- a/app/assets/javascripts/alert_management/components/alert_status.vue +++ b/app/assets/javascripts/alert_management/components/alert_status.vue @@ -3,7 +3,7 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; import { s__ } from '~/locale'; import Tracking from '~/tracking'; import { trackAlertStatusUpdateOptions } from '../constants'; -import updateAlertStatusMutation from '../graphql/mutations/update_alert_status.mutation.graphql'; +import updateAlertStatusMutation from '~/graphql_shared/mutations/update_alert_status.mutation.graphql'; export default { i18n: { diff --git a/app/assets/javascripts/alert_management/graphql/fragments/alert_note.fragment.graphql b/app/assets/javascripts/alert_management/graphql/fragments/alert_note.fragment.graphql deleted file mode 100644 index 74b425717a0..00000000000 --- a/app/assets/javascripts/alert_management/graphql/fragments/alert_note.fragment.graphql +++ /dev/null @@ -1,17 +0,0 @@ -#import "~/graphql_shared/fragments/author.fragment.graphql" - -fragment AlertNote on Note { - id - author { - id - state - ...Author - } - body - bodyHtml - createdAt - discussion { - id - } - systemNoteIconName -} diff --git a/app/assets/javascripts/alert_management/graphql/fragments/detail_item.fragment.graphql b/app/assets/javascripts/alert_management/graphql/fragments/detail_item.fragment.graphql index 406dfe97ce0..9a9ae369519 100644 --- a/app/assets/javascripts/alert_management/graphql/fragments/detail_item.fragment.graphql +++ b/app/assets/javascripts/alert_management/graphql/fragments/detail_item.fragment.graphql @@ -1,5 +1,5 @@ -#import "./list_item.fragment.graphql" -#import "./alert_note.fragment.graphql" +#import "~/graphql_shared/fragments/alert.fragment.graphql" +#import "~/graphql_shared/fragments/alert_note.fragment.graphql" fragment AlertDetailItem on AlertManagementAlert { ...AlertListItem diff --git a/app/assets/javascripts/alert_management/graphql/fragments/list_item.fragment.graphql b/app/assets/javascripts/alert_management/graphql/fragments/list_item.fragment.graphql deleted file mode 100644 index 62119177887..00000000000 --- a/app/assets/javascripts/alert_management/graphql/fragments/list_item.fragment.graphql +++ /dev/null @@ -1,17 +0,0 @@ -fragment AlertListItem on AlertManagementAlert { - iid - title - severity - status - startedAt - eventCount - issueIid - assignees { - nodes { - name - username - avatarUrl - webUrl - } - } -} diff --git a/app/assets/javascripts/alert_management/graphql/mutations/alert_set_assignees.mutation.graphql b/app/assets/javascripts/alert_management/graphql/mutations/alert_set_assignees.mutation.graphql index 5008bfa5e1b..63d952a4857 100644 --- a/app/assets/javascripts/alert_management/graphql/mutations/alert_set_assignees.mutation.graphql +++ b/app/assets/javascripts/alert_management/graphql/mutations/alert_set_assignees.mutation.graphql @@ -1,4 +1,4 @@ -#import "../fragments/alert_note.fragment.graphql" +#import "~/graphql_shared/fragments/alert_note.fragment.graphql" mutation alertSetAssignees($projectPath: ID!, $assigneeUsernames: [String!]!, $iid: String!) { alertSetAssignees( diff --git a/app/assets/javascripts/alert_management/graphql/mutations/update_alert_status.mutation.graphql b/app/assets/javascripts/alert_management/graphql/mutations/update_alert_status.mutation.graphql deleted file mode 100644 index ba1e607bc10..00000000000 --- a/app/assets/javascripts/alert_management/graphql/mutations/update_alert_status.mutation.graphql +++ /dev/null @@ -1,17 +0,0 @@ -#import "../fragments/alert_note.fragment.graphql" - -mutation updateAlertStatus($projectPath: ID!, $status: AlertManagementStatus!, $iid: String!) { - updateAlertStatus(input: { iid: $iid, status: $status, projectPath: $projectPath }) { - errors - alert { - iid - status - endedAt - notes { - nodes { - ...AlertNote - } - } - } - } -} diff --git a/app/assets/javascripts/alert_management/graphql/queries/get_alerts.query.graphql b/app/assets/javascripts/alert_management/graphql/queries/get_alerts.query.graphql deleted file mode 100644 index bc7e51a2e90..00000000000 --- a/app/assets/javascripts/alert_management/graphql/queries/get_alerts.query.graphql +++ /dev/null @@ -1,36 +0,0 @@ -#import "../fragments/list_item.fragment.graphql" - -query getAlerts( - $projectPath: ID! - $statuses: [AlertManagementStatus!] - $sort: AlertManagementAlertSort - $firstPageSize: Int - $lastPageSize: Int - $prevPageCursor: String = "" - $nextPageCursor: String = "" - $searchTerm: String = "" - $assigneeUsername: String = "" -) { - project(fullPath: $projectPath) { - alertManagementAlerts( - search: $searchTerm - assigneeUsername: $assigneeUsername - statuses: $statuses - sort: $sort - first: $firstPageSize - last: $lastPageSize - after: $nextPageCursor - before: $prevPageCursor - ) { - nodes { - ...AlertListItem - } - pageInfo { - hasNextPage - endCursor - hasPreviousPage - startCursor - } - } - } -} diff --git a/app/assets/javascripts/alerts_settings/components/alerts_settings_wrapper.vue b/app/assets/javascripts/alerts_settings/components/alerts_settings_wrapper.vue index a55e63c3bc0..002d09be22b 100644 --- a/app/assets/javascripts/alerts_settings/components/alerts_settings_wrapper.vue +++ b/app/assets/javascripts/alerts_settings/components/alerts_settings_wrapper.vue @@ -243,7 +243,9 @@ export default { }); }, editIntegration({ id }) { - const currentIntegration = this.integrations.list.find(integration => integration.id === id); + const currentIntegration = this.integrations.list.find( + (integration) => integration.id === id, + ); this.$apollo.mutate({ mutation: updateCurrentIntergrationMutation, variables: { diff --git a/app/assets/javascripts/behaviors/markdown/paste_markdown_table.js b/app/assets/javascripts/behaviors/markdown/paste_markdown_table.js index 278dd857ab8..46582867d05 100644 --- a/app/assets/javascripts/behaviors/markdown/paste_markdown_table.js +++ b/app/assets/javascripts/behaviors/markdown/paste_markdown_table.js @@ -1,4 +1,5 @@ -const maxColumnWidth = (rows, columnIndex) => Math.max(...rows.map(row => row[columnIndex].length)); +const maxColumnWidth = (rows, columnIndex) => + Math.max(...rows.map((row) => row[columnIndex].length)); export default class PasteMarkdownTable { constructor(clipboardData) { @@ -16,7 +17,7 @@ export default class PasteMarkdownTable { this.calculateColumnWidths(); const markdownRows = this.rows.map( - row => + (row) => // | Name | Title | Email Address | // |--------------|-------|----------------| // | Jane Atler | CEO | jane@acme.com | @@ -66,7 +67,7 @@ export default class PasteMarkdownTable { return false; } - this.rows = splitRows.map(row => row.split('\t')); + this.rows = splitRows.map((row) => row.split('\t')); this.normalizeRows(); // Check that the max number of columns in the HTML matches the number of @@ -81,10 +82,10 @@ export default class PasteMarkdownTable { // Ensure each row has the same number of columns normalizeRows() { - const rowLengths = this.rows.map(row => row.length); + const rowLengths = this.rows.map((row) => row.length); const maxLength = Math.max(...rowLengths); - this.rows.forEach(row => { + this.rows.forEach((row) => { while (row.length < maxLength) { row.push(''); } @@ -101,7 +102,7 @@ export default class PasteMarkdownTable { const textColumnCount = this.rows[0].length; let htmlColumnCount = 0; - this.doc.querySelectorAll('table tr').forEach(row => { + this.doc.querySelectorAll('table tr').forEach((row) => { htmlColumnCount = Math.max(row.cells.length, htmlColumnCount); }); diff --git a/app/assets/javascripts/boards/components/sidebar/remove_issue.vue b/app/assets/javascripts/boards/components/sidebar/remove_issue.vue index 4e5a6609042..8d65f3240c8 100644 --- a/app/assets/javascripts/boards/components/sidebar/remove_issue.vue +++ b/app/assets/javascripts/boards/components/sidebar/remove_issue.vue @@ -42,13 +42,13 @@ export default { axios.patch(this.updateUrl, data).catch(() => { Flash(__('Failed to remove issue from board, please try again.')); - lists.forEach(list => { + lists.forEach((list) => { list.addIssue(issue); }); }); // Remove from the frontend store - lists.forEach(list => { + lists.forEach((list) => { list.removeIssue(issue); }); @@ -58,9 +58,11 @@ export default { * Build the default patch request. */ buildPatchRequest(issue, lists) { - const listLabelIds = lists.map(list => list.label.id); + const listLabelIds = lists.map((list) => list.label.id); - const labelIds = issue.labels.map(label => label.id).filter(id => !listLabelIds.includes(id)); + const labelIds = issue.labels + .map((label) => label.id) + .filter((id) => !listLabelIds.includes(id)); return { label_ids: labelIds, diff --git a/app/assets/javascripts/diffs/components/diff_row.vue b/app/assets/javascripts/diffs/components/diff_row.vue index 9a43a7405c6..0b11895097e 100644 --- a/app/assets/javascripts/diffs/components/diff_row.vue +++ b/app/assets/javascripts/diffs/components/diff_row.vue @@ -115,7 +115,9 @@ export default { const table = line.closest('.diff-table'); table.classList.remove('left-side-selected', 'right-side-selected'); - const [lineClass] = ['left-side', 'right-side'].filter(name => line.classList.contains(name)); + const [lineClass] = ['left-side', 'right-side'].filter((name) => + line.classList.contains(name), + ); if (lineClass) { table.classList.add(`${lineClass}-selected`); diff --git a/app/assets/javascripts/diffs/store/getters.js b/app/assets/javascripts/diffs/store/getters.js index 7b6db0ec706..a167b6d4694 100644 --- a/app/assets/javascripts/diffs/store/getters.js +++ b/app/assets/javascripts/diffs/store/getters.js @@ -9,13 +9,13 @@ import { export * from './getters_versions_dropdowns'; -export const isParallelView = state => state.diffViewType === PARALLEL_DIFF_VIEW_TYPE; +export const isParallelView = (state) => state.diffViewType === PARALLEL_DIFF_VIEW_TYPE; -export const isInlineView = state => state.diffViewType === INLINE_DIFF_VIEW_TYPE; +export const isInlineView = (state) => state.diffViewType === INLINE_DIFF_VIEW_TYPE; -export const whichCollapsedTypes = state => { - const automatic = state.diffFiles.some(file => file.viewer?.automaticallyCollapsed); - const manual = state.diffFiles.some(file => file.viewer?.manuallyCollapsed); +export const whichCollapsedTypes = (state) => { + const automatic = state.diffFiles.some((file) => file.viewer?.automaticallyCollapsed); + const manual = state.diffFiles.some((file) => file.viewer?.manuallyCollapsed); return { any: automatic || manual, @@ -24,18 +24,18 @@ export const whichCollapsedTypes = state => { }; }; -export const commitId = state => (state.commit && state.commit.id ? state.commit.id : null); +export const commitId = (state) => (state.commit && state.commit.id ? state.commit.id : null); /** * Checks if the diff has all discussions expanded * @param {Object} diff * @returns {Boolean} */ -export const diffHasAllExpandedDiscussions = (state, getters) => diff => { +export const diffHasAllExpandedDiscussions = (state, getters) => (diff) => { const discussions = getters.getDiffFileDiscussions(diff); return ( - (discussions && discussions.length && discussions.every(discussion => discussion.expanded)) || + (discussions && discussions.length && discussions.every((discussion) => discussion.expanded)) || false ); }; @@ -45,11 +45,13 @@ export const diffHasAllExpandedDiscussions = (state, getters) => diff => { * @param {Object} diff * @returns {Boolean} */ -export const diffHasAllCollapsedDiscussions = (state, getters) => diff => { +export const diffHasAllCollapsedDiscussions = (state, getters) => (diff) => { const discussions = getters.getDiffFileDiscussions(diff); return ( - (discussions && discussions.length && discussions.every(discussion => !discussion.expanded)) || + (discussions && + discussions.length && + discussions.every((discussion) => !discussion.expanded)) || false ); }; @@ -59,9 +61,9 @@ export const diffHasAllCollapsedDiscussions = (state, getters) => diff => { * @param {Object} diff * @returns {Boolean} */ -export const diffHasExpandedDiscussions = () => diff => { - return diff[INLINE_DIFF_LINES_KEY].filter(l => l.discussions.length >= 1).some( - l => l.discussionsExpanded, +export const diffHasExpandedDiscussions = () => (diff) => { + return diff[INLINE_DIFF_LINES_KEY].filter((l) => l.discussions.length >= 1).some( + (l) => l.discussionsExpanded, ); }; @@ -70,8 +72,8 @@ export const diffHasExpandedDiscussions = () => diff => { * @param {Boolean} diff * @returns {Boolean} */ -export const diffHasDiscussions = () => diff => { - return diff[INLINE_DIFF_LINES_KEY].some(l => l.discussions.length >= 1); +export const diffHasDiscussions = () => (diff) => { + return diff[INLINE_DIFF_LINES_KEY].some((l) => l.discussions.length >= 1); }; /** @@ -79,22 +81,22 @@ export const diffHasDiscussions = () => diff => { * @param {Object} diff * @returns {Array} */ -export const getDiffFileDiscussions = (state, getters, rootState, rootGetters) => diff => +export const getDiffFileDiscussions = (state, getters, rootState, rootGetters) => (diff) => rootGetters.discussions.filter( - discussion => discussion.diff_discussion && discussion.diff_file.file_hash === diff.file_hash, + (discussion) => discussion.diff_discussion && discussion.diff_file.file_hash === diff.file_hash, ) || []; -export const getDiffFileByHash = state => fileHash => - state.diffFiles.find(file => file.file_hash === fileHash); +export const getDiffFileByHash = (state) => (fileHash) => + state.diffFiles.find((file) => file.file_hash === fileHash); -export const flatBlobsList = state => - Object.values(state.treeEntries).filter(f => f.type === 'blob'); +export const flatBlobsList = (state) => + Object.values(state.treeEntries).filter((f) => f.type === 'blob'); export const allBlobs = (state, getters) => getters.flatBlobsList.reduce((acc, file) => { const { parentPath } = file; - if (parentPath && !acc.some(f => f.path === parentPath)) { + if (parentPath && !acc.some((f) => f.path === parentPath)) { acc.push({ path: parentPath, isHeader: true, @@ -102,13 +104,13 @@ export const allBlobs = (state, getters) => }); } - acc.find(f => f.path === parentPath).tree.push(file); + acc.find((f) => f.path === parentPath).tree.push(file); return acc; }, []); -export const getCommentFormForDiffFile = state => fileHash => - state.commentForms.find(form => form.fileHash === fileHash); +export const getCommentFormForDiffFile = (state) => (fileHash) => + state.commentForms.find((form) => form.fileHash === fileHash); /** * Returns the test coverage hits for a specific line of a given file @@ -116,7 +118,7 @@ export const getCommentFormForDiffFile = state => fileHash => * @param {number} line * @returns {number} */ -export const fileLineCoverage = state => (file, line) => { +export const fileLineCoverage = (state) => (file, line) => { if (!state.coverageFiles.files) return {}; const fileCoverage = state.coverageFiles.files[file]; if (!fileCoverage) return {}; @@ -137,13 +139,13 @@ export const fileLineCoverage = state => (file, line) => { * Returns index of a currently selected diff in diffFiles * @returns {number} */ -export const currentDiffIndex = state => +export const currentDiffIndex = (state) => Math.max( 0, - state.diffFiles.findIndex(diff => diff.file_hash === state.currentDiffFileId), + state.diffFiles.findIndex((diff) => diff.file_hash === state.currentDiffFileId), ); -export const diffLines = state => (file, unifiedDiffComponents) => { +export const diffLines = (state) => (file, unifiedDiffComponents) => { if (!unifiedDiffComponents && state.diffViewType === INLINE_DIFF_VIEW_TYPE) { return null; } @@ -155,5 +157,5 @@ export const diffLines = state => (file, unifiedDiffComponents) => { }; export function fileReviews(state) { - return state.diffFiles.map(file => isFileReviewed(state.mrReviews, file)); + return state.diffFiles.map((file) => isFileReviewed(state.mrReviews, file)); } diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js index 49f54261983..d7aacfbce60 100644 --- a/app/assets/javascripts/dropzone_input.js +++ b/app/assets/javascripts/dropzone_input.js @@ -46,7 +46,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { let uploadFile; formTextarea.wrap('
'); - formTextarea.on('paste', event => handlePaste(event)); + formTextarea.on('paste', (event) => handlePaste(event)); // Add dropzone area to the form. const $mdArea = formTextarea.closest('.md-area'); @@ -139,7 +139,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { // removeAllFiles(true) stops uploading files (if any) // and remove them from dropzone files queue. - $cancelButton.on('click', e => { + $cancelButton.on('click', (e) => { e.preventDefault(); e.stopPropagation(); Dropzone.forElement($formDropzone.get(0)).removeAllFiles(true); @@ -149,7 +149,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { // clear dropzone files queue, change status of failed files to undefined, // and add that files to the dropzone files queue again. // addFile() adds file to dropzone files queue and upload it. - $retryLink.on('click', e => { + $retryLink.on('click', (e) => { const dropzoneInstance = Dropzone.forElement( e.target.closest('.js-main-target-form').querySelector('.div-dropzone'), ); @@ -161,7 +161,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { // uploading of files that are being uploaded at the moment. dropzoneInstance.removeAllFiles(true); - failedFiles.map(failedFile => { + failedFiles.map((failedFile) => { const file = failedFile; if (file.status === Dropzone.ERROR) { @@ -173,7 +173,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { }); }); // eslint-disable-next-line consistent-return - handlePaste = event => { + handlePaste = (event) => { const pasteEvent = event.originalEvent; const { clipboardData } = pasteEvent; if (clipboardData && clipboardData.items) { @@ -198,7 +198,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { } }; - isImage = data => { + isImage = (data) => { let i = 0; while (i < data.clipboardData.items.length) { const item = data.clipboardData.items[i]; @@ -228,7 +228,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { return formTextarea.trigger('input'); }; - addFileToForm = path => { + addFileToForm = (path) => { $(form).append(``); }; @@ -236,7 +236,7 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { const closeSpinner = () => $uploadingProgressContainer.addClass('hide'); - const showError = message => { + const showError = (message) => { $uploadingErrorContainer.removeClass('hide'); $uploadingErrorMessage.html(message); }; @@ -269,15 +269,16 @@ export default function dropzoneInput(form, config = { parallelUploads: 2 }) { insertToTextArea(filename, md); closeSpinner(); }) - .catch(e => { + .catch((e) => { showError(e.response.data.message); closeSpinner(); }); }; updateAttachingMessage = (files, messageContainer) => { - const filesCount = files.filter(file => file.status === 'uploading' || file.status === 'queued') - .length; + const filesCount = files.filter( + (file) => file.status === 'uploading' || file.status === 'queued', + ).length; const attachingMessage = n__('Attaching a file', 'Attaching %d files', filesCount); messageContainer.text(`${attachingMessage} -`); diff --git a/app/assets/javascripts/feature_flags/components/strategy.vue b/app/assets/javascripts/feature_flags/components/strategy.vue index ce03248381c..9593bcf6487 100644 --- a/app/assets/javascripts/feature_flags/components/strategy.vue +++ b/app/assets/javascripts/feature_flags/components/strategy.vue @@ -83,7 +83,7 @@ export default { ); }, filteredEnvironments() { - return this.environments.filter(e => !e.shouldBeDestroyed); + return this.environments.filter((e) => !e.shouldBeDestroyed); }, isPercentUserRollout() { return this.formStrategy.name === ROLLOUT_STRATEGY_PERCENT_ROLLOUT; @@ -91,7 +91,9 @@ export default { }, methods: { addEnvironment(environment) { - const allEnvironmentsScope = this.environments.find(scope => scope.environmentScope === '*'); + const allEnvironmentsScope = this.environments.find( + (scope) => scope.environmentScope === '*', + ); if (allEnvironmentsScope) { allEnvironmentsScope.shouldBeDestroyed = true; } @@ -113,7 +115,7 @@ export default { if (isNumber(environment.id)) { Vue.set(environment, 'shouldBeDestroyed', true); } else { - this.environments = this.environments.filter(e => e !== environment); + this.environments = this.environments.filter((e) => e !== environment); } if (this.filteredEnvironments.length === 0) { this.environments.push({ environmentScope: '*' }); diff --git a/app/assets/javascripts/graphql_shared/fragments/alert.fragment.graphql b/app/assets/javascripts/graphql_shared/fragments/alert.fragment.graphql new file mode 100644 index 00000000000..62119177887 --- /dev/null +++ b/app/assets/javascripts/graphql_shared/fragments/alert.fragment.graphql @@ -0,0 +1,17 @@ +fragment AlertListItem on AlertManagementAlert { + iid + title + severity + status + startedAt + eventCount + issueIid + assignees { + nodes { + name + username + avatarUrl + webUrl + } + } +} diff --git a/app/assets/javascripts/graphql_shared/fragments/alert_note.fragment.graphql b/app/assets/javascripts/graphql_shared/fragments/alert_note.fragment.graphql new file mode 100644 index 00000000000..74b425717a0 --- /dev/null +++ b/app/assets/javascripts/graphql_shared/fragments/alert_note.fragment.graphql @@ -0,0 +1,17 @@ +#import "~/graphql_shared/fragments/author.fragment.graphql" + +fragment AlertNote on Note { + id + author { + id + state + ...Author + } + body + bodyHtml + createdAt + discussion { + id + } + systemNoteIconName +} diff --git a/app/assets/javascripts/graphql_shared/mutations/update_alert_status.mutation.graphql b/app/assets/javascripts/graphql_shared/mutations/update_alert_status.mutation.graphql new file mode 100644 index 00000000000..42dc388c9d1 --- /dev/null +++ b/app/assets/javascripts/graphql_shared/mutations/update_alert_status.mutation.graphql @@ -0,0 +1,17 @@ +#import "~/graphql_shared/fragments/alert_note.fragment.graphql" + +mutation updateAlertStatus($projectPath: ID!, $status: AlertManagementStatus!, $iid: String!) { + updateAlertStatus(input: { iid: $iid, status: $status, projectPath: $projectPath }) { + errors + alert { + iid + status + endedAt + notes { + nodes { + ...AlertNote + } + } + } + } +} diff --git a/app/assets/javascripts/graphql_shared/queries/get_alerts.query.graphql b/app/assets/javascripts/graphql_shared/queries/get_alerts.query.graphql new file mode 100644 index 00000000000..e94758ef60e --- /dev/null +++ b/app/assets/javascripts/graphql_shared/queries/get_alerts.query.graphql @@ -0,0 +1,36 @@ +#import "~/graphql_shared/fragments/alert.fragment.graphql" + +query getAlerts( + $projectPath: ID! + $statuses: [AlertManagementStatus!] + $sort: AlertManagementAlertSort + $firstPageSize: Int + $lastPageSize: Int + $prevPageCursor: String = "" + $nextPageCursor: String = "" + $searchTerm: String = "" + $assigneeUsername: String = "" +) { + project(fullPath: $projectPath) { + alertManagementAlerts( + search: $searchTerm + assigneeUsername: $assigneeUsername + statuses: $statuses + sort: $sort + first: $firstPageSize + last: $lastPageSize + after: $nextPageCursor + before: $prevPageCursor + ) { + nodes { + ...AlertListItem + } + pageInfo { + hasNextPage + endCursor + hasPreviousPage + startCursor + } + } + } +} diff --git a/app/assets/javascripts/ide/lib/create_diff.js b/app/assets/javascripts/ide/lib/create_diff.js index 3e915afdbcb..51d4967fb23 100644 --- a/app/assets/javascripts/ide/lib/create_diff.js +++ b/app/assets/javascripts/ide/lib/create_diff.js @@ -32,8 +32,8 @@ const filesWithChanges = ({ stagedFiles = [], changedFiles = [], entries = {} }) // We need to clean "move" actions, because we can only support 100% similarity moves at the moment. // This is because the previous file's content might not be loaded. Object.values(changes) - .filter(change => change.action === commitActionTypes.move) - .forEach(change => { + .filter((change) => change.action === commitActionTypes.move) + .forEach((change) => { const prev = changes[change.file.prevPath]; if (!prev) { @@ -51,14 +51,14 @@ const filesWithChanges = ({ stagedFiles = [], changedFiles = [], entries = {} }) // Next, we need to add deleted directories by looking at the parents Object.values(changes) - .filter(change => change.action === commitActionTypes.delete && change.file.parentPath) + .filter((change) => change.action === commitActionTypes.delete && change.file.parentPath) .forEach(({ file }) => { // Do nothing if we've already visited this directory. if (changes[file.parentPath]) { return; } - getDeletedParents(entries, file).forEach(parent => { + getDeletedParents(entries, file).forEach((parent) => { changes[parent.path] = { action: commitActionTypes.delete, file: parent }; }); }); @@ -66,13 +66,15 @@ const filesWithChanges = ({ stagedFiles = [], changedFiles = [], entries = {} }) return Object.values(changes); }; -const createDiff = state => { +const createDiff = (state) => { const changes = filesWithChanges(state); - const toDelete = changes.filter(x => x.action === commitActionTypes.delete).map(x => x.file.path); + const toDelete = changes + .filter((x) => x.action === commitActionTypes.delete) + .map((x) => x.file.path); const patch = changes - .filter(x => x.action !== commitActionTypes.delete) + .filter((x) => x.action !== commitActionTypes.delete) .map(({ file, action }) => createFileDiff(file, action)) .join(''); diff --git a/app/assets/javascripts/ide/stores/modules/pipelines/getters.js b/app/assets/javascripts/ide/stores/modules/pipelines/getters.js index eb3cc027494..051159a0fd5 100644 --- a/app/assets/javascripts/ide/stores/modules/pipelines/getters.js +++ b/app/assets/javascripts/ide/stores/modules/pipelines/getters.js @@ -1,22 +1,23 @@ import { states } from './constants'; -export const hasLatestPipeline = state => !state.isLoadingPipeline && Boolean(state.latestPipeline); +export const hasLatestPipeline = (state) => + !state.isLoadingPipeline && Boolean(state.latestPipeline); -export const pipelineFailed = state => +export const pipelineFailed = (state) => state.latestPipeline && state.latestPipeline.details.status.text === states.failed; -export const failedStages = state => +export const failedStages = (state) => state.stages - .filter(stage => stage.status.text.toLowerCase() === states.failed) - .map(stage => ({ + .filter((stage) => stage.status.text.toLowerCase() === states.failed) + .map((stage) => ({ ...stage, - jobs: stage.jobs.filter(job => job.status.text.toLowerCase() === states.failed), + jobs: stage.jobs.filter((job) => job.status.text.toLowerCase() === states.failed), })); -export const failedJobsCount = state => +export const failedJobsCount = (state) => state.stages.reduce( - (acc, stage) => acc + stage.jobs.filter(j => j.status.text === states.failed).length, + (acc, stage) => acc + stage.jobs.filter((j) => j.status.text === states.failed).length, 0, ); -export const jobsCount = state => state.stages.reduce((acc, stage) => acc + stage.jobs.length, 0); +export const jobsCount = (state) => state.stages.reduce((acc, stage) => acc + stage.jobs.length, 0); diff --git a/app/assets/javascripts/members/components/table/members_table.vue b/app/assets/javascripts/members/components/table/members_table.vue index da77e5caad2..0c79bf06d64 100644 --- a/app/assets/javascripts/members/components/table/members_table.vue +++ b/app/assets/javascripts/members/components/table/members_table.vue @@ -34,7 +34,9 @@ export default { computed: { ...mapState(['members', 'tableFields', 'tableAttrs', 'currentUserId', 'sourceId']), filteredFields() { - return FIELDS.filter(field => this.tableFields.includes(field.key) && this.showField(field)); + return FIELDS.filter( + (field) => this.tableFields.includes(field.key) && this.showField(field), + ); }, userIsLoggedIn() { return this.currentUserId !== null; @@ -56,7 +58,7 @@ export default { return false; } - return this.members.some(member => { + return this.members.some((member) => { return ( canRemove(member, this.sourceId) || canResend(member) || diff --git a/app/assets/javascripts/members/store/utils.js b/app/assets/javascripts/members/store/utils.js index 7dcd33111e8..585962be27e 100644 --- a/app/assets/javascripts/members/store/utils.js +++ b/app/assets/javascripts/members/store/utils.js @@ -1 +1,2 @@ -export const findMember = (state, memberId) => state.members.find(member => member.id === memberId); +export const findMember = (state, memberId) => + state.members.find((member) => member.id === memberId); diff --git a/app/assets/javascripts/monitoring/components/charts/anomaly.vue b/app/assets/javascripts/monitoring/components/charts/anomaly.vue index ac401c6e381..14483fe04de 100644 --- a/app/assets/javascripts/monitoring/components/charts/anomaly.vue +++ b/app/assets/javascripts/monitoring/components/charts/anomaly.vue @@ -1,4 +1,5 @@