web: Add createProfiledUnit

This commit is contained in:
2025-06-23 16:48:10 -05:00
parent 8827f9e6c8
commit 8397571c11
7 changed files with 146 additions and 79 deletions

View File

@@ -23,6 +23,7 @@ import { ColumnDefinition } from "tabulator-tables";
import { offerDownload } from "../../Common/io";
import FileUploadElement from "../../Common/Buttons/FileUploadElement";
import { useRef } from "react";
import { createProfiledUnit } from "../../../core/Operations/profiledUnitOps";
interface ProfiledUnitsProps {
scenario: UnitCommitmentScenario;
@@ -98,7 +99,14 @@ const ProfiledUnitsComponent = (props: ProfiledUnitsProps) => {
});
};
const onAdd = () => {};
const onAdd = () => {
const [newScenario, err] = createProfiledUnit(props.scenario);
if (err) {
props.onError(err.message);
return;
}
props.onDataChanged(newScenario);
};
return (
<div>