From 9421ae25be5824bc724307c51018ed790e87ea91 Mon Sep 17 00:00:00 2001 From: Maxim Mordasov Date: Mon, 30 Jan 2023 13:34:35 +0300 Subject: [PATCH] Add Server URL below QR code for OSS for debugging purposes (#1209) # What this PR does ## Which issue(s) this PR fixes ## Checklist - [ ] Tests updated - [ ] Documentation added - [x] `CHANGELOG.md` updated --------- Co-authored-by: Joey Orlando Co-authored-by: Joey Orlando Co-authored-by: teodosii --- CHANGELOG.md | 1 + grafana-plugin/package.json | 1 + .../MobileAppConnection.tsx | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72b86e13..86f5fde1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Add Server URL below QR code for OSS for debugging purposes - Add Slack slash command allowing to trigger a direct page via a manually created alert group - Remove resolved and acknowledged filters as we switched to status ([#1201](https://github.com/grafana/oncall/pull/1201)) - Add sync with grafana on /users and /teams api calls from terraform plugin diff --git a/grafana-plugin/package.json b/grafana-plugin/package.json index 63b9c244..da6da4de 100644 --- a/grafana-plugin/package.json +++ b/grafana-plugin/package.json @@ -10,6 +10,7 @@ "build": "grafana-toolkit plugin:build", "build:dev": "grafana-toolkit plugin:build --skipTest --skipLint", "test": "jest --verbose", + "test:silent": "jest --silent", "dev": "grafana-toolkit plugin:dev", "watch": "grafana-toolkit plugin:dev --watch", "sign": "grafana-toolkit plugin:sign", diff --git a/grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.tsx b/grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.tsx index 39de4a98..a7335139 100644 --- a/grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.tsx +++ b/grafana-plugin/src/containers/MobileAppConnection/MobileAppConnection.tsx @@ -12,6 +12,7 @@ import { User } from 'models/user/user.types'; import { AppFeature } from 'state/features'; import { useStore } from 'state/useStore'; import { isUserActionAllowed, UserActions } from 'utils/authorization'; +import { GRAFANA_LICENSE_OSS } from 'utils/consts'; import styles from './MobileAppConnection.module.scss'; import DisconnectButton from './parts/DisconnectButton/DisconnectButton'; @@ -153,6 +154,8 @@ const MobileAppConnection = observer(({ userPk }: Props) => { ); } else if (QRCodeValue) { + const QRCodeDataParsed = getParsedQRCodeValue(); + content = ( @@ -163,6 +166,15 @@ const MobileAppConnection = observer(({ userPk }: Props) => { {isQRBlurry && } + {store.backendLicense === GRAFANA_LICENSE_OSS && QRCodeDataParsed && ( + + Server URL embedded in this QR: +
+ + {QRCodeDataParsed.oncall_api_url} + +
+ )}
); } @@ -178,6 +190,14 @@ const MobileAppConnection = observer(({ userPk }: Props) => { ); + function getParsedQRCodeValue() { + try { + return JSON.parse(QRCodeValue); + } catch (ex) { + return undefined; + } + } + function clearTimeouts(): void { clearTimeout(userTimeoutId); clearTimeout(refreshTimeoutId);