Skip to content
Snippets Groups Projects
Commit 784fae4b authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent fc53ce8e
No related branches found
No related tags found
No related merge requests found
Showing
with 179 additions and 31 deletions
Loading
Loading
@@ -226,7 +226,7 @@ export default {
<icon :size="12" name="expand-up" aria-hidden="true" />
</a>
<a class="mx-2 cursor-pointer js-unfold-all" @click="handleExpandLines()">
<span>{{ s__('Diffs|Show all lines') }}</span>
<span>{{ s__('Diffs|Show unchanged lines') }}</span>
</a>
<a
v-if="canExpandDown"
Loading
Loading
Loading
Loading
@@ -57,4 +57,4 @@ export const MIN_RENDERING_MS = 2;
export const START_RENDERING_INDEX = 200;
export const INLINE_DIFF_LINES_KEY = 'highlighted_diff_lines';
export const PARALLEL_DIFF_LINES_KEY = 'parallel_diff_lines';
export const DIFFS_PER_PAGE = 10;
export const DIFFS_PER_PAGE = 20;
Loading
Loading
@@ -172,7 +172,7 @@
}
 
.template-selector-dropdowns-wrap {
display: inline-block;
display: flex;
vertical-align: top;
 
@media(max-width: map-get($grid-breakpoints, lg)-1) {
Loading
Loading
@@ -189,6 +189,7 @@
display: inline-block;
vertical-align: top;
font-family: $regular_font;
margin: 0 8px 0 0;
 
@media(max-width: map-get($grid-breakpoints, lg)-1) {
display: block;
Loading
Loading
Loading
Loading
@@ -249,14 +249,9 @@ module Clusters
end
 
def kubernetes_namespace_for(environment)
project = environment.project
persisted_namespace = Clusters::KubernetesNamespaceFinder.new(
self,
project: project,
environment_name: environment.name
).execute
persisted_namespace&.namespace || Gitlab::Kubernetes::DefaultNamespace.new(self, project: project).from_environment_slug(environment.slug)
managed_namespace(environment) ||
ci_configured_namespace(environment) ||
default_namespace(environment)
end
 
def allow_user_defined_namespace?
Loading
Loading
@@ -308,6 +303,25 @@ module Clusters
end
end
 
def managed_namespace(environment)
Clusters::KubernetesNamespaceFinder.new(
self,
project: environment.project,
environment_name: environment.name
).execute&.namespace
end
def ci_configured_namespace(environment)
environment.last_deployable&.expanded_kubernetes_namespace
end
def default_namespace(environment)
Gitlab::Kubernetes::DefaultNamespace.new(
self,
project: environment.project
).from_environment_slug(environment.slug)
end
def instance_domain
@instance_domain ||= Gitlab::CurrentSettings.auto_devops_domain
end
Loading
Loading
Loading
Loading
@@ -2079,10 +2079,16 @@ class Project < ApplicationRecord
end
 
def default_merge_request_target
if forked_from_project&.merge_requests_enabled?
forked_from_project
else
return self unless forked_from_project
return self unless forked_from_project.merge_requests_enabled?
# When our current visibility is more restrictive than the source project,
# (e.g., the fork is `private` but the parent is `public`), target the less
# permissive project
if visibility_level_value < forked_from_project.visibility_level_value
self
else
forked_from_project
end
end
 
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@
= form_tag labels_filter_path, method: :get do
= hidden_field_tag :subscribed, params[:subscribed]
.input-group
= search_field_tag :search, params[:search], { placeholder: _('Filter'), id: 'label-search', class: 'form-control search-text-input input-short', spellcheck: false }
= search_field_tag :search, params[:search], { placeholder: _('Filter'), id: 'label-search', class: 'form-control search-text-input input-short', spellcheck: false, autofocus: true }
%span.input-group-append
%button.btn.btn-default{ type: "submit", "aria-label" => _('Submit search') }
= icon("search")
Loading
Loading
---
title: Allow Kubernetes namespaces specified via CI template to be used for terminals,
pod logs and deploy boards
merge_request: 21460
author:
type: added
---
title: Add autofocus to label search fields
merge_request: 21508
author:
type: changed
---
title: Improve diff expansion text
merge_request: 21616
author:
type: other
---
title: Fix Single-File-Editor-Layout breaking when branch name is too long
merge_request: 21577
author: Roman Kuba
type: fixed
---
title: 'When a forked project is less visible than its source, merge requests now target the less visible project by default.'
merge_request: 21517
author:
type: changed
Loading
Loading
@@ -119,6 +119,7 @@ Rails.application.routes.draw do
draw :trial_registration
draw :country
draw :country_state
draw :subscription
end
 
Gitlab.ee do
Loading
Loading
Loading
Loading
@@ -144,6 +144,8 @@ Read more about local state management with Apollo in the [Vue Apollo documentat
 
### Testing
 
#### Mocking response as component data
With [Vue test utils][vue-test-utils] it is easy to quickly test components that
fetch GraphQL queries. The simplest way is to use `shallowMount` and then set
the data on the component
Loading
Loading
@@ -158,7 +160,100 @@ it('tests apollo component', () => {
});
```
 
Another possible way is testing queries with mocked GraphQL schema. Read more about this way in [Vue Apollo testing documentation](https://vue-apollo.netlify.com/guide/testing.html#tests-with-mocked-graqhql-schema)
#### Testing loading state
If we need to test how our component renders when results from the GraphQL API are still loading, we can mock a loading state into respective Apollo queries/mutations:
```javascript
function createComponent({
loading = false,
} = {}) {
const $apollo = {
queries: {
designs: {
loading,
},
};
wrapper = shallowMount(Index, {
sync: false,
mocks: { $apollo }
});
}
it('renders loading icon', () => {
createComponent({ loading: true });
expect(wrapper.element).toMatchSnapshot();
})
```
#### Testing Apollo components
If we use `ApolloQuery` or `ApolloMutation` in our components, in order to test their functionality we need to add a stub first:
```javascript
import { ApolloMutation } from 'vue-apollo';
function createComponent(props = {}) {
wrapper = shallowMount(MyComponent, {
sync: false,
propsData: {
...props,
},
stubs: {
ApolloMutation,
},
});
}
```
`ApolloMutation` component exposes `mutate` method via scoped slot. If we want to test this method, we need to add it to mocks:
```javascript
const mutate = jest.fn(() => Promise.resolve());
const $apollo = {
mutate,
};
function createComponent(props = {}) {
wrapper = shallowMount(MyComponent, {
sync: false,
propsData: {
...props,
},
stubs: {
ApolloMutation,
},
mocks: {
$apollo:
}
});
}
```
Then we can check if `mutate` is called with correct variables:
```javascript
const mutationVariables = {
mutation: createNoteMutation,
update: expect.anything(),
variables: {
input: {
noteableId: 'noteable-id',
body: 'test',
discussionId: '0',
},
},
};
it('calls mutation on submitting form ', () => {
createComponent()
findReplyForm().vm.$emit('submitForm');
expect(mutate).toHaveBeenCalledWith(mutationVariables);
});
```
 
## Usage outside of Vue
 
Loading
Loading
Loading
Loading
@@ -68,7 +68,7 @@ list.
 
By default, the diff shows only the parts of a file which are changed.
To view more unchanged lines above or below a change click on the
**Expand up** or **Expand down** icons. You can also click on **Show all lines**
**Expand up** or **Expand down** icons. You can also click on **Show unchanged lines**
to expand the entire file.
 
![Incrementally expand merge request diffs](img/incrementally_expand_merge_request_diffs_v12_2.png)
Loading
Loading
Loading
Loading
@@ -3209,6 +3209,9 @@ msgstr ""
msgid "Checking username availability..."
msgstr ""
 
msgid "Checkout"
msgstr ""
msgid "Cherry-pick this commit"
msgstr ""
 
Loading
Loading
@@ -5994,7 +5997,7 @@ msgstr ""
msgid "Diffs|No file name available"
msgstr ""
 
msgid "Diffs|Show all lines"
msgid "Diffs|Show unchanged lines"
msgstr ""
 
msgid "Diffs|Something went wrong while fetching diff lines."
Loading
Loading
Loading
Loading
@@ -24,7 +24,7 @@ describe AbuseReportsController do
get :new, params: { user_id: user_id }
 
expect(response).to redirect_to root_path
expect(flash[:alert]).to eq('Cannot create the abuse report. The user has been deleted.')
expect(flash[:alert]).to eq(_('Cannot create the abuse report. The user has been deleted.'))
end
end
 
Loading
Loading
@@ -35,7 +35,7 @@ describe AbuseReportsController do
get :new, params: { user_id: user.id }
 
expect(response).to redirect_to user
expect(flash[:alert]).to eq('Cannot create the abuse report. This user has been blocked.')
expect(flash[:alert]).to eq(_('Cannot create the abuse report. This user has been blocked.'))
end
end
end
Loading
Loading
Loading
Loading
@@ -155,7 +155,7 @@ describe Admin::UsersController do
put :block, params: { id: user.username }
user.reload
expect(user.blocked?).to be_truthy
expect(flash[:notice]).to eq 'Successfully blocked'
expect(flash[:notice]).to eq _('Successfully blocked')
end
end
 
Loading
Loading
@@ -171,7 +171,7 @@ describe Admin::UsersController do
put :unblock, params: { id: user.username }
user.reload
expect(user.blocked?).to be_truthy
expect(flash[:alert]).to eq 'This user cannot be unlocked manually from GitLab'
expect(flash[:alert]).to eq _('This user cannot be unlocked manually from GitLab')
end
end
 
Loading
Loading
@@ -184,7 +184,7 @@ describe Admin::UsersController do
put :unblock, params: { id: user.username }
user.reload
expect(user.blocked?).to be_falsey
expect(flash[:notice]).to eq 'Successfully unblocked'
expect(flash[:notice]).to eq _('Successfully unblocked')
end
end
end
Loading
Loading
@@ -234,7 +234,7 @@ describe Admin::UsersController do
go
 
expect(flash[:notice])
.to eq 'Two-factor Authentication has been disabled for this user'
.to eq _('Two-factor Authentication has been disabled for this user')
end
 
def go
Loading
Loading
@@ -249,7 +249,9 @@ describe Admin::UsersController do
 
it 'shows only one error message for an invalid email' do
post :create, params: { user: attributes_for(:user, email: 'bogus') }
expect(assigns[:user].errors).to contain_exactly("Email is invalid")
errors = assigns[:user].errors
expect(errors).to contain_exactly(errors.full_message(:email, I18n.t('errors.messages.invalid')))
end
end
 
Loading
Loading
@@ -346,7 +348,7 @@ describe Admin::UsersController do
it "shows a notice" do
post :impersonate, params: { id: user.username }
 
expect(flash[:alert]).to eq("You cannot impersonate a blocked user")
expect(flash[:alert]).to eq(_('You cannot impersonate a blocked user'))
end
 
it "doesn't sign us in as the user" do
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ describe PasswordsController do
post :create
 
expect(response).to have_gitlab_http_status(302)
expect(flash[:alert]).to eq 'Password authentication is unavailable.'
expect(flash[:alert]).to eq _('Password authentication is unavailable.')
end
end
 
Loading
Loading
@@ -26,7 +26,7 @@ describe PasswordsController do
it 'prevents a password reset' do
post :create, params: { user: { email: user.email } }
 
expect(flash[:alert]).to eq 'Password authentication is unavailable.'
expect(flash[:alert]).to eq _('Password authentication is unavailable.')
end
end
end
Loading
Loading
Loading
Loading
@@ -37,7 +37,7 @@ describe Profiles::PreferencesController do
context 'on successful update' do
it 'sets the flash' do
go
expect(flash[:notice]).to eq 'Preferences saved.'
expect(flash[:notice]).to eq _('Preferences saved.')
end
 
it "changes the user's preferences" do
Loading
Loading
@@ -62,7 +62,7 @@ describe Profiles::PreferencesController do
 
go
 
expect(flash[:alert]).to eq('Failed to save preferences.')
expect(flash[:alert]).to eq(_('Failed to save preferences.'))
end
end
 
Loading
Loading
Loading
Loading
@@ -70,7 +70,7 @@ describe Profiles::TwoFactorAuthsController do
 
it 'assigns error' do
go
expect(assigns[:error]).to eq 'Invalid pin code'
expect(assigns[:error]).to eq _('Invalid pin code')
end
 
it 'assigns qr_code' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment