Commit 8f534e1e authored by 🤖 GitLab Bot 🤖's avatar 🤖 GitLab Bot 🤖

Add latest changes from gitlab-org/gitlab@master

parent ea3306a1
<script>
import { GlLink, GlPopover, GlSprintf, GlTooltipDirective } from '@gitlab/ui';
import { GlLink, GlPopover, GlSprintf, GlTooltipDirective, GlBadge } from '@gitlab/ui';
import { SCHEDULE_ORIGIN } from '../../constants';
export default {
......@@ -7,6 +7,7 @@ export default {
GlLink,
GlPopover,
GlSprintf,
GlBadge,
},
directives: {
GlTooltip: GlTooltipDirective,
......@@ -57,46 +58,49 @@ export default {
</gl-link>
<div class="label-container">
<gl-link v-if="isScheduled" :href="pipelineScheduleUrl" target="__blank">
<span
<gl-badge
v-gl-tooltip
:title="__('This pipeline was triggered by a schedule.')"
class="badge badge-info"
variant="info"
size="sm"
data-testid="pipeline-url-scheduled"
>{{ __('Scheduled') }}</span
>{{ __('Scheduled') }}</gl-badge
>
</gl-link>
<span
<gl-badge
v-if="pipeline.flags.latest"
v-gl-tooltip
:title="__('Latest pipeline for the most recent commit on this branch')"
class="badge badge-success"
variant="success"
size="sm"
data-testid="pipeline-url-latest"
>{{ __('latest') }}</span
>{{ __('latest') }}</gl-badge
>
<span
<gl-badge
v-if="pipeline.flags.yaml_errors"
v-gl-tooltip
:title="pipeline.yaml_errors"
class="badge badge-danger"
variant="danger"
size="sm"
data-testid="pipeline-url-yaml"
>{{ __('yaml invalid') }}</span
>{{ __('yaml invalid') }}</gl-badge
>
<span
<gl-badge
v-if="pipeline.flags.failure_reason"
v-gl-tooltip
:title="pipeline.failure_reason"
class="badge badge-danger"
variant="danger"
size="sm"
data-testid="pipeline-url-failure"
>{{ __('error') }}</span
>{{ __('error') }}</gl-badge
>
<gl-link
v-if="pipeline.flags.auto_devops"
:id="`pipeline-url-autodevops-${pipeline.id}`"
tabindex="0"
class="badge badge-info autodevops-badge"
data-testid="pipeline-url-autodevops"
role="button"
>{{ __('Auto DevOps') }}</gl-link
><gl-badge variant="info" size="sm">{{ __('Auto DevOps') }}</gl-badge></gl-link
>
<gl-popover
:target="`pipeline-url-autodevops-${pipeline.id}`"
......@@ -122,13 +126,14 @@ export default {
__('Learn more about Auto DevOps')
}}</gl-link>
</gl-popover>
<span
<gl-badge
v-if="pipeline.flags.stuck"
class="badge badge-warning"
variant="warning"
size="sm"
data-testid="pipeline-url-stuck"
>{{ __('stuck') }}</span
>{{ __('stuck') }}</gl-badge
>
<span
<gl-badge
v-if="pipeline.flags.detached_merge_request_pipeline"
v-gl-tooltip
:title="
......@@ -136,17 +141,19 @@ export default {
'Pipelines for merge requests are configured. A detached pipeline runs in the context of the merge request, and not against the merged result. Learn more in the documentation for Pipelines for Merged Results.',
)
"
class="badge badge-info"
variant="info"
size="sm"
data-testid="pipeline-url-detached"
>{{ __('detached') }}</span
>{{ __('detached') }}</gl-badge
>
<span
<gl-badge
v-if="isInFork"
v-gl-tooltip
:title="__('Pipeline ran in fork of project')"
class="badge badge-info"
variant="info"
size="sm"
data-testid="pipeline-url-fork"
>{{ __('fork') }}</span
>{{ __('fork') }}</gl-badge
>
</div>
</div>
......
<script>
import { GlTabs, GlTab } from '@gitlab/ui';
import PipelineCharts from './pipeline_charts.vue';
export default {
components: {
GlTabs,
GlTab,
PipelineCharts,
DeploymentFrequencyCharts: () =>
import('ee_component/projects/pipelines/charts/components/deployment_frequency_charts.vue'),
},
inject: {
shouldRenderDeploymentFrequencyCharts: {
type: Boolean,
default: false,
},
},
props: {
counts: {
type: Object,
required: true,
},
timesChartData: {
type: Object,
required: true,
},
lastWeekChartData: {
type: Object,
required: true,
},
lastMonthChartData: {
type: Object,
required: true,
},
lastYearChartData: {
type: Object,
required: true,
},
},
data() {
return {
// this loading flag gives the echarts library just enough time
// to ensure all DOM nodes have been mounted.
//
// https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1131
loading: true,
};
},
async mounted() {
await this.$nextTick();
this.loading = false;
},
};
</script>
<template>
<gl-tabs v-if="shouldRenderDeploymentFrequencyCharts">
<gl-tab :title="__('Pipelines')">
<pipeline-charts
:counts="counts"
:last-week="lastWeekChartData"
:last-month="lastMonthChartData"
:last-year="lastYearChartData"
:times-chart="timesChartData"
:loading="loading"
/>
</gl-tab>
<gl-tab :title="__('Deployments')">
<deployment-frequency-charts />
</gl-tab>
</gl-tabs>
<pipeline-charts
v-else
:counts="counts"
:last-week="lastWeekChartData"
:last-month="lastMonthChartData"
:last-year="lastYearChartData"
:times-chart="timesChartData"
/>
</template>
......@@ -2,7 +2,6 @@ import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import { parseBoolean } from '~/lib/utils/common_utils';
import ProjectPipelinesChartsLegacy from './components/app_legacy.vue';
import ProjectPipelinesCharts from './components/app.vue';
Vue.use(VueApollo);
......@@ -12,107 +11,24 @@ const apolloProvider = new VueApollo({
});
const mountPipelineChartsApp = (el) => {
// Not all of the values will be defined since some them will be
// empty depending on the value of the graphql_pipeline_analytics
// feature flag, once the rollout of the feature flag is completed
// the undefined values will be deleted
const {
countsFailed,
countsSuccess,
countsTotal,
countsTotalDuration,
successRatio,
timesChartLabels,
timesChartValues,
lastWeekChartLabels,
lastWeekChartTotals,
lastWeekChartSuccess,
lastMonthChartLabels,
lastMonthChartTotals,
lastMonthChartSuccess,
lastYearChartLabels,
lastYearChartTotals,
lastYearChartSuccess,
projectPath,
} = el.dataset;
const { projectPath } = el.dataset;
const shouldRenderDeploymentFrequencyCharts = parseBoolean(
el.dataset.shouldRenderDeploymentFrequencyCharts,
);
const parseAreaChartData = (labels, totals, success) => {
let parsedData = {};
try {
parsedData = {
labels: JSON.parse(labels),
totals: JSON.parse(totals),
success: JSON.parse(success),
};
} catch {
parsedData = {};
}
return parsedData;
};
if (gon?.features?.graphqlPipelineAnalytics) {
return new Vue({
el,
name: 'ProjectPipelinesChartsApp',
components: {
ProjectPipelinesCharts,
},
apolloProvider,
provide: {
projectPath,
shouldRenderDeploymentFrequencyCharts,
},
render: (createElement) => createElement(ProjectPipelinesCharts, {}),
});
}
return new Vue({
el,
name: 'ProjectPipelinesChartsAppLegacy',
name: 'ProjectPipelinesChartsApp',
components: {
ProjectPipelinesChartsLegacy,
ProjectPipelinesCharts,
},
apolloProvider,
provide: {
projectPath,
shouldRenderDeploymentFrequencyCharts,
},
render: (createElement) =>
createElement(ProjectPipelinesChartsLegacy, {
props: {
counts: {
failed: countsFailed,
success: countsSuccess,
total: countsTotal,
successRatio,
totalDuration: countsTotalDuration,
},
timesChartData: {
labels: JSON.parse(timesChartLabels),
values: JSON.parse(timesChartValues),
},
lastWeekChartData: parseAreaChartData(
lastWeekChartLabels,
lastWeekChartTotals,
lastWeekChartSuccess,
),
lastMonthChartData: parseAreaChartData(
lastMonthChartLabels,
lastMonthChartTotals,
lastMonthChartSuccess,
),
lastYearChartData: parseAreaChartData(
lastYearChartLabels,
lastYearChartTotals,
lastYearChartSuccess,
),
},
}),
render: (createElement) => createElement(ProjectPipelinesCharts, {}),
});
};
......
......@@ -17,7 +17,6 @@ class Projects::PipelinesController < Projects::ApplicationController
push_frontend_feature_flag(:new_pipeline_form, project, default_enabled: true)
push_frontend_feature_flag(:graphql_pipeline_header, project, type: :development, default_enabled: false)
push_frontend_feature_flag(:graphql_pipeline_details, project, type: :development, default_enabled: false)
push_frontend_feature_flag(:graphql_pipeline_analytics, project, type: :development)
push_frontend_feature_flag(:new_pipeline_form_prefilled_vars, project, type: :development, default_enabled: true)
end
before_action :ensure_pipeline, only: [:show]
......@@ -189,23 +188,6 @@ def cancel
end
end
def charts
@charts = {}
@counts = {}
return if Feature.enabled?(:graphql_pipeline_analytics)
@charts[:week] = Gitlab::Ci::Charts::WeekChart.new(project)
@charts[:month] = Gitlab::Ci::Charts::MonthChart.new(project)
@charts[:year] = Gitlab::Ci::Charts::YearChart.new(project)
@charts[:pipeline_times] = Gitlab::Ci::Charts::PipelineTime.new(project)
@counts[:total] = @project.all_pipelines.count(:all)
@counts[:success] = @project.all_pipelines.success.count(:all)
@counts[:failed] = @project.all_pipelines.failed.count(:all)
@counts[:total_duration] = @project.all_pipelines.total_duration
end
def test_report
respond_to do |format|
format.html do
......
......@@ -20,7 +20,7 @@ class Update < Base
description: copy_field_description(Types::MergeRequestType, :description)
def resolve(args)
merge_request = authorized_find!(args.slice(:project_path, :iid))
merge_request = authorized_find!(**args.slice(:project_path, :iid))
attributes = args.slice(:title, :description, :target_branch).compact
::MergeRequests::UpdateService
......
......@@ -111,6 +111,10 @@ def banzai_render_context(field)
super.merge(suggestions_filter_enabled: true)
end
def multiline?
position&.multiline?
end
private
def enqueue_diff_file_creation_job
......
......@@ -122,7 +122,7 @@ def track_note_creation_usage_for_issues(note)
end
def track_note_creation_usage_for_merge_requests(note)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_create_comment_action(user: note.author)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_create_comment_action(note: note)
end
end
end
......@@ -19,7 +19,7 @@ def track_note_removal_usage_for_issues(note)
end
def track_note_removal_usage_for_merge_requests(note)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_remove_comment_action(user: note.author)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_remove_comment_action(note: note)
end
end
end
......
......@@ -98,7 +98,7 @@ def track_note_edit_usage_for_issues(note)
end
def track_note_edit_usage_for_merge_requests(note)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_edit_comment_action(user: note.author)
Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_edit_comment_action(note: note)
end
end
end
......
......@@ -57,6 +57,8 @@
= render "projects/merge_requests/awards_block"
- if mr_action === "show"
- add_page_startup_api_call discussions_path(@merge_request)
- add_page_startup_api_call widget_project_json_merge_request_path(@project, @merge_request, format: :json)
- add_page_startup_api_call cached_widget_project_json_merge_request_path(@project, @merge_request, format: :json)
#js-vue-mr-discussions{ data: { notes_data: notes_data(@merge_request).to_json,
noteable_data: serialize_issuable(@merge_request, serializer: 'noteable'),
noteable_type: 'MergeRequest',
......
- page_title _('CI / CD Analytics')
- if Feature.enabled?(:graphql_pipeline_analytics)
#js-project-pipelines-charts-app{ data: { project_path: @project.full_path,
should_render_deployment_frequency_charts: should_render_deployment_frequency_charts.to_s } }
- else
#js-project-pipelines-charts-app{ data: { counts: @counts, success_ratio: success_ratio(@counts),
times_chart: { labels: @charts[:pipeline_times].labels, values: @charts[:pipeline_times].pipeline_times },
last_week_chart: { labels: @charts[:week].labels, totals: @charts[:week].total, success: @charts[:week].success },
last_month_chart: { labels: @charts[:month].labels, totals: @charts[:month].total, success: @charts[:month].success },
last_year_chart: { labels: @charts[:year].labels, totals: @charts[:year].total, success: @charts[:year].success },
project_path: @project.full_path,
should_render_deployment_frequency_charts: should_render_deployment_frequency_charts.to_s } }
#js-project-pipelines-charts-app{ data: { project_path: @project.full_path,
should_render_deployment_frequency_charts: should_render_deployment_frequency_charts.to_s } }
= link_to project_settings_operations_path(@project), title: _('Configure Tracing'), class: 'btn btn-success' do
= link_to project_settings_operations_path(@project), title: _('Configure Tracing'), class: 'gl-button btn btn-success' do
= _('Add Jaeger URL')
......@@ -23,6 +23,6 @@
.clearable-input
= text_field_tag :expires_at, nil, class: 'form-control js-access-expiration-date', placeholder: 'Expiration date'
= sprite_icon('close', size: 16, css_class: 'clear-icon js-clear-input gl-text-gray-200')
= submit_tag _("Invite"), class: "btn btn-success", data: { qa_selector: 'invite_member_button' }
= submit_tag _("Invite"), class: "gl-button btn btn-success", data: { qa_selector: 'invite_member_button' }
- if can_import_members
= link_to _("Import"), import_path, class: "btn btn-default", title: _("Import members from another project")
= link_to _("Import"), import_path, class: "gl-button btn btn-default", title: _("Import members from another project")
---
title: Add metrics to creating, editing or removing multiline comments on merge requests
merge_request: 51098
author:
type: other
---
title: Use GlBadge for badges in pipeline_url.vue
merge_request: 51058
author: Kev @KevSlashNull
type: changed
---
title: Update pipeline graphs on CI/CD Analytics page to use GraphQL endpoint
merge_request: 51504
author:
type: changed
---
title: Add delete metric image REST API endpoint
merge_request: 50043
author:
type: added
---
title: Add gl-button to Add Jaeger URL
merge_request: 51553
author: Yogi (@yo)
type: other
---
title: Update to new GitLab UI button in members invite page
merge_request: 51300
author: Yogi (@yo)
type: other
......@@ -4,5 +4,5 @@ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44622
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/267162
milestone: '13.5'
type: development
group: group::knowledge
group: group::editor
default_enabled: true
---
name: graphql_pipeline_analytics
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48267
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/290153
milestone: '13.7'
name: usage_data_i_code_review_user_create_multiline_mr_comment
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51098
rollout_issue_url:
milestone: '13.8'
type: development
group: group::continuos integration
default_enabled: false
group: group::code review
default_enabled: true
---
name: usage_data_i_code_review_user_edit_multiline_mr_comment
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51098
rollout_issue_url:
milestone: '13.8'
type: development
group: group::code review
default_enabled: true
---
name: usage_data_i_code_review_user_remove_multiline_mr_comment
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/51098
rollout_issue_url:
milestone: '13.8'
type: development
group: group::code review
default_enabled: true
---
name: usage_data_i_testing_full_code_quality_report_total
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49079
rollout_issue_url:
milestone: '13.8'
type: development
group: group::testing
default_enabled: true
......@@ -4,5 +4,5 @@ introduced_by_url:
rollout_issue_url:
milestone:
type: development
group:
group: group::editor
default_enabled: true
---
name: wiki_front_matter
introduced_by_url:
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27706
rollout_issue_url:
milestone:
milestone: '12.10'
type: development
group: