Commit 36199aa6 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent efd32d389f95
......@@ -24,9 +24,9 @@ const JumpToDiscussion = Vue.extend({
computed: {
buttonText() {
if (this.discussionId) {
return __('Jump to next unresolved discussion');
return __('Jump to next unresolved thread');
} else {
return __('Jump to first unresolved discussion');
return __('Jump to first unresolved thread');
}
},
allResolved() {
......
......@@ -69,13 +69,11 @@ export default () => {
},
},
render(createElement) {
const isDiffView = this.activeTab === 'diffs';
// NOTE: Even though `discussionKeyboardNavigator` is added to the `notes-app`,
// it adds a global key listener so it works on the diffs tab as well.
// If we create a single Vue app for all of the MR tabs, we should move this
// up the tree, to the root.
return createElement(discussionKeyboardNavigator, { props: { isDiffView } }, [
return createElement(discussionKeyboardNavigator, [
createElement('notes-app', {
props: {
noteableData: this.noteableData,
......
......@@ -73,7 +73,7 @@ export default {
v-if="discussion.resolvable && shouldShowJumpToNextDiscussion"
class="btn-group discussion-actions ml-sm-2"
>
<jump-to-next-discussion-button @onClick="$emit('jumpToNextDiscussion')" />
<jump-to-next-discussion-button />
</div>
</div>
</template>
<script>
import { mapActions, mapGetters } from 'vuex';
import { mapGetters } from 'vuex';
import { GlTooltipDirective } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import discussionNavigation from '../mixins/discussion_navigation';
......@@ -17,9 +17,7 @@ export default {
'getUserData',
'getNoteableData',
'resolvableDiscussionsCount',
'firstUnresolvedDiscussionId',
'unresolvedDiscussionsCount',
'getDiscussion',
]),
isLoggedIn() {
return this.getUserData.id;
......@@ -37,16 +35,6 @@ export default {
return this.resolvableDiscussionsCount - this.unresolvedDiscussionsCount;
},
},
methods: {
...mapActions(['expandDiscussion']),
jumpToFirstUnresolvedDiscussion() {
const diffTab = window.mrTabs.currentAction === 'diffs';
const discussionId =
this.firstUnresolvedDiscussionId(diffTab) || this.firstUnresolvedDiscussionId();
const firstDiscussion = this.getDiscussion(discussionId);
this.jumpToDiscussion(firstDiscussion);
},
},
};
</script>
......@@ -83,9 +71,9 @@ export default {
<div v-if="isLoggedIn && !allResolved" class="btn-group btn-group-sm" role="group">
<button
v-gl-tooltip
title="Jump to first unresolved thread"
title="Jump to next unresolved thread"
class="btn btn-default discussion-next-btn"
@click="jumpToFirstUnresolvedDiscussion"
@click="jumpToNextDiscussion"
>
<icon name="comment-next" />
</button>
......
<script>
import { GlTooltipDirective } from '@gitlab/ui';
import icon from '~/vue_shared/components/icon.vue';
import discussionNavigation from '../mixins/discussion_navigation';
export default {
name: 'JumpToNextDiscussionButton',
......@@ -10,6 +11,7 @@ export default {
directives: {
GlTooltip: GlTooltipDirective,
},
mixins: [discussionNavigation],
};
</script>
......@@ -19,8 +21,8 @@ export default {
ref="button"
v-gl-tooltip
class="btn btn-default discussion-next-btn"
:title="s__('MergeRequests|Jump to next unresolved discussion')"
@click="$emit('onClick')"
:title="s__('MergeRequests|Jump to next unresolved thread')"
@click="jumpToNextDiscussion"
>
<icon name="comment-next" />
</button>
......
<script>
/* global Mousetrap */
import 'mousetrap';
import { mapGetters, mapActions } from 'vuex';
import discussionNavigation from '~/notes/mixins/discussion_navigation';
export default {
mixins: [discussionNavigation],
props: {
isDiffView: {
type: Boolean,
required: false,
default: false,
},
},
data() {
return {
currentDiscussionId: null,
};
},
computed: {
...mapGetters([
'nextUnresolvedDiscussionId',
'previousUnresolvedDiscussionId',
'getDiscussion',
]),
},
mounted() {
Mousetrap.bind('n', () => this.jumpToNextDiscussion());
Mousetrap.bind('p', () => this.jumpToPreviousDiscussion());
Mousetrap.bind('n', this.jumpToNextDiscussion);
Mousetrap.bind('p', this.jumpToPreviousDiscussion);
},
beforeDestroy() {
Mousetrap.unbind('n');
Mousetrap.unbind('p');
},
methods: {
...mapActions(['expandDiscussion']),
jumpToNextDiscussion() {
const nextId = this.nextUnresolvedDiscussionId(this.currentDiscussionId, this.isDiffView);
const nextDiscussion = this.getDiscussion(nextId);
this.jumpToDiscussion(nextDiscussion);
this.currentDiscussionId = nextId;
},
jumpToPreviousDiscussion() {
const prevId = this.previousUnresolvedDiscussionId(this.currentDiscussionId, this.isDiffView);
const prevDiscussion = this.getDiscussion(prevId);
this.jumpToDiscussion(prevDiscussion);
this.currentDiscussionId = prevId;
},
},
render() {
return this.$slots.default;
},
......
......@@ -14,7 +14,6 @@ import noteForm from './note_form.vue';
import diffWithNote from './diff_with_note.vue';
import noteable from '../mixins/noteable';
import resolvable from '../mixins/resolvable';
import discussionNavigation from '../mixins/discussion_navigation';
import eventHub from '../event_hub';
import DiscussionNotes from './discussion_notes.vue';
import DiscussionActions from './discussion_actions.vue';
......@@ -35,7 +34,7 @@ export default {
directives: {
GlTooltip: GlTooltipDirective,
},
mixins: [noteable, resolvable, discussionNavigation, diffLineNoteFormMixin],
mixins: [noteable, resolvable, diffLineNoteFormMixin],
props: {
discussion: {
type: Object,
......@@ -79,12 +78,8 @@ export default {
'convertedDisscussionIds',
'getNoteableData',
'userCanReply',
'nextUnresolvedDiscussionId',
'unresolvedDiscussionsCount',
'hasUnresolvedDiscussions',
'showJumpToNextDiscussion',
'getUserData',
'getDiscussion',
]),
currentUser() {
return this.getUserData;
......@@ -152,7 +147,6 @@ export default {
'saveNote',
'removePlaceholderNotes',
'toggleResolveNote',
'expandDiscussion',
'removeConvertedDiscussion',
]),
showReplyForm() {
......@@ -219,15 +213,6 @@ export default {
callback(err);
});
},
jumpToNextDiscussion() {
const nextId = this.nextUnresolvedDiscussionId(
this.discussion.id,
this.discussionsByDiffOrder,
);
const nextDiscussion = this.getDiscussion(nextId);
this.jumpToDiscussion(nextDiscussion);
},
deleteNoteHandler(note) {
this.$emit('noteDeleted', this.discussion, note);
},
......@@ -294,7 +279,6 @@ export default {
:should-show-jump-to-next-discussion="shouldShowJumpToNextDiscussion"
@showReplyForm="showReplyForm"
@resolve="resolveHandler"
@jumpToNextDiscussion="jumpToNextDiscussion"
/>
<div v-if="isReplying" class="avatar-note-form-holder">
<user-avatar-link
......
import { mapGetters, mapActions, mapState } from 'vuex';
import { scrollToElement } from '~/lib/utils/common_utils';
import eventHub from '../../notes/event_hub';
export default {
computed: {
...mapGetters([
'nextUnresolvedDiscussionId',
'previousUnresolvedDiscussionId',
'getDiscussion',
]),
...mapState({
currentDiscussionId: state => state.notes.currentDiscussionId,
}),
},
methods: {
...mapActions(['expandDiscussion', 'setCurrentDiscussionId']),
diffsJump(id) {
const selector = `ul.notes[data-discussion-id="${id}"]`;
......@@ -58,5 +71,21 @@ export default {
}
}
},
jumpToNextDiscussion() {
this.handleDiscussionJump(this.nextUnresolvedDiscussionId);
},
jumpToPreviousDiscussion() {
this.handleDiscussionJump(this.previousUnresolvedDiscussionId);
},
handleDiscussionJump(fn) {
const isDiffView = window.mrTabs.currentAction === 'diffs';
const targetId = fn(this.currentDiscussionId, isDiffView);
const discussion = this.getDiscussion(targetId);
this.jumpToDiscussion(discussion);
this.setCurrentDiscussionId(targetId);
},
},
};
......@@ -506,5 +506,8 @@ export const fetchDescriptionVersion = (_, { endpoint, startingVersion }) => {
});
};
export const setCurrentDiscussionId = ({ commit }, discussionId) =>
commit(types.SET_CURRENT_DISCUSSION_ID, discussionId);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};
......@@ -59,7 +59,6 @@ export const getDiscussionLastNote = state => discussion =>
export const unresolvedDiscussionsCount = state => state.unresolvedDiscussionsCount;
export const resolvableDiscussionsCount = state => state.resolvableDiscussionsCount;
export const hasUnresolvedDiscussions = state => state.hasUnresolvedDiscussions;
export const showJumpToNextDiscussion = (state, getters) => (mode = 'discussion') => {
const orderedDiffs =
......
......@@ -8,6 +8,7 @@ export default () => ({
convertedDisscussionIds: [],
targetNoteHash: null,
lastFetchedAt: null,
currentDiscussionId: null,
// View layer
isToggleStateButtonLoading: false,
......@@ -26,7 +27,6 @@ export default () => ({
commentsDisabled: false,
resolvableDiscussionsCount: 0,
unresolvedDiscussionsCount: 0,
hasUnresolvedDiscussions: false,
},
actions,
getters,
......
......@@ -25,6 +25,7 @@ export const COLLAPSE_DISCUSSION = 'COLLAPSE_DISCUSSION';
export const EXPAND_DISCUSSION = 'EXPAND_DISCUSSION';
export const TOGGLE_DISCUSSION = 'TOGGLE_DISCUSSION';
export const UPDATE_RESOLVABLE_DISCUSSIONS_COUNTS = 'UPDATE_RESOLVABLE_DISCUSSIONS_COUNTS';
export const SET_CURRENT_DISCUSSION_ID = 'SET_CURRENT_DISCUSSION_ID';
// Issue
export const CLOSE_ISSUE = 'CLOSE_ISSUE';
......
......@@ -267,7 +267,6 @@ export default {
discussion.resolvable &&
discussion.notes.some(note => note.resolvable && !note.resolved),
).length;
state.hasUnresolvedDiscussions = state.unresolvedDiscussionsCount > 1;
},
[types.CONVERT_TO_DISCUSSION](state, discussionId) {
......@@ -281,4 +280,8 @@ export default {
convertedDisscussionIds.splice(convertedDisscussionIds.indexOf(discussionId), 1);
Object.assign(state, { convertedDisscussionIds });
},
[types.SET_CURRENT_DISCUSSION_ID](state, discussionId) {
state.currentDiscussionId = discussionId;
},
};
......@@ -122,6 +122,13 @@ def source_icon(source, options = {})
else
source_identicon(source, options)
end
rescue GRPC::Unavailable, GRPC::DeadlineExceeded => e
# Handle Gitaly connection issues gracefully
Gitlab::ErrorTracking
.track_exception(e, source_type: source.class.name, source_id: source.id)
source_identicon(source, options)
end
def source_identicon(source, options = {})
......
---
title: Fix 503 errors caused by Gitaly failures during project_icon lookup
merge_request: 23930
author:
type: fixed
---
title: Cycle unresolved threads
merge_request: 23123
author:
type: changed
......@@ -10,6 +10,16 @@ def log_pool_size(db, previous_pool_size, current_pool_size)
Gitlab::AppLogger.debug(log_message.join(' '))
end
Gitlab.ee do
# We need to initialize the Geo database before
# setting the Geo DB connection pool size.
if File.exist?(Rails.root.join('config/database_geo.yml'))
Rails.application.configure do
config.geo_database = config_for(:database_geo)
end
end
end
# When running on multi-threaded runtimes like Puma or Sidekiq,
# set the number of threads per process as the minimum DB connection pool size.
# This is to avoid connectivity issues as was documented here:
......
# frozen_string_literal: true
Gitlab.ee do
if File.exist?(Rails.root.join('config/database_geo.yml'))
Rails.application.configure do
config.geo_database = config_for(:database_geo)
end
end
begin
if Gitlab::Geo.connected? && Gitlab::Geo.primary?
Gitlab::Geo.current_node&.update_clone_url!
end
rescue => e
warn "WARNING: Unable to check/update clone_url_prefix for Geo: #{e}"
if Gitlab::Geo.connected? && Gitlab::Geo.primary?
Gitlab::Geo.current_node&.update_clone_url!
end
rescue => e
warn "WARNING: Unable to check/update clone_url_prefix for Geo: #{e}"
end
......@@ -26,7 +26,7 @@ To do so we'll generate a dump of our current database. This dump will only
contain the structure, not any data. To generate this dump run the following
command on your active database server:
```bash
```shell
sudo -u gitlab-psql /opt/gitlab/embedded/bin/pg_dump -h /var/opt/gitlab/postgresql -p 5432 -U gitlab-psql -s -f /tmp/structure.sql gitlabhq_production
```
......@@ -39,14 +39,14 @@ Once the structure dump is generated we also need to generate a dump for the
can't be replicated easily by Slony. To generate this dump run the following
command on your active database server:
```bash
```shell
sudo -u gitlab-psql /opt/gitlab/embedded/bin/pg_dump -h /var/opt/gitlab/postgresql/ -p 5432 -U gitlab-psql -a -t schema_migrations -f /tmp/migrations.sql gitlabhq_production
```
Next we'll need to move these files somewhere accessible by the new database
server. The easiest way is to simply download these files to your local system:
```bash
```shell
scp your-user@production-database-host:/tmp/*.sql /tmp
```
......@@ -63,7 +63,7 @@ install Slony using said package manager.
When compiling Slony from source you *must* use the following commands to do so:
```bash
```shell
./configure --prefix=/path/to/installation/directory --with-perltools --with-pgconfigdir=/path/to/directory/containing/pg_config/bin
make
make install
......@@ -71,7 +71,7 @@ make install
Omnibus users can use the following commands:
```bash
```shell
./configure --prefix=/opt/gitlab/embedded --with-perltools --with-pgconfigdir=/opt/gitlab/embedded/bin
make
make install
......@@ -81,7 +81,7 @@ This assumes you have installed GitLab into `/opt/gitlab`.
To test if Slony is installed properly, run the following commands:
```bash
```shell
test -f /opt/gitlab/embedded/bin/slonik && echo 'Slony installed' || echo 'Slony not installed'
test -f /opt/gitlab/embedded/bin/slonik_init_cluster && echo 'Slony Perl tools are available' || echo 'Slony Perl tools are not available'
/opt/gitlab/embedded/bin/slonik -v
......@@ -91,7 +91,7 @@ This assumes Slony was installed to `/opt/gitlab/embedded`. If Slony was
installed properly the output of these commands will be (the mentioned "slonik"
version may be different):
```
```plaintext
Slony installed
Slony Perl tools are available
slonik version 2.2.5
......@@ -126,7 +126,7 @@ First we'll need to create some required directories and set the correct
permissions. To do so, run the following commands on both the old and new
database server:
```bash
```shell
sudo mkdir -p /var/log/gitlab/slony /var/run/slony1 /var/opt/gitlab/postgresql/slony
sudo chown gitlab-psql:root /var/log/gitlab/slony /var/run/slony1 /var/opt/gitlab/postgresql/slony
```
......@@ -184,7 +184,7 @@ use it. The following placeholders should be replaced:
The list of tables to replicate can be generated by running the following
command on your old PostgreSQL database:
```
```shell
sudo gitlab-psql gitlabhq_production -c "select concat('\"', schemaname, '.', tablename, '\",') from pg_catalog.pg_tables where schemaname = 'public' and tableowner = 'gitlab' and tablename != 'schema_migrations' order by tablename asc;" -t
```
......@@ -216,13 +216,13 @@ sure that the SQL files we generated earlier can be found in the `/tmp`
directory of the new server. Once these files are in place start a `psql`
session on this server:
```
```shell
sudo gitlab-psql gitlabhq_production
```
Now run the following commands:
```
```plaintext
\i /tmp/structure.sql
\i /tmp/migrations.sql
```
......@@ -231,7 +231,7 @@ To verify if the structure is in place close the session, start it again, then
run `\d`. If all went well you should see output along the lines of the
following:
```
```plaintext
List of relations
Schema | Name | Type | Owner
--------+---------------------------------------------+----------+-------------
......@@ -248,13 +248,13 @@ following:
Now we can initialize the required tables and what not that Slony will use for
its replication process. To do so, run the following on the old database:
```
```shell
sudo -u gitlab-psql /opt/gitlab/embedded/bin/slonik_init_cluster --conf /var/opt/gitlab/postgresql/slony/slon_tools.conf | /opt/gitlab/embedded/bin/slonik
```
If all went well this will produce something along the lines of:
```
```plaintext
<stdin>:10: Set up replication nodes
<stdin>:13: Next: configure paths for each node/origin
<stdin>:16: Replication nodes prepared
......@@ -264,13 +264,13 @@ If all went well this will produce something along the lines of:
Next we need to start a replication node on every server. To do so, run the
following on the old database:
```
```shell
sudo -u gitlab-psql /opt/gitlab/embedded/bin/slon_start 1 --conf /var/opt/gitlab/postgresql/slony/slon_tools.conf
```
If all went well this will produce output such as:
```
```plaintext
Invoke slon for node 1 - /opt/gitlab/embedded/bin/slon -p /var/run/slony1/slony_replication_node1.pid -s 1000 -d2 slony_replication 'host=192.168.0.7 dbname=gitlabhq_production user=slony port=5432 password=hieng8ezohHuCeiqu0leeghai4aeyahp' > /var/log/gitlab/slony/node1/gitlabhq_production-2016-10-06.log 2>&1 &
Slon successfully started for cluster slony_replication, node node1
PID [26740]
......@@ -279,7 +279,7 @@ Start the watchdog process as well...
Next we need to run the following command on the _new_ database server:
```
```shell
sudo -u gitlab-psql /opt/gitlab/embedded/bin/slon_start 2 --conf /var/opt/gitlab/postgresql/slony/slon_tools.conf
```
......@@ -288,13 +288,13 @@ This will produce similar output if all went well.
Next we need to tell the new database server what it should replicate. This can
be done by running the following command on the _new_ database server:
```
```shell
sudo -u gitlab-psql /opt/gitlab/embedded/bin/slonik_create_set 1 --conf /var/opt/gitlab/postgresql/slony/slon_tools.conf | /opt/gitlab/embedded/bin/slonik
```
This should produce output along the lines of the following:
```
```plaintext
<stdin>:11: Subscription set 1 (set1) created
<stdin>:12: Adding tables to the subscription set
<stdin>:16: Add primary keyed table public.abuse_reports
......@@ -308,13 +308,13 @@ This should produce output along the lines of the following:
Finally we can start the replication process by running the following on the
_new_ database server:
```
```shell
sudo -u gitlab-psql /opt/gitlab/embedded/bin/slonik_subscribe_set 1 2 --conf /var/opt/gitlab/postgresql/slony/slon_tools.conf | /opt/gitlab/embedded/bin/slonik
```
This should produce the following output:
```
```plaintext
<stdin>:6: Subscribed nodes to set 1
```
......@@ -324,7 +324,7 @@ not days. Unfortunately Slony itself doesn't really provide a way of knowing
when the two databases are in sync. To get an estimate of the progress you can
use the following shell script:
```
```shell
#!/usr/bin/env bash
set -e
......@@ -365,7 +365,7 @@ GitLab so it can use the new database, etc.
First, let's stop all of GitLab. Omnibus users can do so by running the
following on their GitLab server(s):
```
```shell
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
sudo gitlab-ctl stop mailroom
......@@ -382,7 +382,7 @@ as this data will be lost.
To stop replication, run the following on both database servers:
```bash
```shell
sudo -u gitlab-psql /opt/gitlab/embedded/bin/slon_kill --conf /var/opt/gitlab/postgresql/slony/slon_tools.conf
```
......@@ -394,7 +394,7 @@ The above setup does not replicate database sequences, as such these must be
reset manually in the target database. You can use the following script for
this:
```bash
```shell
#!/usr/bin/env bash
set -e
......@@ -459,7 +459,7 @@ main