提交 e65c1d31 编写于 作者: G GitLab Bot

Add latest changes from gitlab-org/gitlab@master

上级 4ae91e9f
......@@ -127,6 +127,7 @@
- "{,ee/}{,spec/}{db,migrations}/**/*"
- "{,ee/}{,spec/}lib/{,ee/}gitlab/background_migration/**/*"
- "config/prometheus/common_metrics.yml" # Used by Gitlab::DatabaseImporters::CommonMetrics::Importer
- "{,ee/}app/models/project_statistics.rb" # Used to calculate sizes in migration specs
.backstage-patterns: &backstage-patterns
- "Dangerfile"
......
......@@ -76,6 +76,10 @@ export default class MilestoneSelect {
let getMilestones = Api.projectMilestones;
const reqParams = { state: 'active', include_parent_milestones: true };
if (term) {
reqParams.search = term.trim();
}
if (!contextId) {
contextId = $dropdown.get(0).dataset.groupId;
delete reqParams.include_parent_milestones;
......@@ -162,6 +166,7 @@ export default class MilestoneSelect {
`;
},
filterable: true,
filterRemote: true,
search: {
fields: ['title'],
},
......
<script>
import { GlButton } from '@gitlab/ui';
import { __ } from '~/locale';
export default {
components: {
GlButton,
},
props: {
isTodo: {
type: Boolean,
required: false,
default: true,
},
},
computed: {
buttonLabel() {
return this.isTodo ? __('Mark as done') : __('Add a To-Do');
},
},
};
</script>
<template>
<gl-button v-bind="$attrs" :aria-label="buttonLabel" @click="$emit('click', $event)">
{{ buttonLabel }}
</gl-button>
</template>
......@@ -151,3 +151,7 @@ ul.wiki-pages-list.content-list {
.empty-state-wiki .text-content {
max-width: 490px; // Widen to allow for the Confluence button
}
.wiki-form .markdown-area {
max-height: none;
}
= icon('spinner spin fw')
= loading_icon(css_class: "gl-vertical-align-text-bottom mr-1")
Validating GitLab CI configuration…
= link_to 'Learn more', help_page_path('ci/yaml/README')
.text-center.gl-mt-3.gl-mb-3
= icon('spinner spin 2x', 'aria-hidden' => 'true', 'aria-label' => 'Loading content…', class: 'qa-spinner')
.text-center.gl-mt-4.gl-mb-3
= loading_icon(size: "md", css_class: "qa-spinner")
= icon('spinner spin fw')
= loading_icon(css_class: "gl-vertical-align-text-bottom")
Analyzing file…
= icon('spinner spin fw')
= loading_icon(css_class: "gl-vertical-align-text-bottom gl-mr-1")
Validating Route Map…
= link_to 'Learn more', help_page_path('ci/environments/index.md', anchor: 'going-from-source-files-to-public-pages')
.file-content#js-sketch-viewer{ data: { endpoint: blob_raw_path } }
.js-loading-icon.text-center.gl-mt-3.gl-mb-3.js-loading-icon{ 'aria-label' => 'Loading Sketch preview' }
= icon('spinner spin 2x', 'aria-hidden' => 'true');
.text-center.gl-mt-4.gl-mb-3.js-loading-icon
= loading_icon(size: "md")
.file-content.is-stl-loading
.text-center#js-stl-viewer{ data: { endpoint: blob_raw_path } }
= icon('spinner spin 2x', class: 'gl-mt-3 gl-mb-3', 'aria-hidden' => 'true', 'aria-label' => 'Loading')
= loading_icon(size: "md", css_class: "gl-mt-4 gl-mb-3")
.text-center.gl-mt-3.gl-mb-3.stl-controls
.btn-group
%button.btn.btn-default.btn-sm.js-material-changer{ data: { type: 'wireframe' } }
......
---
title: Migrate .fa-spinner to .spinner for app/views/projects/blob/viewers
merge_request: 25046
author: nuwe1
type: other
......@@ -38,6 +38,8 @@ For example, consider a migration that creates a table with two text columns,
```ruby
class CreateDbGuides < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
......@@ -179,6 +181,7 @@ in a post-deployment migration,
```ruby
class AddTextLimitMigration < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
......
......@@ -14,23 +14,23 @@ module Gitlab
# @param [ActiveSupport::TimeWithZone] end_date end of time frame
# @return [Integer] number of unique visitors
def unique_visits_for(targets:, start_date: 7.days.ago, end_date: start_date + 1.week)
target_ids = if targets == :analytics
self.class.analytics_ids
elsif targets == :compliance
self.class.compliance_ids
else
Array(targets)
end
events = if targets == :analytics
self.class.analytics_events
elsif targets == :compliance
self.class.compliance_events
else
Array(targets)
end
Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: target_ids, start_date: start_date, end_date: end_date)
Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: events, start_date: start_date, end_date: end_date)
end
class << self
def analytics_ids
def analytics_events
Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category('analytics')
end
def compliance_ids
def compliance_events
Gitlab::UsageDataCounters::HLLRedisCounter.events_for_category('compliance')
end
end
......
......@@ -589,8 +589,8 @@ module Gitlab
end
def analytics_unique_visits_data
results = ::Gitlab::Analytics::UniqueVisits.analytics_ids.each_with_object({}) do |target_id, hash|
hash[target_id] = redis_usage_data { unique_visit_service.unique_visits_for(targets: target_id) }
results = ::Gitlab::Analytics::UniqueVisits.analytics_events.each_with_object({}) do |target, hash|
hash[target] = redis_usage_data { unique_visit_service.unique_visits_for(targets: target) }
end
results['analytics_unique_visits_for_any_target'] = redis_usage_data { unique_visit_service.unique_visits_for(targets: :analytics) }
results['analytics_unique_visits_for_any_target_monthly'] = redis_usage_data { unique_visit_service.unique_visits_for(targets: :analytics, start_date: 4.weeks.ago.to_date, end_date: Date.current) }
......@@ -599,8 +599,8 @@ module Gitlab
end
def compliance_unique_visits_data
results = ::Gitlab::Analytics::UniqueVisits.compliance_ids.each_with_object({}) do |target_id, hash|
hash[target_id] = redis_usage_data { unique_visit_service.unique_visits_for(targets: target_id) }
results = ::Gitlab::Analytics::UniqueVisits.compliance_events.each_with_object({}) do |target, hash|
hash[target] = redis_usage_data { unique_visit_service.unique_visits_for(targets: target) }
end
results['compliance_unique_visits_for_any_target'] = redis_usage_data { unique_visit_service.unique_visits_for(targets: :compliance) }
results['compliance_unique_visits_for_any_target_monthly'] = redis_usage_data { unique_visit_service.unique_visits_for(targets: :compliance, start_date: 4.weeks.ago.to_date, end_date: Date.current) }
......
......@@ -3,9 +3,9 @@
require 'spec_helper'
RSpec.describe 'Value Stream Analytics', :js do
let(:user) { create(:user) }
let(:guest) { create(:user) }
let(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
let_it_be(:guest) { create(:user) }
let_it_be(:project) { create(:project, :repository) }
let(:issue) { create(:issue, project: project, created_at: 2.days.ago) }
let(:milestone) { create(:milestone, project: project) }
let(:mr) { create_merge_request_closing_issue(user, project, issue, commit_message: "References #{issue.to_reference}") }
......@@ -13,9 +13,11 @@ RSpec.describe 'Value Stream Analytics', :js do
context 'as an allowed user' do
context 'when project is new' do
before do
before(:all) do
project.add_maintainer(user)
end
before do
sign_in(user)
visit project_cycle_analytics_path(project)
......
......@@ -4,13 +4,17 @@ require "spec_helper"
RSpec.describe "Issues > User edits issue", :js do
let_it_be(:project) { create(:project_empty_repo, :public) }
let_it_be(:project_with_milestones) { create(:project_empty_repo, :public) }
let_it_be(:user) { create(:user) }
let_it_be(:issue) { create(:issue, project: project, author: user, assignees: [user]) }
let_it_be(:issue_with_milestones) { create(:issue, project: project_with_milestones, author: user, assignees: [user]) }
let_it_be(:label) { create(:label, project: project) }
let_it_be(:milestone) { create(:milestone, project: project) }
let_it_be(:milestones) { create_list(:milestone, 25, project: project_with_milestones) }
before do
project.add_developer(user)
project_with_milestones.add_developer(user)
sign_in(user)
end
......@@ -218,6 +222,23 @@ RSpec.describe "Issues > User edits issue", :js do
end
end
end
it 'allows user to search milestone' do
visit project_issue_path(project_with_milestones, issue_with_milestones)
page.within('.milestone') do
click_link 'Edit'
wait_for_requests
# We need to enclose search string in quotes for exact match as all the milestone titles
# within tests are prefixed with `My title`.
find('.dropdown-input-field', visible: true).send_keys "\"#{milestones[0].title}\""
wait_for_requests
page.within '.dropdown-content' do
expect(page).to have_content milestones[0].title
end
end
end
end
context 'by unauthorized user' do
......
import { shallowMount, mount } from '@vue/test-utils';
import { GlButton } from '@gitlab/ui';
import TodoButton from '~/vue_shared/components/todo_button.vue';
describe('Todo Button', () => {
let wrapper;
const createComponent = (props = {}, mountFn = shallowMount) => {
wrapper = mountFn(TodoButton, {
propsData: {
...props,
},
});
};
afterEach(() => {
wrapper.destroy();
});
it('renders GlButton', () => {
createComponent();
expect(wrapper.find(GlButton).exists()).toBe(true);
});
it('emits click event when clicked', () => {
createComponent({}, mount);
wrapper.find(GlButton).trigger('click');
expect(wrapper.emitted().click).toBeTruthy();
});
it.each`
label | isTodo
${'Mark as done'} | ${true}
${'Add a To-Do'} | ${false}
`('sets correct label when isTodo is $isTodo', ({ label, isTodo }) => {
createComponent({ isTodo });
expect(wrapper.find(GlButton).text()).toBe(label);
});
it('binds additional props to GlButton', () => {
createComponent({ loading: true });
expect(wrapper.find(GlButton).props('loading')).toBe(true);
});
});
......@@ -960,8 +960,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
subject { described_class.analytics_unique_visits_data }
it 'returns the number of unique visits to pages with analytics features' do
::Gitlab::Analytics::UniqueVisits.analytics_ids.each do |target_id|
expect_any_instance_of(::Gitlab::Analytics::UniqueVisits).to receive(:unique_visits_for).with(targets: target_id).and_return(123)
::Gitlab::Analytics::UniqueVisits.analytics_events.each do |target|
expect_any_instance_of(::Gitlab::Analytics::UniqueVisits).to receive(:unique_visits_for).with(targets: target).and_return(123)
end
expect_any_instance_of(::Gitlab::Analytics::UniqueVisits).to receive(:unique_visits_for).with(targets: :analytics).and_return(543)
......@@ -996,8 +996,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
described_class.clear_memoization(:unique_visit_service)
allow_next_instance_of(::Gitlab::Analytics::UniqueVisits) do |instance|
::Gitlab::Analytics::UniqueVisits.compliance_ids.each do |target_id|
allow(instance).to receive(:unique_visits_for).with(targets: target_id).and_return(123)
::Gitlab::Analytics::UniqueVisits.compliance_events.each do |target|
allow(instance).to receive(:unique_visits_for).with(targets: target).and_return(123)
end
allow(instance).to receive(:unique_visits_for).with(targets: :compliance).and_return(543)
......
......@@ -84,7 +84,7 @@ RSpec.describe Packages::Package, type: :model do
end
describe 'validations' do
subject { create(:package) }
subject { build(:package) }
it { is_expected.to validate_presence_of(:project) }
it { is_expected.to validate_uniqueness_of(:name).scoped_to(:project_id, :version, :package_type) }
......@@ -95,7 +95,7 @@ RSpec.describe Packages::Package, type: :model do
it { is_expected.not_to allow_value("my(dom$$$ain)com.my-app").for(:name) }
context 'conan package' do
subject { create(:conan_package) }
subject { build_stubbed(:conan_package) }
let(:fifty_one_characters) {'f_b' * 17}
......@@ -112,7 +112,7 @@ RSpec.describe Packages::Package, type: :model do
describe '#version' do
RSpec.shared_examples 'validating version to be SemVer compliant for' do |factory_name|
context "for #{factory_name}" do
subject { create(factory_name) }
subject { build_stubbed(factory_name) }
it { is_expected.to allow_value('1.2.3').for(:version) }
it { is_expected.to allow_value('1.2.3-beta').for(:version) }
......@@ -126,7 +126,7 @@ RSpec.describe Packages::Package, type: :model do
end
context 'conan package' do
subject { create(:conan_package) }
subject { build_stubbed(:conan_package) }
let(:fifty_one_characters) {'1.2' * 17}
......@@ -142,7 +142,7 @@ RSpec.describe Packages::Package, type: :model do
end
context 'maven package' do
subject { create(:maven_package) }
subject { build_stubbed(:maven_package) }
it { is_expected.to allow_value('0').for(:version) }
it { is_expected.to allow_value('1').for(:version) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册