Skip to content

Commit

Permalink
delete rqa and loadtest and resilience test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Plüddemann committed Jul 26, 2024
1 parent c55ed15 commit 4049c88
Show file tree
Hide file tree
Showing 18 changed files with 164 additions and 1,002 deletions.
14 changes: 10 additions & 4 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
".direnv",
"doc",
"public",
"screenshots"
"screenshots",
"src/components/testing"
]
},
"organizeImports": {
Expand All @@ -22,13 +23,18 @@
"suspicious": {
"noExplicitAny": {
"level": "off"
},
"noArrayIndexKey": {
"level": "off"
}
},
"a11y": {
"useButtonType": "off"
"useButtonType": "off",
"useKeyWithClickEvents": "off"
},
"style": {
"noParameterAssign": "off"
"noParameterAssign": "off",
"noUselessElse": "off"
},
"complexity": {
"noForEach": "off"
Expand All @@ -49,4 +55,4 @@
"trailingCommas": "none"
}
}
}
}
2 changes: 0 additions & 2 deletions src/app/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
const backendUrl = new URL(
"/api/v2/domain-story",
`http://${process.env.DQAPI_HOST}` || "http://localhost:8099",
"/api/v2/domain-story",
`http://${process.env.DQAPI_HOST}` || "http://localhost:8099",
);

