Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
71616b047e
commit
6fb22ef2ea
|
@ -4,6 +4,7 @@ import { s__ } from '~/locale';
|
|||
import getPipelineCountByStatus from '../graphql/queries/get_pipeline_count_by_status.query.graphql';
|
||||
import getProjectPipelineStatistics from '../graphql/queries/get_project_pipeline_statistics.query.graphql';
|
||||
import PipelineCharts from './pipeline_charts.vue';
|
||||
import { mergeUrlParams, updateHistory, getParameterValues } from '~/lib/utils/url_utility';
|
||||
|
||||
import {
|
||||
DEFAULT,
|
||||
|
@ -36,6 +37,8 @@ const defaultCountValues = {
|
|||
},
|
||||
};
|
||||
|
||||
const charts = ['pipelines', 'deployments'];
|
||||
|
||||
export default {
|
||||
components: {
|
||||
GlAlert,
|
||||
|
@ -56,7 +59,11 @@ export default {
|
|||
},
|
||||
},
|
||||
data() {
|
||||
const [chart] = getParameterValues('chart') || charts;
|
||||
const tab = charts.indexOf(chart);
|
||||
return {
|
||||
chart,
|
||||
selectedTab: tab >= 0 ? tab : 0,
|
||||
showFailureAlert: false,
|
||||
failureType: null,
|
||||
analytics: { ...defaultAnalyticsValues },
|
||||
|
@ -172,6 +179,11 @@ export default {
|
|||
this.showFailureAlert = true;
|
||||
this.failureType = type;
|
||||
},
|
||||
onTabChange(index) {
|
||||
this.selectedTab = index;
|
||||
const path = mergeUrlParams({ chart: charts[index] }, window.location.pathname);
|
||||
updateHistory({ url: path });
|
||||
},
|
||||
},
|
||||
errorTexts: {
|
||||
[LOAD_ANALYTICS_FAILURE]: s__(
|
||||
|
@ -190,7 +202,7 @@ export default {
|
|||
<gl-alert v-if="showFailureAlert" :variant="failure.variant" @dismiss="hideAlert">{{
|
||||
failure.text
|
||||
}}</gl-alert>
|
||||
<gl-tabs v-if="shouldRenderDeploymentFrequencyCharts">
|
||||
<gl-tabs v-if="shouldRenderDeploymentFrequencyCharts" :value="selectedTab" @input="onTabChange">
|
||||
<gl-tab :title="__('Pipelines')">
|
||||
<pipeline-charts
|
||||
:counts="formattedCounts"
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
<script>
|
||||
/* eslint-disable vue/no-v-html */
|
||||
import emptyStateSVG from 'icons/_mr_widget_empty_state.svg';
|
||||
import { GlButton } from '@gitlab/ui';
|
||||
|
||||
export default {
|
||||
name: 'MRWidgetNothingToMerge',
|
||||
components: {
|
||||
GlButton,
|
||||
},
|
||||
props: {
|
||||
mr: {
|
||||
type: Object,
|
||||
|
@ -25,11 +29,13 @@ export default {
|
|||
<span v-html="emptyStateSVG"></span>
|
||||
</div>
|
||||
<div class="text col-md-7 order-md-first col-12">
|
||||
<span>{{
|
||||
s__(
|
||||
'mrWidgetNothingToMerge|Merge requests are a place to propose changes you have made to a project and discuss those changes with others.',
|
||||
)
|
||||
}}</span>
|
||||
<p class="highlight">
|
||||
{{
|
||||
s__(
|
||||
'mrWidgetNothingToMerge|Merge requests are a place to propose changes you have made to a project and discuss those changes with others.',
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
<p>
|
||||
{{
|
||||
s__(
|
||||
|
@ -45,9 +51,14 @@ export default {
|
|||
}}
|
||||
</p>
|
||||
<div>
|
||||
<a v-if="mr.newBlobPath" :href="mr.newBlobPath" class="btn btn-inverted btn-success">{{
|
||||
__('Create file')
|
||||
}}</a>
|
||||
<gl-button
|
||||
v-if="mr.newBlobPath"
|
||||
:href="mr.newBlobPath"
|
||||
category="secondary"
|
||||
variant="success"
|
||||
>
|
||||
{{ __('Create file') }}
|
||||
</gl-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -375,13 +375,14 @@ $mr-widget-min-height: 69px;
|
|||
}
|
||||
|
||||
.text {
|
||||
span {
|
||||
font-weight: $gl-font-weight-bold;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: $gl-padding;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
margin: 0 0 $gl-padding;
|
||||
font-weight: $gl-font-weight-bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Apply GitLab UI for create file button in MR
|
||||
merge_request: 51795
|
||||
author: Yogi (@yo)
|
||||
type: other
|
|
@ -11261,7 +11261,7 @@ type Group {
|
|||
): [VulnerableProjectsByGrade!]!
|
||||
|
||||
"""
|
||||
Vulnerability scanners reported on the project vulnerabilties of the group and its subgroups
|
||||
Vulnerability scanners reported on the project vulnerabilities of the group and its subgroups
|
||||
"""
|
||||
vulnerabilityScanners(
|
||||
"""
|
||||
|
@ -11966,7 +11966,7 @@ type InstanceSecurityDashboard {
|
|||
vulnerabilityGrades: [VulnerableProjectsByGrade!]!
|
||||
|
||||
"""
|
||||
Vulnerability scanners reported on the vulnerabilties from projects selected in Instance Security Dashboard
|
||||
Vulnerability scanners reported on the vulnerabilities from projects selected in Instance Security Dashboard
|
||||
"""
|
||||
vulnerabilityScanners(
|
||||
"""
|
||||
|
@ -19650,7 +19650,7 @@ type Project {
|
|||
): VulnerabilitiesCountByDayConnection
|
||||
|
||||
"""
|
||||
Vulnerability scanners reported on the project vulnerabilties
|
||||
Vulnerability scanners reported on the project vulnerabilities
|
||||
"""
|
||||
vulnerabilityScanners(
|
||||
"""
|
||||
|
|
|
@ -30680,7 +30680,7 @@
|
|||
},
|
||||
{
|
||||
"name": "vulnerabilityScanners",
|
||||
"description": "Vulnerability scanners reported on the project vulnerabilties of the group and its subgroups",
|
||||
"description": "Vulnerability scanners reported on the project vulnerabilities of the group and its subgroups",
|
||||
"args": [
|
||||
{
|
||||
"name": "after",
|
||||
|
@ -32690,7 +32690,7 @@
|
|||
},
|
||||
{
|
||||
"name": "vulnerabilityScanners",
|
||||
"description": "Vulnerability scanners reported on the vulnerabilties from projects selected in Instance Security Dashboard",
|
||||
"description": "Vulnerability scanners reported on the vulnerabilities from projects selected in Instance Security Dashboard",
|
||||
"args": [
|
||||
{
|
||||
"name": "after",
|
||||
|
@ -57062,7 +57062,7 @@
|
|||
},
|
||||
{
|
||||
"name": "vulnerabilityScanners",
|
||||
"description": "Vulnerability scanners reported on the project vulnerabilties",
|
||||
"description": "Vulnerability scanners reported on the project vulnerabilities",
|
||||
"args": [
|
||||
{
|
||||
"name": "after",
|
||||
|
|
|
@ -1693,7 +1693,7 @@ Autogenerated return type of GitlabSubscriptionActivate.
|
|||
| `vulnerabilitiesCountByDay` | VulnerabilitiesCountByDayConnection | Number of vulnerabilities per day for the projects in the group and its subgroups |
|
||||
| `vulnerabilitiesCountByDayAndSeverity` **{warning-solid}** | VulnerabilitiesCountByDayAndSeverityConnection | **Deprecated:** Use `vulnerabilitiesCountByDay`. Deprecated in 13.3. |
|
||||
| `vulnerabilityGrades` | VulnerableProjectsByGrade! => Array | Represents vulnerable project counts for each grade |
|
||||
| `vulnerabilityScanners` | VulnerabilityScannerConnection | Vulnerability scanners reported on the project vulnerabilties of the group and its subgroups |
|
||||
| `vulnerabilityScanners` | VulnerabilityScannerConnection | Vulnerability scanners reported on the project vulnerabilities of the group and its subgroups |
|
||||
| `vulnerabilitySeveritiesCount` | VulnerabilitySeveritiesCount | Counts for each vulnerability severity in the group and its subgroups |
|
||||
| `webUrl` | String! | Web URL of the group. |
|
||||
|
||||
|
@ -1818,7 +1818,7 @@ A block of time for which a participant is on-call..
|
|||
| ----- | ---- | ----------- |
|
||||
| `projects` | ProjectConnection! | Projects selected in Instance Security Dashboard |
|
||||
| `vulnerabilityGrades` | VulnerableProjectsByGrade! => Array | Represents vulnerable project counts for each grade |
|
||||
| `vulnerabilityScanners` | VulnerabilityScannerConnection | Vulnerability scanners reported on the vulnerabilties from projects selected in Instance Security Dashboard |
|
||||
| `vulnerabilityScanners` | VulnerabilityScannerConnection | Vulnerability scanners reported on the vulnerabilities from projects selected in Instance Security Dashboard |
|
||||
| `vulnerabilitySeveritiesCount` | VulnerabilitySeveritiesCount | Counts for each vulnerability severity from projects selected in Instance Security Dashboard |
|
||||
|
||||
### InstanceStatisticsMeasurement
|
||||
|
@ -2824,7 +2824,7 @@ Autogenerated return type of PipelineRetry.
|
|||
| `visibility` | String | Visibility of the project |
|
||||
| `vulnerabilities` | VulnerabilityConnection | Vulnerabilities reported on the project |
|
||||
| `vulnerabilitiesCountByDay` | VulnerabilitiesCountByDayConnection | Number of vulnerabilities per day for the project |
|
||||
| `vulnerabilityScanners` | VulnerabilityScannerConnection | Vulnerability scanners reported on the project vulnerabilties |
|
||||
| `vulnerabilityScanners` | VulnerabilityScannerConnection | Vulnerability scanners reported on the project vulnerabilities |
|
||||
| `vulnerabilitySeveritiesCount` | VulnerabilitySeveritiesCount | Counts for each vulnerability severity in the project |
|
||||
| `webUrl` | String | Web URL of the project |
|
||||
| `wikiEnabled` | Boolean | Indicates if Wikis are enabled for the current user |
|
||||
|
|
|
@ -5,6 +5,13 @@ require 'spec_helper'
|
|||
RSpec.describe 'Projects > Show > User sees Git instructions' do
|
||||
let_it_be(:user) { create(:user) }
|
||||
|
||||
before do
|
||||
# Reset user notification settings between examples to prevent
|
||||
# validation failure on NotificationSetting.
|
||||
# See https://gitlab.com/gitlab-org/gitlab/-/issues/299822#note_492817174
|
||||
user.notification_settings.reset
|
||||
end
|
||||
|
||||
shared_examples_for 'redirects to the sign in page' do
|
||||
it 'redirects to the sign in page' do
|
||||
expect(current_path).to eq(new_user_session_path)
|
||||
|
|
|
@ -3,12 +3,17 @@ import { createLocalVue, shallowMount } from '@vue/test-utils';
|
|||
import VueApollo from 'vue-apollo';
|
||||
import { GlTabs, GlTab } from '@gitlab/ui';
|
||||
import createMockApollo from 'helpers/mock_apollo_helper';
|
||||
import setWindowLocation from 'helpers/set_window_location_helper';
|
||||
import { TEST_HOST } from 'helpers/test_constants';
|
||||
import { mergeUrlParams, updateHistory, getParameterValues } from '~/lib/utils/url_utility';
|
||||
import Component from '~/projects/pipelines/charts/components/app.vue';
|
||||
import PipelineCharts from '~/projects/pipelines/charts/components/pipeline_charts.vue';
|
||||
import getPipelineCountByStatus from '~/projects/pipelines/charts/graphql/queries/get_pipeline_count_by_status.query.graphql';
|
||||
import getProjectPipelineStatistics from '~/projects/pipelines/charts/graphql/queries/get_project_pipeline_statistics.query.graphql';
|
||||
import { mockPipelineCount, mockPipelineStatistics } from '../mock_data';
|
||||
|
||||
jest.mock('~/lib/utils/url_utility');
|
||||
|
||||
const projectPath = 'gitlab-org/gitlab';
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(VueApollo);
|
||||
|
@ -115,6 +120,49 @@ describe('ProjectsPipelinesChartsApp', () => {
|
|||
expect(findGlTabAt(1).attributes('title')).toBe('Deployments');
|
||||
expect(findDeploymentFrequencyCharts().exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('sets the tab and url when a tab is clicked', async () => {
|
||||
let chartsPath;
|
||||
setWindowLocation(`${TEST_HOST}/gitlab-org/gitlab-test/-/pipelines/charts`);
|
||||
|
||||
mergeUrlParams.mockImplementation(({ chart }, path) => {
|
||||
expect(chart).toBe('deployments');
|
||||
expect(path).toBe(window.location.pathname);
|
||||
chartsPath = `${path}?chart=${chart}`;
|
||||
return chartsPath;
|
||||
});
|
||||
|
||||
updateHistory.mockImplementation(({ url }) => {
|
||||
expect(url).toBe(chartsPath);
|
||||
});
|
||||
const tabs = findGlTabs();
|
||||
|
||||
expect(tabs.attributes('value')).toBe('0');
|
||||
|
||||
tabs.vm.$emit('input', 1);
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
expect(tabs.attributes('value')).toBe('1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when provided with a query param', () => {
|
||||
it.each`
|
||||
chart | tab
|
||||
${'deployments'} | ${'1'}
|
||||
${'pipelines'} | ${'0'}
|
||||
${'fake'} | ${'0'}
|
||||
${''} | ${'0'}
|
||||
`('shows the correct tab for URL parameter "$chart"', ({ chart, tab }) => {
|
||||
setWindowLocation(`${TEST_HOST}/gitlab-org/gitlab-test/-/pipelines/charts?chart=${chart}`);
|
||||
getParameterValues.mockImplementation((name) => {
|
||||
expect(name).toBe('chart');
|
||||
return chart ? [chart] : [];
|
||||
});
|
||||
createComponent({ provide: { shouldRenderDeploymentFrequencyCharts: true } });
|
||||
expect(findGlTabs().attributes('value')).toBe(tab);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when shouldRenderDeploymentFrequencyCharts is false', () => {
|
||||
|
|
Loading…
Reference in New Issue