Skip to content

Commit 844e3ef

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent a3dfd31 commit 844e3ef

File tree

35 files changed

+628
-145
lines changed

35 files changed

+628
-145
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<script>
2+
import { s__ } from '~/locale';
3+
import IntegrationsTable from './integrations_table.vue';
4+
5+
export default {
6+
name: 'IntegrationsList',
7+
components: {
8+
IntegrationsTable,
9+
},
10+
props: {
11+
integrations: {
12+
type: Array,
13+
required: true,
14+
},
15+
},
16+
computed: {
17+
integrationsGrouped() {
18+
return this.integrations.reduce(
19+
(integrations, integration) => {
20+
if (integration.active) {
21+
integrations.active.push(integration);
22+
} else {
23+
integrations.inactive.push(integration);
24+
}
25+
26+
return integrations;
27+
},
28+
{ active: [], inactive: [] },
29+
);
30+
},
31+
},
32+
i18n: {
33+
activeTableEmptyText: s__("Integrations|You haven't activated any integrations yet."),
34+
inactiveTableEmptyText: s__("Integrations|You've activated every integration 🎉"),
35+
activeIntegrationsHeading: s__('Integrations|Active integrations'),
36+
inactiveIntegrationsHeading: s__('Integrations|Add an integration'),
37+
},
38+
};
39+
</script>
40+
41+
<template>
42+
<div>
43+
<h4>{{ $options.i18n.activeIntegrationsHeading }}</h4>
44+
<integrations-table
45+
class="gl-mb-7!"
46+
:integrations="integrationsGrouped.active"
47+
:empty-text="$options.i18n.activeTableEmptyText"
48+
show-updated-at
49+
data-testid="active-integrations-table"
50+
/>
51+
52+
<h4>{{ $options.i18n.inactiveIntegrationsHeading }}</h4>
53+
<integrations-table
54+
:integrations="integrationsGrouped.inactive"
55+
:empty-text="$options.i18n.inactiveTableEmptyText"
56+
data-testid="inactive-integrations-table"
57+
/>
58+
</div>
59+
</template>
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<script>
2+
import { GlIcon, GlLink, GlTable, GlTooltipDirective } from '@gitlab/ui';
3+
import { sprintf, s__, __ } from '~/locale';
4+
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
5+
6+
export default {
7+
components: {
8+
GlIcon,
9+
GlLink,
10+
GlTable,
11+
TimeAgoTooltip,
12+
},
13+
directives: {
14+
GlTooltip: GlTooltipDirective,
15+
},
16+
props: {
17+
integrations: {
18+
type: Array,
19+
required: true,
20+
},
21+
showUpdatedAt: {
22+
type: Boolean,
23+
required: false,
24+
default: false,
25+
},
26+
emptyText: {
27+
type: String,
28+
required: false,
29+
default: undefined,
30+
},
31+
},
32+
computed: {
33+
fields() {
34+
return [
35+
{
36+
key: 'active',
37+
label: '',
38+
thClass: 'gl-w-10',
39+
},
40+
{
41+
key: 'title',
42+
label: __('Integration'),
43+
thClass: 'gl-w-quarter',
44+
},
45+
{
46+
key: 'description',
47+
label: __('Description'),
48+
thClass: 'gl-display-none d-sm-table-cell',
49+
tdClass: 'gl-display-none d-sm-table-cell',
50+
},
51+
{
52+
key: 'updated_at',
53+
label: this.showUpdatedAt ? __('Last updated') : '',
54+
thClass: 'gl-w-20p',
55+
},
56+
];
57+
},
58+
},
59+
methods: {
60+
getStatusTooltipTitle(integration) {
61+
return sprintf(s__('Integrations|%{integrationTitle}: active'), {
62+
integrationTitle: integration.title,
63+
});
64+
},
65+
},
66+
};
67+
</script>
68+
69+
<template>
70+
<gl-table :items="integrations" :fields="fields" :empty-text="emptyText" show-empty fixed>
71+
<template #cell(active)="{ item }">
72+
<gl-icon
73+
v-if="item.active"
74+
v-gl-tooltip
75+
name="check"
76+
class="gl-text-green-500"
77+
:title="getStatusTooltipTitle(item)"
78+
/>
79+
</template>
80+
81+
<template #cell(title)="{ item }">
82+
<gl-link
83+
:href="item.edit_path"
84+
class="gl-font-weight-bold"
85+
:data-qa-selector="`${item.name}_link`"
86+
>
87+
{{ item.title }}
88+
</gl-link>
89+
</template>
90+
91+
<template #cell(updated_at)="{ item }">
92+
<time-ago-tooltip v-if="showUpdatedAt && item.updated_at" :time="item.updated_at" />
93+
</template>
94+
</gl-table>
95+
</template>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Vue from 'vue';
2+
import IntegrationList from './components/integrations_list.vue';
3+
4+
export default () => {
5+
const el = document.querySelector('.js-integrations-list');
6+
7+
if (!el) {
8+
return null;
9+
}
10+
11+
const { integrations } = el.dataset;
12+
13+
return new Vue({
14+
el,
15+
render(createElement) {
16+
return createElement(IntegrationList, {
17+
props: {
18+
integrations: JSON.parse(integrations),
19+
},
20+
});
21+
},
22+
});
23+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import initIntegrationsList from '~/integrations/index';
2+
3+
initIntegrationsList();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import initIntegrationsList from '~/integrations/index';
12
import PersistentUserCallout from '~/persistent_user_callout';
23

34
const callout = document.querySelector('.js-webhooks-moved-alert');
45
PersistentUserCallout.factory(callout);
6+
7+
initIntegrationsList();

app/helpers/services_helper.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ def integration_form_data(integration, group: nil)
115115
form_data
116116
end
117117

118+
def integration_list_data(integrations)
119+
{
120+
integrations: integrations.map { |i| serialize_integration(i) }.to_json
121+
}
122+
end
123+
118124
def trigger_events_for_service(integration)
119125
ServiceEventSerializer.new(service: integration).represent(integration.configurable_events).to_json
120126
end
@@ -155,6 +161,17 @@ def integration_level(integration)
155161
'project'
156162
end
157163
end
164+
165+
def serialize_integration(integration)
166+
{
167+
active: integration.operating?,
168+
title: integration.title,
169+
description: integration.description,
170+
updated_at: integration.updated_at,
171+
edit_path: scoped_edit_integration_path(integration),
172+
name: integration.to_param
173+
}
174+
end
158175
end
159176

160177
ServicesHelper.prepend_if_ee('EE::ServicesHelper')

app/models/pages/lookup_path.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def legacy_source
7272
path: File.join(project.full_path, 'public/')
7373
}
7474
rescue LegacyStorageDisabledError => e
75-
Gitlab::ErrorTracking.track_exception(e)
75+
Gitlab::ErrorTracking.track_exception(e, project_id: project.id)
7676

