Skip to content

Commit 8cdf5ee

Browse files
authored
E2C: Add Public Preview banner (#90922)
* E2C: Add public preview message * Read feedback URL from the settings * Translate strings * Add missing translation * Add missing translation[2]
1 parent 944cc87 commit 8cdf5ee

File tree

7 files changed

+41
-2
lines changed

7 files changed

+41
-2
lines changed

packages/grafana-runtime/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
179179
rootFolderUID: string | undefined;
180180
localFileSystemAvailable: boolean | undefined;
181181
cloudMigrationIsTarget: boolean | undefined;
182+
cloudMigrationFeedbackURL = '';
182183
reportingStaticContext?: Record<string, string>;
183184
exploreDefaultTimeOffset = '1h';
184185

pkg/api/dtos/frontend_settings.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ type FrontendSettingsDTO struct {
256256
PublicDashboardAccessToken string `json:"publicDashboardAccessToken"`
257257
PublicDashboardsEnabled bool `json:"publicDashboardsEnabled"`
258258

259-
CloudMigrationIsTarget bool `json:"cloudMigrationIsTarget"`
259+
CloudMigrationIsTarget bool `json:"cloudMigrationIsTarget"`
260+
CloudMigrationFeedbackURL string `json:"cloudMigrationFeedbackURL"`
260261

261262
DateFormats setting.DateFormats `json:"dateFormats,omitempty"`
262263

pkg/api/frontendsettings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
223223
PublicDashboardAccessToken: c.PublicDashboardAccessToken,
224224
PublicDashboardsEnabled: hs.Cfg.PublicDashboardsEnabled,
225225
CloudMigrationIsTarget: isCloudMigrationTarget,
226+
CloudMigrationFeedbackURL: hs.Cfg.CloudMigration.FeedbackURL,
226227
SharedWithMeFolderUID: folder.SharedWithMeFolderUID,
227228
RootFolderUID: accesscontrol.GeneralFolderUID,
228229
LocalFileSystemAvailable: hs.Cfg.LocalFileSystemAvailable,

pkg/setting/setting_cloud_migration.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type CloudMigrationSettings struct {
2323
CreateTokenTimeout time.Duration
2424
DeleteTokenTimeout time.Duration
2525
TokenExpiresAfter time.Duration
26+
FeedbackURL string
2627

2728
IsDeveloperMode bool
2829
}
@@ -47,6 +48,7 @@ func (cfg *Cfg) readCloudMigrationSettings() {
4748
cfg.CloudMigration.DeleteTokenTimeout = cloudMigration.Key("delete_token_timeout").MustDuration(5 * time.Second)
4849
cfg.CloudMigration.TokenExpiresAfter = cloudMigration.Key("token_expires_after").MustDuration(7 * 24 * time.Hour)
4950
cfg.CloudMigration.IsDeveloperMode = cloudMigration.Key("developer_mode").MustBool(false)
51+
cfg.CloudMigration.FeedbackURL = cloudMigration.Key("feedback_url").MustString("")
5052

5153
if cfg.CloudMigration.SnapshotFolder == "" {
5254
homeDir, _ := os.UserHomeDir()
Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
import { config } from '@grafana/runtime';
2+
import { Alert } from '@grafana/ui';
23
import { Page } from 'app/core/components/Page/Page';
34

5+
import { Trans, t } from '../../core/internationalization';
6+
47
import { Page as CloudPage } from './cloud/Page';
58
import { Page as OnPremPage } from './onprem/Page';
69

710
export default function MigrateToCloud() {
8-
return <Page navId="migrate-to-cloud">{config.cloudMigrationIsTarget ? <CloudPage /> : <OnPremPage />}</Page>;
11+
const feedbackURL = config.cloudMigrationFeedbackURL;
12+
return (
13+
<Page navId="migrate-to-cloud">
14+
<Alert
15+
title={t('migrate-to-cloud.public-preview.title', 'Migrate to Grafana Cloud is in public preview')}
16+
buttonContent={t('migrate-to-cloud.public-preview.button-text', 'Give feedback')}
17+
severity={'info'}
18+
onRemove={
19+
feedbackURL
20+
? () => {
21+
window.location.href = feedbackURL;
22+
}
23+
: undefined
24+
}
25+
>
26+
<Trans i18nKey="migrate-to-cloud.public-preview.message">
27+
Help us improve this feature by providing feedback and reporting any issues.
28+
</Trans>
29+
</Alert>
30+
{config.cloudMigrationIsTarget ? <CloudPage /> : <OnPremPage />}
31+
</Page>
32+
);
933
}

public/locales/en-US/grafana.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,11 @@
10701070
"link-title": "Grafana Cloud pricing",
10711071
"title": "How much does it cost?"
10721072
},
1073+
"public-preview": {
1074+
"button-text": "Give feedback",
1075+
"message": "Help us improve this feature by providing feedback and reporting any issues.",
1076+
"title": "Migrate to Grafana Cloud is in public preview"
1077+
},
10731078
"resource-status": {
10741079
"error-details-button": "Details",
10751080
"failed": "Error",

public/locales/pseudo-LOCALE/grafana.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,11 @@
10701070
"link-title": "Ğřäƒäʼnä Cľőūđ přįčįʼnģ",
10711071
"title": "Ħőŵ mūčĥ đőęş įŧ čőşŧ?"
10721072
},
1073+
"public-preview": {
1074+
"button-text": "Ğįvę ƒęęđþäčĸ",
1075+
"message": "Ħęľp ūş įmpřővę ŧĥįş ƒęäŧūřę þy přővįđįʼnģ ƒęęđþäčĸ äʼnđ řępőřŧįʼnģ äʼny įşşūęş.",
1076+
"title": "Mįģřäŧę ŧő Ğřäƒäʼnä Cľőūđ įş įʼn pūþľįč přęvįęŵ"
1077+
},
10731078
"resource-status": {
10741079
"error-details-button": "Đęŧäįľş",
10751080
"failed": "Ēřřőř",

0 commit comments

Comments
 (0)