Share Externally: Texts modification (#89640)

This commit is contained in:
Juan Cabanas
2024-06-25 17:52:41 -03:00
committed by GitHub
parent 2fb7b18ead
commit 0d276fe7b1
8 changed files with 39 additions and 49 deletions

View File

@@ -127,7 +127,7 @@ func TestAPIViewPublicDashboard(t *testing.T) {
var errResp errutil.PublicError var errResp errutil.PublicError
err := json.Unmarshal(response.Body.Bytes(), &errResp) err := json.Unmarshal(response.Body.Bytes(), &errResp)
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, "Public dashboard not found", errResp.Message) assert.Equal(t, "Dashboard not found", errResp.Message)
assert.Equal(t, "publicdashboards.notFound", errResp.MessageID) assert.Equal(t, "publicdashboards.notFound", errResp.MessageID)
} }
}) })

View File

@@ -5,24 +5,24 @@ import "github.com/grafana/grafana/pkg/apimachinery/errutil"
var ( var (
ErrInternalServerError = errutil.Internal("publicdashboards.internalServerError", errutil.WithPublicMessage("Internal server error")) ErrInternalServerError = errutil.Internal("publicdashboards.internalServerError", errutil.WithPublicMessage("Internal server error"))
ErrPublicDashboardNotFound = errutil.NotFound("publicdashboards.notFound", errutil.WithPublicMessage("Public dashboard not found")) ErrPublicDashboardNotFound = errutil.NotFound("publicdashboards.notFound", errutil.WithPublicMessage("Dashboard not found"))
ErrDashboardNotFound = errutil.NotFound("publicdashboards.dashboardNotFound", errutil.WithPublicMessage("Dashboard not found")) ErrDashboardNotFound = errutil.NotFound("publicdashboards.dashboardNotFound", errutil.WithPublicMessage("Dashboard not found"))
ErrPanelNotFound = errutil.NotFound("publicdashboards.panelNotFound", errutil.WithPublicMessage("Public dashboard panel not found")) ErrPanelNotFound = errutil.NotFound("publicdashboards.panelNotFound", errutil.WithPublicMessage("Dashboard panel not found"))
ErrBadRequest = errutil.BadRequest("publicdashboards.badRequest") ErrBadRequest = errutil.BadRequest("publicdashboards.badRequest")
ErrPanelQueriesNotFound = errutil.BadRequest("publicdashboards.panelQueriesNotFound", errutil.WithPublicMessage("Failed to extract queries from panel")) ErrPanelQueriesNotFound = errutil.BadRequest("publicdashboards.panelQueriesNotFound", errutil.WithPublicMessage("Failed to extract queries from panel"))
ErrInvalidAccessToken = errutil.BadRequest("publicdashboards.invalidAccessToken", errutil.WithPublicMessage("Invalid access token")) ErrInvalidAccessToken = errutil.BadRequest("publicdashboards.invalidAccessToken", errutil.WithPublicMessage("Invalid access token"))
ErrInvalidPanelId = errutil.BadRequest("publicdashboards.invalidPanelId", errutil.WithPublicMessage("Invalid panel id")) ErrInvalidPanelId = errutil.BadRequest("publicdashboards.invalidPanelId", errutil.WithPublicMessage("Invalid panel id"))
ErrInvalidUid = errutil.BadRequest("publicdashboards.invalidUid", errutil.WithPublicMessage("Invalid Uid")) ErrInvalidUid = errutil.BadRequest("publicdashboards.invalidUid", errutil.WithPublicMessage("Invalid Uid"))
ErrPublicDashboardIdentifierNotSet = errutil.BadRequest("publicdashboards.identifierNotSet", errutil.WithPublicMessage("No Uid for public dashboard specified")) ErrPublicDashboardIdentifierNotSet = errutil.BadRequest("publicdashboards.identifierNotSet", errutil.WithPublicMessage("No Uid for dashboard specified"))
ErrPublicDashboardHasTemplateVariables = errutil.BadRequest("publicdashboards.hasTemplateVariables", errutil.WithPublicMessage("Public dashboard has template variables")) ErrPublicDashboardHasTemplateVariables = errutil.BadRequest("publicdashboards.hasTemplateVariables", errutil.WithPublicMessage("Dashboard has template variables"))
ErrInvalidInterval = errutil.BadRequest("publicdashboards.invalidInterval", errutil.WithPublicMessage("intervalMS should be greater than 0")) ErrInvalidInterval = errutil.BadRequest("publicdashboards.invalidInterval", errutil.WithPublicMessage("intervalMS should be greater than 0"))
ErrInvalidMaxDataPoints = errutil.BadRequest("publicdashboards.maxDataPoints", errutil.WithPublicMessage("maxDataPoints should be greater than 0")) ErrInvalidMaxDataPoints = errutil.BadRequest("publicdashboards.maxDataPoints", errutil.WithPublicMessage("maxDataPoints should be greater than 0"))
ErrInvalidTimeRange = errutil.BadRequest("publicdashboards.invalidTimeRange", errutil.WithPublicMessage("Invalid time range")) ErrInvalidTimeRange = errutil.BadRequest("publicdashboards.invalidTimeRange", errutil.WithPublicMessage("Invalid time range"))
ErrInvalidShareType = errutil.BadRequest("publicdashboards.invalidShareType", errutil.WithPublicMessage("Invalid share type")) ErrInvalidShareType = errutil.BadRequest("publicdashboards.invalidShareType", errutil.WithPublicMessage("Invalid share type"))
ErrDashboardIsPublic = errutil.BadRequest("publicdashboards.dashboardIsPublic", errutil.WithPublicMessage("Dashboard is already public")) ErrDashboardIsPublic = errutil.BadRequest("publicdashboards.dashboardIsPublic", errutil.WithPublicMessage("Dashboard is already public"))
ErrPublicDashboardUidExists = errutil.BadRequest("publicdashboards.uidExists", errutil.WithPublicMessage("Public Dashboard Uid already exists")) ErrPublicDashboardUidExists = errutil.BadRequest("publicdashboards.uidExists", errutil.WithPublicMessage("Dashboard Uid already exists"))
ErrPublicDashboardAccessTokenExists = errutil.BadRequest("publicdashboards.accessTokenExists", errutil.WithPublicMessage("Public Dashboard Access Token already exists")) ErrPublicDashboardAccessTokenExists = errutil.BadRequest("publicdashboards.accessTokenExists", errutil.WithPublicMessage("Dashboard Access Token already exists"))
ErrPublicDashboardNotEnabled = errutil.Forbidden("publicdashboards.notEnabled", errutil.WithPublicMessage("Public dashboard paused")) ErrPublicDashboardNotEnabled = errutil.Forbidden("publicdashboards.notEnabled", errutil.WithPublicMessage("Dashboard paused"))
) )

