Skip to content

Commit

Permalink
Add Server URL below QR code for OSS for debugging purposes (grafana#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
Co-authored-by: Joey Orlando <[email protected]>
Co-authored-by: teodosii <[email protected]>
  • Loading branch information
4 people authored Jan 30, 2023
1 parent 63e91f8 commit 9421ae2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions grafana-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -153,6 +154,8 @@ const MobileAppConnection = observer(({ userPk }: Props) => {
</VerticalGroup>
);
} else if (QRCodeValue) {
const QRCodeDataParsed = getParsedQRCodeValue();

content = (
<VerticalGroup spacing="lg">
<Text type="primary" strong>
Expand All @@ -163,6 +166,15 @@ const MobileAppConnection = observer(({ userPk }: Props) => {
<QRCode className={cx({ 'qr-code': true, blurry: isQRBlurry })} value={QRCodeValue} />
{isQRBlurry && <QRLoading />}
</div>
{store.backendLicense === GRAFANA_LICENSE_OSS && QRCodeDataParsed && (
<Text type="secondary">
Server URL embedded in this QR:
<br />
<a href={QRCodeDataParsed.oncall_api_url}>
<Text type="link">{QRCodeDataParsed.oncall_api_url}</Text>
</a>
</Text>
)}
</VerticalGroup>
);
}
Expand All @@ -178,6 +190,14 @@ const MobileAppConnection = observer(({ userPk }: Props) => {
</div>
);

function getParsedQRCodeValue() {
try {
return JSON.parse(QRCodeValue);
} catch (ex) {
return undefined;
}
}

function clearTimeouts(): void {
clearTimeout(userTimeoutId);
clearTimeout(refreshTimeoutId);
Expand Down

0 comments on commit 9421ae2

Please sign in to comment.