Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/dashboard/Dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ body:global(.sidebarCollapsed) {
}
}

// Floating so it doesn't shift page layout; stays below modals/popovers (z-index 1001).
.masterKeyRotatedAlert {
position: fixed;
right: 24px;
bottom: 24px;
max-width: 420px;
z-index: 999;

> div {
margin-bottom: 0;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

@media (max-width: 600px) {
left: 16px;
right: 16px;
bottom: 16px;
max-width: none;
}
}


.loadingError {
font-size: 58px;
Expand Down
23 changes: 23 additions & 0 deletions src/dashboard/DashboardView.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { canAccess } from 'lib/serverInfo';
import { openConnect } from 'dashboard/Data/AppOverview/connectEvents';
import PlanUsageBadge from 'components/Sidebar/PlanUsageBadge.react';
import { PlugIcon } from 'dashboard/Data/AppOverview/connectIcons.react';
import B4AAlert from 'components/B4AAlert/B4AAlert.react';
import { Link } from 'react-router-dom';

// Alert parameters
const MySwal = withReactContent(Swal);
Expand Down Expand Up @@ -488,10 +490,31 @@ export default class DashboardView extends React.Component {
// );
// }

let masterKeyRotatedAlert = null;
if (this.context.showMasterKeyRotatedAlert) {
masterKeyRotatedAlert = (
<div className={styles.masterKeyRotatedAlert}>
<B4AAlert
title="Your Master Key was rotated"
description={
<>
As a security precaution, we rotated this app&apos;s Master Key. The new key is already available in{' '}
<Link to={`/apps/${appSlug}/settings/keys`}>App Settings &gt; Security &amp; Keys</Link>.
</>
}
handlerCloseEvent={() => {
this.context.dismissMasterKeyRotatedAlert().catch(() => {});
}}
/>
</div>
);
}

return (
<div className={styles.dashboard}>
{content}
{sidebar}
{masterKeyRotatedAlert}
</div>
);
}
Expand Down
10 changes: 10 additions & 0 deletions src/lib/ParseApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default class ParseApp {
databaseType,
databaseVersion,
isMongoUpgradeAvailable,
showMasterKeyRotatedAlert,
region
}) {
this.name = appName;
Expand Down Expand Up @@ -104,6 +105,7 @@ export default class ParseApp {
this.region = region;
this.databaseVersion = databaseVersion;
this.isMongoUpgradeAvailable = isMongoUpgradeAvailable;
this.showMasterKeyRotatedAlert = showMasterKeyRotatedAlert === true;
if (!supportedPushLocales) {
console.warn('Missing push locales for \'' + appName + '\', see this link for details on setting localizations up. https://github.com/parse-community/parse-dashboard#configuring-localized-push-notifications');
}
Expand Down Expand Up @@ -436,6 +438,14 @@ export default class ParseApp {
return AJAX.post(path);
}

// Cleared in memory first so the alert doesn't come back when DashboardView remounts on route change.
dismissMasterKeyRotatedAlert() {
this.showMasterKeyRotatedAlert = false;
// eslint-disable-next-line no-undef
const path = `${b4aSettings.BACK4APP_API_PATH}/parse-app/${this.slug}/master-key-rotated-alert/dismiss`;
return AJAX.post(path);
}

transferApp(newOwner) {
const path = `/parse-app/${this.slug}/transfer`;
return AJAX.post(path, { newOwner });
Expand Down
Loading