提交 3b963d69 编写于 作者: G GitLab Bot

Add latest changes from gitlab-org/gitlab@master

上级 d06c3083
56251315578cd17c0ceebcb911e8d3ddb159afca
78d2b0cdb08b0e45de5324e2ac992282b7ecf691
......@@ -81,7 +81,7 @@ GitLab is a Ruby on Rails application that runs on the following software:
- Ubuntu/Debian/CentOS/RHEL/OpenSUSE
- Ruby (MRI) 2.6.5
- Git 2.8.4+
- Redis 2.8+
- Redis 4.0+
- PostgreSQL 11+
For more information please see the [architecture](https://docs.gitlab.com/ee/development/architecture.html) and [requirements](https://docs.gitlab.com/ee/install/requirements.html) documentation.
......
<script>
import { mapState, mapActions, mapGetters } from 'vuex';
import sum from 'lodash/sum';
import { GlDeprecatedButton, GlCard, GlIcon } from '@gitlab/ui';
import { GlButton, GlCard, GlIcon } from '@gitlab/ui';
import { n__ } from '~/locale';
import { monitoringDashboard } from '~/monitoring/stores';
import MetricEmbed from './metric_embed.vue';
export default {
components: {
GlDeprecatedButton,
GlButton,
GlCard,
GlIcon,
MetricEmbed,
......@@ -78,15 +78,16 @@ export default {
:body-class="bodyClass"
>
<template #header>
<gl-deprecated-button
class="collapsible-card-btn d-flex text-decoration-none"
<gl-button
class="collapsible-card-btn gl-display-flex gl-text-decoration-none gl-reset-color! gl-hover-text-blue-800! gl-shadow-none!"
:aria-label="buttonLabel"
variant="link"
category="tertiary"
@click="toggleCollapsed"
>
<gl-icon class="mr-1" :name="arrowIconName" />
{{ buttonLabel }}
</gl-deprecated-button>
</gl-button>
</template>
<div class="d-flex flex-wrap">
<metric-embed
......
......@@ -74,8 +74,9 @@ export default {
<span data-testid="package-type" class="gl-font-weight-bold">{{ packageTypeDisplay }}</span>
</div>
<div v-if="hasTagsToDisplay" class="gl-display-flex gl-align-items-center gl-mr-5">
<package-tags :tag-display-limit="1" :tags="packageEntity.tags" />
<div class="gl-display-flex gl-align-items-center gl-mr-5">
<gl-icon name="disk" class="gl-text-gray-500 gl-mr-3" />
<span data-testid="package-size" class="gl-font-weight-bold">{{ totalSize }}</span>
</div>
<div v-if="packagePipeline" class="gl-display-flex gl-align-items-center gl-mr-5">
......@@ -103,9 +104,8 @@ export default {
>
</div>
<div class="gl-display-flex gl-align-items-center gl-mr-5">
<gl-icon name="disk" class="gl-text-gray-500 gl-mr-3" />
<span data-testid="package-size" class="gl-font-weight-bold">{{ totalSize }}</span>
<div v-if="hasTagsToDisplay" class="gl-display-flex gl-align-items-center gl-mr-5">
<package-tags :tag-display-limit="2" :tags="packageEntity.tags" hide-label />
</div>
</div>
</div>
......
......@@ -80,6 +80,7 @@ export default {
data-testid="tagBadge"
:class="tagBadgeClass(index)"
variant="info"
size="sm"
>{{ tag.name }}</gl-badge
>
......@@ -89,6 +90,7 @@ export default {
data-testid="moreBadge"
variant="muted"
:title="moreTagsTooltip"
size="sm"
class="gl-display-none d-md-flex gl-ml-2"
><gl-sprintf :message="__('+%{tags} more')">
<template #tags>
......
......@@ -254,7 +254,7 @@ export default {
href="#"
:aria-label="__('Leave zen mode')"
>
<icon :size="16" name="screen-normal" />
<icon :size="16" name="minimize" />
</a>
<markdown-toolbar
:markdown-docs-path="markdownDocsPath"
......
......@@ -221,7 +221,7 @@ export default {
:title="__('Go full screen')"
type="button"
>
<icon name="screen-full" />
<icon name="maximize" />
</button>
</div>
</li>
......
......@@ -132,10 +132,10 @@ ul.content-list {
a {
color: $gl-text-color;
}
&.inline-link {
color: $blue-600;
}
.member-group-link {
color: $blue-600;
}
.description {
......
......@@ -180,6 +180,10 @@
word-break: break-all;
}
.member-group-link {
display: inline-block;
}
.form-control {
width: inherit;
}
......
......@@ -81,7 +81,7 @@ class GraphqlController < ApplicationController
end
def context
@context ||= { current_user: current_user }
@context ||= { current_user: current_user, is_sessionless_user: !!sessionless_user? }
end
def build_variables(variable_info)
......
......@@ -10,6 +10,9 @@ class Projects::MergeRequests::ContentController < Projects::MergeRequests::Appl
before_action :set_polling_header
around_action :allow_gitaly_ref_name_caching
FAST_POLLING_INTERVAL = 10.seconds.in_milliseconds
SLOW_POLLING_INTERVAL = 5.minutes.in_milliseconds
def widget
respond_to do |format|
format.json do
......@@ -29,7 +32,8 @@ class Projects::MergeRequests::ContentController < Projects::MergeRequests::Appl
private
def set_polling_header
Gitlab::PollingInterval.set_header(response, interval: 10_000)
interval = merge_request.open? ? FAST_POLLING_INTERVAL : SLOW_POLLING_INTERVAL
Gitlab::PollingInterval.set_header(response, interval: interval)
end
def serializer(entity)
......
......@@ -17,6 +17,10 @@ module Mutations
context[:current_user]
end
def api_user?
context[:is_sessionless_user]
end
# Returns Array of errors on an ActiveRecord object
def errors_on_object(record)
record.errors.full_messages
......
......@@ -214,7 +214,7 @@ class Repository
return false if with_slash.empty?
prefixes = no_slash.map { |ref| Regexp.escape(ref) }.join('|')
prefix_regex = %r{^#{prefixes}/}
prefix_regex = %r{^(#{prefixes})/}
with_slash.any? do |ref|
prefix_regex.match?(ref)
......
......@@ -16,4 +16,4 @@
- else
= text_area_tag attr, current_text, data: { qa_selector: qa_selector }, class: classes, placeholder: placeholder
%a.zen-control.zen-control-leave.js-zen-leave.gl-text-gray-500{ href: "#" }
= sprite_icon('compress')
= sprite_icon('minimize')
......@@ -10,4 +10,4 @@
= markdown_toolbar_button({ icon: "table", data: { "md-tag" => "| header | header |\n| ------ | ------ |\n| cell | cell |\n| cell | cell |", "md-prepend" => true }, title: _("Add a table") })
- if show_fullscreen_button
%button.toolbar-btn.toolbar-fullscreen-btn.js-zen-enter.has-tooltip{ type: "button", tabindex: -1, "aria-label": "Go full screen", title: _("Go full screen"), data: { container: "body" } }
= sprite_icon("screen-full")
= sprite_icon("maximize")
......@@ -33,7 +33,7 @@
- if source.instance_of?(Group) && source != @group
&middot;
= link_to source.full_name, source, class: "gl-display-inline-block inline-link"
= link_to source.full_name, source, class: "member-group-link"
.cgray
- if member.request?
......
---
title: Update order of the Header Metadata in Package details
merge_request: 39585
author:
type: changed
---
title: Syncronize use of maximize and minimize icons in order to deprecate duplicates
with different names
merge_request: 39889
author:
type: other
---
title: Increase poll interval for merged MRs widget
merge_request: 39961
author:
type: performance
......@@ -78,6 +78,10 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o
1. GitLab 10.4 and up only: Do the following to make sure the `gitlab` database user has a password defined:
NOTE: **Note:**
Until FDW settings are removed in GitLab version 14.0, avoid using single or double quotes in the
password for PostgreSQL as that will lead to errors when reconfiguring.
Generate a MD5 hash of the desired password:
```shell
......
......@@ -158,3 +158,15 @@ The following are PostgreSQL upgrade validation tests we performed.
- [`gitlab-ctl` reconfigure fails on Redis node in multi-node Geo setup](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4706).
- [Geo multi-node upgrade from 12.0.9 to 12.1.9 does not upgrade PostgreSQL](https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/4705).
- [Refresh foreign tables fails on app server in multi-node setup after upgrade to 12.1.9](https://gitlab.com/gitlab-org/gitlab/-/issues/32119).
## Other tests
The following are additional validation tests we performed.
### August 2020
[Test Gitaly Cluster on a Geo Deployment](https://gitlab.com/gitlab-org/gitlab/-/issues/223210):
- Description: Tested a Geo deployment with Gitaly clusters configured on both the primary and secondary Geo sites. Triggered automatic Gitaly cluster failover on the primary Geo site, and ran end-to-end Geo tests. Then triggered Gitaly cluster failover on the secondary Geo site, and re-ran the end-to-end Geo tests.
- Outcome: Successful end-to-end tests before and after Gitaly cluster failover on the primary site, and before and after Gitaly cluster failover on the secondary site.
......@@ -14,7 +14,7 @@ which is exposed as an API endpoint at `/api/graphql`.
In March 2019, Nick Thomas hosted a Deep Dive (GitLab team members only: `https://gitlab.com/gitlab-org/create-stage/issues/1`)
on GitLab's [GraphQL API](../api/graphql/index.md) to share his domain specific knowledge
with anyone who may work in this part of the code base in the future. You can find the
with anyone who may work in this part of the codebase in the future. You can find the
[recording on YouTube](https://www.youtube.com/watch?v=-9L_1MWrjkg), and the slides on
[Google Slides](https://docs.google.com/presentation/d/1qOTxpkTdHIp1CRjuTvO-aXg0_rUtzE3ETfLUdnBB5uQ/edit)
and in [PDF](https://gitlab.com/gitlab-org/create-stage/uploads/8e78ea7f326b2ef649e7d7d569c26d56/GraphQL_Deep_Dive__Create_.pdf).
......@@ -33,7 +33,7 @@ Authentication happens through the `GraphqlController`, right now this
uses the same authentication as the Rails application. So the session
can be shared.
It is also possible to add a `private_token` to the querystring, or
It's also possible to add a `private_token` to the query string, or
add a `HTTP_PRIVATE_TOKEN` header.
## Global IDs
......@@ -75,7 +75,7 @@ The `iid`, `title` and `description` are _scalar_ GraphQL types.
When exposing a model through the GraphQL API, we do so by creating a
new type in `app/graphql/types`. You can also declare custom GraphQL data types
for scalar data types (e.g. `TimeType`).
for scalar data types (for example `TimeType`).
When exposing properties in a type, make sure to keep the logic inside
the definition as minimal as possible. Instead, consider moving any
......@@ -760,6 +760,44 @@ to advertise the need for lookahead:
For an example of real world use, please
see [`ResolvesMergeRequests`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/graphql/resolvers/concerns/resolves_merge_requests.rb).
## Pass a parent object into a child Presenter
Sometimes you need to access the resolved query parent in a child context to compute fields. Usually the parent is only
available in the `Resolver` class as `parent`.
To find the parent object in your `Presenter` class:
1. Add the parent object to the GraphQL `context` from within your resolver's `resolve` method:
```ruby
def resolve(**args)
context[:parent_object] = parent
end
```
1. Declare that your fields require the `parent` field context. For example:
```ruby
# in ChildType
field :computed_field, SomeType, null: true,
method: :my_computing_method,
extras: [:parent], # Necessary
description: 'My field description'
```
1. Declare your field's method in your Presenter class and have it accept the `parent` keyword argument.
This argument contains the parent **GraphQL context**, so you have to access the parent object with
`parent[:parent_object]` or whatever key you used in your `Resolver`:
```ruby
# in ChildPresenter
def my_computing_method(parent:)
# do something with `parent[:parent_object]` here
end
```
For an example of real-world use, check [this MR that added `scopedPath` and `scopedUrl` to `IterationPresenter`](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/39543)
## Mutations
Mutations are used to change any stored values, or to trigger
......
......@@ -55,5 +55,5 @@ publish_package:
npm publish &&
echo "Successfully published version ${NPM_PACKAGE_VERSION} of ${NPM_PACKAGE_NAME} to GitLab's NPM registry: ${CI_PROJECT_URL}/-/packages"
} || {
echo "No new version of ${NPM_PACKAGE_NAME} published. This is most likely because version ${NPM_PACKAGE_VERSION} already exists in GitLab's NPM registry."
echo "No new version of ${NPM_PACKAGE_NAME} published. This is most likely because version ${NPM_PACKAGE_VERSION} already exists in GitLab's NPM registry."; exit 1
}
......@@ -12587,9 +12587,6 @@ msgstr ""
msgid "How many users will be evaluating the trial?"
msgstr ""
msgid "How to upgrade"
msgstr ""
msgid "However, you are already a member of this %{member_source}. Sign in using a different account to accept the invitation."
msgstr ""
......
......@@ -138,8 +138,12 @@ module Trigger
def extra_variables
# Use CI_MERGE_REQUEST_SOURCE_BRANCH_SHA for omnibus checkouts due to pipeline for merged results
# and fallback to CI_COMMIT_SHA for the `detached` pipelines.
# We also set IMAGE_TAG so the GitLab and QA docker images are tagged with
# that SHA.
source_sha = Trigger.non_empty_variable_value('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA') || ENV['CI_COMMIT_SHA']
{
'GITLAB_VERSION' => Trigger.non_empty_variable_value('CI_MERGE_REQUEST_SOURCE_BRANCH_SHA') || ENV['CI_COMMIT_SHA'],
'GITLAB_VERSION' => source_sha,
'IMAGE_TAG' => source_sha,
'ALTERNATIVE_SOURCES' => 'true',
'SECURITY_SOURCES' => Trigger.security? ? 'true' : 'false',
'ee' => Trigger.ee? ? 'true' : 'false',
......
......@@ -60,14 +60,28 @@ RSpec.describe GraphqlController do
it 'updates the users last_activity_on field' do
expect { post :execute }.to change { user.reload.last_activity_on }
end
it "sets context's sessionless value as false" do
post :execute
expect(assigns(:context)[:is_sessionless_user]).to be false
end
end
context 'when user uses an API token' do
let(:user) { create(:user, last_activity_on: Date.yesterday) }
let(:token) { create(:personal_access_token, user: user, scopes: [:api]) }
subject { post :execute, params: { access_token: token.token } }
it 'updates the users last_activity_on field' do
expect { post :execute, params: { access_token: token.token } }.to change { user.reload.last_activity_on }
expect { subject }.to change { user.reload.last_activity_on }
end
it "sets context's sessionless value as true" do
subject
expect(assigns(:context)[:is_sessionless_user]).to be true
end
end
......@@ -77,6 +91,12 @@ RSpec.describe GraphqlController do
expect(response).to have_gitlab_http_status(:ok)
end
it "sets context's sessionless value as false" do
post :execute
expect(assigns(:context)[:is_sessionless_user]).to be false
end
end
end
......
......@@ -48,6 +48,8 @@ RSpec.describe Projects::MergeRequests::ContentController do
expect(merge_request).to receive(:check_mergeability)
do_request(:widget)
expect(response.headers['Poll-Interval']).to eq('10000')
end
context 'merged merge request' do
......@@ -59,6 +61,7 @@ RSpec.describe Projects::MergeRequests::ContentController do
do_request(:widget)
expect(response).to match_response_schema('entities/merge_request_poll_widget')
expect(response.headers['Poll-Interval']).to eq('300000')
end
end
end
......
import { createLocalVue, mount, shallowMount } from '@vue/test-utils';
import Vuex from 'vuex';
import { GlDeprecatedButton, GlCard } from '@gitlab/ui';
import { GlButton, GlCard } from '@gitlab/ui';
import { TEST_HOST } from 'helpers/test_constants';
import EmbedGroup from '~/monitoring/components/embeds/embed_group.vue';
import MetricEmbed from '~/monitoring/components/embeds/metric_embed.vue';
......@@ -80,7 +80,7 @@ describe('Embed Group', () => {
metricsWithDataGetter.mockReturnValue([1]);
mountComponent({ shallow: false, stubs: { MetricEmbed: '<div />' } });
wrapper.find(GlDeprecatedButton).trigger('click');
wrapper.find(GlButton).trigger('click');
wrapper.vm.$nextTick(() => {
expect(wrapper.find('.card-body').classes()).toContain('d-none');
......@@ -150,14 +150,14 @@ describe('Embed Group', () => {
metricsWithDataGetter.mockReturnValue([1]);
mountComponent({ shallow: false, stubs: { MetricEmbed: '<div />' } });
expect(wrapper.find(GlDeprecatedButton).text()).toBe('Hide chart');
expect(wrapper.find(GlButton).text()).toBe('Hide chart');
});
it('has a plural label when there are multiple embeds', () => {
metricsWithDataGetter.mockReturnValue([2]);
mountComponent({ shallow: false, stubs: { MetricEmbed: '<div />' } });
expect(wrapper.find(GlDeprecatedButton).text()).toBe('Hide charts');
expect(wrapper.find(GlButton).text()).toBe('Hide charts');
});
});
});
......@@ -56,19 +56,6 @@ exports[`PackageTitle renders with tags 1`] = `
</span>
</div>
<div
class="gl-display-flex gl-align-items-center gl-mr-5"
>
<package-tags-stub
tagdisplaylimit="1"
tags="[object Object],[object Object],[object Object],[object Object]"
/>
</div>
<!---->
<!---->
<div
class="gl-display-flex gl-align-items-center gl-mr-5"
>
......@@ -85,6 +72,20 @@ exports[`PackageTitle renders with tags 1`] = `
300 bytes
</span>
</div>
<!---->
<!---->
<div
class="gl-display-flex gl-align-items-center gl-mr-5"
>
<package-tags-stub
hidelabel="true"
tagdisplaylimit="2"
tags="[object Object],[object Object],[object Object],[object Object]"
/>
</div>
</div>
</div>
`;
......@@ -145,12 +146,6 @@ exports[`PackageTitle renders without tags 1`] = `
</span>
</div>
<!---->
<!---->
<!---->
<div
class="gl-display-flex gl-align-items-center gl-mr-5"
>
......@@ -167,6 +162,12 @@ exports[`PackageTitle renders without tags 1`] = `
300 bytes
</span>
</div>
<!---->
<!---->
<!---->
</div>
</div>
`;
......@@ -64,7 +64,7 @@ exports[`Snippet Description Edit component rendering matches the snapshot 1`] =
href="#"
>
<icon-stub
name="screen-normal"
name="minimize"
size="16"
/>
</a>
......
......@@ -1263,6 +1263,7 @@ RSpec.describe Repository do
%w(a b c/z) | %w(c d) | true
%w(a/b/z) | %w(a/b) | false # we only consider refs ambiguous before the first slash
%w(a/b/z) | %w(a/b a) | true
%w(ab) | %w(abc/d a b) | false
end
with_them do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册