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]
This commit is contained in:
Alex Khomenko
2024-07-25 12:44:49 +03:00
committed by GitHub
parent 944cc87f65
commit 8cdf5ee824
7 changed files with 41 additions and 2 deletions
+1
View File
@@ -179,6 +179,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
rootFolderUID: string | undefined;
localFileSystemAvailable: boolean | undefined;
cloudMigrationIsTarget: boolean | undefined;
cloudMigrationFeedbackURL = '';
reportingStaticContext?: Record<string, string>;
exploreDefaultTimeOffset = '1h';
+2 -1
View File
@@ -256,7 +256,8 @@ type FrontendSettingsDTO struct {
PublicDashboardAccessToken string `json:"publicDashboardAccessToken"`
PublicDashboardsEnabled bool `json:"publicDashboardsEnabled"`
CloudMigrationIsTarget bool `json:"cloudMigrationIsTarget"`
CloudMigrationIsTarget bool `json:"cloudMigrationIsTarget"`
CloudMigrationFeedbackURL string `json:"cloudMigrationFeedbackURL"`
DateFormats setting.DateFormats `json:"dateFormats,omitempty"`
+1
View File
@@ -223,6 +223,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
PublicDashboardAccessToken: c.PublicDashboardAccessToken,
PublicDashboardsEnabled: hs.Cfg.PublicDashboardsEnabled,
CloudMigrationIsTarget: isCloudMigrationTarget,
CloudMigrationFeedbackURL: hs.Cfg.CloudMigration.FeedbackURL,
SharedWithMeFolderUID: folder.SharedWithMeFolderUID,
RootFolderUID: accesscontrol.GeneralFolderUID,
LocalFileSystemAvailable: hs.Cfg.LocalFileSystemAvailable,
+2
View File
@@ -23,6 +23,7 @@ type CloudMigrationSettings struct {
CreateTokenTimeout time.Duration
DeleteTokenTimeout time.Duration
TokenExpiresAfter time.Duration
FeedbackURL string
IsDeveloperMode bool
}
@@ -47,6 +48,7 @@ func (cfg *Cfg) readCloudMigrationSettings() {
cfg.CloudMigration.DeleteTokenTimeout = cloudMigration.Key("delete_token_timeout").MustDuration(5 * time.Second)
cfg.CloudMigration.TokenExpiresAfter = cloudMigration.Key("token_expires_after").MustDuration(7 * 24 * time.Hour)
cfg.CloudMigration.IsDeveloperMode = cloudMigration.Key("developer_mode").MustBool(false)
cfg.CloudMigration.FeedbackURL = cloudMigration.Key("feedback_url").MustString("")
if cfg.CloudMigration.SnapshotFolder == "" {
homeDir, _ := os.UserHomeDir()
@@ -1,9 +1,33 @@
import { config } from '@grafana/runtime';
import { Alert } from '@grafana/ui';
import { Page } from 'app/core/components/Page/Page';
import { Trans, t } from '../../core/internationalization';
import { Page as CloudPage } from './cloud/Page';
import { Page as OnPremPage } from './onprem/Page';
export default function MigrateToCloud() {
return <Page navId="migrate-to-cloud">{config.cloudMigrationIsTarget ? <CloudPage /> : <OnPremPage />}</Page>;
const feedbackURL = config.cloudMigrationFeedbackURL;
return (
<Page navId="migrate-to-cloud">
<Alert
title={t('migrate-to-cloud.public-preview.title', 'Migrate to Grafana Cloud is in public preview')}
buttonContent={t('migrate-to-cloud.public-preview.button-text', 'Give feedback')}
severity={'info'}
onRemove={
feedbackURL
? () => {
window.location.href = feedbackURL;
}
: undefined
}
>
<Trans i18nKey="migrate-to-cloud.public-preview.message">
Help us improve this feature by providing feedback and reporting any issues.
</Trans>
</Alert>
{config.cloudMigrationIsTarget ? <CloudPage /> : <OnPremPage />}
</Page>
);
}
+5
View File
@@ -1070,6 +1070,11 @@
"link-title": "Grafana Cloud pricing",
"title": "How much does it cost?"
},
"public-preview": {
"button-text": "Give feedback",
"message": "Help us improve this feature by providing feedback and reporting any issues.",
"title": "Migrate to Grafana Cloud is in public preview"
},
"resource-status": {
"error-details-button": "Details",
"failed": "Error",
@@ -1070,6 +1070,11 @@
"link-title": "Ğřäƒäʼnä Cľőūđ přįčįʼnģ",
"title": "Ħőŵ mūčĥ đőęş įŧ čőşŧ?"
},
"public-preview": {
"button-text": "Ğįvę ƒęęđþäčĸ",
"message": "Ħęľp ūş įmpřővę ŧĥįş ƒęäŧūřę þy přővįđįʼnģ ƒęęđþäčĸ äʼnđ řępőřŧįʼnģ äʼny įşşūęş.",
"title": "Mįģřäŧę ŧő Ğřäƒäʼnä Cľőūđ įş įʼn pūþľįč přęvįęŵ"
},
"resource-status": {
"error-details-button": "Đęŧäįľş",
"failed": "Ēřřőř",