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.
This commit is contained in:
+5
-50
@@ -1,24 +1,15 @@
|
||||
using JdeScoping.ConfigManager.Models;
|
||||
using JdeScoping.DataSync.Configuration;
|
||||
|
||||
namespace JdeScoping.ConfigManager.ViewModels.PipelineSteps;
|
||||
|
||||
/// <summary>
|
||||
/// Destination type for the pipeline.
|
||||
/// </summary>
|
||||
public enum DestinationType
|
||||
{
|
||||
BulkImport,
|
||||
BulkMerge
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// View model for the destination step in a pipeline.
|
||||
/// </summary>
|
||||
public class DestinationStepViewModel : PipelineStepViewModelBase
|
||||
{
|
||||
private readonly PipelineDestination _model;
|
||||
private readonly DestinationElement _model;
|
||||
|
||||
public DestinationStepViewModel(PipelineDestination model, Action onChanged) : base(onChanged)
|
||||
public DestinationStepViewModel(DestinationElement model, Action onChanged) : base(onChanged)
|
||||
{
|
||||
_model = model ?? throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
@@ -28,40 +19,6 @@ public class DestinationStepViewModel : PipelineStepViewModelBase
|
||||
public override string Icon => ""; // mdi-database
|
||||
public override string Summary => !string.IsNullOrEmpty(Table) ? $"→ {Table}" : "(no table)";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the destination type (BulkImport or BulkMerge).
|
||||
/// </summary>
|
||||
public DestinationType Type
|
||||
{
|
||||
get => _model.Type?.Equals("BulkImport", StringComparison.OrdinalIgnoreCase) == true
|
||||
? DestinationType.BulkImport
|
||||
: DestinationType.BulkMerge;
|
||||
set
|
||||
{
|
||||
var typeStr = value == DestinationType.BulkImport ? "BulkImport" : "BulkMerge";
|
||||
if (_model.Type != typeStr)
|
||||
{
|
||||
_model.Type = typeStr;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(IsBulkMerge));
|
||||
OnPropertyChanged(nameof(TypeDescription));
|
||||
NotifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the destination type is BulkMerge (shows match columns).
|
||||
/// </summary>
|
||||
public bool IsBulkMerge => Type == DestinationType.BulkMerge;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a description of the current type.
|
||||
/// </summary>
|
||||
public string TypeDescription => Type == DestinationType.BulkImport
|
||||
? "Truncate table and bulk load all data"
|
||||
: "Merge data using match columns (upsert)";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the destination table name.
|
||||
/// </summary>
|
||||
@@ -82,14 +39,13 @@ public class DestinationStepViewModel : PipelineStepViewModelBase
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the match columns as newline-separated text.
|
||||
/// Only used for BulkMerge type.
|
||||
/// </summary>
|
||||
public string MatchColumnsText
|
||||
{
|
||||
get => string.Join("\n", _model.MatchColumns);
|
||||
set
|
||||
{
|
||||
var columns = (value ?? string.Empty).Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
var columns = (value ?? string.Empty).Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).ToList();
|
||||
if (!_model.MatchColumns.SequenceEqual(columns))
|
||||
{
|
||||
_model.MatchColumns = columns;
|
||||
@@ -101,14 +57,13 @@ public class DestinationStepViewModel : PipelineStepViewModelBase
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the columns to exclude from updates as newline-separated text.
|
||||
/// Only used for BulkMerge type.
|
||||
/// </summary>
|
||||
public string ExcludeFromUpdateText
|
||||
{
|
||||
get => string.Join("\n", _model.ExcludeFromUpdate);
|
||||
set
|
||||
{
|
||||
var columns = (value ?? string.Empty).Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
var columns = (value ?? string.Empty).Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).ToList();
|
||||
if (!_model.ExcludeFromUpdate.SequenceEqual(columns))
|
||||
{
|
||||
_model.ExcludeFromUpdate = columns;
|
||||
|
||||
Reference in New Issue
Block a user