|
6 | 6 |
|
7 | 7 | from django.utils.translation import ugettext_lazy as _
|
8 | 8 | from rest_framework.serializers import ValidationError
|
| 9 | +from six.moves.urllib.parse import urlencode |
9 | 10 |
|
10 | 11 |
|
11 | 12 | from sentry.integrations import (
|
|
21 | 22 | from sentry.identity.pipeline import IdentityProviderPipeline
|
22 | 23 | from sentry.utils.http import absolute_uri
|
23 | 24 | from sentry.models import (
|
| 25 | + Organization, |
24 | 26 | Integration,
|
25 | 27 | Project,
|
26 | 28 | ProjectKey,
|
|
36 | 38 |
|
37 | 39 | logger = logging.getLogger("sentry.integrations.vercel")
|
38 | 40 |
|
39 |
| -DESCRIPTION = """ |
| 41 | +DESCRIPTION = _( |
| 42 | + """ |
40 | 43 | Vercel is an all-in-one platform with Global CDN supporting static & JAMstack deployment and Serverless Functions.
|
41 | 44 | """
|
| 45 | +) |
42 | 46 |
|
43 | 47 | FEATURES = [
|
44 | 48 | FeatureDescription(
|
|
49 | 53 | ),
|
50 | 54 | ]
|
51 | 55 |
|
52 |
| -INSTALL_NOTICE_TEXT = ( |
| 56 | +INSTALL_NOTICE_TEXT = _( |
53 | 57 | "Visit the Vercel Marketplace to install this integration. After installing the"
|
54 | 58 | " Sentry integration, you'll be redirected back to Sentry to finish syncing Vercel and Sentry projects."
|
55 | 59 | )
|
|
63 | 67 |
|
64 | 68 |
|
65 | 69 | configure_integration = {"title": _("Connect Your Projects")}
|
| 70 | +connect_project_instruction = _( |
| 71 | + "To complete installation, please connect your Sentry and Vercel projects." |
| 72 | +) |
| 73 | +install_source_code_integration = _( |
| 74 | + "Install a [source code integration]({}) and configure your repositories." |
| 75 | +) |
66 | 76 |
|
67 | 77 | disable_dialog = {
|
68 |
| - "actionText": "Visit Vercel", |
69 |
| - "body": "In order to uninstall this integration, you must go" |
70 |
| - " to Vercel and uninstall there by clicking 'Remove Configuration'.", |
| 78 | + "actionText": _("Visit Vercel"), |
| 79 | + "body": _( |
| 80 | + "In order to uninstall this integration, you must go" |
| 81 | + " to Vercel and uninstall there by clicking 'Remove Configuration'." |
| 82 | + ), |
71 | 83 | }
|
72 | 84 |
|
73 | 85 |
|
@@ -97,6 +109,21 @@ class VercelIntegration(IntegrationInstallation):
|
97 | 109 | def metadata(self):
|
98 | 110 | return self.model.metadata
|
99 | 111 |
|
| 112 | + def get_dynamic_display_information(self): |
| 113 | + organization = Organization.objects.get_from_cache(id=self.organization_id) |
| 114 | + source_code_link = absolute_uri( |
| 115 | + u"/settings/%s/integrations/?%s" |
| 116 | + % (organization.slug, urlencode({"category": "source code management"})) |
| 117 | + ) |
| 118 | + return { |
| 119 | + "configure_integration": { |
| 120 | + "instructions": [ |
| 121 | + connect_project_instruction, |
| 122 | + install_source_code_integration.format(source_code_link), |
| 123 | + ] |
| 124 | + } |
| 125 | + } |
| 126 | + |
100 | 127 | def get_client(self):
|
101 | 128 | access_token = self.metadata["access_token"]
|
102 | 129 | if self.metadata["installation_type"] == "team":
|
|
0 commit comments