Files
jdescopingtool/NEW/src/Utils/JdeScoping.ConfigManager/ViewModels/PipelineSteps/DestinationStepViewModel.cs
T
Joseph Doherty ba54a87be5 refactor(configmanager): migrate to per-file pipeline system
Align ConfigManager with DataSync's per-file pipeline format (pipeline.*.json)
by reusing EtlPipelineConfig types directly, eliminating duplicate models and
simplifying the codebase. Removes ~3200 lines of obsolete code.
2026-01-23 02:30:48 -05:00

76 lines
2.4 KiB
C#

using JdeScoping.DataSync.Configuration;
namespace JdeScoping.ConfigManager.ViewModels.PipelineSteps;
/// <summary>
/// View model for the destination step in a pipeline.
/// </summary>
public class DestinationStepViewModel : PipelineStepViewModelBase
{
private readonly DestinationElement _model;
public DestinationStepViewModel(DestinationElement model, Action onChanged) : base(onChanged)
{
_model = model ?? throw new ArgumentNullException(nameof(model));
}
public override PipelineStepType StepType => PipelineStepType.Destination;
public override string DisplayName => "Destination";
public override string Icon => "󰆼"; // mdi-database
public override string Summary => !string.IsNullOrEmpty(Table) ? $"→ {Table}" : "(no table)";
/// <summary>
/// Gets or sets the destination table name.
/// </summary>
public string Table
{
get => _model.Table;
set
{
if (_model.Table != value)
{
_model.Table = value ?? string.Empty;
OnPropertyChanged();
OnPropertyChanged(nameof(Summary));
NotifyChanged();
}
}
}
/// <summary>
/// Gets or sets the match columns as newline-separated text.
/// </summary>
public string MatchColumnsText
{
get => string.Join("\n", _model.MatchColumns);
set
{
var columns = (value ?? string.Empty).Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).ToList();
if (!_model.MatchColumns.SequenceEqual(columns))
{
_model.MatchColumns = columns;
OnPropertyChanged();
NotifyChanged();
}
}
}
/// <summary>
/// Gets or sets the columns to exclude from updates as newline-separated text.
/// </summary>
public string ExcludeFromUpdateText
{
get => string.Join("\n", _model.ExcludeFromUpdate);
set
{
var columns = (value ?? string.Empty).Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).ToList();
if (!_model.ExcludeFromUpdate.SequenceEqual(columns))
{
_model.ExcludeFromUpdate = columns;
OnPropertyChanged();
NotifyChanged();
}
}
}
}