console: fixes for cloud console

Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com>
GitOrigin-RevId: 7e86572cb18e045520a922e57a22057a82af6f0f
This commit is contained in:
Sameer Kolhar 2021-02-24 14:56:14 +05:30 committed by hasura-bot
parent baae5441f2
commit 827a332464
2 changed files with 18 additions and 5 deletions

View File

@ -31,16 +31,23 @@ const App = ({
document.getElementById('content').className = className + ' show';
document.getElementById('loading').style.display = 'none';
}, []);
const telemetryShown = React.useRef(false);
// should be true only in the case of hasura cloud
const isContextCloud =
window.__env.userRole || window.location.host.includes('cloud');
React.useEffect(() => {
if (
telemetry.console_opts &&
!telemetry.console_opts.telemetryNotificationShown
!telemetry.console_opts.telemetryNotificationShown &&
!telemetryShown.current &&
!isContextCloud
) {
telemetryShown.current = true;
dispatch(showTelemetryNotification());
dispatch(telemetryNotificationShown());
}
}, [dispatch, telemetry]);
}, [dispatch, telemetry, isContextCloud]);
let connectionFailMsg = null;
if (connectionFailed) {

View File

@ -1,3 +1,4 @@
/* eslint-disable no-underscore-dangle */
import { AnyAction, Dispatch } from 'redux';
import { ThunkDispatch } from 'redux-thunk';
@ -109,9 +110,14 @@ const setOnboardingCompletedInDB = (
getState: GetReduxState
) => {
const successCb = () => {
dispatch(
showSuccessNotification('Success', 'Dismissed console onboarding')
);
// the success notification won't be shown on cloud
const isCloudContext =
window.__env.userRole || window.location.host.includes('cloud');
if (!isCloudContext) {
dispatch(
showSuccessNotification('Success', 'Dismissed console onboarding')
);
}
};
const errorCb = (error: Error) => {