From 5fdb17eea7a2e7089ba905f8b15ed317240d8812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr> Date: Wed, 7 Dec 2022 13:16:26 +0100 Subject: [PATCH] fix: predams graph: do not allow to remove basin if it's unique refs #582 --- src/app/components/pb-schema/pb-schema.component.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/components/pb-schema/pb-schema.component.ts b/src/app/components/pb-schema/pb-schema.component.ts index 7ac6b72a7..6de70eecd 100644 --- a/src/app/components/pb-schema/pb-schema.component.ts +++ b/src/app/components/pb-schema/pb-schema.component.ts @@ -435,6 +435,13 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni } public get enableRemoveButton() { + // do not allow to remove last basin + if (this._selectedItem instanceof PbBassin) { + if (this.predamService.bassins.length == 1) { + return false; + } + } + if (this._selectedItem === this.predamService.upstreamBassin) { return false; } -- GitLab