diff --git a/app/src/api/gram/validation.js b/app/src/api/gram/validation.js
index f12b7b9a..35cc8b10 100644
--- a/app/src/api/gram/validation.js
+++ b/app/src/api/gram/validation.js
@@ -4,8 +4,7 @@ const validationApi = api.injectEndpoints({
endpoints: (build) => ({
validate: build.query({
query: (modelId) => `/validate/${modelId}`,
- transformResponse: (response, meta, arg) => {
- console.log(response);
+ transformResponse: (response) => {
return response;
},
providesTags: ["Validation"],
diff --git a/app/src/components/elements/modal/ModalManager.js b/app/src/components/elements/modal/ModalManager.js
index 4e983452..4ffc7c9f 100644
--- a/app/src/components/elements/modal/ModalManager.js
+++ b/app/src/components/elements/modal/ModalManager.js
@@ -13,11 +13,11 @@ import { CancelReview } from "../../reviews/modals/CancelReview";
import { DeclineReview } from "../../reviews/modals/DeclineReview";
import { ExportActionItem } from "../../model/modals/ExportActionItem";
import { RevisitActionItems } from "../../model/modals/RevisitActionItems";
-import { ValidateBeforeReview } from "../../model/modals/ValidateBeforeReview";
+import { QualityCheck } from "../../model/modals/QualityCheck";
export const MODALS = {
ChangeReviewer,
- ValidateBeforeReview,
+ QualityCheck,
RequestReview,
EditNote,
RequestMeeting,
diff --git a/app/src/components/home/Home.js b/app/src/components/home/Home.js
index 9b157e3f..e710dd0c 100644
--- a/app/src/components/home/Home.js
+++ b/app/src/components/home/Home.js
@@ -49,6 +49,7 @@ export default function Home() {
Systems owned by the accountable teams you're in
-
+
{user?.teams &&
user.teams.map((team, i) => (
diff --git a/app/src/components/model/board/Board.js b/app/src/components/model/board/Board.js
index b6e9ec4b..00c5a15f 100644
--- a/app/src/components/model/board/Board.js
+++ b/app/src/components/model/board/Board.js
@@ -638,22 +638,21 @@ export default function Board() {
onKeyDown={(e) => onKeyDown(e)}
onKeyUp={(e) => onKeyUp(e)}
>
- {!isFramed && (
- {
- let pos = {
- x: stage.width / 2,
- y: stage.height / 2,
- };
- if (stageRef.current) {
- pos = getAbsolutePosition(stageRef.current, pos);
- }
- addComponent({ name, type, x: pos.x, y: pos.y });
- }}
- />
- )}
+ {
+ let pos = {
+ x: stage.width / 2,
+ y: stage.height / 2,
+ };
+ if (stageRef.current) {
+ pos = getAbsolutePosition(stageRef.current, pos);
+ }
+ addComponent({ name, type, x: pos.x, y: pos.y });
+ }}
+ />
+
{rightPanelCollapsed === true && }
{leftPanelCollapsed === true && }
diff --git a/app/src/components/model/board/components/ControlsToolBar.js b/app/src/components/model/board/components/ControlsToolBar.js
index e938a659..d0310223 100644
--- a/app/src/components/model/board/components/ControlsToolBar.js
+++ b/app/src/components/model/board/components/ControlsToolBar.js
@@ -45,6 +45,7 @@ export function ControlsToolBar({ zoomInCenter, onAddComponent }) {
>
{!isFramed && (
dispatch(changeCursorMode(mode))}
@@ -68,7 +69,10 @@ export function ControlsToolBar({ zoomInCenter, onAddComponent }) {
)}
-
+
zoomInCenter(-1)}>
diff --git a/app/src/components/model/modals/ValidateBeforeReview.js b/app/src/components/model/modals/QualityCheck.js
similarity index 77%
rename from app/src/components/model/modals/ValidateBeforeReview.js
rename to app/src/components/model/modals/QualityCheck.js
index dc72fafc..16634c14 100644
--- a/app/src/components/model/modals/ValidateBeforeReview.js
+++ b/app/src/components/model/modals/QualityCheck.js
@@ -21,7 +21,19 @@ import { useValidateQuery } from "../../../api/gram/validation";
import { modalActions } from "../../../redux/modalSlice";
import { MODALS } from "../../elements/modal/ModalManager";
-export function ValidateBeforeReview() {
+function createQualityMessage(successRatio) {
+ if (successRatio === 1.0) {
+ return "Good job, your threat model is ready to be reviewed.";
+ } else if (successRatio >= 0.75) {
+ return "Your threat model is good and can be sent for review. You can make it even better by fixing the following failed checks:";
+ } else if (successRatio >= 0.5) {
+ return "Your threat model might not be understood by a reviewer external to your team/domain. You can make it better by fixing the following failed checks:";
+ } else {
+ return "Your threat model is lacking information necessary for the reviewer to understand and approve it. Please go back to the model and fix the following failed checks:";
+ }
+}
+
+export function QualityCheck() {
const dispatch = useDispatch();
const modelId = useModelID();
const { data: validation } = useValidateQuery(modelId);
@@ -31,20 +43,9 @@ export function ValidateBeforeReview() {
const failedResults = validationResults.filter(
(result) => !result.testResult
);
- const successRatio = (
- passedResults.length / validationResults.length
- ).toFixed(2);
- function createQualityMessage(successRatio) {
- if (successRatio === 1) {
- return "Good job, your threat model is ready to be reviewed. Please click on REQUEST REVIEW";
- } else if (successRatio >= 0.75) {
- return "Your threat model is very good, and can be improved by fixing the following failed checks:";
- } else if (successRatio >= 0.5) {
- return "Your threat model is good, and can be better understood by the review by fixing the following failed checks:";
- } else {
- return "Your threat model is lacking information necessary for the reviewer to understand and approve it. Please go back to the model and fix the following failed checks:";
- }
- }
+ const successRatio = Number(
+ (passedResults.length / validationResults.length).toFixed(2)
+ );
return (
);
diff --git a/app/src/components/model/panels/bottom/BottomPanel.js b/app/src/components/model/panels/bottom/BottomPanel.js
index ee6c98d7..3ebf6a58 100644
--- a/app/src/components/model/panels/bottom/BottomPanel.js
+++ b/app/src/components/model/panels/bottom/BottomPanel.js
@@ -68,7 +68,7 @@ export function BottomPanel() {
return <>>;
}
return (
-
+
{!isLoading && (
<>
-
- setTab(v)}
- textColor="inherit"
- variant="fullWidth"
- sx={{
- "& .MuiTabs-indicator": {
- backgroundColor: (theme) => theme.palette.common.gramPink,
- },
- }}
- >
-
-
- ALL
-
-
- }
- value={TAB.ALL}
- />
-
-
- MODEL
-
-
- }
- value={TAB.MODEL}
- />
- {selected && (
+
+
+
+ QUALITY CHECK
+
+
+
+
+ setTab(v)}
+ textColor="inherit"
+ variant="fullWidth"
+ sx={{
+ "& .MuiTabs-indicator": {
+ backgroundColor: (theme) => theme.palette.common.gramPink,
+ },
+ }}
+ >
- SELECTED COMPONENT
+ ALL
}
- value={TAB.SELECTED_COMPONENT}
+ value={TAB.ALL}
/>
- )}
-
-
-
+
+
+ MODEL
+
+
+ }
+ value={TAB.MODEL}
+ />
+ {selected && (
+
+
+ SELECTED COMPONENT
+
+
+ }
+ value={TAB.SELECTED_COMPONENT}
+ />
+ )}
+
+
+
+
);
}
diff --git a/app/src/components/model/panels/bottom/ValidationTab.js b/app/src/components/model/panels/bottom/ValidationTab.js
index d4edfc2e..2c4dd681 100644
--- a/app/src/components/model/panels/bottom/ValidationTab.js
+++ b/app/src/components/model/panels/bottom/ValidationTab.js
@@ -77,7 +77,9 @@ function renderResults(results, setSelected, deselectAll, setTab) {
export function ValidationTab({ tab, setTab, filteredResults, isLoading }) {
const setSelected = useSetSelected();
const deselectAll = useDeselectAll();
+
const selectedComponent = useSelectedComponent();
+ console.log({ selectedComponent });
if (isLoading) {
return (
diff --git a/app/src/components/model/panels/left/Review.js b/app/src/components/model/panels/left/Review.js
index 447bd705..523aff95 100644
--- a/app/src/components/model/panels/left/Review.js
+++ b/app/src/components/model/panels/left/Review.js
@@ -180,7 +180,7 @@ function RequestReviewButton({ permissions, modelId }) {
onClick={() => {
dispatch(
modalActions.open({
- type: MODALS.ValidateBeforeReview.name,
+ type: MODALS.QualityCheck.name,
props: { modelId },
})
);
diff --git a/app/src/components/systems/TeamSystems/TeamSystemsPageList.js b/app/src/components/systems/TeamSystems/TeamSystemsPageList.js
index 46568040..0d6c6cb6 100644
--- a/app/src/components/systems/TeamSystems/TeamSystemsPageList.js
+++ b/app/src/components/systems/TeamSystems/TeamSystemsPageList.js
@@ -34,8 +34,8 @@ export function TeamSystemsPageList({ teamId, pagesize = 10 }) {
const systems = teamSystems ? [...teamSystems?.systems] : [];
return (
-
-
+
+