View File

@@ -75,10 +75,7 @@ export const ConfigEmailSharing = () => {
> >
<Stack direction="row"> <Stack direction="row">
<Input <Input
placeholder={t( placeholder={t('public-dashboard.email-sharing.recipient-email-placeholder', 'Email')}
'public-dashboard.email-sharing.recipient-email-placeholder',
'Type in the recipient email address and press Enter'
)}
autoCapitalize="none" autoCapitalize="none"
loading={isAddEmailLoading} loading={isAddEmailLoading}
{...register('email', { {...register('email', {

View File

@@ -38,7 +38,7 @@ export const getAnyOneWithTheLinkShareOption = () => {
label: t('public-dashboard.share-externally.public-share-type-option-label', 'Anyone with the link'), label: t('public-dashboard.share-externally.public-share-type-option-label', 'Anyone with the link'),
description: t( description: t(
'public-dashboard.share-externally.public-share-type-option-description', 'public-dashboard.share-externally.public-share-type-option-description',
'Anyone with the link can access' 'Anyone with the link can access dashboard'
), ),
value: PublicDashboardShareType.PUBLIC, value: PublicDashboardShareType.PUBLIC,
icon: 'globe', icon: 'globe',
@@ -49,7 +49,7 @@ const getOnlySpecificPeopleShareOption = () => ({
label: t('public-dashboard.share-externally.email-share-type-option-label', 'Only specific people'), label: t('public-dashboard.share-externally.email-share-type-option-label', 'Only specific people'),
description: t( description: t(
'public-dashboard.share-externally.email-share-type-option-description', 'public-dashboard.share-externally.email-share-type-option-description',
'Only people with access can open with the link' 'Only people with the link can access dashboard'
), ),
value: PublicDashboardShareType.EMAIL, value: PublicDashboardShareType.EMAIL,
icon: 'users-alt', icon: 'users-alt',

View File

@@ -69,29 +69,24 @@ export default function ShareTypeSelect({
</Label> </Label>
{isLoading && <Spinner />} {isLoading && <Spinner />}
</Stack> </Stack>
<Stack direction="row" gap={1} alignItems="center"> {isEmailSharingEnabled() ? (
{isEmailSharingEnabled() ? ( <Select
<Select data-testid={selectors.shareTypeSelect}
data-testid={selectors.shareTypeSelect} options={options}
options={options} value={value}
value={value} disabled={!hasWritePermissions}
disabled={!hasWritePermissions} onChange={(v) => {
onChange={(v) => { setShareType(v);
setShareType(v); onUpdateShareType(v.value!);
onUpdateShareType(v.value!); }}
}} className={styles.select}
className={styles.select} />
/> ) : (
) : ( <>
<> {toIconName(anyOneWithTheLinkOpt.icon) && <Icon name={toIconName(anyOneWithTheLinkOpt.icon)!} />}
{toIconName(anyOneWithTheLinkOpt.icon) && <Icon name={toIconName(anyOneWithTheLinkOpt.icon)!} />} <Text>{anyOneWithTheLinkOpt.label}</Text>
<Text>{anyOneWithTheLinkOpt.label}</Text> </>
</> )}
)}
<Text element="p" variant="bodySmall" color="disabled">
<Trans i18nKey="public-dashboard.share-configuration.access-label">can access</Trans>
</Text>
</Stack>
</div> </div>
); );
} }

View File

@@ -8,8 +8,8 @@ export function EmailSharingPricingAlert() {
<Alert title="" severity="info" bottomSpacing={0}> <Alert title="" severity="info" bottomSpacing={0}>
<Stack justifyContent="space-between" gap={2} alignItems="center"> <Stack justifyContent="space-between" gap={2} alignItems="center">
<Trans i18nKey="public-dashboard.email-sharing.alert-text"> <Trans i18nKey="public-dashboard.email-sharing.alert-text">
Effective immediately, sharing public dashboards by email incurs a cost per active user. Going forward, youll Sharing dashboards by email is billed per user for the duration of the 30-day token, regardless of how many
be prompted for payment whenever you add new users to your dashboard. dashboards are shared. Billing stops after 30 days unless you renew the token.
</Trans> </Trans>
<Button variant="secondary" onClick={() => window.open(EMAIL_SHARING_URL, '_blank')} type="button"> <Button variant="secondary" onClick={() => window.open(EMAIL_SHARING_URL, '_blank')} type="button">
<Trans i18nKey="public-dashboard.email-sharing.learn-more-button">Learn more</Trans> <Trans i18nKey="public-dashboard.email-sharing.learn-more-button">Learn more</Trans>

View File

@@ -1443,7 +1443,7 @@
}, },
"email-sharing": { "email-sharing": {
"accept-button": "Accept", "accept-button": "Accept",
"alert-text": "Effective immediately, sharing public dashboards by email incurs a cost per active user. Going forward, youll be prompted for payment whenever you add new users to your dashboard.", "alert-text": "Sharing dashboards by email is billed per user for the duration of the 30-day token, regardless of how many dashboards are shared. Billing stops after 30 days unless you renew the token.",
"bill-ack": "I understand that adding users requires payment.*", "bill-ack": "I understand that adding users requires payment.*",
"cancel-button": "Cancel", "cancel-button": "Cancel",
"input-invalid-email-text": "Invalid email", "input-invalid-email-text": "Invalid email",
@@ -1452,7 +1452,7 @@
"invite-field-desc": "Invite people by email", "invite-field-desc": "Invite people by email",
"invite-field-label": "Invite", "invite-field-label": "Invite",
"learn-more-button": "Learn more", "learn-more-button": "Learn more",
"recipient-email-placeholder": "Type in the recipient email address and press Enter", "recipient-email-placeholder": "Email",
"recipient-invalid-email-text": "Invalid email", "recipient-invalid-email-text": "Invalid email",
"recipient-invitation-button": "Invite", "recipient-invitation-button": "Invite",
"recipient-invitation-description": "Invite someone by email", "recipient-invitation-description": "Invite someone by email",
@@ -1512,16 +1512,15 @@
"success-delete-old": "Public dashboard deleted!" "success-delete-old": "Public dashboard deleted!"
}, },
"share-configuration": { "share-configuration": {
"access-label": "can access",
"share-type-label": "Link access" "share-type-label": "Link access"
}, },
"share-externally": { "share-externally": {
"copy-link-button": "Copy external link", "copy-link-button": "Copy external link",
"email-share-type-option-description": "Only people with access can open with the link", "email-share-type-option-description": "Only people with the link can access dashboard",
"email-share-type-option-label": "Only specific people", "email-share-type-option-label": "Only specific people",
"pause-access-button": "Pause access", "pause-access-button": "Pause access",
"pause-access-tooltip": "Pausing will temporarily disable access to this dashboard for all users", "pause-access-tooltip": "Pausing will temporarily disable access to this dashboard for all users",
"public-share-type-option-description": "Anyone with the link can access", "public-share-type-option-description": "Anyone with the link can access dashboard",
"public-share-type-option-label": "Anyone with the link", "public-share-type-option-label": "Anyone with the link",
"resume-access-button": "Resume access", "resume-access-button": "Resume access",
"revoke-access-button": "Revoke access", "revoke-access-button": "Revoke access",

View File

@@ -1443,7 +1443,7 @@
}, },
"email-sharing": { "email-sharing": {
"accept-button": "Åččępŧ", "accept-button": "Åččępŧ",
"alert-text": "Ēƒƒęčŧįvę įmmęđįäŧęľy, şĥäřįʼnģ pūþľįč đäşĥþőäřđş þy ęmäįľ įʼnčūřş ä čőşŧ pęř äčŧįvę ūşęř. Ğőįʼnģ ƒőřŵäřđ, yőūľľ þę přőmpŧęđ ƒőř päymęʼnŧ ŵĥęʼnęvęř yőū äđđ ʼnęŵ ūşęřş ŧő yőūř đäşĥþőäřđ.", "alert-text": "Ŝĥäřįʼnģ đäşĥþőäřđş þy ęmäįľ įş þįľľęđ pęř ūşęř ƒőř ŧĥę đūřäŧįőʼn őƒ ŧĥę 30-đäy ŧőĸęʼn, řęģäřđľęşş őƒ ĥőŵ mäʼny đäşĥþőäřđş äřę şĥäřęđ. ßįľľįʼnģ şŧőpş äƒŧęř 30 đäyş ūʼnľęşş yőū řęʼnęŵ ŧĥę ŧőĸęʼn.",
"bill-ack": "Ĩ ūʼnđęřşŧäʼnđ ŧĥäŧ äđđįʼnģ ūşęřş řęqūįřęş päymęʼnŧ.*", "bill-ack": "Ĩ ūʼnđęřşŧäʼnđ ŧĥäŧ äđđįʼnģ ūşęřş řęqūįřęş päymęʼnŧ.*",
"cancel-button": "Cäʼnčęľ", "cancel-button": "Cäʼnčęľ",
"input-invalid-email-text": "Ĩʼnväľįđ ęmäįľ", "input-invalid-email-text": "Ĩʼnväľįđ ęmäįľ",
@@ -1452,7 +1452,7 @@
"invite-field-desc": "Ĩʼnvįŧę pęőpľę þy ęmäįľ", "invite-field-desc": "Ĩʼnvįŧę pęőpľę þy ęmäįľ",
"invite-field-label": "Ĩʼnvįŧę", "invite-field-label": "Ĩʼnvįŧę",
"learn-more-button": "Ŀęäřʼn mőřę", "learn-more-button": "Ŀęäřʼn mőřę",
"recipient-email-placeholder": "Ŧypę įʼn ŧĥę řęčįpįęʼnŧ ęmäįľ äđđřęşş äʼnđ přęşş Ēʼnŧęř", "recipient-email-placeholder": "Ēmäįľ",
"recipient-invalid-email-text": "Ĩʼnväľįđ ęmäįľ", "recipient-invalid-email-text": "Ĩʼnväľįđ ęmäįľ",
"recipient-invitation-button": "Ĩʼnvįŧę", "recipient-invitation-button": "Ĩʼnvįŧę",
"recipient-invitation-description": "Ĩʼnvįŧę şőmęőʼnę þy ęmäįľ", "recipient-invitation-description": "Ĩʼnvįŧę şőmęőʼnę þy ęmäįľ",
@@ -1512,16 +1512,15 @@
"success-delete-old": "Pūþľįč đäşĥþőäřđ đęľęŧęđ!" "success-delete-old": "Pūþľįč đäşĥþőäřđ đęľęŧęđ!"
}, },
"share-configuration": { "share-configuration": {
"access-label": "čäʼn äččęşş",
"share-type-label": "Ŀįʼnĸ äččęşş" "share-type-label": "Ŀįʼnĸ äččęşş"
}, },
"share-externally": { "share-externally": {
"copy-link-button": "Cőpy ęχŧęřʼnäľ ľįʼnĸ", "copy-link-button": "Cőpy ęχŧęřʼnäľ ľįʼnĸ",
"email-share-type-option-description": "Øʼnľy pęőpľę ŵįŧĥ äččęşş čäʼn őpęʼn ŵįŧĥ ŧĥę ľįʼnĸ", "email-share-type-option-description": "Øʼnľy pęőpľę ŵįŧĥ ŧĥę ľįʼnĸ čäʼn äččęşş đäşĥþőäřđ",
"email-share-type-option-label": "Øʼnľy şpęčįƒįč pęőpľę", "email-share-type-option-label": "Øʼnľy şpęčįƒįč pęőpľę",
"pause-access-button": "Päūşę äččęşş", "pause-access-button": "Päūşę äččęşş",
"pause-access-tooltip": "Päūşįʼnģ ŵįľľ ŧęmpőřäřįľy đįşäþľę äččęşş ŧő ŧĥįş đäşĥþőäřđ ƒőř äľľ ūşęřş", "pause-access-tooltip": "Päūşįʼnģ ŵįľľ ŧęmpőřäřįľy đįşäþľę äččęşş ŧő ŧĥįş đäşĥþőäřđ ƒőř äľľ ūşęřş",
"public-share-type-option-description": "Åʼnyőʼnę ŵįŧĥ ŧĥę ľįʼnĸ čäʼn äččęşş", "public-share-type-option-description": "Åʼnyőʼnę ŵįŧĥ ŧĥę ľįʼnĸ čäʼn äččęşş đäşĥþőäřđ",
"public-share-type-option-label": "Åʼnyőʼnę ŵįŧĥ ŧĥę ľįʼnĸ", "public-share-type-option-label": "Åʼnyőʼnę ŵįŧĥ ŧĥę ľįʼnĸ",
"resume-access-button": "Ŗęşūmę äččęşş", "resume-access-button": "Ŗęşūmę äččęşş",
"revoke-access-button": "Ŗęvőĸę äččęşş", "revoke-access-button": "Ŗęvőĸę äččęşş",