From b4ded0ba7b4d2cdbed5b1f331cf2083a25ee4d7c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 10 Feb 2020 09:08:56 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../components/blob_header_viewer_switcher.vue | 75 ++++++++++++++++++++++ .../javascripts/blob/components/constants.js | 6 ++ app/assets/javascripts/boards/models/list.js | 45 +------------ .../javascripts/boards/stores/boards_store.js | 47 ++++++++++++++ app/assets/javascripts/commons/polyfills.js | 2 - .../components/error_tracking_list.vue | 4 +- .../error_tracking/store/list/actions.js | 4 ++ .../error_tracking/store/list/mutation_types.js | 1 + .../error_tracking/store/list/mutations.js | 3 + .../error_tracking_settings/store/getters.js | 4 +- .../error_tracking_settings/store/mutations.js | 9 +-- .../fragments/author.fragment.graphql | 6 ++ .../pipelines/pipeline_details_bundle.js | 8 +++ .../snippets/fragments/author.fragment.graphql | 8 --- .../snippets/queries/snippet.query.graphql | 6 +- 15 files changed, 162 insertions(+), 66 deletions(-) create mode 100644 app/assets/javascripts/blob/components/blob_header_viewer_switcher.vue create mode 100644 app/assets/javascripts/graphql_shared/fragments/author.fragment.graphql delete mode 100644 app/assets/javascripts/snippets/fragments/author.fragment.graphql (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/blob/components/blob_header_viewer_switcher.vue b/app/assets/javascripts/blob/components/blob_header_viewer_switcher.vue new file mode 100644 index 00000000000..7acdd574359 --- /dev/null +++ b/app/assets/javascripts/blob/components/blob_header_viewer_switcher.vue @@ -0,0 +1,75 @@ + + diff --git a/app/assets/javascripts/blob/components/constants.js b/app/assets/javascripts/blob/components/constants.js index fe2ac7b7c51..d3fed9e51e9 100644 --- a/app/assets/javascripts/blob/components/constants.js +++ b/app/assets/javascripts/blob/components/constants.js @@ -3,3 +3,9 @@ import { __ } from '~/locale'; export const BTN_COPY_CONTENTS_TITLE = __('Copy file contents'); export const BTN_RAW_TITLE = __('Open raw'); export const BTN_DOWNLOAD_TITLE = __('Download'); + +export const SIMPLE_BLOB_VIEWER = 'simple'; +export const SIMPLE_BLOB_VIEWER_TITLE = __('Display source'); + +export const RICH_BLOB_VIEWER = 'rich'; +export const RICH_BLOB_VIEWER_TITLE = __('Display rendered file'); diff --git a/app/assets/javascripts/boards/models/list.js b/app/assets/javascripts/boards/models/list.js index 299864c279b..ff50b8ed7d1 100644 --- a/app/assets/javascripts/boards/models/list.js +++ b/app/assets/javascripts/boards/models/list.js @@ -161,50 +161,7 @@ class List { } addMultipleIssues(issues, listFrom, newIndex) { - let moveBeforeId = null; - let moveAfterId = null; - - const listHasIssues = issues.every(issue => this.findIssue(issue.id)); - - if (!listHasIssues) { - if (newIndex !== undefined) { - if (this.issues[newIndex - 1]) { - moveBeforeId = this.issues[newIndex - 1].id; - } - - if (this.issues[newIndex]) { - moveAfterId = this.issues[newIndex].id; - } - - this.issues.splice(newIndex, 0, ...issues); - } else { - this.issues.push(...issues); - } - - if (this.label) { - issues.forEach(issue => issue.addLabel(this.label)); - } - - if (this.assignee) { - if (listFrom && listFrom.type === 'assignee') { - issues.forEach(issue => issue.removeAssignee(listFrom.assignee)); - } - issues.forEach(issue => issue.addAssignee(this.assignee)); - } - - if (IS_EE && this.milestone) { - if (listFrom && listFrom.type === 'milestone') { - issues.forEach(issue => issue.removeMilestone(listFrom.milestone)); - } - issues.forEach(issue => issue.addMilestone(this.milestone)); - } - - if (listFrom) { - this.issuesSize += issues.length; - - this.updateMultipleIssues(issues, listFrom, moveBeforeId, moveAfterId); - } - } + boardsStore.addMultipleListIssues(this, issues, listFrom, newIndex); } addIssue(issue, listFrom, newIndex) { diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js index df8b7a2df6c..e5ce8b70a4f 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js +++ b/app/assets/javascripts/boards/stores/boards_store.js @@ -131,6 +131,53 @@ const boardsStore = { listFrom.update(); }, + addMultipleListIssues(list, issues, listFrom, newIndex) { + let moveBeforeId = null; + let moveAfterId = null; + + const listHasIssues = issues.every(issue => list.findIssue(issue.id)); + + if (!listHasIssues) { + if (newIndex !== undefined) { + if (list.issues[newIndex - 1]) { + moveBeforeId = list.issues[newIndex - 1].id; + } + + if (list.issues[newIndex]) { + moveAfterId = list.issues[newIndex].id; + } + + list.issues.splice(newIndex, 0, ...issues); + } else { + list.issues.push(...issues); + } + + if (list.label) { + issues.forEach(issue => issue.addLabel(list.label)); + } + + if (list.assignee) { + if (listFrom && listFrom.type === 'assignee') { + issues.forEach(issue => issue.removeAssignee(listFrom.assignee)); + } + issues.forEach(issue => issue.addAssignee(list.assignee)); + } + + if (IS_EE && list.milestone) { + if (listFrom && listFrom.type === 'milestone') { + issues.forEach(issue => issue.removeMilestone(listFrom.milestone)); + } + issues.forEach(issue => issue.addMilestone(list.milestone)); + } + + if (listFrom) { + list.issuesSize += issues.length; + + list.updateMultipleIssues(issues, listFrom, moveBeforeId, moveAfterId); + } + } + }, + startMoving(list, issue) { Object.assign(this.moving, { list, issue }); }, diff --git a/app/assets/javascripts/commons/polyfills.js b/app/assets/javascripts/commons/polyfills.js index dec3c637c22..5e04b0573d2 100644 --- a/app/assets/javascripts/commons/polyfills.js +++ b/app/assets/javascripts/commons/polyfills.js @@ -1,5 +1,3 @@ -import 'core-js/stable'; - // Browser polyfills import 'formdata-polyfill'; import './polyfills/custom_event'; diff --git a/app/assets/javascripts/error_tracking/components/error_tracking_list.vue b/app/assets/javascripts/error_tracking/components/error_tracking_list.vue index 1c996cbc13b..a90f446159d 100644 --- a/app/assets/javascripts/error_tracking/components/error_tracking_list.vue +++ b/app/assets/javascripts/error_tracking/components/error_tracking_list.vue @@ -168,6 +168,7 @@ export default { 'setIndexPath', 'fetchPaginatedResults', 'updateStatus', + 'removeIgnoredResolvedErrors', ]), setSearchText(text) { this.errorSearchQuery = text; @@ -196,9 +197,9 @@ export default { updateIssueStatus(errorId, status) { this.updateStatus({ endpoint: this.getIssueUpdatePath(errorId), - redirectUrl: this.listPath, status, }); + this.removeIgnoredResolvedErrors(errorId); }, }, }; @@ -235,7 +236,6 @@ export default {
{ dispatch('startPolling'); }; +export const removeIgnoredResolvedErrors = ({ commit }, error) => { + commit(types.REMOVE_IGNORED_RESOLVED_ERRORS, error); +}; + export default () => {}; diff --git a/app/assets/javascripts/error_tracking/store/list/mutation_types.js b/app/assets/javascripts/error_tracking/store/list/mutation_types.js index c3468b7eabd..23495cbf01d 100644 --- a/app/assets/javascripts/error_tracking/store/list/mutation_types.js +++ b/app/assets/javascripts/error_tracking/store/list/mutation_types.js @@ -9,3 +9,4 @@ export const SET_ENDPOINT = 'SET_ENDPOINT'; export const SET_SORT_FIELD = 'SET_SORT_FIELD'; export const SET_SEARCH_QUERY = 'SET_SEARCH_QUERY'; export const SET_CURSOR = 'SET_CURSOR'; +export const REMOVE_IGNORED_RESOLVED_ERRORS = 'REMOVE_IGNORED_RESOLVED_ERRORS'; diff --git a/app/assets/javascripts/error_tracking/store/list/mutations.js b/app/assets/javascripts/error_tracking/store/list/mutations.js index dd5cde0576a..38d156263fb 100644 --- a/app/assets/javascripts/error_tracking/store/list/mutations.js +++ b/app/assets/javascripts/error_tracking/store/list/mutations.js @@ -59,4 +59,7 @@ export default { [types.SET_ENDPOINT](state, endpoint) { state.endpoint = endpoint; }, + [types.REMOVE_IGNORED_RESOLVED_ERRORS](state, error) { + state.errors = state.errors.filter(err => err.id !== error); + }, }; diff --git a/app/assets/javascripts/error_tracking_settings/store/getters.js b/app/assets/javascripts/error_tracking_settings/store/getters.js index d77e5f15469..e27fe9c079e 100644 --- a/app/assets/javascripts/error_tracking_settings/store/getters.js +++ b/app/assets/javascripts/error_tracking_settings/store/getters.js @@ -1,4 +1,4 @@ -import _ from 'underscore'; +import { isMatch } from 'lodash'; import { __, s__, sprintf } from '~/locale'; import { getDisplayName } from '../utils'; @@ -7,7 +7,7 @@ export const hasProjects = state => Boolean(state.projects) && state.projects.le export const isProjectInvalid = (state, getters) => Boolean(state.selectedProject) && getters.hasProjects && - !state.projects.some(project => _.isMatch(state.selectedProject, project)); + !state.projects.some(project => isMatch(state.selectedProject, project)); export const dropdownLabel = (state, getters) => { if (state.selectedProject !== null) { diff --git a/app/assets/javascripts/error_tracking_settings/store/mutations.js b/app/assets/javascripts/error_tracking_settings/store/mutations.js index 133f25264b9..e1986eb694b 100644 --- a/app/assets/javascripts/error_tracking_settings/store/mutations.js +++ b/app/assets/javascripts/error_tracking_settings/store/mutations.js @@ -1,4 +1,4 @@ -import _ from 'underscore'; +import { pick } from 'lodash'; import { convertObjectPropsToCamelCase, parseBoolean } from '~/lib/utils/common_utils'; import * as types from './mutation_types'; import { projectKeys } from '../utils'; @@ -12,7 +12,7 @@ export default { .map(convertObjectPropsToCamelCase) // The `pick` strips out extra properties returned from Sentry. // Such properties could be problematic later, e.g. when checking whether `projects` contains `selectedProject` - .map(project => _.pick(project, projectKeys)); + .map(project => pick(project, projectKeys)); }, [types.RESET_CONNECT](state) { state.connectSuccessful = false; @@ -29,10 +29,7 @@ export default { state.operationsSettingsEndpoint = operationsSettingsEndpoint; if (project) { - state.selectedProject = _.pick( - convertObjectPropsToCamelCase(JSON.parse(project)), - projectKeys, - ); + state.selectedProject = pick(convertObjectPropsToCamelCase(JSON.parse(project)), projectKeys); } }, [types.UPDATE_API_HOST](state, apiHost) { diff --git a/app/assets/javascripts/graphql_shared/fragments/author.fragment.graphql b/app/assets/javascripts/graphql_shared/fragments/author.fragment.graphql new file mode 100644 index 00000000000..9a2ff1c1648 --- /dev/null +++ b/app/assets/javascripts/graphql_shared/fragments/author.fragment.graphql @@ -0,0 +1,6 @@ +fragment Author on User { + avatarUrl + name + username + webUrl +} diff --git a/app/assets/javascripts/pipelines/pipeline_details_bundle.js b/app/assets/javascripts/pipelines/pipeline_details_bundle.js index 4ae3e813c36..71bdf279861 100644 --- a/app/assets/javascripts/pipelines/pipeline_details_bundle.js +++ b/app/assets/javascripts/pipelines/pipeline_details_bundle.js @@ -10,6 +10,7 @@ import pipelineHeader from './components/header_component.vue'; import eventHub from './event_hub'; import TestReports from './components/test_reports/test_reports.vue'; import testReportsStore from './stores/test_reports'; +import axios from '~/lib/utils/axios_utils'; Vue.use(Translate); @@ -111,5 +112,12 @@ export default () => { return createElement('test-reports'); }, }); + + axios + .get(dataset.testReportEndpoint) + .then(({ data }) => { + document.querySelector('.js-test-report-badge-counter').innerHTML = data.total_count; + }) + .catch(() => {}); } }; diff --git a/app/assets/javascripts/snippets/fragments/author.fragment.graphql b/app/assets/javascripts/snippets/fragments/author.fragment.graphql deleted file mode 100644 index 2684bd0fa37..00000000000 --- a/app/assets/javascripts/snippets/fragments/author.fragment.graphql +++ /dev/null @@ -1,8 +0,0 @@ -fragment Author on Snippet { - author { - name, - avatarUrl, - username, - webUrl - } -} \ No newline at end of file diff --git a/app/assets/javascripts/snippets/queries/snippet.query.graphql b/app/assets/javascripts/snippets/queries/snippet.query.graphql index 1cb2c86c4d8..c58a5168ba3 100644 --- a/app/assets/javascripts/snippets/queries/snippet.query.graphql +++ b/app/assets/javascripts/snippets/queries/snippet.query.graphql @@ -1,6 +1,6 @@ #import '../fragments/snippetBase.fragment.graphql' #import '../fragments/project.fragment.graphql' -#import '../fragments/author.fragment.graphql' +#import "~/graphql_shared/fragments/author.fragment.graphql" query GetSnippetQuery($ids: [ID!]) { snippets(ids: $ids) { @@ -8,7 +8,9 @@ query GetSnippetQuery($ids: [ID!]) { node { ...SnippetBase ...Project - ...Author + author { + ...Author + } } } } -- cgit v1.2.1