Skip to content

Commit 04b866f

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent cd353f0 commit 04b866f

File tree

66 files changed

+706
-472
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+706
-472
lines changed

.haml-lint_todo.yml

-43
This file was deleted.

app/assets/javascripts/environments/graphql/resolvers/flux.js

+88-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1+
import { Configuration, WatchApi, EVENT_DATA } from '@gitlab/cluster-client';
12
import axios from '~/lib/utils/axios_utils';
23
import {
34
HELM_RELEASES_RESOURCE_TYPE,
45
KUSTOMIZATIONS_RESOURCE_TYPE,
56
} from '~/environments/constants';
7+
import fluxKustomizationStatusQuery from '../queries/flux_kustomization_status.query.graphql';
8+
import fluxHelmReleaseStatusQuery from '../queries/flux_helm_release_status.query.graphql';
69

710
const helmReleasesApiVersion = 'helm.toolkit.fluxcd.io/v2beta1';
811
const kustomizationsApiVersion = 'kustomize.toolkit.fluxcd.io/v1beta1';
912

13+
const helmReleaseField = 'fluxHelmReleaseStatus';
14+
const kustomizationField = 'fluxKustomizationStatus';
15+
1016
const handleClusterError = (err) => {
1117
const error = err?.response?.data?.message ? new Error(err.response.data.message) : err;
1218
throw error;
@@ -22,14 +28,57 @@ const buildFluxResourceUrl = ({
2228
return `${basePath}/apis/${apiVersion}/namespaces/${namespace}/${resourceType}/${environmentName}`;
2329
};
2430

25-
const getFluxResourceStatus = (configuration, url) => {
26-
const { headers } = configuration;
31+
const buildFluxResourceWatchPath = ({ namespace, apiVersion, resourceType }) => {
32+
return `/apis/${apiVersion}/namespaces/${namespace}/${resourceType}`;
33+
};
34+
35+
const watchFluxResource = ({ watchPath, resourceName, query, variables, field, client }) => {
36+
const config = new Configuration(variables.configuration);
37+
const watcherApi = new WatchApi(config);
38+
const fieldSelector = `metadata.name=${decodeURIComponent(resourceName)}`;
39+
40+
watcherApi
41+
.subscribeToStream(watchPath, { watch: true, fieldSelector })
42+
.then((watcher) => {
43+
let result = [];
44+
45+
watcher.on(EVENT_DATA, (data) => {
46+
result = data[0]?.status?.conditions;
47+
48+
client.writeQuery({
49+
query,
50+
variables,
51+
data: { [field]: result },
52+
});
53+
});
54+
})
55+
.catch((err) => {
56+
handleClusterError(err);
57+
});
58+
};
59+
60+
const getFluxResourceStatus = ({ url, watchPath, query, variables, field, client }) => {
61+
const { headers } = variables.configuration;
2762
const withCredentials = true;
2863

2964
return axios
3065
.get(url, { withCredentials, headers })
3166
.then((res) => {
32-
return res?.data?.status?.conditions || [];
67+
const fluxData = res?.data;
68+
const resourceName = fluxData?.metadata?.name;
69+
70+
if (gon.features?.k8sWatchApi && resourceName) {
71+
watchFluxResource({
72+
watchPath,
73+
resourceName,
74+
query,
75+
variables,
76+
field,
77+
client,
78+
});
79+
}
80+
81+
return fluxData?.status?.conditions || [];
3382
})
3483
.catch((err) => {
3584
handleClusterError(err);
@@ -62,7 +111,16 @@ const getFluxResources = (configuration, url) => {
62111
};
63112

64113
export default {
65-
fluxKustomizationStatus(_, { configuration, namespace, environmentName, fluxResourcePath = '' }) {
114+
fluxKustomizationStatus(
115+
_,
116+
{ configuration, namespace, environmentName, fluxResourcePath = '' },
117+
{ client },
118+
) {
119+
const watchPath = buildFluxResourceWatchPath({
120+
namespace,
121+
apiVersion: kustomizationsApiVersion,
122+
resourceType: KUSTOMIZATIONS_RESOURCE_TYPE,
123+
});
66124
let url;
67125

68126
if (fluxResourcePath) {
@@ -76,9 +134,25 @@ export default {
76134
environmentName,
77135
});
78136
}
79-
return getFluxResourceStatus(configuration, url);
137+
return getFluxResourceStatus({
138+
url,
139+
watchPath,
140+
query: fluxKustomizationStatusQuery,
141+
variables: { configuration, namespace, environmentName, fluxResourcePath },
142+
field: kustomizationField,
143+
client,
144+
});
80145
},
81-
fluxHelmReleaseStatus(_, { configuration, namespace, environmentName, fluxResourcePath }) {
146+
fluxHelmReleaseStatus(
147+
_,
148+
{ configuration, namespace, environmentName, fluxResourcePath },
149+
{ client },
150+
) {
151+
const watchPath = buildFluxResourceWatchPath({
152+
namespace,
153+
apiVersion: helmReleasesApiVersion,
154+
resourceType: HELM_RELEASES_RESOURCE_TYPE,
155+
});
82156
let url;
83157

84158
if (fluxResourcePath) {
@@ -92,7 +166,14 @@ export default {
92166
environmentName,
93167
});
94168
}
95-
return getFluxResourceStatus(configuration, url);
169+
return getFluxResourceStatus({
170+
url,
171+
watchPath,
172+
query: fluxHelmReleaseStatusQuery,
173+
variables: { configuration, namespace, environmentName, fluxResourcePath },
174+
field: helmReleaseField,
175+
client,
176+
});
96177
},
97178
fluxKustomizations(_, { configuration, namespace }) {
98179
const url = buildFluxResourceUrl({

app/assets/javascripts/pages/users/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { initProfileTabs } from '~/profile';
55
import UserTabs from './user_tabs';
66

77
function initUserProfile(action) {
8+
// TODO: Remove both Vue and legacy JS tabs code/feature flag uses with the
9+
// removal of the old navigation.
10+
// See https://gitlab.com/groups/gitlab-org/-/epics/11875.
11+
812
if (gon.features?.profileTabsVue) {
913
initProfileTabs();
1014
} else {

app/assets/javascripts/pages/users/user_tabs.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// TODO: Remove this with the removal of the old navigation.
2+
// See https://gitlab.com/groups/gitlab-org/-/epics/11875.
3+
14
import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
25
import $ from 'jquery';
36
import Activities from '~/activities';

app/assets/javascripts/vue_shared/components/source_viewer/source_viewer_new.vue

+24-20
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export default {
5151
lineHighlighter: new LineHighlighter(),
5252
blameData: [],
5353
renderedChunks: [],
54-
overlappingBlameRequested: false,
5554
};
5655
},
5756
computed: {
@@ -72,6 +71,7 @@ export default {
7271
showBlame: {
7372
handler(shouldShow) {
7473
toggleBlameClasses(this.blameData, shouldShow);
74+
this.requestBlameInfo(this.renderedChunks[0]);
7575
},
7676
immediate: true,
7777
},
@@ -92,32 +92,36 @@ export default {
9292
this.selectLine();
9393
},
9494
methods: {
95-
async handleChunkAppear(chunkIndex) {
96-
const chunk = this.chunks[chunkIndex];
97-
95+
async handleChunkAppear(chunkIndex, handleOverlappingChunk = true) {
9896
if (!this.renderedChunks.includes(chunkIndex)) {
9997
this.renderedChunks.push(chunkIndex);
98+
await this.requestBlameInfo(chunkIndex);
10099
101-
const { data } = await this.$apollo.query({
102-
query: blameDataQuery,
103-
variables: {
104-
fullPath: this.projectPath,
105-
filePath: this.blob.path,
106-
fromLine: chunk.startingFrom + 1,
107-
toLine: chunk.startingFrom + chunk.totalLines,
108-
},
109-
});
110-
111-
const blob = data?.project?.repository?.blobs?.nodes[0];
112-
const blameGroups = blob?.blame?.groups;
113-
if (blameGroups) this.blameData.push(...blameGroups);
114-
if (chunkIndex > 0 && !this.overlappingBlameRequested) {
100+
if (chunkIndex > 0 && handleOverlappingChunk) {
115101
// request the blame information for overlapping chunk incase it is visible in the DOM
116-
this.handleChunkAppear(chunkIndex - 1);
117-
this.overlappingBlameRequested = true;
102+
this.handleChunkAppear(chunkIndex - 1, false);
118103
}
119104
}
120105
},
106+
async requestBlameInfo(chunkIndex) {
107+
const chunk = this.chunks[chunkIndex];
108+
if (!this.showBlame || !chunk) return;
109+
110+
const { data } = await this.$apollo.query({
111+
query: blameDataQuery,
112+
variables: {
113+
fullPath: this.projectPath,
114+
filePath: this.blob.path,
115+
fromLine: chunk.startingFrom + 1,
116+
toLine: chunk.startingFrom + chunk.totalLines,
117+
},
118+
});
119+
120+
const blob = data?.project?.repository?.blobs?.nodes[0];
121+
const blameGroups = blob?.blame?.groups;
122+
const isDuplicate = this.blameData.includes(blameGroups[0]);
123+
if (blameGroups && !isDuplicate) this.blameData.push(...blameGroups);
124+
},
121125
async selectLine() {
122126
await this.$nextTick();
123127
this.lineHighlighter.highlightHash(this.$route.hash);

app/assets/javascripts/vue_shared/components/source_viewer/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const findLineContentElement = (lineNumber) => document.getElementById(`LC${line
1010
export const calculateBlameOffset = (lineNumber) => {
1111
if (lineNumber === 1) return '0px';
1212
const blobViewerOffset = document.querySelector(VIEWER_SELECTOR)?.getBoundingClientRect().top;
13-
const lineContentOffset = findLineContentElement(lineNumber).getBoundingClientRect().top;
13+
const lineContentOffset = findLineContentElement(lineNumber)?.getBoundingClientRect().top;
1414
return `${lineContentOffset - blobViewerOffset}px`;
1515
};
1616

app/assets/stylesheets/framework/layout.scss

-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ html {
44
&.touch .tooltip {
55
display: none !important;
66
}
7-
8-
@include media-breakpoint-up(sm) {
9-
&.logged-out-marketing-header {
10-
--header-height: 72px;
11-
}
12-
}
137
}
148

159
body {

app/helpers/application_helper.rb

-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ def page_class
318318
class_names << 'with-header' if !show_super_sidebar? || !current_user
319319
class_names << 'with-top-bar' if show_super_sidebar? && !@hide_top_bar_padding
320320
class_names << system_message_class
321-
class_names << 'logged-out-marketing-header' if !current_user && ::Gitlab.com? && !show_super_sidebar?
322321

323322
class_names
324323
end

app/helpers/nav_helper.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ def admin_monitoring_nav_links
8080

8181
def show_super_sidebar?(user = current_user)
8282
# The new sidebar is not enabled for anonymous use
83-
# Once we enable the new sidebar by default, this
84-
# should return true
85-
return Feature.enabled?(:super_sidebar_logged_out) unless user
83+
return true unless user
8684

8785
# Users who get the new nav unless they explicitly
8886
# opt-out via the toggle

app/services/ci/destroy_pipeline_service.rb

+2
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ def execute(pipeline)
2828
end
2929
end
3030
end
31+
32+
Ci::DestroyPipelineService.prepend_mod

app/views/admin/application_settings/_localization.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
.form-group
1313
= f.label :time_tracking, _('Time tracking'), class: 'label-bold'
14-
- time_tracking_help_link = help_page_path('user/project/time_tracking.md')
14+
- time_tracking_help_link = help_page_path('user/project/time_tracking')
1515
- time_tracking_help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: time_tracking_help_link }
1616
= f.gitlab_ui_checkbox_component :time_tracking_limit_to_hours, _('Limit display of time tracking units to hours.'), help_text: _('Display time tracking in issues in total hours only. %{link_start}What is time tracking?%{link_end}').html_safe % { link_start: time_tracking_help_link_start, link_end: '</a>'.html_safe }
1717

app/views/profiles/two_factor_auths/show.html.haml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
alert_options: { class: 'gl-mb-3' },
4242
dismissible: false) do |c|
4343
- c.with_body do
44-
= link_to _('Try the troubleshooting steps here.'), help_page_path('user/profile/account/two_factor_authentication.md', anchor: 'troubleshooting'), target: '_blank', rel: 'noopener noreferrer'
44+
= link_to _('Try the troubleshooting steps here.'), help_page_path('user/profile/account/two_factor_authentication', anchor: 'troubleshooting'), target: '_blank', rel: 'noopener noreferrer'
4545

4646
- if current_password_required?
4747
.form-group
@@ -130,7 +130,7 @@
130130
alert_options: { class: 'gl-mb-3' },
131131
dismissible: false) do |c|
132132
- c.with_body do
133-
= link_to _('Try the troubleshooting steps here.'), help_page_path('user/profile/account/two_factor_authentication.md', anchor: 'troubleshooting'), target: '_blank', rel: 'noopener noreferrer'
133+
= link_to _('Try the troubleshooting steps here.'), help_page_path('user/profile/account/two_factor_authentication', anchor: 'troubleshooting'), target: '_blank', rel: 'noopener noreferrer'
134134
.js-manage-two-factor-form{ data: { current_password_required: current_password_required?.to_s, profile_two_factor_auth_path: profile_two_factor_auth_path, profile_two_factor_auth_method: 'delete', codes_profile_two_factor_auth_path: codes_profile_two_factor_auth_path, codes_profile_two_factor_auth_method: 'post' } }
135135
- else
136136
%p

app/views/projects/settings/merge_requests/_merge_request_merge_commit_template.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
%p.form-text.text-muted
1010
= s_('ProjectSettings|Leave empty to use default template.')
1111
= sprintf(s_('ProjectSettings|Maximum %{maxLength} characters.'), { maxLength: Project::MAX_COMMIT_TEMPLATE_LENGTH })
12-
- link = link_to('', help_page_path('user/project/merge_requests/commit_templates.md'), target: '_blank', rel: 'noopener noreferrer')
12+
- link = link_to('', help_page_path('user/project/merge_requests/commit_templates'), target: '_blank', rel: 'noopener noreferrer')
1313
= safe_format(s_('ProjectSettings|%{link_start}What variables can I use?%{link_end}'), tag_pair(link, :link_start, :link_end))

app/views/projects/settings/merge_requests/_merge_request_merge_suggestions_settings.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
%p.form-text.text-muted
1010
= s_('ProjectSettings|Leave empty to use default template.')
1111
= sprintf(s_('ProjectSettings|Maximum %{maxLength} characters.'), { maxLength: Project::MAX_SUGGESTIONS_TEMPLATE_LENGTH })
12-
- link = link_to('', help_page_path('user/project/merge_requests/reviews/suggestions.md', anchor: 'configure-the-commit-message-for-applied-suggestions'), target: '_blank', rel: 'noopener noreferrer')
12+
- link = link_to('', help_page_path('user/project/merge_requests/reviews/suggestions', anchor: 'configure-the-commit-message-for-applied-suggestions'), target: '_blank', rel: 'noopener noreferrer')
1313
= safe_format(s_('ProjectSettings|%{link_start}What variables can I use?%{link_end}'), tag_pair(link, :link_start, :link_end))

app/views/projects/settings/merge_requests/_merge_request_squash_commit_template.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
%p.form-text.text-muted
1010
= s_('ProjectSettings|Leave empty to use default template.')
1111
= sprintf(s_('ProjectSettings|Maximum %{maxLength} characters.'), { maxLength: Project::MAX_COMMIT_TEMPLATE_LENGTH })
12-
- link = link_to('', help_page_path('user/project/merge_requests/commit_templates.md'), target: '_blank', rel: 'noopener noreferrer')
12+
- link = link_to('', help_page_path('user/project/merge_requests/commit_templates'), target: '_blank', rel: 'noopener noreferrer')
1313
= safe_format(s_('ProjectSettings|%{link_start}What variables can I use?%{link_end}'), tag_pair(link, :link_start, :link_end))

app/views/projects/usage_quotas/index.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
.col-sm-12
1515
%p.gl-text-secondary
1616
= s_('UsageQuota|Usage of project resources across the %{strong_start}%{project_name}%{strong_end} project').html_safe % { strong_start: '<strong>'.html_safe, strong_end: '</strong>'.html_safe, project_name: @project.name } + '.'
17-
%a{ href: help_page_path('user/usage_quotas.md'), target: '_blank', rel: 'noopener noreferrer' }
17+
%a{ href: help_page_path('user/usage_quotas'), target: '_blank', rel: 'noopener noreferrer' }
1818
= s_('UsageQuota|Learn more about usage quotas') + '.'
1919

2020
= gl_tabs_nav({ id: 'js-project-usage-quotas-tabs' }) do

app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
= _('Container registry is not enabled on this GitLab instance. Ask an administrator to enable it in order for Auto DevOps to work.')
1010
- c.with_actions do
1111
= link_button_to _('Settings'), project_settings_ci_cd_path(project), class: 'alert-link', variant: :confirm
12-
= link_button_to _('More information'), help_page_path('topics/autodevops/index.md'), target: '_blank', class: 'alert-link gl-ml-3'
12+
= link_button_to _('More information'), help_page_path('topics/autodevops/index'), target: '_blank', class: 'alert-link gl-ml-3'

app/views/shared/_registration_features_discovery_message.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- feature_title = local_assigns.fetch(:feature_title, s_('RegistrationFeatures|use this feature'))
2-
- registration_features_docs_path = help_page_path('administration/settings/usage_statistics.md', anchor: 'registration-features-program')
2+
- registration_features_docs_path = help_page_path('administration/settings/usage_statistics', anchor: 'registration-features-program')
33
- registration_features_link_start = '<a href="%{url}" target="_blank">'.html_safe % { url: registration_features_docs_path }
44

55
%div

0 commit comments

Comments
 (0)