7777
nil
7878
end

app/models/project_services/drone_ci_service.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,25 @@ def build_page(sha, ref)
7979
end
8080

8181
def title
82-
'Drone CI'
82+
'Drone'
8383
end
8484

8585
def description
86-
'Drone is a Continuous Integration platform built on Docker, written in Go'
86+
s_('ProjectService|Run CI/CD pipelines with Drone.')
8787
end
8888

8989
def self.to_param
9090
'drone_ci'
9191
end
9292

93+
def help
94+
s_('ProjectService|Run CI/CD pipelines with Drone.')
95+
end
96+
9397
def fields
9498
[
95-
{ type: 'text', name: 'token', placeholder: 'Drone CI project specific token', required: true },
96-
{ type: 'text', name: 'drone_url', title: s_('ProjectService|Drone URL'), placeholder: 'http://drone.example.com', required: true },
99+
{ type: 'text', name: 'token', help: s_('ProjectService|Token for the Drone project.'), required: true },
100+
{ type: 'text', name: 'drone_url', title: s_('ProjectService|Drone server URL'), placeholder: 'http://drone.example.com', required: true },
97101
{ type: 'checkbox', name: 'enable_ssl_verification', title: "Enable SSL verification" }
98102
]
99103
end

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
.gl-alert-actions
1414
= link_to s_('AdminSettings|Go to General Settings'), general_admin_application_settings_path, class: 'btn gl-alert-action btn-info gl-button'
1515

16-
%h4= s_('AdminSettings|Apply integration settings to all Projects')
17-
%p
18-
= s_('AdminSettings|Integrations configured here will automatically apply to all projects on this instance.')
19-
= link_to _('Learn more'), integrations_help_page_path, target: '_blank', rel: 'noopener noreferrer'
16+
%h3= s_('Integrations|Project integration management')
17+
18+
- integrations_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: integrations_help_page_path }
19+
%p= s_('Integrations|As a GitLab administrator, you can set default configuration parameters for a given integration that all projects can inherit and use. When you set these parameters, your changes update the integration for all projects that are not already using custom settings. Learn more about %{integrations_link_start}Project integration management%{link_end}.').html_safe % { integrations_link_start: integrations_link_start, link_end: '</a>'.html_safe }
2020
= render 'shared/integrations/index', integrations: @integrations

app/views/groups/settings/integrations/index.html.haml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
- page_title _('Integrations')
33
- @content_class = 'limit-container-width' unless fluid_layout
44

5-
%h4= s_('GroupSettings|Apply integration settings to all Projects')
6-
%p
7-
= s_('GroupSettings|Integrations configured here will automatically apply to all projects in this group.')
8-
= link_to _('Learn more'), integrations_help_page_path, target: '_blank', rel: 'noopener noreferrer'
5+
%h3= s_('Integrations|Project integration management')
6+
7+
- integrations_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: integrations_help_page_path }
8+
%p= s_('Integrations|As a GitLab administrator, you can set default configuration parameters for a given integration that all projects can inherit and use. When you set these parameters, your changes update the integration for all projects that are not already using custom settings. Learn more about %{integrations_link_start}Project integration management%{link_end}.').html_safe % { integrations_link_start: integrations_link_start, link_end: '</a>'.html_safe }
99
= render 'shared/integrations/index', integrations: @integrations

0 commit comments

Comments
 (0)