Skip to content

Commit

Permalink
Removed notification popup if there are no Klamm warnings, Updated pa…
Browse files Browse the repository at this point in the history
…ge titles
  • Loading branch information
timwekkenbc committed Oct 2, 2024
1 parent ec8a93f commit 97f522e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
8 changes: 7 additions & 1 deletion app/components/SavePublish/SavePublishWarnings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ export default function SavePublishWarnings({ filePath, ruleContent, isSaving }:

useEffect(() => {
if (misconnectedFieldsPanelOpen) {
warnOfMisconnectedFields();
if (misconnectedFields.length > 0) {
warnOfMisconnectedFields();
} else {
// Remove notification if there are no warnings
notification.destroy("klamm-warning");
setMisconnectedFieldsPanelOpen(false);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [misconnectedFields, misconnectedFieldsPanelOpen]);
Expand Down
7 changes: 5 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import styles from "./styles/layout.module.css";
const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
title: "BRMS Simulation System MVP (SDPR)",
description: "System for simulating results for SDPR Business Rules",
title: {
template: "%s | Business Rules Management App (SDPR)",
default: "Business Rules Management App (SDPR)",
},
description: "System for creating and simulating results for SDPR Business Rules",
};

export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
Expand Down
8 changes: 7 additions & 1 deletion app/rule/[ruleId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Metadata } from "next";
import { getScenariosByFilename } from "@/app/utils/api";
import RuleHeader from "@/app/components/RuleHeader";
import RuleManager from "@/app/components/RuleManager";
Expand All @@ -7,6 +8,8 @@ import { RULE_VERSION } from "@/app/constants/ruleVersion";
import { GithubAuthProvider, GithubAuthContextType } from "@/app/components/GithubAuthProvider";
import useGithubAuth from "@/app/hooks/useGithubAuth";

export let metadata: Metadata;

export default async function Rule({
params: { ruleId },
searchParams,
Expand All @@ -17,9 +20,9 @@ export default async function Rule({
// Get version of rule to use
const { version } = searchParams;

const oAuthRequired = version === RULE_VERSION.draft; // only require oauth if editing a draft
// Ensure user is first logged into github so they can save what they edit
// If they are not, redirect them to the oauth flow
const oAuthRequired = version === RULE_VERSION.draft; // only require oauth if editing a draft
const githubAuthInfo = await useGithubAuth(`rule/${ruleId}?version=${version}`, oAuthRequired);

// Get rule details and json content for the rule id
Expand All @@ -29,6 +32,9 @@ export default async function Rule({
return <h1>Rule not found</h1>;
}

// Update page title with rule name
metadata = { title: ruleInfo.title };

// Get scenario information
const scenarios: Scenario[] = await getScenariosByFilename(ruleInfo.goRulesJSONFilename);

Expand Down
5 changes: 5 additions & 0 deletions app/rule/new/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Metadata } from "next";
import { GithubAuthProvider } from "@/app/components/GithubAuthProvider";
import useGithubAuth from "@/app/hooks/useGithubAuth";
import NewRule from "./NewRule";
Expand All @@ -13,3 +14,7 @@ export default async function NewRuleWrapper() {
</GithubAuthProvider>
);
}

export const metadata: Metadata = {
title: "New Rule",
};

0 comments on commit 97f522e

Please sign in to comment.