Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-10 12:08:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-10 12:08:56 +0300
commitb4ded0ba7b4d2cdbed5b1f331cf2083a25ee4d7c (patch)
tree6694fa9d8f3e226597cc01dfb8e3e07b50ae85b6 /app
parent2aaef94c80937d9d188f7b9cbbad2dcd1508c3c1 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/blob/components/blob_header_viewer_switcher.vue75
-rw-r--r--app/assets/javascripts/blob/components/constants.js6
-rw-r--r--app/assets/javascripts/boards/models/list.js45
-rw-r--r--app/assets/javascripts/boards/stores/boards_store.js47
-rw-r--r--app/assets/javascripts/commons/polyfills.js2
-rw-r--r--app/assets/javascripts/error_tracking/components/error_tracking_list.vue4
-rw-r--r--app/assets/javascripts/error_tracking/store/list/actions.js4
-rw-r--r--app/assets/javascripts/error_tracking/store/list/mutation_types.js1
-rw-r--r--app/assets/javascripts/error_tracking/store/list/mutations.js3
-rw-r--r--app/assets/javascripts/error_tracking_settings/store/getters.js4
-rw-r--r--app/assets/javascripts/error_tracking_settings/store/mutations.js9
-rw-r--r--app/assets/javascripts/graphql_shared/fragments/author.fragment.graphql6
-rw-r--r--app/assets/javascripts/pipelines/pipeline_details_bundle.js8
-rw-r--r--app/assets/javascripts/snippets/fragments/author.fragment.graphql8
-rw-r--r--app/assets/javascripts/snippets/queries/snippet.query.graphql6
-rw-r--r--app/finders/keys_finder.rb15
-rw-r--r--app/views/projects/pipelines/_with_tabs.html.haml2
17 files changed, 169 insertions, 76 deletions
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 @@
+<script>
+import { GlButton, GlButtonGroup, GlIcon, GlTooltipDirective } from '@gitlab/ui';
+import {
+ RICH_BLOB_VIEWER,
+ RICH_BLOB_VIEWER_TITLE,
+ SIMPLE_BLOB_VIEWER,
+ SIMPLE_BLOB_VIEWER_TITLE,
+} from './constants';
+
+export default {
+ components: {
+ GlIcon,
+ GlButtonGroup,
+ GlButton,
+ },
+ directives: {
+ GlTooltip: GlTooltipDirective,
+ },
+ props: {
+ blob: {
+ type: Object,
+ required: true,
+ },
+ },
+ data() {
+ return {
+ viewer: this.blob.richViewer ? RICH_BLOB_VIEWER : SIMPLE_BLOB_VIEWER,
+ };
+ },
+ computed: {
+ isSimpleViewer() {
+ return this.viewer === SIMPLE_BLOB_VIEWER;
+ },
+ isRichViewer() {
+ return this.viewer === RICH_BLOB_VIEWER;
+ },
+ },
+ methods: {
+ switchToViewer(viewer) {
+ if (viewer !== this.viewer) {
+ this.viewer = viewer;
+ this.$emit('switch-viewer', viewer);
+ }
+ },
+ },
+ SIMPLE_BLOB_VIEWER,
+ RICH_BLOB_VIEWER,
+ SIMPLE_BLOB_VIEWER_TITLE,
+ RICH_BLOB_VIEWER_TITLE,
+};
+</script>
+<template>
+ <gl-button-group class="js-blob-viewer-switcher ml-2">
+ <gl-button
+ v-gl-tooltip.hover
+ :aria-label="$options.SIMPLE_BLOB_VIEWER_TITLE"
+ :title="$options.SIMPLE_BLOB_VIEWER_TITLE"
+ :selected="isSimpleViewer"
+ :class="{ active: isSimpleViewer }"
+ @click="switchToViewer($options.SIMPLE_BLOB_VIEWER)"
+ >
+ <gl-icon name="code" :size="14" />
+ </gl-button>
+ <gl-button
+ v-gl-tooltip.hover
+ :aria-label="$options.RICH_BLOB_VIEWER_TITLE"
+ :title="$options.RICH_BLOB_VIEWER_TITLE"
+ :selected="isRichViewer"
+ :class="{ active: isRichViewer }"
+ @click="switchToViewer($options.RICH_BLOB_VIEWER)"
+ >
+ <gl-icon name="document" :size="14" />
+ </gl-button>
+ </gl-button-group>
+</template>
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 {
</gl-dropdown>
<div class="filtered-search-input-container flex-fill">
<gl-form-input
- v-model="errorSearchQuery"
class="pl-2 filtered-search"
:disabled="loading"
:placeholder="__('Search or filter results…')"
diff --git a/app/assets/javascripts/error_tracking/store/list/actions.js b/app/assets/javascripts/error_tracking/store/list/actions.js
index d96ac7f524e..6f8573c0f4d 100644
--- a/app/assets/javascripts/error_tracking/store/list/actions.js
+++ b/app/assets/javascripts/error_tracking/store/list/actions.js
@@ -100,4 +100,8 @@ export const fetchPaginatedResults = ({ commit, dispatch }, cursor) => {
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
+ }
}
}
}
diff --git a/app/finders/keys_finder.rb b/app/finders/keys_finder.rb
index 6fd914c88cd..0263d809246 100644
--- a/app/finders/keys_finder.rb
+++ b/app/finders/keys_finder.rb
@@ -8,16 +8,13 @@ class KeysFinder
'md5' => 'fingerprint'
}.freeze
- def initialize(current_user, params)
- @current_user = current_user
+ def initialize(params)
@params = params
end
def execute
- raise GitLabAccessDeniedError unless current_user.admin?
-
keys = by_key_type
- keys = by_user(keys)
+ keys = by_users(keys)
keys = sort(keys)
by_fingerprint(keys)
@@ -25,7 +22,7 @@ class KeysFinder
private
- attr_reader :current_user, :params
+ attr_reader :params
def by_key_type
if params[:key_type] == 'ssh'
@@ -39,10 +36,10 @@ class KeysFinder
keys.order_last_used_at_desc
end
- def by_user(keys)
- return keys unless params[:user]
+ def by_users(keys)
+ return keys unless params[:users]
- keys.for_user(params[:user])
+ keys.for_user(params[:users])
end
def by_fingerprint(keys)
diff --git a/app/views/projects/pipelines/_with_tabs.html.haml b/app/views/projects/pipelines/_with_tabs.html.haml
index 4d8cba5168d..cdd75d43a78 100644
--- a/app/views/projects/pipelines/_with_tabs.html.haml
+++ b/app/views/projects/pipelines/_with_tabs.html.haml
@@ -18,7 +18,7 @@
%li.js-tests-tab-link
= link_to test_report_project_pipeline_path(@project, @pipeline), data: { target: '#js-tab-tests', action: 'test_report', toggle: 'tab' }, class: 'test-tab' do
= s_('TestReports|Tests')
- %span.badge.badge-pill= pipeline.test_reports.total_count
+ %span.badge.badge-pill.js-test-report-badge-counter
= render_if_exists "projects/pipelines/tabs_holder", pipeline: @pipeline, project: @project
.tab-content