Skip to content

Commit

Permalink
feat: added cloud workspace id to workspace statistics (#32298)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva committed May 2, 2024
1 parent 972b5b8 commit 70ab2a7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changeset/wild-teachers-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@rocket.chat/meteor": minor
"@rocket.chat/core-typings": minor
"@rocket.chat/i18n": minor
---

Added "Rocket.Chat Cloud Workspace ID" to workspace statistics page
5 changes: 4 additions & 1 deletion apps/meteor/app/api/server/lib/getServerInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ 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');

export async function getServerInfo(userId?: string): Promise<IWorkspaceInfo> {
const hasPermissionToViewStatistics = userId && (await hasPermissionAsync(userId, 'view-statistics'));
const supportedVersionsToken = await wrapPromise(getCachedSupportedVersionsToken());
const cloudWorkspaceId = settings.get<string | undefined>('Cloud_Workspace_Id');

return {
version: removePatchInfo(Info.version),

...(hasPermissionToViewStatistics && {
info: {
...Info,
Expand All @@ -28,5 +29,7 @@ export async function getServerInfo(userId?: string): Promise<IWorkspaceInfo> {
supportedVersionsToken.result && {
supportedVersions: { signed: supportedVersionsToken.result },
}),

cloudWorkspaceId,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -33,6 +33,8 @@ const DeploymentCard = ({ serverInfo: { info }, statistics, instances }: Deploym
<WorkspaceCardSection title={t('Version')} body={statistics.version} />
<WorkspaceCardSection title={t('Deployment_ID')} body={statistics.uniqueId} />

{cloudWorkspaceId && <WorkspaceCardSection title={t('Cloud_Workspace_Id')} body={cloudWorkspaceId} />}

{appsEngineVersion && <WorkspaceCardSection title={t('Apps_Engine_Version')} body={appsEngineVersion} />}
<WorkspaceCardSection title={t('Node_version')} body={statistics.process.nodeVersion} />
<WorkspaceCardSection
Expand Down
1 change: 1 addition & 0 deletions packages/core-typings/src/IWorkspaceInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export type IWorkspaceInfo = {
supportedVersions?: { signed: string };
minimumClientVersions: { desktop: string; mobile: string };
version: string;
cloudWorkspaceId?: string;
};
1 change: 1 addition & 0 deletions packages/i18n/src/locales/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +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",
"Collaborative": "Collaborative",
"Collapse": "Collapse",
"Collapse_Embedded_Media_By_Default": "Collapse Embedded Media by Default",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/src/locales/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5016,4 +5016,4 @@
"Enterprise": "Enterprise",
"UpgradeToGetMore_engagement-dashboard_Title": "Analytics",
"UpgradeToGetMore_auditing_Title": "Auditoria de mensagem"
}
}

0 comments on commit 70ab2a7

Please sign in to comment.