Skip to content

Commit

Permalink
Add questionnaire view driven from example yaml
Browse files Browse the repository at this point in the history
Add answer table

Add tags to be applied labels for questions with conditional tags

Fix weight icons and status

Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 committed Aug 16, 2023
1 parent a9f64a7 commit 669152f
Show file tree
Hide file tree
Showing 10 changed files with 638 additions and 7 deletions.
211 changes: 211 additions & 0 deletions client/public/questionnaire-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
name: Cloud Native
description: |
Questionnaire that includes the Twelve Factor Application principles.
sections:
- name: Application technologies 1
questions:
- formulation: What is the main technology in your application?
explanation: What would you describe as the main framework used to build your application.
answers:
- choice: Unknown
rationale: This is a problem because of the uncertainty.
mitigation: Gathering more information about this is required.
risk: unknown
- choice: Quarkus
risk: green
autoanswer_if_tags_present:
- category: Technology
tag: Quarkus
autotag:
- category: Technology
tag: Quarkus
- choice: Spring Boot
risk: green
autoanswer_if_tags_present:
- category: Technology
tag: Spring Boot
autotag:
- category: Technology
tag: Spring Boot
- choice: Java EE
rationale: This might not be the most cloud friendly technology.
mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE.
risk: yellow
autoanswer_if_tags_present:
- category: Technology
tag: Java EE
autotag:
- category: Technology
tag: Java EE
- choice: J2EE
rationale: This is obsolete.
mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE.
risk: red
autoanswer_if_tags_present:
- category: Technology
tag: J2EE
autotag:
- category: Technology
tag: J2EE
- formulation: "What version of Java EE does the application use?"
explanation: "What version of the Java EE specification is your application using?"
answers:
- choice: Below 5.
rationale: This technology stack is obsolete.
mitigation: Consider migrating to at least Java EE 7.
risk: red
- choice: 5 or 6
rationale: This is a mostly outdated stack.
mitigation: Consider migrating to at least Java EE 7.
risk: yellow
- choice: "7"
risk: green
include_if_tags_present:
- category: Technology
tag: Java EE
- formulation: Does your application use any caching mechanism?
answers:
- choice: Yes
rationale: This could be problematic in containers and Kubernetes.
mitigation: Review the clustering mechanism to check compatibility and support for container environments.
risk: yellow
autoanswer_if_tags_present:
- category: Caching
tag: Infinispan
- category: Caching
tag: Datagrid
- category: Caching
tag: eXtreme Scale
- category: Caching
tag: Coherence
- choice: No
risk: green
- choice: Unknown
rationale: This is a problem because of the uncertainty.
mitigation: Gathering more information about this is required.
risk: unknown
- formulation: What implementation of JAX-WS does your application use?
answers:
- choice: Apache Axis
rationale: This version is obsolete
mitigation: Consider migrating to Apache CXF
risk: red
- choice: Apache CXF
risk: green
- choice: Unknown
rationale: This is a problem because of the uncertainty.
mitigation: Gathering more information about this is required.
risk: unknown
skip_if_tags_present:
- category: Technology
tag: Spring Boot
- category: Technology
tag: Quarkus
- name: Application technologies
questions:
- formulation: What is the main technology in your application?
explanation: What would you describe as the main framework used to build your application.
answers:
- choice: Unknown
rationale: This is a problem because of the uncertainty.
mitigation: Gathering more information about this is required.
risk: unknown
- choice: Quarkus
risk: green
autoanswer_if_tags_present:
- category: Technology
tag: Quarkus
autotag:
- category: Technology
tag: Quarkus
- choice: Spring Boot
risk: green
autoanswer_if_tags_present:
- category: Technology
tag: Spring Boot
autotag:
- category: Technology
tag: Spring Boot
- choice: Java EE
rationale: This might not be the most cloud friendly technology.
mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE.
risk: yellow
autoanswer_if_tags_present:
- category: Technology
tag: Java EE
autotag:
- category: Technology
tag: Java EE
- choice: J2EE
rationale: This is obsolete.
mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE.
risk: red
autoanswer_if_tags_present:
- category: Technology
tag: J2EE
autotag:
- category: Technology
tag: J2EE
- formulation: "What version of Java EE does the application use?"
explanation: "What version of the Java EE specification is your application using?"
answers:
- choice: Below 5.
rationale: This technology stack is obsolete.
mitigation: Consider migrating to at least Java EE 7.
risk: red
- choice: 5 or 6
rationale: This is a mostly outdated stack.
mitigation: Consider migrating to at least Java EE 7.
risk: yellow
- choice: "7"
risk: green
include_if_tags_present:
- category: Technology
tag: Java EE
- formulation: Does your application use any caching mechanism?
answers:
- choice: Yes
rationale: This could be problematic in containers and Kubernetes.
mitigation: Review the clustering mechanism to check compatibility and support for container environments.
risk: yellow
autoanswer_if_tags_present:
- category: Caching
tag: Infinispan
- category: Caching
tag: Datagrid
- category: Caching
tag: eXtreme Scale
- category: Caching
tag: Coherence
- choice: No
risk: green
- choice: Unknown
rationale: This is a problem because of the uncertainty.
mitigation: Gathering more information about this is required.
risk: unknown
- formulation: What implementation of JAX-WS does your application use?
answers:
- choice: Apache Axis
rationale: This version is obsolete
mitigation: Consider migrating to Apache CXF
risk: red
- choice: Apache CXF
risk: green
- choice: Unknown
rationale: This is a problem because of the uncertainty.
mitigation: Gathering more information about this is required.
risk: unknown
skip_if_tags_present:
- category: Technology
tag: Spring Boot
- category: Technology
tag: Quarkus
thresholds:
red: 1%
yellow: 30%
unknown: 15%
risk_messages:
red: Application requires deep changes in architecture or lifecycle
yellow: Application is Cloud friendly but requires some minor changes
green: Application is Cloud Native
unknown: More information about the application is required
1 change: 1 addition & 0 deletions client/src/app/Paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export enum Paths {
proxies = "/proxies",
migrationTargets = "/migration-targets",
assessment = "/assessment",
questionnaire = "/questionnaire",
jira = "/jira",
}

