From ae2df5ca1fd6808c8e894fa59ce1cf7c92f09ac0 Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Tue, 23 Apr 2024 10:12:42 -0300 Subject: [PATCH 1/6] feat: added cloud workspace id to workspace statistics --- apps/meteor/app/statistics/server/lib/statistics.ts | 2 ++ .../views/admin/workspace/DeploymentCard/DeploymentCard.tsx | 2 ++ packages/core-typings/src/IStats.ts | 1 + packages/i18n/src/locales/en.i18n.json | 1 + packages/i18n/src/locales/pt-BR.i18n.json | 1 + 5 files changed, 7 insertions(+) diff --git a/apps/meteor/app/statistics/server/lib/statistics.ts b/apps/meteor/app/statistics/server/lib/statistics.ts index a6fcc5b17b5b..cb51e0cb5a2c 100644 --- a/apps/meteor/app/statistics/server/lib/statistics.ts +++ b/apps/meteor/app/statistics/server/lib/statistics.ts @@ -98,6 +98,8 @@ export const statistics = { statistics.installedAt = uniqueID.createdAt.toISOString(); } + statistics.cloudWorkspaceId = settings.get('Cloud_Workspace_Id'); + statistics.deploymentFingerprintHash = settings.get('Deployment_FingerPrint_Hash'); statistics.deploymentFingerprintVerified = settings.get('Deployment_FingerPrint_Verified'); diff --git a/apps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsx b/apps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsx index 0b48d0c8cc88..60001d80a5f5 100644 --- a/apps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsx +++ b/apps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsx @@ -33,6 +33,8 @@ const DeploymentCard = ({ serverInfo: { info }, statistics, instances }: Deploym + {statistics.cloudWorkspaceId && } + {appsEngineVersion && } Date: Tue, 23 Apr 2024 13:16:41 -0300 Subject: [PATCH 2/6] chore: changeset --- .changeset/wild-teachers-design.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/wild-teachers-design.md diff --git a/.changeset/wild-teachers-design.md b/.changeset/wild-teachers-design.md new file mode 100644 index 000000000000..267340c1a64d --- /dev/null +++ b/.changeset/wild-teachers-design.md @@ -0,0 +1,7 @@ +--- +"@rocket.chat/meteor": minor +"@rocket.chat/core-typings": minor +"@rocket.chat/i18n": minor +--- + +**Added "Cloud Workspace ID" to workspace statistics page** From 89dc7d37b7bca9b345acde02a036852d97f3e398 Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Thu, 25 Apr 2024 10:57:41 -0300 Subject: [PATCH 3/6] chore: adjusted i18n expressions --- packages/i18n/src/locales/en.i18n.json | 2 +- packages/i18n/src/locales/pt-BR.i18n.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index b2ce05dc895f..717b4a5e6aac 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -1100,7 +1100,7 @@ "Cloud_workspace_connected_without_account": "Your workspace is now connected to the Rocket.Chat Cloud. If you would like, you can login to the Rocket.Chat Cloud and associate your workspace with your Cloud account.", "Cloud_workspace_disconnect": "If you no longer wish to utilize cloud services you can disconnect your workspace from Rocket.Chat Cloud.", "Cloud_workspace_support": "If you have trouble with a cloud service, please try to sync first. Should the issue persist, please open a support ticket in the Cloud Console.", - "Cloud_Workspace_Id": "Cloud Workspace ID", + "Cloud_Workspace_Id": "Rocket.Chat Cloud Workspace ID", "Collaborative": "Collaborative", "Collapse": "Collapse", "Collapse_Embedded_Media_By_Default": "Collapse Embedded Media by Default", diff --git a/packages/i18n/src/locales/pt-BR.i18n.json b/packages/i18n/src/locales/pt-BR.i18n.json index 0e222e59a071..a679437579f6 100644 --- a/packages/i18n/src/locales/pt-BR.i18n.json +++ b/packages/i18n/src/locales/pt-BR.i18n.json @@ -939,7 +939,7 @@ "Cloud_workspace_connected_without_account": "Seu espaço de trabalho está agora conectado ao Rocket.Chat Cloud. Se desejar, você poderá fazer login na Rocket.Chat Cloud e associar seu espaço de trabalho à sua conta na nuvem.", "Cloud_workspace_disconnect": "Se você não deseja mais utilizar os serviços da nuvem, você poderá desconectar seu espaço de trabalho da Rocket.Chat Cloud.", "Cloud_workspace_support": "Se você tiver um problema com um serviço de nuvem, tente sincronizar primeiro. Se o problema persistir, abra um ticket de suporte no console da nuvem.", - "Cloud_Workspace_Id": "ID do espaço de trabalho na nuvem", + "Cloud_Workspace_Id": "ID do Espaço de Trabalho na Rocket.Chat Cloud", "Collaborative": "Colaborativo", "Collapse": "Retrair", "Collapse_Embedded_Media_By_Default": "Retrair mídia incorporada por padrão", @@ -5017,4 +5017,4 @@ "Enterprise": "Enterprise", "UpgradeToGetMore_engagement-dashboard_Title": "Analytics", "UpgradeToGetMore_auditing_Title": "Auditoria de mensagem" -} \ No newline at end of file +} From aa81da488db7853311b2f8237eaef1dc2b405861 Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Thu, 25 Apr 2024 10:57:51 -0300 Subject: [PATCH 4/6] chore: changeset --- .changeset/wild-teachers-design.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/wild-teachers-design.md b/.changeset/wild-teachers-design.md index 267340c1a64d..f49f4549e762 100644 --- a/.changeset/wild-teachers-design.md +++ b/.changeset/wild-teachers-design.md @@ -4,4 +4,4 @@ "@rocket.chat/i18n": minor --- -**Added "Cloud Workspace ID" to workspace statistics page** +Added "Rocket.Chat Cloud Workspace ID" to workspace statistics page From c6c958a364d9bc41146d497e4af023c89280a6ce Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Thu, 25 Apr 2024 11:13:44 -0300 Subject: [PATCH 5/6] refactor: moved cloud workspace id from statistics to server info --- apps/meteor/app/api/server/lib/getServerInfo.ts | 5 ++++- apps/meteor/app/statistics/server/lib/statistics.ts | 2 -- .../views/admin/workspace/DeploymentCard/DeploymentCard.tsx | 4 ++-- packages/core-typings/src/IStats.ts | 1 - packages/core-typings/src/IWorkspaceInfo.ts | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/meteor/app/api/server/lib/getServerInfo.ts b/apps/meteor/app/api/server/lib/getServerInfo.ts index 9a0e7e4e11c9..020988b0aca4 100644 --- a/apps/meteor/app/api/server/lib/getServerInfo.ts +++ b/apps/meteor/app/api/server/lib/getServerInfo.ts @@ -5,6 +5,7 @@ import { getCachedSupportedVersionsToken, wrapPromise, } from '../../../cloud/server/functions/supportedVersionsToken/supportedVersionsToken'; +import { settings } from '../../../settings/server'; import { Info, minimumClientVersions } from '../../../utils/rocketchat.info'; const removePatchInfo = (version: string): string => version.replace(/(\d+\.\d+).*/, '$1'); @@ -12,10 +13,10 @@ const removePatchInfo = (version: string): string => version.replace(/(\d+\.\d+) export async function getServerInfo(userId?: string): Promise { const hasPermissionToViewStatistics = userId && (await hasPermissionAsync(userId, 'view-statistics')); const supportedVersionsToken = await wrapPromise(getCachedSupportedVersionsToken()); + const cloudWorkspaceId = settings.get('Cloud_Workspace_Id'); return { version: removePatchInfo(Info.version), - ...(hasPermissionToViewStatistics && { info: { ...Info, @@ -28,5 +29,7 @@ export async function getServerInfo(userId?: string): Promise { supportedVersionsToken.result && { supportedVersions: { signed: supportedVersionsToken.result }, }), + + cloudWorkspaceId, }; } diff --git a/apps/meteor/app/statistics/server/lib/statistics.ts b/apps/meteor/app/statistics/server/lib/statistics.ts index cb51e0cb5a2c..a6fcc5b17b5b 100644 --- a/apps/meteor/app/statistics/server/lib/statistics.ts +++ b/apps/meteor/app/statistics/server/lib/statistics.ts @@ -98,8 +98,6 @@ export const statistics = { statistics.installedAt = uniqueID.createdAt.toISOString(); } - statistics.cloudWorkspaceId = settings.get('Cloud_Workspace_Id'); - statistics.deploymentFingerprintHash = settings.get('Deployment_FingerPrint_Hash'); statistics.deploymentFingerprintVerified = settings.get('Deployment_FingerPrint_Verified'); diff --git a/apps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsx b/apps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsx index 60001d80a5f5..a300a792f45c 100644 --- a/apps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsx +++ b/apps/meteor/client/views/admin/workspace/DeploymentCard/DeploymentCard.tsx @@ -16,7 +16,7 @@ type DeploymentCardProps = { statistics: IStats; }; -const DeploymentCard = ({ serverInfo: { info }, statistics, instances }: DeploymentCardProps): ReactElement => { +const DeploymentCard = ({ serverInfo: { info, cloudWorkspaceId }, statistics, instances }: DeploymentCardProps): ReactElement => { const t = useTranslation(); const formatDateAndTime = useFormatDateAndTime(); const setModal = useSetModal(); @@ -33,7 +33,7 @@ const DeploymentCard = ({ serverInfo: { info }, statistics, instances }: Deploym - {statistics.cloudWorkspaceId && } + {cloudWorkspaceId && } {appsEngineVersion && } diff --git a/packages/core-typings/src/IStats.ts b/packages/core-typings/src/IStats.ts index a8178478de13..826396bbb9c7 100644 --- a/packages/core-typings/src/IStats.ts +++ b/packages/core-typings/src/IStats.ts @@ -18,7 +18,6 @@ export interface IStats { registerServer?: boolean; }; uniqueId: string; - cloudWorkspaceId: string; deploymentFingerprintHash: string; deploymentFingerprintVerified: boolean; installedAt?: string; diff --git a/packages/core-typings/src/IWorkspaceInfo.ts b/packages/core-typings/src/IWorkspaceInfo.ts index eede7d1011ff..1282c8bb9277 100644 --- a/packages/core-typings/src/IWorkspaceInfo.ts +++ b/packages/core-typings/src/IWorkspaceInfo.ts @@ -5,4 +5,5 @@ export type IWorkspaceInfo = { supportedVersions?: { signed: string }; minimumClientVersions: { desktop: string; mobile: string }; version: string; + cloudWorkspaceId?: string; }; From 424f614d569e6c76c7e65eead6415572a6d38a7e Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Fri, 26 Apr 2024 11:29:08 -0300 Subject: [PATCH 6/6] chore: adjusted i18n expressions --- packages/i18n/src/locales/en.i18n.json | 2 +- packages/i18n/src/locales/pt-BR.i18n.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index 717b4a5e6aac..b2ce05dc895f 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -1100,7 +1100,7 @@ "Cloud_workspace_connected_without_account": "Your workspace is now connected to the Rocket.Chat Cloud. If you would like, you can login to the Rocket.Chat Cloud and associate your workspace with your Cloud account.", "Cloud_workspace_disconnect": "If you no longer wish to utilize cloud services you can disconnect your workspace from Rocket.Chat Cloud.", "Cloud_workspace_support": "If you have trouble with a cloud service, please try to sync first. Should the issue persist, please open a support ticket in the Cloud Console.", - "Cloud_Workspace_Id": "Rocket.Chat Cloud Workspace ID", + "Cloud_Workspace_Id": "Cloud Workspace ID", "Collaborative": "Collaborative", "Collapse": "Collapse", "Collapse_Embedded_Media_By_Default": "Collapse Embedded Media by Default", diff --git a/packages/i18n/src/locales/pt-BR.i18n.json b/packages/i18n/src/locales/pt-BR.i18n.json index a679437579f6..cbe9906ed8aa 100644 --- a/packages/i18n/src/locales/pt-BR.i18n.json +++ b/packages/i18n/src/locales/pt-BR.i18n.json @@ -939,7 +939,6 @@ "Cloud_workspace_connected_without_account": "Seu espaço de trabalho está agora conectado ao Rocket.Chat Cloud. Se desejar, você poderá fazer login na Rocket.Chat Cloud e associar seu espaço de trabalho à sua conta na nuvem.", "Cloud_workspace_disconnect": "Se você não deseja mais utilizar os serviços da nuvem, você poderá desconectar seu espaço de trabalho da Rocket.Chat Cloud.", "Cloud_workspace_support": "Se você tiver um problema com um serviço de nuvem, tente sincronizar primeiro. Se o problema persistir, abra um ticket de suporte no console da nuvem.", - "Cloud_Workspace_Id": "ID do Espaço de Trabalho na Rocket.Chat Cloud", "Collaborative": "Colaborativo", "Collapse": "Retrair", "Collapse_Embedded_Media_By_Default": "Retrair mídia incorporada por padrão",