783da8e21a
Replace raw-JSON text inputs with rich UI: script parameter/return types use a JSON Schema builder (SchemaBuilder + JsonSchemaShapeParser, with a migration to convert existing definitions); alarm trigger config uses a type-aware editor with a flattened attribute picker (AlarmTriggerEditor). AlarmActor gains optional direction (rising/falling/either) on RateOfChange triggers.
21 lines
737 B
C#
21 lines
737 B
C#
using ScadaLink.CentralUI.ScriptAnalysis;
|
|
|
|
namespace ScadaLink.CentralUI.Components.Shared;
|
|
|
|
/// <summary>
|
|
/// Parses the parameter-definitions JSON Schema written by SchemaBuilder and
|
|
/// returns the declared parameter names (and shapes). Used by script-edit
|
|
/// pages to feed the Monaco editor's Parameters["..."] context.
|
|
/// </summary>
|
|
public static class ScriptParameterNames
|
|
{
|
|
public static IReadOnlyList<string> Parse(string? json) =>
|
|
JsonSchemaShapeParser.ParseParameters(json)
|
|
.Select(p => p.Name)
|
|
.Where(s => !string.IsNullOrEmpty(s))
|
|
.ToList();
|
|
|
|
public static IReadOnlyList<ParameterShape> ParseShapes(string? json) =>
|
|
JsonSchemaShapeParser.ParseParameters(json);
|
|
}
|