Expand Down
17 changes: 15 additions & 2 deletions client/src/app/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ const AffectedApplications = lazy(
() => import("./pages/issues/affected-applications")
);
const Dependencies = lazy(() => import("./pages/dependencies"));
const Questionnaires = lazy(() => import("./pages/assessment"));

const AssessmentSettings = lazy(
() =>
import(
"./pages/assessment-management/assessment-settings/assessment-settings-page"
)
);
const Questionnaire = lazy(
() => import("./pages/assessment-management/questionnaire/questionnaire-page")
);
export interface IRoute {
path: string;
comp: React.ComponentType<any>;
Expand Down Expand Up @@ -123,7 +131,12 @@ export const devRoutes: IRoute[] = [
: []),
{
path: Paths.assessment,
comp: Questionnaires,
comp: AssessmentSettings,
exact: false,
},
{
path: Paths.questionnaire,
comp: Questionnaire,
exact: false,
},
];
Expand Down
39 changes: 39 additions & 0 deletions client/src/app/api/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,3 +714,42 @@ export interface Questionnaire {
dateImported: string;
system: boolean;
}
export interface RiskMessages {
green: string;
red: string;
unknown: string;
yellow: string;
}
export interface Section {
name: string;
questions: CustomYamlAssessmentQuestion[];
}

// TODO: Rename after removing pathfinder
export interface CustomYamlAssessmentQuestion {
answers: Answer[];
explanation: string;
formulation: string;
include_if_tags_present?: Tag[];
skip_if_tags_present?: Tag[];
}

export interface Answer {
choice: string;
mitigation: string;
rationale: string;
risk: string;
autoanswer_if_tags_present?: Tag[];
}
export interface Thresholds {
red: string;
unknown: string;
yellow: string;
}
export interface YamlAssessment {
description: string;
name: string;
risk_messages: RiskMessages;
sections: Section[];
thresholds: Thresholds;
}
18 changes: 17 additions & 1 deletion client/src/app/components/IconedStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import CheckCircleIcon from "@patternfly/react-icons/dist/esm/icons/check-circle
import TimesCircleIcon from "@patternfly/react-icons/dist/esm/icons/times-circle-icon";
import InProgressIcon from "@patternfly/react-icons/dist/esm/icons/in-progress-icon";
import ExclamationCircleIcon from "@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon";
import WarningTriangleIcon from "@patternfly/react-icons/dist/esm/icons/warning-triangle-icon";
import UnknownIcon from "@patternfly/react-icons/dist/esm/icons/unknown-icon";

export type IconedStatusPreset =
Expand All @@ -16,7 +17,10 @@ export type IconedStatusPreset =
| "NotStarted"
| "Ok"
| "Scheduled"
| "Unknown";
| "Unknown"
| "LowRisk"
| "MediumRisk"
| "HighRisk";

export type IconedStatusStatusType =
| "custom"
Expand Down Expand Up @@ -87,6 +91,18 @@ export const IconedStatus: React.FC<IIconedStatusProps> = ({
Unknown: {
icon: <UnknownIcon />,
},
LowRisk: {
icon: <CheckCircleIcon />,
status: "success",
},
HighRisk: {
icon: <TimesCircleIcon />,
status: "danger",
},
MediumRisk: {
icon: <WarningTriangleIcon />,
status: "warning",
},
};
const presetProps = preset && presets[preset];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ import { useLocalTableControls } from "@app/hooks/table-controls";
import { NotificationsContext } from "@app/components/NotificationsContext";
import { getAxiosErrorMessage } from "@app/utils/utils";
import { Questionnaire } from "@app/api/models";
import { useHistory } from "react-router-dom";
import { Paths } from "@app/Paths";

export const AssessmentSettings: React.FC = () => {
const AssessmentSettings: React.FC = () => {
const { t } = useTranslation();

const history = useHistory();
const { pushNotification } = React.useContext(NotificationsContext);

const { questionnaires, isFetching, fetchError } = useFetchQuestionnaires();
Expand Down Expand Up @@ -324,8 +327,7 @@ export const AssessmentSettings: React.FC = () => {
key="view"
component="button"
onClick={() => {
// TODO Link to questionnaire page
// history.push(Paths.questionnaire);
history.push(Paths.questionnaire);
}}
>
{t("actions.view")}
Expand Down Expand Up @@ -430,3 +432,4 @@ export const AssessmentSettings: React.FC = () => {
</>
);
};
export default AssessmentSettings;
Loading

0 comments on commit 669152f

Please sign in to comment.