mirror of
https://github.com/ANL-CEEESA/UnitCommitment.jl.git
synced 2025-12-07 16:58:51 -06:00
web: ProfiledUnits: Rename and delete
This commit is contained in:
@@ -30,7 +30,7 @@ import {
|
||||
createBus,
|
||||
deleteBus,
|
||||
renameBus,
|
||||
} from "../../../core/Operations/busOperations";
|
||||
} from "../../../core/Operations/busOps";
|
||||
|
||||
export const BusesColumnSpec: ColumnSpec[] = [
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
changeParameter,
|
||||
changeTimeHorizon,
|
||||
changeTimeStep,
|
||||
} from "../../../core/Operations/parameterOperations";
|
||||
} from "../../../core/Operations/parameterOps";
|
||||
|
||||
interface ParametersProps {
|
||||
scenario: UnitCommitmentScenario;
|
||||
|
||||
@@ -23,7 +23,11 @@ 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";
|
||||
import {
|
||||
createProfiledUnit,
|
||||
deleteGenerator,
|
||||
} from "../../../core/Operations/generatorOps";
|
||||
import { ValidationError } from "../../../core/Validation/validate";
|
||||
|
||||
interface ProfiledUnitsProps {
|
||||
scenario: UnitCommitmentScenario;
|
||||
@@ -108,6 +112,12 @@ const ProfiledUnitsComponent = (props: ProfiledUnitsProps) => {
|
||||
props.onDataChanged(newScenario);
|
||||
};
|
||||
|
||||
const onDelete = (name: string): ValidationError | null => {
|
||||
const newScenario = deleteGenerator(name, props.scenario);
|
||||
props.onDataChanged(newScenario);
|
||||
return null;
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SectionHeader title="Profiled Units">
|
||||
@@ -120,9 +130,7 @@ const ProfiledUnitsComponent = (props: ProfiledUnitsProps) => {
|
||||
<SectionButton icon={faUpload} tooltip="Upload" onClick={onUpload} />
|
||||
</SectionHeader>
|
||||
<DataTable
|
||||
onRowDeleted={() => {
|
||||
return null;
|
||||
}}
|
||||
onRowDeleted={onDelete}
|
||||
onRowRenamed={() => {
|
||||
return null;
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user