@@ -34,13 +42,13 @@
ScrollableAreaCssClass="treeview-scrollarea"
InitialIteration="@this.ViewModel.CurrentThing"
SelectionChanged="model =>
+ {
+ if (model != null)
{
- if (model != null)
- {
- this.TargetTree.ClearSelection();
- }
- this.OnElementSelected(model);
- }"
+ this.TargetTree.ClearSelection();
+ }
+ this.OnElementSelected(model);
+ }"
AllowDrag="true"
AllowDrop="true"
OnCalculateDropIsAllowed="@(async x => await this.SetDropIsAllowedAsync(x))"
@@ -107,4 +115,11 @@
+
+
+
+
+
+
+
diff --git a/COMETwebapp/Components/MultiModelEditor/MultiModelEditor.razor.cs b/COMETwebapp/Components/MultiModelEditor/MultiModelEditor.razor.cs
index 6ae73077..d6deed44 100644
--- a/COMETwebapp/Components/MultiModelEditor/MultiModelEditor.razor.cs
+++ b/COMETwebapp/Components/MultiModelEditor/MultiModelEditor.razor.cs
@@ -73,6 +73,7 @@ protected override void OnViewModelAssigned()
this.Disposables.Add(this.WhenAnyValue(x => x.ViewModel.IsOnCreationMode).SubscribeAsync(_ => this.InvokeAsync(this.StateHasChanged)));
this.Disposables.Add(this.WhenAnyValue(x => x.ViewModel.IsOnAddingParameterMode).SubscribeAsync(_ => this.InvokeAsync(this.StateHasChanged)));
+ this.Disposables.Add(this.WhenAnyValue(x => x.ViewModel.IsOnCopySettingsMode).SubscribeAsync(_ => this.InvokeAsync(this.StateHasChanged)));
}
///
diff --git a/COMETwebapp/Extensions/ServiceCollectionExtensions.cs b/COMETwebapp/Extensions/ServiceCollectionExtensions.cs
index 99cc9f37..f3a52c4b 100644
--- a/COMETwebapp/Extensions/ServiceCollectionExtensions.cs
+++ b/COMETwebapp/Extensions/ServiceCollectionExtensions.cs
@@ -62,6 +62,7 @@ namespace COMETwebapp.Extensions
using COMETwebapp.ViewModels.Components.ReferenceData;
using COMETwebapp.ViewModels.Pages;
using COMETwebapp.ViewModels.Components.SiteDirectory;
+ using COMETwebapp.ViewModels.Components.MultiModelEditor.CopySettings;
///
/// Extension class for the
@@ -107,6 +108,7 @@ public static void RegisterViewModels(this IServiceCollection serviceCollection)
serviceCollection.AddTransient();
serviceCollection.AddTransient();
serviceCollection.AddTransient();
+ serviceCollection.AddTransient();
serviceCollection.AddTransient();
serviceCollection.AddTransient();
serviceCollection.AddTransient();
diff --git a/COMETwebapp/ViewModels/Components/MultiModelEditor/CopySettings/CopySettingsViewModel.cs b/COMETwebapp/ViewModels/Components/MultiModelEditor/CopySettings/CopySettingsViewModel.cs
new file mode 100644
index 00000000..ac094870
--- /dev/null
+++ b/COMETwebapp/ViewModels/Components/MultiModelEditor/CopySettings/CopySettingsViewModel.cs
@@ -0,0 +1,114 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Copyright (c) 2024 Starion Group S.A.
+//
+// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, João Rua
+//
+// This file is part of COMET WEB Community Edition
+// The COMET WEB Community Edition is the Starion Group Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C.
+//
+// The COMET WEB Community Edition is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Affero General Public
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// The COMET WEB Community Edition is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace COMETwebapp.ViewModels.Components.MultiModelEditor.CopySettings
+{
+ using CDP4Dal.Operations;
+
+ using COMET.Web.Common.Enumerations;
+ using COMET.Web.Common.Model;
+ using COMET.Web.Common.Services.Cache;
+ using COMET.Web.Common.Utilities.DisposableObject;
+
+ using Microsoft.AspNetCore.Components;
+
+ ///
+ /// View model for the component
+ ///
+ public class CopySettingsViewModel : DisposableObject, ICopySettingsViewModel
+ {
+ ///
+ /// Holds a reference to the Injected
+ ///
+ private readonly ICacheService cacheService;
+
+ ///
+ /// Gets a collection of instance that can be selected as Copy Operation
+ ///
+ public CopyOperationKinds AvailableOperationKinds { get; } = new();
+
+ ///
+ /// Gets or sets the selected
+ ///
+ public OperationKind SelectedOperationKind { get; set; } = OperationKind.Copy;
+
+ ///
+ /// The selected copy 's descriptive text
+ ///
+ public string SelectedOperationKindDescription => this.AvailableOperationKinds.Single(x => x.Value == this.SelectedOperationKind).Key;
+
+ ///
+ /// The callback executed when the method was executed
+ ///
+ public EventCallback OnSaveSettings { get; set; }
+
+ ///
+ /// Create a new instance of the class
+ ///
+ /// The Injected
+ public CopySettingsViewModel(ICacheService cacheService)
+ {
+ this.cacheService = cacheService;
+
+ if (this.cacheService.TryGetOrAddBrowserSessionSetting(BrowserSessionSettingKey.CopyElementDefinitionOperationKind, OperationKind.Copy, out var selectedOperationKind) && selectedOperationKind is OperationKind operationKind)
+ {
+ this.SelectedOperationKind = operationKind;
+ }
+ }
+
+ ///
+ /// Initializes the current view model
+ ///
+ public void InitializeViewModel()
+ {
+ }
+
+ ///
+ /// Saves the Settings
+ ///
+ /// An awaitable
+ public async Task SaveSettings()
+ {
+ this.cacheService.AddOrUpdateBrowserSessionSetting(BrowserSessionSettingKey.CopyElementDefinitionOperationKind, this.SelectedOperationKind);
+ await this.OnSaveSettings.InvokeAsync();
+ }
+ }
+
+ ///
+ /// Defines a collection of descriptive strings that belongs to an
+ ///
+ public class CopyOperationKinds : Dictionary
+ {
+ ///
+ /// Creates a new instance of the
+ ///
+ public CopyOperationKinds()
+ {
+ this.Add("Set Parameter values to default, keep original owner", OperationKind.Copy);
+ this.Add("Set Parameter values to default, change owner to active domain", OperationKind.CopyDefaultValuesChangeOwner);
+ this.Add("Keep parameter values, keep original owner", OperationKind.CopyKeepValues);
+ this.Add("Keep parameter values, change owner to active domain", OperationKind.CopyKeepValuesChangeOwner);
+ }
+ }
+}
diff --git a/COMETwebapp/ViewModels/Components/MultiModelEditor/CopySettings/ICopySettingsViewModel.cs b/COMETwebapp/ViewModels/Components/MultiModelEditor/CopySettings/ICopySettingsViewModel.cs
new file mode 100644
index 00000000..1bd7097a
--- /dev/null
+++ b/COMETwebapp/ViewModels/Components/MultiModelEditor/CopySettings/ICopySettingsViewModel.cs
@@ -0,0 +1,67 @@
+// --------------------------------------------------------------------------------------------------------------------
+//
+// Copyright (c) 2024 Starion Group S.A.
+//
+// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, João Rua
+//
+// This file is part of COMET WEB Community Edition
+// The COMET WEB Community Edition is the Starion Group Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C.
+//
+// The COMET WEB Community Edition is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Affero General Public
+// License as published by the Free Software Foundation; either
+// version 3 of the License, or (at your option) any later version.
+//
+// The COMET WEB Community Edition is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+//
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace COMETwebapp.ViewModels.Components.MultiModelEditor.CopySettings
+{
+ using CDP4Dal.Operations;
+
+ using Microsoft.AspNetCore.Components;
+
+ ///
+ /// Interface for the
+ ///
+ public interface ICopySettingsViewModel
+ {
+ ///
+ /// Gets a collection of instance that can be selected as Copy Operation
+ ///
+ CopyOperationKinds AvailableOperationKinds { get; }
+
+ ///
+ /// Gets the selected
+ ///
+ OperationKind SelectedOperationKind { get; set; }
+
+ ///
+ /// The callback executed when the method was executed
+ ///
+ EventCallback OnSaveSettings { get; set; }
+
+ ///
+ /// The selected copy 's descriptive text
+ ///
+ string SelectedOperationKindDescription { get; }
+
+ ///
+ /// Initializes the current view model
+ ///
+ void InitializeViewModel();
+
+ ///
+ /// Saves the Settings
+ ///
+ /// An awaitable
+ Task SaveSettings();
+ }
+}
diff --git a/COMETwebapp/ViewModels/Components/MultiModelEditor/ElementDefinitionTreeViewModel.cs b/COMETwebapp/ViewModels/Components/MultiModelEditor/ElementDefinitionTreeViewModel.cs
index 2aaf4ce6..38e1bd27 100644
--- a/COMETwebapp/ViewModels/Components/MultiModelEditor/ElementDefinitionTreeViewModel.cs
+++ b/COMETwebapp/ViewModels/Components/MultiModelEditor/ElementDefinitionTreeViewModel.cs
@@ -38,10 +38,14 @@ namespace COMETwebapp.ViewModels.Components.MultiModelEditor
using COMETwebapp.Components.MultiModelEditor;
using COMETwebapp.ViewModels.Components.ModelEditor;
+ using COMETwebapp.ViewModels.Components.ModelEditor.AddParameterViewModel;
+ using COMETwebapp.ViewModels.Components.MultiModelEditor.CopySettings;
using COMETwebapp.ViewModels.Components.MultiModelEditor.Rows;
using DynamicData;
+ using Microsoft.AspNetCore.Components;
+
using ReactiveUI;
///
@@ -74,7 +78,8 @@ public class ElementDefinitionTreeViewModel : ApplicationBaseViewModel, IElement
///
/// the
/// The
- public ElementDefinitionTreeViewModel(ISessionService sessionService, ICDPMessageBus messageBus) : base(sessionService, messageBus)
+ /// The Injected
+ public ElementDefinitionTreeViewModel(ISessionService sessionService, ICDPMessageBus messageBus, ICopySettingsViewModel copySettingsViewModel) : base(sessionService, messageBus)
{
this.sessionService = sessionService;
this.RegisterViewModelWithReusableRows(this);
diff --git a/COMETwebapp/ViewModels/Components/MultiModelEditor/IElementDefinitionTreeViewModel.cs b/COMETwebapp/ViewModels/Components/MultiModelEditor/IElementDefinitionTreeViewModel.cs
index 720aa34d..ba4798a3 100644
--- a/COMETwebapp/ViewModels/Components/MultiModelEditor/IElementDefinitionTreeViewModel.cs
+++ b/COMETwebapp/ViewModels/Components/MultiModelEditor/IElementDefinitionTreeViewModel.cs
@@ -31,6 +31,7 @@ namespace COMETwebapp.ViewModels.Components.MultiModelEditor
using COMET.Web.Common.Model;
using COMET.Web.Common.ViewModels.Components.Applications;
+ using COMETwebapp.ViewModels.Components.MultiModelEditor.CopySettings;
using COMETwebapp.ViewModels.Components.MultiModelEditor.Rows;
///
diff --git a/COMETwebapp/ViewModels/Components/MultiModelEditor/IMultiModelEditorViewModel.cs b/COMETwebapp/ViewModels/Components/MultiModelEditor/IMultiModelEditorViewModel.cs
index b795cbf9..a261f1ba 100644
--- a/COMETwebapp/ViewModels/Components/MultiModelEditor/IMultiModelEditorViewModel.cs
+++ b/COMETwebapp/ViewModels/Components/MultiModelEditor/IMultiModelEditorViewModel.cs
@@ -32,6 +32,7 @@ namespace COMETwebapp.ViewModels.Components.MultiModelEditor
using COMETwebapp.Components.MultiModelEditor;
using COMETwebapp.ViewModels.Components.ModelEditor;
using COMETwebapp.ViewModels.Components.ModelEditor.AddParameterViewModel;
+ using COMETwebapp.ViewModels.Components.MultiModelEditor.CopySettings;
using COMETwebapp.ViewModels.Components.SystemRepresentation;
///
@@ -74,11 +75,21 @@ public interface IMultiModelEditorViewModel : ISingleIterationApplicationBaseVie
///
IAddParameterViewModel AddParameterViewModel { get; set; }
+ ///
+ /// Gets the
+ ///
+ ICopySettingsViewModel CopySettingsViewModel { get; set; }
+
///
/// Value indicating the user is currently adding a new to a
///
bool IsOnAddingParameterMode { get; set; }
+ ///
+ /// Value indicating the user is currently setting the Copy settings that apply when a node is dropped
+ ///
+ bool IsOnCopySettingsMode { get; set; }
+
///
/// Opens the popup
///
@@ -95,6 +106,11 @@ public interface IMultiModelEditorViewModel : ISingleIterationApplicationBaseVie
///
void OpenAddParameterPopup();
+ ///
+ /// Opens the popup
+ ///
+ void OpenCopySettingsPopup();
+
///
/// Add a new based on an existing
///
diff --git a/COMETwebapp/ViewModels/Components/MultiModelEditor/MultiModelEditorViewModel.cs b/COMETwebapp/ViewModels/Components/MultiModelEditor/MultiModelEditorViewModel.cs
index fceec26f..bebe43a4 100644
--- a/COMETwebapp/ViewModels/Components/MultiModelEditor/MultiModelEditorViewModel.cs
+++ b/COMETwebapp/ViewModels/Components/MultiModelEditor/MultiModelEditorViewModel.cs
@@ -30,7 +30,10 @@ namespace COMETwebapp.ViewModels.Components.MultiModelEditor
using CDP4Dal;
using CDP4Dal.Events;
+ using CDP4Dal.Operations;
+ using COMET.Web.Common.Enumerations;
+ using COMET.Web.Common.Services.Cache;
using COMET.Web.Common.Services.SessionManagement;
using COMET.Web.Common.Utilities;
using COMET.Web.Common.ViewModels.Components.Applications;
@@ -39,6 +42,7 @@ namespace COMETwebapp.ViewModels.Components.MultiModelEditor
using COMETwebapp.Components.MultiModelEditor;
using COMETwebapp.ViewModels.Components.ModelEditor;
using COMETwebapp.ViewModels.Components.ModelEditor.AddParameterViewModel;
+ using COMETwebapp.ViewModels.Components.MultiModelEditor.CopySettings;
using COMETwebapp.ViewModels.Components.SystemRepresentation;
using COMETwebapp.ViewModels.Components.SystemRepresentation.Rows;
@@ -56,6 +60,11 @@ public class MultiModelEditorViewModel : SingleIterationApplicationBaseViewModel
///
private readonly ISessionService sessionService;
+ ///
+ /// The
+ ///
+ private readonly ICacheService cacheService;
+
///
/// Backing field for
///
@@ -66,14 +75,21 @@ public class MultiModelEditorViewModel : SingleIterationApplicationBaseViewModel
///
private bool isOnCreationMode;
+ ///
+ /// Backing field for
+ ///
+ private bool isOnCopySettingsMode;
+
///
/// Creates a new instance of
///
///
the
///
The
- public MultiModelEditorViewModel(ISessionService sessionService, ICDPMessageBus messageBus) : base(sessionService, messageBus)
+ ///
The
+ public MultiModelEditorViewModel(ISessionService sessionService, ICDPMessageBus messageBus, ICacheService cacheService) : base(sessionService, messageBus)
{
this.sessionService = sessionService;
+ this.cacheService = cacheService;
var eventCallbackFactory = new EventCallbackFactory();
this.ElementDefinitionCreationViewModel = new ElementDefinitionCreationViewModel(sessionService, messageBus)
@@ -86,6 +102,11 @@ public MultiModelEditorViewModel(ISessionService sessionService, ICDPMessageBus
OnParameterAdded = eventCallbackFactory.Create(this, () => this.IsOnAddingParameterMode = false)
};
+ this.CopySettingsViewModel = new CopySettingsViewModel(cacheService)
+ {
+ OnSaveSettings = eventCallbackFactory.Create(this, () => this.IsOnCopySettingsMode = false)
+ };
+
this.InitializeSubscriptions([typeof(ElementBase)]);
this.TargetIteration = this.CurrentThing;
@@ -111,6 +132,11 @@ public MultiModelEditorViewModel(ISessionService sessionService, ICDPMessageBus
///
public IAddParameterViewModel AddParameterViewModel { get; set; }
+ ///
+ /// Gets or sets the
+ ///
+ public ICopySettingsViewModel CopySettingsViewModel { get; set; }
+
///
/// Gets target
///
@@ -121,6 +147,24 @@ public MultiModelEditorViewModel(ISessionService sessionService, ICDPMessageBus
///
public Iteration SourceIteration { get; set; }
+ ///
+ /// Value indicating the user is currently setting the Copy settings that apply when a node is dropped
+ ///
+ public bool IsOnCopySettingsMode
+ {
+ get => this.isOnCopySettingsMode;
+ set => this.RaiseAndSetIfChanged(ref this.isOnCopySettingsMode, value);
+ }
+
+ ///
+ /// Opens the popup
+ ///
+ public void OpenCopySettingsPopup()
+ {
+ this.CopySettingsViewModel.InitializeViewModel();
+ this.IsOnCopySettingsMode = true;
+ }
+
///
/// Value indicating the user is currently creating a new
///
@@ -164,6 +208,7 @@ public void SelectElement(ElementBase selectedElementBase)
///
public void OpenCreateElementDefinitionCreationPopup()
{
+ this.ElementDefinitionCreationViewModel.InitializeViewModel(this.SelectedElementDefinition.GetContainerOfType
());
this.ElementDefinitionCreationViewModel.ElementDefinition = new ElementDefinition();
this.ElementDefinitionCreationViewModel.SelectedCategories = new List();
this.IsOnCreationMode = true;
@@ -210,7 +255,10 @@ private async Task CopyAndAddNewElementImplAsync(ElementDefinitionTree elementDe
else
{
var copyCreator = new CopyCreator(this.sessionService.Session);
- await copyCreator.CopyAsync((ElementDefinition)elementBase, elementDefinitionTree.ViewModel.Iteration);
+
+ this.cacheService.TryGetOrAddBrowserSessionSetting(BrowserSessionSettingKey.CopyElementDefinitionOperationKind, OperationKind.Copy, out var selectedOperationKind);
+
+ await copyCreator.CopyAsync((ElementDefinition)elementBase, elementDefinitionTree.ViewModel.Iteration, selectedOperationKind is OperationKind operationKind ? operationKind : OperationKind.Copy);
}
}
finally
@@ -270,9 +318,10 @@ public async Task AddingElementDefinitionAsync()
this.ElementDefinitionCreationViewModel.ElementDefinition.Category = this.ElementDefinitionCreationViewModel.SelectedCategories.ToList();
}
- this.ElementDefinitionCreationViewModel.ElementDefinition.Container = this.CurrentThing;
+ var iteration = this.SelectedElementDefinition.GetContainerOfType();
+ this.ElementDefinitionCreationViewModel.ElementDefinition.Container = iteration;
thingsToCreate.Add(this.ElementDefinitionCreationViewModel.ElementDefinition);
- var clonedIteration = this.CurrentThing.Clone(false);
+ var clonedIteration = iteration.Clone(false);
if (this.ElementDefinitionCreationViewModel.IsTopElement)
{
diff --git a/COMETwebapp/appsettings.Development.json b/COMETwebapp/appsettings.Development.json
index 7db92f2e..a7200e21 100644
--- a/COMETwebapp/appsettings.Development.json
+++ b/COMETwebapp/appsettings.Development.json
@@ -1,6 +1,6 @@
{
"ServerConfiguration": {
- "ServerAddress": ""
+ "ServerAddress": "http://localhost:5000/"
},
"DetailedErrors": true
}
diff --git a/COMETwebapp/wwwroot/css/app.css b/COMETwebapp/wwwroot/css/app.css
index e8d71525..d4b25d4a 100644
--- a/COMETwebapp/wwwroot/css/app.css
+++ b/COMETwebapp/wwwroot/css/app.css
@@ -316,4 +316,13 @@ sub {
.search-mark {
background-color: yellow !important;
+ color:black !important;
+}
+
+.drop-area-background-color {
+ background-color: cadetblue !important;
+}
+
+.drop-area-color {
+ color: cadetblue !important;
}