Skip to content

Commit 1a3e837

Browse files
committed
console,account: Remove and rewrite all message duplicates
1 parent cc189e5 commit 1a3e837

File tree

65 files changed

+587
-935
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+587
-935
lines changed

pkg/webui/account/components/oauth-client-form/messages.js

-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export default defineMessages({
2121
clientDescDescription:
2222
'The description is displayed to the user when authorizing the client. Use it to explain the purpose of your client.',
2323
createClient: 'Create OAuth client',
24-
deleteTitle: 'Are you sure you want to delete this account?',
2524
deleteWarning:
2625
'This will <strong>PERMANENTLY DELETE THIS OAUTH CLIENT</strong> and <strong>LOCK THE OAUTH ID</strong>. Make sure you assign new collaborators to such entities if you plan to continue using them.',
2726
purgeWarning:
@@ -41,9 +40,7 @@ export default defineMessages({
4140
'If set, the authorization page will visually indicate endorsement to improve trust',
4241
grants: 'Grant types',
4342
grantsDesc: 'OAuth flows that can be used for the client to get a token',
44-
grantAuthorizationLabel: 'Authorization code',
4543
grantRefreshTokenLabel: 'Refresh token',
46-
grantPasswordLabel: 'Password',
4744
deleteClient: 'Delete OAuth client',
4845
urlsPlaceholder: 'https://example.com/oauth/callback',
4946
rightsWarning:

pkg/webui/account/containers/authorizations-table/index.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import React from 'react'
1616
import { useSelector } from 'react-redux'
17-
import { defineMessages } from 'react-intl'
1817
import { createSelector } from 'reselect'
1918

2019
import FetchTable from '@ttn-lw/containers/fetch-table'
@@ -32,11 +31,6 @@ import {
3231
} from '@account/store/selectors/authorizations'
3332
import { selectUserId } from '@account/store/selectors/user'
3433

35-
const m = defineMessages({
36-
clientId: 'Client ID',
37-
tableTitle: 'OAuth client authorizations',
38-
})
39-
4034
const getItemPathPrefix = item => `${item.client_ids.client_id}`
4135

4236
const OAuthClientAuthorizationsTable = () => {
@@ -46,7 +40,7 @@ const OAuthClientAuthorizationsTable = () => {
4640
const baseHeaders = [
4741
{
4842
name: 'client_ids.client_id',
49-
displayName: m.clientId,
43+
displayName: sharedMessages.clientId,
5044
width: 20,
5145
},
5246
{
@@ -84,7 +78,7 @@ const OAuthClientAuthorizationsTable = () => {
8478
getItemsAction={getItems}
8579
baseDataSelector={baseDataSelector}
8680
getItemPathPrefix={getItemPathPrefix}
87-
tableTitle={<Message content={m.tableTitle} />}
81+
tableTitle={<Message content={sharedMessages.oauthClientAuthorizations} />}
8882
clickable
8983
/>
9084
)

pkg/webui/account/containers/clients-table/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const m = defineMessages({
4444
restoreFail: 'There was an error and OAuth client could not be restored',
4545
purgeSuccess: 'OAuth client purged',
4646
purgeFail: 'There was an error and the OAuth client could not be purged',
47-
addClient: 'Add OAuth client',
4847
})
4948

5049
const OWNED_TAB = 'owned'
@@ -200,7 +199,7 @@ const ClientsTable = () => {
200199
<FetchTable
201200
entity="clients"
202201
defaultOrder="-created_at"
203-
addMessage={m.addClient}
202+
addMessage={sharedMessages.addOAuthClient}
204203
headers={headers}
205204
getItemsAction={getItems}
206205
baseDataSelector={baseDataSelector}

pkg/webui/account/containers/collaborators-table/index.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,9 @@ import style from './client-collaborators.styl'
4646
const RIGHT_TAG_MAX_WIDTH = 140
4747

4848
const m = defineMessages({
49-
id: 'User / Organization ID',
50-
addCollaborator: 'Add collaborator',
5149
deleteCollaboratorError: 'There was an error and the collaborator could not be deleted',
5250
deleteOnlyCollaboratorError:
5351
'This collaborator could not be deleted because every client needs at least one collaborator with all rights',
54-
removeButtonMessage: 'Remove',
5552
})
5653

5754
const CollaboratorsTable = props => {
@@ -87,7 +84,7 @@ const CollaboratorsTable = props => {
8784
const baseHeaders = [
8885
{
8986
name: 'ids',
90-
displayName: m.id,
87+
displayName: sharedMessages.userOrgId,
9188
render: ids => {
9289
const isUser = 'user_ids' in ids
9390
const collaboratorId = getCollaboratorId({ ids })
@@ -144,7 +141,7 @@ const CollaboratorsTable = props => {
144141
<Button
145142
type="button"
146143
onClick={details.delete}
147-
message={m.removeButtonMessage}
144+
message={sharedMessages.remove}
148145
icon="delete"
149146
danger
150147
/>
@@ -188,7 +185,7 @@ const CollaboratorsTable = props => {
188185
headers={headers}
189186
rowKeySelector={rowKeySelector}
190187
getItemPathPrefix={getCollaboratorPathPrefix}
191-
addMessage={m.addCollaborator}
188+
addMessage={sharedMessages.addCollaborator}
192189
getItemsAction={getItems}
193190
baseDataSelector={baseDataSelector}
194191
tableTitle={<Message content={sharedMessages.collaborator} />}

pkg/webui/account/containers/profile-settings-form/messages.js

-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,12 @@ export default defineMessages({
2020
successMessage: 'Profile updated',
2121
deleteAccount: 'Delete account',
2222
useGravatar: 'Use Gravatar',
23-
uploadAnImage: 'Upload an image',
2423
gravatarInfo:
2524
"If available, we're using the <link>Gravatar</link> image associated with your email address. You can upload a different profile picture by selecting the option above.",
2625
gravatarInfoGravatarOnly:
2726
"If available, we're using the <link>Gravatar</link> image associated with your email address. Please follow the instructions on the Gravatar website to change your profile picture.",
2827
primaryEmailAddressDescription: 'Primary email address associated with your account',
2928
deleteAccountError: 'There was an error and your account could not be deleted',
30-
deleteAccountSuccess: 'Account deleted',
3129
imageRequired:
3230
'Please select a file to use as your profile picture or choose "Gravatar" as source',
3331
imageUpload: 'Image upload',

pkg/webui/account/containers/sessions-table/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import { selectUserSessions, selectUserSessionsTotalCount } from '@account/store
3636
const m = defineMessages({
3737
deleteSessionSuccess: 'Session removed successfully',
3838
deleteSessionError: 'There was an error and the session could not be deleted',
39-
sessionsTableTitle: 'Sessions',
4039
removeButtonMessage: 'Remove this session',
4140
noExpiryDate: 'No expiry date',
4241
endSession: 'Logout to end this session',
@@ -183,7 +182,7 @@ const UserSessionsTable = () => {
183182
headers={makeHeaders}
184183
getItemsAction={getSessions}
185184
baseDataSelector={baseDataSelector}
186-
tableTitle={<Message content={m.sessionsTableTitle} />}
185+
tableTitle={<Message content={sharedMessages.sessions} />}
187186
getItemPathPrefix={getItemPathPrefix}
188187
/>
189188
)

pkg/webui/account/containers/tokens-table/index.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,13 @@ import { selectTokens, selectTokensTotalCount } from '@account/store/selectors/a
4545
import { selectUserId } from '@account/store/selectors/user'
4646

4747
const m = defineMessages({
48-
tableTitle: 'Access tokens',
4948
deleteSuccess: 'Access token invalidated',
5049
deleteFail: 'There was an error and the access token could not be invalidated',
5150
deleteButton: 'Invalidate this access token',
5251
deleteAllSuccess: 'All access tokens invalidated',
5352
deleteAllFail: 'There was an error and the access tokens could not be invalidated',
5453
deleteAllButton: 'Invalidate all access tokens',
5554
expires: 'Expires',
56-
accessTokens: 'Access tokens',
5755
})
5856

5957
const TokensTable = () => {
@@ -67,7 +65,7 @@ const TokensTable = () => {
6765
'client-authorizations.single.access-tokens',
6866
<Breadcrumb
6967
path={`/client-authorizations/${clientId}/access-tokens`}
70-
content={m.accessTokens}
68+
content={sharedMessages.accessTokens}
7169
/>,
7270
)
7371

@@ -200,7 +198,7 @@ const TokensTable = () => {
200198
baseDataSelector={baseDataSelector}
201199
pageSize={PAGE_SIZES.SMALL}
202200
actionItems={deleteAllButton}
203-
tableTitle={<Message content={m.tableTitle} />}
201+
tableTitle={<Message content={sharedMessages.accessTokens} />}
204202
/>
205203
</Col>
206204
</Row>

pkg/webui/account/views/code/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ import { selectApplicationSiteTitle } from '@ttn-lw/lib/selectors/env'
2828
import style from './code.styl'
2929

3030
const m = defineMessages({
31-
code: 'Authorization code',
3231
codeDescription: 'Your authorization code is:',
33-
backToAccount: 'Back to {siteTitle}',
3432
})
3533

3634
const siteTitle = selectApplicationSiteTitle()

pkg/webui/account/views/front-not-found/index.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2020 The Things Network Foundation, The Things Industries B.V.
1+
// Copyright © 2023 The Things Network Foundation, The Things Industries B.V.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -13,7 +13,6 @@
1313
// limitations under the License.
1414

1515
import React from 'react'
16-
import { defineMessages } from 'react-intl'
1716

1817
import Button from '@ttn-lw/components/button'
1918

@@ -25,10 +24,7 @@ import style from '@account/views/front/front.styl'
2524
import { selectApplicationSiteName, selectApplicationSiteTitle } from '@ttn-lw/lib/selectors/env'
2625
import errorMessages from '@ttn-lw/lib/errors/error-messages'
2726
import statusCodeMessages from '@ttn-lw/lib/errors/status-code-messages'
28-
29-
const m = defineMessages({
30-
backToAccount: 'Back to {siteTitle}',
31-
})
27+
import sharedMessages from '@ttn-lw/lib/shared-messages'
3228

3329
const siteName = selectApplicationSiteName()
3430
const siteTitle = selectApplicationSiteTitle()
@@ -51,7 +47,7 @@ const FrontNotFound = () => (
5147
<Button.Link
5248
to="/login"
5349
icon="keyboard_arrow_left"
54-
message={{ ...m.backToAccount, values: { siteTitle } }}
50+
message={{ ...sharedMessages.backTo, values: { siteTitle } }}
5551
/>
5652
</div>
5753
</React.Fragment>

pkg/webui/account/views/login/index.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ const m = defineMessages({
4444
createAccount: 'Create an account',
4545
forgotPassword: 'Forgot password?',
4646
loginToContinue: 'Please login to continue',
47-
loginFailed: 'Login failed',
48-
accountDeleted: 'Account deleted',
4947
})
5048

5149
const appRoot = selectApplicationRootPath()
@@ -114,7 +112,7 @@ const Login = () => {
114112
} else if (!next || (next !== appRoot && !Boolean(error))) {
115113
info = m.loginToContinue
116114
} else if ('account-deleted' in Query.parse(location.search)) {
117-
info = m.accountDeleted
115+
info = sharedMessages.accountDeleted
118116
}
119117

120118
return (
@@ -130,7 +128,7 @@ const Login = () => {
130128
onSubmit={handleSubmit}
131129
initialValues={initialValues}
132130
error={error}
133-
errorTitle={m.loginFailed}
131+
errorTitle={sharedMessages.loginFailed}
134132
info={info}
135133
validationSchema={validationSchema}
136134
horizontal={false}

pkg/webui/account/views/oauth-client-add/index.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
import React from 'react'
1616
import { useSelector } from 'react-redux'
1717
import { Container, Col, Row } from 'react-grid-system'
18-
import { defineMessages } from 'react-intl'
1918

2019
import PageTitle from '@ttn-lw/components/page-title'
2120

2221
import RequireRequest from '@ttn-lw/lib/components/require-request'
2322

2423
import ClientAdd from '@account/containers/oauth-client-add'
2524

25+
import sharedMessages from '@ttn-lw/lib/shared-messages'
26+
2627
import { getUserRights } from '@account/store/actions/user'
2728

2829
import {
@@ -32,10 +33,6 @@ import {
3233
selectUserPseudoRights,
3334
} from '@account/store/selectors/user'
3435

35-
const m = defineMessages({
36-
addClient: 'Add OAuth client',
37-
})
38-
3936
const OAuthClientAddInner = () => {
4037
const userId = useSelector(selectUserId)
4138
const isAdmin = useSelector(selectUserIsAdmin)
@@ -44,7 +41,7 @@ const OAuthClientAddInner = () => {
4441

4542
return (
4643
<Container>
47-
<PageTitle tall title={m.addClient} />
44+
<PageTitle tall title={sharedMessages.addOAuthClient} />
4845
<Row>
4946
<Col lg={8} md={12}>
5047
<ClientAdd

pkg/webui/account/views/profile-settings/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const m = defineMessages({
3232
profileEdit: 'Edit profile',
3333
generalSettingsDescription:
3434
'Change basic info such as your name, profile picture or email address.',
35-
changePasswordTitle: 'Change password',
3635
changePasswordDescription: 'Set up a new password for your account.',
3736
})
3837

@@ -55,7 +54,10 @@ const ProfileSettings = () => {
5554
>
5655
<ProfileSettingsForm />
5756
</Collapse>
58-
<Collapse title={m.changePasswordTitle} description={m.changePasswordDescription}>
57+
<Collapse
58+
title={sharedMessages.changePassword}
59+
description={m.changePasswordDescription}
60+
>
5961
<ChangePasswordForm />
6062
</Collapse>
6163
</Overlay>

pkg/webui/account/views/token-login/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import sharedMessages from '@ttn-lw/lib/shared-messages'
3737

3838
const m = defineMessages({
3939
loginToken: 'Login Token',
40-
loginFailed: 'Login failed',
4140
})
4241

4342
const appRoot = selectApplicationRootPath()
@@ -97,7 +96,7 @@ const TokenLogin = () => {
9796
onSubmit={handleSubmit}
9897
initialValues={initialValues}
9998
error={error}
100-
errorTitle={m.loginFailed}
99+
errorTitle={sharedMessages.loginFailed}
101100
validationSchema={validationSchema}
102101
horizontal={false}
103102
>

pkg/webui/components/file-input/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const m = defineMessages({
3535
noFileSelected: 'No file selected',
3636
fileProvided: 'A file has been provided',
3737
tooBig: 'The selected file is too large',
38-
remove: 'Remove',
3938
})
4039

4140
const defaultDataTransform = content => content.replace(/^.*;base64,/, '')

pkg/webui/components/qr-modal-button/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const QrScanDoc = (
3434
)
3535

3636
const m = defineMessages({
37-
scanEndDevice: 'Scan end device QR code',
3837
scanEndDeviceContinue: 'Please scan the QR code to continue. {qrScanDoc}',
3938
invalidData:
4039
'Invalid QR code data. Please note that only TR005 LoRaWAN® Device Identification QR Code can be scanned. Some devices have unrelated QR codes printed on them that cannot be used.',
@@ -81,7 +80,7 @@ const QRModalButton = props => {
8180
onApprove={onApprove}
8281
message={message}
8382
modalData={{
84-
title: m.scanEndDevice,
83+
title: sharedMessages.scanEndDevice,
8584
children: modalData,
8685
buttonMessage: m.apply,
8786
approveButtonProps: {

pkg/webui/components/qr/require-permission.js

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import style from './qr.styl'
2828
const m = defineMessages({
2929
permissionDeniedError: 'Permission Denied: Please allow access to your camera or upload a photo',
3030
fetchingPermission: 'Please set camera permissions',
31-
uploadImage: 'Upload an image',
3231
})
3332

3433
const RequirePermission = props => {

pkg/webui/console/components/device-import-form/index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ const m = defineMessages({
5353
formatInfo: 'Format information',
5454
selectAFile: 'Please select a template file',
5555
fileInfoPlaceholder: 'Please select a template format',
56-
claiming: 'Claiming',
5756
setClaimAuthCode: 'Set claim authentication code',
5857
targetedComponents: 'Targeted components',
5958
advancedSectionTitle: 'Advanced end device claiming settings',
@@ -143,7 +142,7 @@ const DeviceBulkCreateFormInner = props => {
143142
<Form.CollapseSection id="advanced-settings" title={m.advancedSectionTitle}>
144143
<Form.Field
145144
disabled={!jsEnabled}
146-
title={m.claiming}
145+
title={sharedMessages.claiming}
147146
label={m.setClaimAuthCode}
148147
component={Checkbox}
149148
name="set_claim_auth_code"

pkg/webui/console/components/downlink-form/downlink-form.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const m = defineMessages({
3939
bytes: 'Bytes',
4040
replace: 'Replace downlink queue',
4141
push: 'Push to downlink queue (append)',
42-
confirmedDownlink: 'Confirmed downlink',
4342
scheduleDownlink: 'Schedule downlink',
4443
downlinkSuccess: 'Downlink scheduled',
4544
bytesPayloadDescription: 'The desired payload bytes of the downlink message',
@@ -183,7 +182,11 @@ const DownlinkForm = ({ appId, devId, device, downlinkQueue, skipPayloadCrypto }
183182
maxLines={14}
184183
/>
185184
)}
186-
<Form.Field label={m.confirmedDownlink} name="confirmed" component={Checkbox} />
185+
<Form.Field
186+
label={sharedMessages.confirmedDownlink}
187+
name="confirmed"
188+
component={Checkbox}
189+
/>
187190
<SubmitBar>
188191
<Form.Submit component={SubmitButton} message={m.scheduleDownlink} />
189192
</SubmitBar>

0 commit comments

Comments
 (0)