/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/monitoring/MonitoringSpecifier.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext, useState } from "react";
import { InputSelect } from "../input/InputSelect";
import { MonitoringDefinition } from "@/types/rqa/definition/monitoring/MonitoringDefinition";
import type { MonitoringDefinition } from "@/types/rqa/definition/monitoring/MonitoringDefinition";
import { getAllActivities } from "@/utils/dam.utils";
import { DqContext } from "@/app/providers/DqContext";
import { MeasurementType } from "@/types/rqa/definition/monitoring/MeasurementType";
Expand All @@ -13,7 +13,7 @@ export default function ShowMonitoringSpecifier() {
const [target, setMonitoringTarget] = useState<string>("");
const [measurementName, setMeasurementName] = useState<string>("");
const [measurementType, setMeasurementType] = useState<MeasurementType>(
MeasurementType.EXECUTION_TIME
MeasurementType.EXECUTION_TIME,
);
const [measurementUnit, setMeasurementUnit] = useState<string>("");

Expand Down
6 changes: 3 additions & 3 deletions src/components/monitoring/action.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"use server";

import type { RuntimeQualityAnalysisDefinition } from "@/types/rqa/definition/RuntimeQualityAnalysisDefinition";
import { MonitoringDefinition } from "@/types/rqa/definition/monitoring/MonitoringDefinition";
import type { MonitoringDefinition } from "@/types/rqa/definition/monitoring/MonitoringDefinition";

const backendUrl = new URL(
"/api/v2/rqa",
`http://${process.env.DQAPI_HOST}` || "http://localhost:8099"
`http://${process.env.DQAPI_HOST}` || "http://localhost:8099",
);

export const updateRqaMonitoring = async (
rqa_id: string,
monitoringDefinition: MonitoringDefinition
monitoringDefinition: MonitoringDefinition,
) => {
const res = await fetch(`${backendUrl}/${rqa_id}/monitoring`, {
method: "PATCH",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ interface DeleteResilienceTestButtonProps {

export function DeleteResilienceTestButton({
rqaId,
resilienceTestDefinition: resiliendceTestDefinition
resilienceTestDefinition: resiliendceTestDefinition,
}: DeleteResilienceTestButtonProps) {
return (
<button
className="btn btn-xs w-fit btn-ghost"
onClick={() => deleteResilienceTest({ rqaId, resilienceTestId: resiliendceTestDefinition.name })}
onClick={() =>
deleteResilienceTest({
rqaId,
resilienceTestId: resiliendceTestDefinition.name,
})
}
>
<DeleteIcon color="error" />
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MonitoringDefinition } from "@/types/rqa/definition/monitoring/MonitoringDefinition";
import type { MonitoringDefinition } from "@/types/rqa/definition/monitoring/MonitoringDefinition";

interface MonitoringDefinitionListProps {
monitoringDefinitions: MonitoringDefinition[];
Expand Down
1 change: 0 additions & 1 deletion src/components/rqaExplorer/rqaTree/RqaDefinition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export function RqaDefinition({
typeof rqa[key] === "string" &&
key !== "name" &&
key !== "id" && (
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
<li key={i}>
<span>
{key}: {rqa[key]}
Expand Down
177 changes: 88 additions & 89 deletions src/components/scenario_explorer/ScenarioExplorerNode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,99 +2,98 @@ import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight";
import { useRef, useState } from "react";
export default function ExpandableScenarioNode({
paramName,
data,
expandable = true,
expandFunction,
expanded,
level,
setInputOpen,
setRqas,
paramName,
data,
expandable = true,
expandFunction,
expanded,
level,
setInputOpen,
setRqas,
}) {
const [value, setValue] = useState(data);
const [isEditing, setIsEditing] = useState(data ? false : true);
const inputRef = useRef();
const [value, setValue] = useState(data);
const [isEditing, setIsEditing] = useState(data ? false : true);
const inputRef = useRef();

const spacingVariants = {
0: "px-0",
1: "px-2",
2: "px-4",
3: "px-6",
4: "px-8",
5: "px-10",
6: "px-16",
8: "px-32",
};
const spacingVariants = {
0: "px-0",
1: "px-2",
2: "px-4",
3: "px-6",
4: "px-8",
5: "px-10",
6: "px-16",
8: "px-32",
};

const handleClick = () => {
expandFunction();
};
const handleClick = () => {
expandFunction();
};

const handleChangeValue = (e) => {
setValue(e.target.value);
};
const handleChangeValue = (e) => {
setValue(e.target.value);
};

const handleSave = (event) => {
if (event.key === "Enter") {
// Perform the desired action when "Enter" is pressed
console.log("Enter key was pressed");
inputRef.current.blur(); // Unfocus the input field
setIsEditing(false);
fetch("https://64917f002f2c7ee6c2c85311.mockapi.io/api/v1/rqas/", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
name: value,
context: "",
environment: "",
runtime_quality_analysis: {
artifacts: [],
settings: {
confidence: 0,
environment: null,
timeSlot: null,
},
},
}),
})
.then((response) => response.json())
.then((data) => {
setInputOpen(false);
setRqas((prevState) => [...prevState, data]);
});
}
};
const handleSave = (event) => {
if (event.key === "Enter") {
// Perform the desired action when "Enter" is pressed
console.log("Enter key was pressed");
inputRef.current.blur(); // Unfocus the input field
setIsEditing(false);
fetch("https://64917f002f2c7ee6c2c85311.mockapi.io/api/v1/rqas/", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
name: value,
context: "",
environment: "",
runtime_quality_analysis: {
artifacts: [],
settings: {
confidence: 0,
environment: null,
timeSlot: null,
},
},
}),
})
.then((response) => response.json())
.then((data) => {
setInputOpen(false);
setRqas((prevState) => [...prevState, data]);
});
}
};

return (
<>
<div
className={`flex items-center hover:bg-slate-500 hover:cursor-pointer w-50 ${spacingVariants[level]} py-2 `}
onClick={handleClick}
>
{!expandable ? null : expanded ? (
<KeyboardArrowDownIcon fontSize="small" />
) : (
<KeyboardArrowRightIcon fontSize="small" />
)}
{level === 1 && isEditing ? (
<input
ref={inputRef}
type="text"
autoFocus
className="input input-bordered input-info w-full max-w-xs"
onKeyDown={handleSave}
onBlur={handleSave}
onChange={handleChangeValue}
value={value}
/>
) : (
<span>
{paramName && <b>{paramName}:</b>} {value}
</span>
)}
</div>
</>
);
return (
<>
<div
className={`flex items-center hover:bg-slate-500 hover:cursor-pointer w-50 ${spacingVariants[level]} py-2 `}
onClick={handleClick}
>
{!expandable ? null : expanded ? (
<KeyboardArrowDownIcon fontSize="small" />
) : (
<KeyboardArrowRightIcon fontSize="small" />
)}
{level === 1 && isEditing ? (
<input
ref={inputRef}
type="text"
className="input input-bordered input-info w-full max-w-xs"
onKeyDown={handleSave}
onBlur={handleSave}
onChange={handleChangeValue}
value={value}
/>
) : (
<span>
{paramName && <b>{paramName}:</b>} {value}
</span>
)}
</div>
</>
);
}
3 changes: 1 addition & 2 deletions src/components/scenariotest/FileWriterService.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ export default function FileWriterService(scenarioArray) {
let content = "";

for (let index = 1; index <= scenarioArray.length; index++) {
content =
content + index + ": " + scenarioArray[index - 1].description + "\n";
content = `${content + index}: ${scenarioArray[index - 1].description}\n`;
}

const blob = new Blob([content], { type: "text/plain" });
Expand Down
9 changes: 5 additions & 4 deletions src/components/scenariotest/PlaceholderWordMapperService.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import pluralize from "pluralize";
import indefinite from "indefinite";
import compromise from "compromise";
import CaseService from "./CaseService.jsx";
import WhatIfVariantFormatterService from "./WhatIfVariantFormatterService.jsx";
import VerbConjugationService from "./VerbConjugationService.jsx";
import compromisee from compromisese;
";
import pluralizefrom "ppluralize
import VerbConjugationService./VerbConVerbConjugationService.jsx
import WhatIfVariantFormatterServiceService fWhatIfVariantFormatterService.jsxterService.jsx";

export default function PlaceholderWordMapperService(sentence, part) {
const fitsIn = (wordType, placeholder) => {
Expand Down
19 changes: 9 additions & 10 deletions src/components/scenariotest/RqsBuilderService.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CaseService from "./CaseService.jsx";
import PlaceholderWordMapperService from "./PlaceholderWordMapperService.jsx";
import deepCopy from "./deepCopy.jsx";
import CaseService from "./CaseService.jsx";

export default function RqsBuilderService(sentence, mode) {
const placeholderRegex = /\[(.*?)\]/g;
Expand All @@ -15,12 +15,11 @@ export default function RqsBuilderService(sentence, mode) {
for (const key of keys) {
if (words[key] === null) {
return null;
} else {
descriptionOfSentencePart = descriptionOfSentencePart.replace(
key,
words[key],
);
}
descriptionOfSentencePart = descriptionOfSentencePart.replace(
key,
words[key],
);
}
}
if (
Expand Down Expand Up @@ -53,7 +52,7 @@ export default function RqsBuilderService(sentence, mode) {
if (description === "") {
description += optional;
} else {
description += " " + optional;
description += ` ${optional}`;
}
}

Expand All @@ -62,15 +61,15 @@ export default function RqsBuilderService(sentence, mode) {
}

if (attachment !== null) {
description += " " + attachment;
description += ` ${attachment}`;
}

if (load !== null) {
description += " " + load;
description += ` ${load}`;
}

if (resilience !== null) {
description += " " + resilience;
description += ` ${resilience}`;
}

if (isQuestion) {
Expand Down
Loading

0 comments on commit 4049c88

Please sign in to comment.