Commit 058e5f4b authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 54e03a55 271ef1f5
......@@ -86,7 +86,11 @@ export default {
<template>
<span>
<span ref="issueDueDate" :class="cssClass" class="board-card-info card-number">
<gl-icon :class="{ 'text-danger': isPastDue }" class="board-card-info-icon" name="calendar" />
<gl-icon
:class="{ 'text-danger': isPastDue }"
class="board-card-info-icon gl-mr-2"
name="calendar"
/>
<time :class="{ 'text-danger': isPastDue }" datetime="date" class="board-card-info-text">{{
body
}}</time>
......
......@@ -37,7 +37,7 @@ export default {
<template>
<span>
<span ref="issueTimeEstimate" class="board-card-info card-number">
<gl-icon name="hourglass" class="board-card-info-icon" />
<gl-icon name="hourglass" class="board-card-info-icon gl-mr-2" />
<time class="board-card-info-text">{{ timeEstimate }}</time>
</span>
<gl-tooltip
......
......@@ -200,9 +200,9 @@ export default {
<gl-form-input id="fork-name" v-model="fork.name" data-testid="fork-name-input" required />
</gl-form-group>
<div class="gl-display-flex">
<div class="gl-w-half">
<gl-form-group label="Project URL" label-for="fork-url" class="gl-pr-2">
<div class="gl-md-display-flex">
<div class="gl-flex-basis-half">
<gl-form-group label="Project URL" label-for="fork-url" class="gl-md-mr-3">
<gl-form-input-group>
<template #prepend>
<gl-input-group-text>
......@@ -225,8 +225,8 @@ export default {
</gl-form-input-group>
</gl-form-group>
</div>
<div class="gl-w-half">
<gl-form-group label="Project slug" label-for="fork-slug" class="gl-pl-2">
<div class="gl-flex-basis-half">
<gl-form-group label="Project slug" label-for="fork-slug" class="gl-md-ml-3">
<gl-form-input
id="fork-slug"
v-model="fork.slug"
......
......@@ -117,6 +117,7 @@
flex-basis: 25%;
}
// Will be moved to @gitlab/ui in https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1168
.gl-md-ml-3 {
@media (min-width: $breakpoint-md) {
margin-left: $gl-spacing-scale-3;
......
---
title: Add space next to icons in epic issue list
merge_request: 54138
author: Yogi (@yo)
type: fixed
......@@ -28,7 +28,7 @@ export default {
class="board-card-info card-number board-card-weight"
v-on="$listeners"
>
<gl-icon name="weight" class="board-card-info-icon" />
<gl-icon name="weight" class="board-card-info-icon gl-mr-2" />
<span class="board-card-info-text"> {{ weight }} </span>
<gl-tooltip
:target="() => $refs.itemWeight"
......
<script>
import { GlAvatar, GlPopover } from '@gitlab/ui';
import { uniqueId } from 'lodash';
import { formatDate } from '~/lib/utils/datetime_utility';
import { truncate } from '~/lib/utils/text_utility';
import { __, sprintf } from '~/locale';
......@@ -57,8 +58,7 @@ export default {
});
},
rotationAssigneeUniqueID() {
const { _uid } = this;
return `${this.assignee.user.id}-${_uid}`;
return uniqueId('rotation-assignee-');
},
rotationMobileView() {
return this.shiftWidth <= SHIFT_WIDTHS.xs;
......
......@@ -8,6 +8,8 @@ import { formatDate } from '~/lib/utils/datetime_utility';
import { truncate } from '~/lib/utils/text_utility';
import mockRotations from '../../mocks/mock_rotation.json';
jest.mock('lodash/uniqueId', () => (prefix) => `${prefix}fakeUniqueId`);
describe('RotationAssignee', () => {
let wrapper;
......@@ -71,9 +73,7 @@ describe('RotationAssignee', () => {
});
it('should render an assignee schedule and rotation information in a popover', () => {
// eslint-disable-next-line no-underscore-dangle
const UID = wrapper.vm._uid;
expect(findPopOver().attributes('target')).toBe(`${assignee.participant.user.id}-${UID}`);
expect(findPopOver().attributes('target')).toBe('rotation-assignee-fakeUniqueId');
expect(findStartsAt().text()).toContain(formattedDate(assignee.startsAt));
expect(findEndsAt().text()).toContain(formattedDate(assignee.endsAt));
});
......
......@@ -83,7 +83,7 @@ exports[`RotationsListSectionComponent when the timeframe includes today renders
<div
class="gl-h-6 gl-bg-data-viz-blue-500 gl-display-flex gl-justify-content-center gl-align-items-center"
data-testid="rotation-assignee"
id="1-12"
id="rotation-assignee-2"
>
<div
class="gl-text-white gl-display-flex gl-justify-content-center gl-align-items-center"
......@@ -123,7 +123,7 @@ exports[`RotationsListSectionComponent when the timeframe includes today renders
<div
class="gl-h-6 gl-bg-data-viz-orange-500 gl-display-flex gl-justify-content-center gl-align-items-center"
data-testid="rotation-assignee"
id="2-16"
id="rotation-assignee-3"
>
<div
class="gl-text-white gl-display-flex gl-justify-content-center gl-align-items-center"
......
......@@ -5,7 +5,7 @@ module Gitlab
module Reports
class CodequalityReportsComparer < ReportsComparer
def initialize(base_report, head_report)
@base_report = base_report || CodequalityReports.new
@base_report = base_report
@head_report = head_report
end
......@@ -15,12 +15,16 @@ module Gitlab
def existing_errors
strong_memoize(:existing_errors) do
next [] if not_found?
base_report.all_degradations & head_report.all_degradations
end
end
def new_errors
strong_memoize(:new_errors) do
next [] if not_found?
fingerprints = head_report.degradations.keys - base_report.degradations.keys
head_report.degradations.fetch_values(*fingerprints)
end
......@@ -28,6 +32,8 @@ module Gitlab
def resolved_errors
strong_memoize(:resolved_errors) do
next [] if not_found?
fingerprints = base_report.degradations.keys - head_report.degradations.keys
base_report.degradations.fetch_values(*fingerprints)
end
......
......@@ -18,10 +18,10 @@ module Gitlab
end
def status
if success?
STATUS_SUCCESS
elsif base_report.nil? || head_report.nil?
if base_report.nil? || head_report.nil?
STATUS_NOT_FOUND
elsif success?
STATUS_SUCCESS
else
STATUS_FAILED
end
......@@ -54,6 +54,10 @@ module Gitlab
def total_count
existing_errors.size + new_errors.size
end
def not_found?
status == STATUS_NOT_FOUND
end
end
end
end
......
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :ci_build_trace_chunk, class: 'Ci::BuildTraceChunk' do
build factory: :ci_build
chunk_index { 0 }
chunk_index { generate(:iid) }
data_store { :redis }
trait :redis_with_data do
......
......@@ -27,6 +27,22 @@ RSpec.describe Gitlab::Ci::Reports::CodequalityReportsComparer do
expect(report_status).to eq(described_class::STATUS_SUCCESS)
end
end
context 'when head report does not exist' do
let(:head_report) { nil }
it 'returns status not found' do
expect(report_status).to eq(described_class::STATUS_NOT_FOUND)
end
end
context 'when base report does not exist' do
let(:base_report) { nil }
it 'returns status success' do
expect(report_status).to eq(described_class::STATUS_NOT_FOUND)
end
end
end
describe '#errors_count' do
......@@ -93,6 +109,14 @@ RSpec.describe Gitlab::Ci::Reports::CodequalityReportsComparer do
expect(resolved_count).to be_zero
end
end
context 'when base report is nil' do
let(:base_report) { nil }
it 'returns zero' do
expect(resolved_count).to be_zero
end
end
end
describe '#total_count' do
......@@ -140,6 +164,14 @@ RSpec.describe Gitlab::Ci::Reports::CodequalityReportsComparer do
expect(total_count).to eq(2)
end
end
context 'when base report is nil' do
let(:base_report) { nil }
it 'returns zero' do
expect(total_count).to be_zero
end
end
end
describe '#existing_errors' do
......@@ -177,6 +209,14 @@ RSpec.describe Gitlab::Ci::Reports::CodequalityReportsComparer do
expect(existing_errors).to be_empty
end
end
context 'when base report is nil' do
let(:base_report) { nil }
it 'returns an empty array' do
expect(existing_errors).to be_empty
end
end
end
describe '#new_errors' do
......@@ -213,6 +253,14 @@ RSpec.describe Gitlab::Ci::Reports::CodequalityReportsComparer do
expect(new_errors).to eq([degradation_1])
end
end
context 'when base report is nil' do
let(:base_report) { nil }
it 'returns an empty array' do
expect(new_errors).to be_empty
end
end
end
describe '#resolved_errors' do
......@@ -250,5 +298,13 @@ RSpec.describe Gitlab::Ci::Reports::CodequalityReportsComparer do
expect(resolved_errors).to be_empty
end
end
context 'when base report is nil' do
let(:base_report) { nil }
it 'returns an empty array' do
expect(resolved_errors).to be_empty
end
end
end
end
......@@ -49,10 +49,6 @@ RSpec.describe Gitlab::Ci::Reports::ReportsComparer do
context 'when base_report is nil' do
let(:base_report) { nil }
before do
allow(comparer).to receive(:success?).and_return(false)
end
it 'returns status not_found' do
expect(status).to eq('not_found')
end
......@@ -61,10 +57,6 @@ RSpec.describe Gitlab::Ci::Reports::ReportsComparer do
context 'when head_report is nil' do
let(:head_report) { nil }
before do
allow(comparer).to receive(:success?).and_return(false)
end
it 'returns status not_found' do
expect(status).to eq('not_found')
end
......@@ -118,4 +110,22 @@ RSpec.describe Gitlab::Ci::Reports::ReportsComparer do
expect { total_count }.to raise_error(NotImplementedError)
end
end
describe '#not_found?' do
subject(:not_found) { comparer.not_found? }
context 'when base report is nil' do
let(:base_report) { nil }
it { is_expected.to be_truthy }
end
context 'when base report exists' do
before do
allow(comparer).to receive(:success?).and_return(true)
end
it { is_expected.to be_falsey }
end
end
end
......@@ -4,8 +4,8 @@ require 'spec_helper'
RSpec.describe Gitlab::ImportExport do
describe 'export filename' do
let(:group) { create(:group, :nested) }
let(:project) { create(:project, :public, path: 'project-path', namespace: group) }
let(:group) { build(:group, path: 'child', parent: build(:group, path: 'parent')) }
let(:project) { build(:project, :public, path: 'project-path', namespace: group) }
it 'contains the project path' do
expect(described_class.export_filename(exportable: project)).to include(project.path)
......
......@@ -31,9 +31,34 @@ RSpec.describe Projects::DestroyService, :aggregate_failures do
end
shared_examples 'deleting the project with pipeline and build' do
context 'with pipeline and build', :sidekiq_inline do # which has optimistic locking
context 'with pipeline and build related records', :sidekiq_inline do # which has optimistic locking
let!(:pipeline) { create(:ci_pipeline, project: project) }
let!(:build) { create(:ci_build, :artifacts, pipeline: pipeline) }
let!(:build) { create(:ci_build, :artifacts, :with_runner_session, pipeline: pipeline) }
let!(:trace_chunks) { create(:ci_build_trace_chunk, build: build) }
let!(:job_variables) { create(:ci_job_variable, job: build) }
let!(:report_result) { create(:ci_build_report_result, build: build) }
let!(:pending_state) { create(:ci_build_pending_state, build: build) }
it 'deletes build related records' do
expect { destroy_project(project, user, {}) }.to change { Ci::Build.count }.by(-1)
.and change { Ci::BuildTraceChunk.count }.by(-1)
.and change { Ci::JobArtifact.count }.by(-2)
.and change { Ci::JobVariable.count }.by(-1)
.and change { Ci::BuildPendingState.count }.by(-1)
.and change { Ci::BuildReportResult.count }.by(-1)
.and change { Ci::BuildRunnerSession.count }.by(-1)
end
it 'avoids N+1 queries', skip: 'skipped until fixed in https://gitlab.com/gitlab-org/gitlab/-/issues/24644' do
recorder = ActiveRecord::QueryRecorder.new { destroy_project(project, user, {}) }
project = create(:project, :repository, namespace: user.namespace)
pipeline = create(:ci_pipeline, project: project)
builds = create_list(:ci_build, 3, :artifacts, pipeline: pipeline)
create_list(:ci_build_trace_chunk, 3, build: builds[0])
expect { destroy_project(project, project.owner, {}) }.not_to exceed_query_limit(recorder)
end
it_behaves_like 'deleting the project'
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment