From 44a40e8e7d52817d8cccff91b7d3ce2b092ce761 Mon Sep 17 00:00:00 2001 From: Gilles Dubreuil Date: Thu, 21 Sep 2023 19:39:32 +0200 Subject: [PATCH 1/3] :sparkles: Reports: select Questionnaires (#1374) Shows selection of possible questionnaires of current assessments Pass to ``: - If "All questionnaires" option has been selected then the whole assessments list is passed - When a specific questionnaire is selected then only the assessments bound to that questionnaire are passed. The consolidation of the risks is left to be handled by the Landscape component in following PR. https://github.com/konveyor/tackle2-ui/issues/1305 ![image](https://github.com/konveyor/tackle2-ui/assets/1901741/c48b117f-7f5a-46e9-ac83-22cb7b14d85f) --------- Signed-off-by: Gilles Dubreuil Co-authored-by: Scott Dickerson --- client/public/locales/en/translation.json | 7 +- client/public/locales/es/translation.json | 7 +- client/src/app/api/models.ts | 5 - client/src/app/api/rest.ts | 3 + .../reports/components/landscape/donut.tsx | 2 +- .../components/landscape/landscape.tsx | 30 +++-- client/src/app/pages/reports/reports.tsx | 115 +++++++++++++++++- client/src/app/queries/assessments.ts | 13 ++ 8 files changed, 149 insertions(+), 33 deletions(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index c64b5bc8af..fc6872bb39 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -71,7 +71,8 @@ "orange": "Orange", "purple": "Purple", "red": "Red", - "teal": "Teal" + "teal": "Teal", + "yellow": "Yellow" }, "composed": { "add": "Add {{what}}", @@ -243,7 +244,6 @@ "businessServices": "Business services", "canceled": "Canceled", "category": "Category", - "cloudNativeReady": "Cloud-native ready", "color": "Color", "comments": "Comments", "completed": "Completed", @@ -311,7 +311,6 @@ "member(s)": "Member(s)", "memberCount": "Member count", "message": "Message", - "modernizable": "Modernizable", "migrationWave": "Migration wave", "migrationWaves": "Migration waves", "migrationWave(s)": "Migration wave(s)", @@ -322,7 +321,6 @@ "notConnected": "Not connected", "notReviewed": "Not reviewed", "notStarted": "Not started", - "notYetAssessed": "Not yet assessed", "notYetReviewed": "Not yet reviewed", "other": "Other", "owner": "Owner", @@ -384,7 +382,6 @@ "unassessed": "Unassessed", "unassigned": "Not yet assigned", "unknown": "Unknown", - "unsuitableForContainers": "Unsuitable for containers", "uploadApplicationFile": "Upload your application file", "uploadYamlFile": "Upload your YAML file", "url": "URL", diff --git a/client/public/locales/es/translation.json b/client/public/locales/es/translation.json index 5bfde9d167..12f96255f9 100644 --- a/client/public/locales/es/translation.json +++ b/client/public/locales/es/translation.json @@ -55,7 +55,8 @@ "green": "Verde", "orange": "Naranja", "purple": "Morado", - "red": "Rojo" + "red": "Rojo", + "yellow": "Amarillo" }, "composed": { "add": "Agregar {{what}}", @@ -194,7 +195,6 @@ "businessServices": "Servicios de negocio", "canceled": "Cancelado", "category": "Categoría", - "cloudNativeReady": "Listo para Cloud-native", "color": "Color", "comments": "Comentarios", "completed": "Completado", @@ -247,13 +247,11 @@ "member(s)": "Miembro(s)", "memberCount": "Número de miembros", "message": "Mensaje", - "modernizable": "Modernizable", "name": "Nombre", "northboundDependencies": "Dependencias del norte", "notAvailable": "No disponible", "notReviewed": "No revisado", "notStarted": "No empezado", - "notYetAssessed": "No evaluado todavía", "notYetReviewed": "No revisado todavía", "other": "Otro", "owner": "Propietario", @@ -304,7 +302,6 @@ "trivialButMigratable": "Trivial pero migrable", "unassessed": "No evaluado", "unknown": "Desconocido", - "unsuitableForContainers": "No apto para contenedores", "uploadApplicationFile": "Carga tu archivo con aplicaciones", "user": "Usuario", "version": "Versión", diff --git a/client/src/app/api/models.ts b/client/src/app/api/models.ts index d4ad356db9..4df69028ae 100644 --- a/client/src/app/api/models.ts +++ b/client/src/app/api/models.ts @@ -723,11 +723,6 @@ export interface AssessmentRisk { applicationId: number; risk: Risk; } -export interface AssessmentRisk { - assessmentId: number; - applicationId: number; - risk: Risk; -} export interface AssessmentQuestionRisk { category: string; diff --git a/client/src/app/api/rest.ts b/client/src/app/api/rest.ts index 18e803352f..e9b06be9e9 100644 --- a/client/src/app/api/rest.ts +++ b/client/src/app/api/rest.ts @@ -205,6 +205,9 @@ export const getApplicationSummaryCSV = (id: string): AxiosPromise => { }); }; +export const getAssessments = (): Promise => + axios.get(ASSESSMENTS).then((response) => response.data); + export const getAssessmentsByItemId = ( isArchetype: boolean, itemId?: number | string diff --git a/client/src/app/pages/reports/components/landscape/donut.tsx b/client/src/app/pages/reports/components/landscape/donut.tsx index b3612229b1..5c0f4bacce 100644 --- a/client/src/app/pages/reports/components/landscape/donut.tsx +++ b/client/src/app/pages/reports/components/landscape/donut.tsx @@ -11,7 +11,7 @@ export interface IDonutProps { total: number; color: string; riskLabel: string; - riskDescription: string; + riskDescription?: string; } export const Donut: React.FC = ({ diff --git a/client/src/app/pages/reports/components/landscape/landscape.tsx b/client/src/app/pages/reports/components/landscape/landscape.tsx index c21b229fda..7c500cd922 100644 --- a/client/src/app/pages/reports/components/landscape/landscape.tsx +++ b/client/src/app/pages/reports/components/landscape/landscape.tsx @@ -7,7 +7,7 @@ import { ConditionalRender } from "@app/components/ConditionalRender"; import { StateError } from "@app/components/StateError"; import { RISK_LIST } from "@app/Constants"; -import { AssessmentRisk } from "@app/api/models"; +import { Assessment, AssessmentRisk } from "@app/api/models"; import { ApplicationSelectionContext } from "../../application-selection-context"; import { NoApplicationSelectedEmptyState } from "../no-application-selected-empty-state"; @@ -48,7 +48,11 @@ const extractLandscapeData = ( return { low, medium, high, unassessed }; }; -export const Landscape: React.FC = () => { +interface ILandscapeProps { + assessments: Assessment[]; +} + +export const Landscape: React.FC = ({ assessments }) => { const { t } = useTranslation(); // Context @@ -89,11 +93,11 @@ export const Landscape: React.FC = () => { @@ -101,17 +105,17 @@ export const Landscape: React.FC = () => { value={landscapeData.medium} total={applications.length} color={RISK_LIST["yellow"].hexColor} - riskLabel={t("terms.mediumRisk")} - riskDescription={t("terms.modernizable")} + riskLabel={t("colors.yellow")} + // riskDescription={} /> @@ -119,8 +123,8 @@ export const Landscape: React.FC = () => { value={landscapeData.unassessed} total={applications.length} color={RISK_LIST["unknown"].hexColor} - riskLabel={t("terms.unassessed")} - riskDescription={t("terms.notYetAssessed")} + riskLabel={`${t("terms.unassessed")}/${t("terms.unknown")}`} + // riskDescription={} /> diff --git a/client/src/app/pages/reports/reports.tsx b/client/src/app/pages/reports/reports.tsx index 5b5aa4b2ea..3a085a639d 100644 --- a/client/src/app/pages/reports/reports.tsx +++ b/client/src/app/pages/reports/reports.tsx @@ -9,9 +9,15 @@ import { CardExpandableContent, CardHeader, CardTitle, + Flex, + FlexItem, + MenuToggle, + MenuToggleElement, PageSection, PageSectionVariants, Popover, + Select, + SelectOption, Split, SplitItem, Stack, @@ -31,11 +37,27 @@ import { Landscape } from "./components/landscape"; import { AdoptionPlan } from "./components/adoption-plan"; import { IdentifiedRisksTable } from "./components/identified-risks-table"; import { useFetchApplications } from "@app/queries/applications"; +import { useFetchAssessments } from "@app/queries/assessments"; +import { Ref } from "@app/api/models"; + +const ALL_QUESTIONNAIRES = "All questionnaires"; export const Reports: React.FC = () => { // i18 const { t } = useTranslation(); + const [isQuestionnaireSelectOpen, setIsQuestionnaireSelectOpen] = + React.useState(false); + + const [selectedQuestionnaire, setSelectedQuestionnaire] = + React.useState("All questionnaires"); + + const { + assessments, + isFetching: isAssessmentsFetching, + fetchError: assessmentsFetchError, + } = useFetchAssessments(); + // Cards const [isAdoptionCandidateTable, setIsAdoptionCandidateTable] = useState(true); @@ -66,6 +88,48 @@ export const Reports: React.FC = () => { ); } + const toggleQuestionnaire = (toggleRef: React.Ref) => ( + { + setIsQuestionnaireSelectOpen(!isQuestionnaireSelectOpen); + }} + isExpanded={isQuestionnaireSelectOpen} + > + {selectedQuestionnaire} + + ); + + const onSelectQuestionnaire = ( + _event: React.MouseEvent | undefined, + value: string | number | undefined + ) => { + setSelectedQuestionnaire(value as string); + setIsQuestionnaireSelectOpen(false); + }; + + const answeredQuestionnaires: Ref[] = + isAssessmentsFetching || assessmentsFetchError + ? [] + : assessments + .reduce((questionnaires: Ref[], assessment) => { + if ( + !questionnaires + .map((ref) => ref.id) + .includes(assessment.questionnaire.id) + ) { + assessment.questionnaire && + questionnaires.push(assessment.questionnaire); + } + return questionnaires; + }, []) + .sort((a, b) => { + if (a.name > b.name) return 1; + if (b.name > a.name) return -1; + return 0; + }); + return ( <> {pageHeaderSection} @@ -78,13 +142,56 @@ export const Reports: React.FC = () => { - - {t("terms.currentLandscape")} - + + + + + {t("terms.currentLandscape")} + + + + + + + - + + assessment.questionnaire.name === + selectedQuestionnaire + ) + } + /> diff --git a/client/src/app/queries/assessments.ts b/client/src/app/queries/assessments.ts index a443d337f1..5fec63ace5 100644 --- a/client/src/app/queries/assessments.ts +++ b/client/src/app/queries/assessments.ts @@ -4,6 +4,7 @@ import { createAssessment, deleteAssessment, getAssessmentById, + getAssessments, getAssessmentsByItemId, updateAssessment, } from "@app/api/rest"; @@ -15,6 +16,18 @@ export const assessmentsQueryKey = "assessments"; export const assessmentQueryKey = "assessment"; export const assessmentsByItemIdQueryKey = "assessmentsByItemId"; +export const useFetchAssessments = () => { + const { isLoading, data, error } = useQuery({ + queryKey: [QuestionnairesQueryKey], + queryFn: getAssessments, + onError: (error: AxiosError) => console.log("error, ", error), + }); + return { + assessments: data || [], + isFetching: isLoading, + fetchError: error, + }; +}; export const useCreateAssessmentMutation = ( isArchetype: boolean, onSuccess: (name: string) => void, From 1573d376337c62877b0c6a56c1ef769e50699b7f Mon Sep 17 00:00:00 2001 From: Scott Dickerson Date: Thu, 21 Sep 2023 15:18:06 -0400 Subject: [PATCH 2/3] :bug: Import questionnaire form - fix success toast message (#1385) The message displayed on successful import of a questionnaire did not exist in the translation file. The message key now uses an existing message to say: "Questionnaire _Name Used_ was successfully created." Signed-off-by: Scott J Dickerson --- .../import-questionnaire-form.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/src/app/pages/assessment-management/import-questionnaire-form/import-questionnaire-form.tsx b/client/src/app/pages/assessment-management/import-questionnaire-form/import-questionnaire-form.tsx index abb3b72634..4e4e58f677 100644 --- a/client/src/app/pages/assessment-management/import-questionnaire-form/import-questionnaire-form.tsx +++ b/client/src/app/pages/assessment-management/import-questionnaire-form/import-questionnaire-form.tsx @@ -56,12 +56,13 @@ export const ImportQuestionnaireForm: React.FC< trigger, } = methods; - const onHandleSuccessfullQuestionnaireCreation = ( - response: Questionnaire - ) => { + const onHandleSuccessfulQuestionnaireCreation = (response: Questionnaire) => { onSaved(response); pushNotification({ - title: t("toastr.success.questionnaireCreated"), + title: t("toastr.success.createWhat", { + type: t("terms.questionnaire"), + what: response.name, + }), variant: "success", }); onSaved(); @@ -75,7 +76,7 @@ export const ImportQuestionnaireForm: React.FC< }; const { mutate: createQuestionnaire } = useCreateQuestionnaireMutation( - onHandleSuccessfullQuestionnaireCreation, + onHandleSuccessfulQuestionnaireCreation, onHandleFailedQuestionnaireCreation ); From 59cbfc5c7a3c12ca7b782347f38fa2f999bf8ea0 Mon Sep 17 00:00:00 2001 From: Scott Dickerson Date: Thu, 21 Sep 2023 17:43:16 -0400 Subject: [PATCH 3/3] :seedling: Add `hacks/` to keep sample data and scripts to help developers (#1384) Modeled after tackle2-hub's `hacks/` folder, add a `hacks/` folder where sample import files (and in future helpful scripts) can be centrally held. The goal is to have a common place to hold things that are useful for developers. Signed-off-by: Scott J Dickerson Co-authored-by: Ian Bolton --- hack/README.md | 17 +++ .../sample-applications.csv | 6 + .../import-questionnaire/cloud-native.yaml | 134 +++++++++--------- .../demo-questionnaire-remove-question.yml | 103 ++++++++++++++ .../demo-questionnaire.yml | 83 +++++++++++ 5 files changed, 279 insertions(+), 64 deletions(-) create mode 100644 hack/README.md create mode 100644 hack/import-applications/sample-applications.csv rename client/public/questionnaire-data.yaml => hack/import-questionnaire/cloud-native.yaml (73%) create mode 100644 hack/import-questionnaire/demo-questionnaire-remove-question.yml create mode 100644 hack/import-questionnaire/demo-questionnaire.yml diff --git a/hack/README.md b/hack/README.md new file mode 100644 index 0000000000..f4820996fe --- /dev/null +++ b/hack/README.md @@ -0,0 +1,17 @@ +# Scripts and samples of import data + +This folder is a place to keep sample data and scripts to help developers with +creating/importing various pieces of data. + +## Adding a base set of data to an empty instance + +For creating a base set of data in a tackle-hub instance, a good place to start +is [tackle-hub's hack folder](https://github.com/konveyor/tackle2-hub/tree/main/hack). +If you have hub running or port forwarded on port :9002, a basic set of data can be +added to the instance by: + +```sh +> git clone https://github.com/konveyor/tackle2-hub.git +> cd tackle2-hub/hack +> HOST=localhost:9002 ./add/all.sh +``` diff --git a/hack/import-applications/sample-applications.csv b/hack/import-applications/sample-applications.csv new file mode 100644 index 0000000000..80f64fdab1 --- /dev/null +++ b/hack/import-applications/sample-applications.csv @@ -0,0 +1,6 @@ +Record Type 1,Application Name,Description,Comments,Business Service,Dependency,Dependency Direction,Binary Group,Binary Artifact,Binary Version,Binary Packaging,Repository Type,Repository URL,Repository Branch,Repository Path,Tag Category 1,Tag 1,Tag Category 2,Tag 2,Tag Category 3,Tag 3,Tag Category 4,Tag 4,Tag Category 5,Tag 5,Tag Category 6,Tag 6,Tag Category 7,Tag 7,Tag Category 8,Tag 8,Tag Category 9,Tag 9,Tag Category 10,Tag 10,Tag Category 11,Tag 11,Tag Category 12,Tag 12,Tag Category 13,Tag 13,Tag Category 14,Tag 14,Tag Category 15,Tag 15,Tag Category 16,Tag 16,Tag Category 17,Tag 17,Tag Category 18,Tag 18,Tag Category 19,Tag 19,Tag Category 20,Tag 20 +1,Customers,Legacy Customers management service,,Retail,,,corp.acme.demo,customers-tomcat,0.0.1-SNAPSHOT,war,git,https://git-acme.local/customers.git,,,Operating System,RHEL 8,Database,Oracle,Language,Java,Runtime,Tomcat,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +1,Inventory,Inventory service,,Retail,,,corp.acme.demo,inventory,0.1.1-SNAPSHOT,war,git,https://git-acme.local/inventory.git,,,Operating System,RHEL 8,Database,Postgresql,Language,Java,Runtime,Quarkus,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +1,Gateway,API Gateway,,Retail,,,corp.acme.demo,gateway,0.1.1-SNAPSHOT,war,git,https://git-acme.local/gateway.git,,,Operating System,RHEL 8,,,Language,Java,Runtime,Spring Boot,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +2,Gateway,,,,Inventory,southbound +2,Gateway,,,,Customers,southbound diff --git a/client/public/questionnaire-data.yaml b/hack/import-questionnaire/cloud-native.yaml similarity index 73% rename from client/public/questionnaire-data.yaml rename to hack/import-questionnaire/cloud-native.yaml index 6af53ee020..b699d8a916 100644 --- a/client/public/questionnaire-data.yaml +++ b/hack/import-questionnaire/cloud-native.yaml @@ -1,75 +1,77 @@ name: Cloud Native description: | Questionnaire that includes the Twelve Factor Application principles. + sections: - - name: Application technologies 1 + - order: 1 + name: Application technologies 1 questions: - - formulation: What is the main technology in your application? + - text: 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 + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - - choice: Quarkus + - text: Quarkus risk: green - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Quarkus - autotag: + applyTags: - category: Technology tag: Quarkus - - choice: Spring Boot + - text: Spring Boot risk: green - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Spring Boot - autotag: + applyTags: - category: Technology tag: Spring Boot - - choice: Java EE + - text: 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: + autoAnswerFor: - category: Technology tag: Java EE - autotag: + applyTags: - category: Technology tag: Java EE - - choice: J2EE + - text: J2EE rationale: This is obsolete. mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE. risk: red - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: J2EE - autotag: + applyTags: - category: Technology tag: J2EE - - formulation: "What version of Java EE does the application use?" + - text: "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. + - text: Below 5. rationale: This technology stack is obsolete. mitigation: Consider migrating to at least Java EE 7. risk: red - - choice: 5 or 6 + - text: 5 or 6 rationale: This is a mostly outdated stack. mitigation: Consider migrating to at least Java EE 7. risk: yellow - - choice: "7" + - text: "7" risk: green - include_if_tags_present: + includeFor: - category: Technology tag: Java EE - - formulation: Does your application use any caching mechanism? + - text: Does your application use any caching mechanism? answers: - - choice: Yes + - text: 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: + autoAnswerFor: - category: Caching tag: Infinispan - category: Caching @@ -78,97 +80,99 @@ sections: tag: eXtreme Scale - category: Caching tag: Coherence - - choice: No + - text: No risk: green - - choice: Unknown + - text: 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? + - text: What implementation of JAX-WS does your application use? answers: - - choice: Apache Axis + - text: Apache Axis rationale: This version is obsolete mitigation: Consider migrating to Apache CXF risk: red - - choice: Apache CXF + - text: Apache CXF risk: green - - choice: Unknown + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - skip_if_tags_present: + excludeFor: - category: Technology tag: Spring Boot - category: Technology tag: Quarkus - - name: Application technologies + + - order: 2 + name: Application technologies questions: - - formulation: What is the main technology in your application? + - text: 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 + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - - choice: Quarkus + - text: Quarkus risk: green - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Quarkus - autotag: + applyTags: - category: Technology tag: Quarkus - - choice: Spring Boot + - text: Spring Boot risk: green - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Spring Boot - autotag: + applyTags: - category: Technology tag: Spring Boot - - choice: Java EE + - text: 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: + autoAnswerFor: - category: Technology tag: Java EE - autotag: + applyTags: - category: Technology tag: Java EE - - choice: J2EE + - text: J2EE rationale: This is obsolete. mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE. risk: red - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: J2EE - autotag: + applyTags: - category: Technology tag: J2EE - - formulation: "What version of Java EE does the application use?" + - text: "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. + - text: Below 5. rationale: This technology stack is obsolete. mitigation: Consider migrating to at least Java EE 7. risk: red - - choice: 5 or 6 + - text: 5 or 6 rationale: This is a mostly outdated stack. mitigation: Consider migrating to at least Java EE 7. risk: yellow - - choice: "7" + - text: "7" risk: green - include_if_tags_present: + includeFor: - category: Technology tag: Java EE - - formulation: Does your application use any caching mechanism? + - text: Does your application use any caching mechanism? answers: - - choice: Yes + - text: 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: + autoAnswerFor: - category: Caching tag: Infinispan - category: Caching @@ -177,34 +181,36 @@ sections: tag: eXtreme Scale - category: Caching tag: Coherence - - choice: No + - text: No risk: green - - choice: Unknown + - text: 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? + - text: What implementation of JAX-WS does your application use? answers: - - choice: Apache Axis + - text: Apache Axis rationale: This version is obsolete mitigation: Consider migrating to Apache CXF risk: red - - choice: Apache CXF + - text: Apache CXF risk: green - - choice: Unknown + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - skip_if_tags_present: + excludeFor: - category: Technology tag: Spring Boot - category: Technology tag: Quarkus + thresholds: - red: 1% - yellow: 30% - unknown: 15% -risk_messages: + red: 1 + yellow: 30 + unknown: 15 + +riskMessages: red: Application requires deep changes in architecture or lifecycle yellow: Application is Cloud friendly but requires some minor changes green: Application is Cloud Native diff --git a/hack/import-questionnaire/demo-questionnaire-remove-question.yml b/hack/import-questionnaire/demo-questionnaire-remove-question.yml new file mode 100644 index 0000000000..0349544f2b --- /dev/null +++ b/hack/import-questionnaire/demo-questionnaire-remove-question.yml @@ -0,0 +1,103 @@ +name: Test questionnaire 2 +description: This is a sample questionnaire in YAML format +required: true +sections: + - order: 1 + name: Section 1 + questions: + - order: 1 + text: What is your favorite color? + explanation: Please select your favorite color. + includeFor: + - category: Category1 + tag: Tag1 + excludeFor: [] + answers: + - order: 1 + text: Red + risk: red + rationale: Red is a nice color. + mitigation: No mitigation needed. + applyTags: [] + autoAnswerFor: [{ category: Category1, tag: Tag1 }] + selected: false + - order: 2 + text: Blue + risk: green + rationale: Blue is a calming color. + mitigation: No mitigation needed. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 2 + text: What is your favorite sport? + explanation: Please select your favorite sport. + excludeFor: + - category: Category1 + tag: Tag1 + answers: + - order: 1 + text: Soccer + risk: red + rationale: There are other sports? + mitigation: Beware of crunching tackles. High risk of injury. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 2 + text: Cycling + risk: red + rationale: Correct. + mitigation: High risk of decapitation by car. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 3 + text: Climbing + risk: yellow + rationale: Climbing is fun. + mitigation: Slight bit of mitigation needed. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 4 + text: Swimming + risk: yellow + rationale: Swimming is fun, too. + mitigation: Slight bit of mitigation needed. Drowning can be a problem. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 5 + text: Running + risk: red + rationale: Oof. + mitigation: Some mitigation required. High risk of injury. Don't run with scissors (or at all). + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 3 + text: What is your favorite shape? + explanation: Please select your favorite shape. + includeFor: + - category: Category1 + tag: Tag1 + excludeFor: [] + answers: + - order: 1 + text: Circle + risk: red + selected: false + - order: 2 + text: Square + risk: green + selected: false +thresholds: + red: 5 + yellow: 10 + unknown: 15 +riskMessages: + red: High risk + yellow: Medium risk + green: Low risk + unknown: Unknown risk diff --git a/hack/import-questionnaire/demo-questionnaire.yml b/hack/import-questionnaire/demo-questionnaire.yml new file mode 100644 index 0000000000..1a5883942f --- /dev/null +++ b/hack/import-questionnaire/demo-questionnaire.yml @@ -0,0 +1,83 @@ +name: Test questionnaire +description: This is a sample questionnaire in YAML format +required: true +sections: + - order: 1 + name: Section 1 + questions: + - order: 1 + text: What is your favorite color? + explanation: Please select your favorite color. + includeFor: + - category: Category1 + tag: Tag1 + excludeFor: [] + answers: + - order: 1 + text: Red + risk: red + rationale: Red is a nice color. + mitigation: No mitigation needed. + applyTags: [] + selected: false + - order: 2 + text: Blue + risk: green + rationale: Blue is a calming color. + mitigation: No mitigation needed. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 2 + text: What is your favorite sport? + explanation: Please select your favorite sport. + answers: + - order: 1 + text: Soccer + risk: red + rationale: There are other sports? + mitigation: Beware of crunching tackles. High risk of injury. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 2 + text: Cycling + risk: red + rationale: Correct. + mitigation: High risk of decapitation by car. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 3 + text: Climbing + risk: yellow + rationale: Climbing is fun. + mitigation: Slight bit of mitigation needed. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 4 + text: Swimming + risk: yellow + rationale: Swimming is fun, too. + mitigation: Slight bit of mitigation needed. Drowning can be a problem. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 5 + text: Running + risk: red + rationale: Oof. + mitigation: Some mitigation required. High risk of injury. Don't run with scissors (or at all). + applyTags: [] + autoAnswerFor: [] + selected: false +thresholds: + red: 5 + yellow: 10 + unknown: 15 +riskMessages: + red: High risk + yellow: Medium risk + green: Low risk + unknown: Unknown risk