1
0
mirror of https://github.com/akpaevj/onecmonitor.git synced 2025-11-25 22:22:15 +02:00

Добавлен слой интеграции с OScript

This commit is contained in:
akpaev.e
2025-08-01 19:08:02 +03:00
parent d978237e3b
commit 9e70e32b79
27 changed files with 361 additions and 18 deletions

View File

@@ -0,0 +1,29 @@
using OneScript.Contexts;
using OneScript.StandardLibrary.Collections;
using OneScript.Values;
using OneSwiss.V8.Platform.Services;
using ScriptEngine.Machine.Contexts;
namespace OneSwiss.OneScript.Oscript;
[ContextClass("СлужбаCrServer", "CrServerService")]
public class CrServerWrapper(CrServer service) : AutoContext<CrServerWrapper>
{
[ContextProperty("Имя", "Name", CanWrite = false)]
public string Name => service.Name;
[ContextProperty("Запущена", "IsActive", CanWrite = false)]
public bool IsActive => service.IsActive;
[ContextProperty("Порт", "Port", CanWrite = false)]
public int Port { get; set; }
[ContextProperty("Каталог", "Directory", CanWrite = false)]
public string Directory { get; set; } = null!;
[ContextProperty("Платформа", "Platform", CanWrite = false)]
public V8PlatformWrapper Platform { get; } = new(service.Platform);
[ContextProperty("Хранилища", "Repositories", CanWrite = false)]
public ArrayImpl Repositories { get; } = new(service.Repositories.Select(BslStringValue.Create));
}

View File

@@ -0,0 +1,20 @@
using OneScript.Contexts;
using OneSwiss.V8.Edt;
using ScriptEngine.Machine.Contexts;
namespace OneSwiss.OneScript.Oscript;
[ContextClass("ИнсталляцияEDT", "EdtInstallation")]
public class EdtInstallationWrapper(EdtInstallation item) : AutoContext<EdtInstallationWrapper>
{
[ContextProperty("Версия", "Version", CanWrite = false)]
public string Version => item.Version;
[ContextProperty("Путь", "Path", CanWrite = false)]
public string Path => item.Path;
[ContextProperty("СуществуетEdtCli", "ExistsEdtCli", CanWrite = false)]
public bool HasEdtCli => item.HasEdtCli;
[ContextProperty("ПутьEdtCli", "PathEdtCli", CanWrite = false)]
public string EdtCliPath => item.EdtCliPath;
[ContextProperty("ИзСтартера", "FromStarter", CanWrite = false)]
public bool FromStarter => item.FromStarter;
}

View File

@@ -0,0 +1,14 @@
using OneScript.Contexts.Enums;
namespace OneSwiss.OneScript.Oscript;
[EnumerationType("ТипОтладкиRagent", "RagentDebugType")]
public enum RagentDebugTypeWrapper
{
[EnumValue("Отключена", "Disabled")]
None,
[EnumValue("TCP")]
Tcp,
[EnumValue("HTTP")]
Http
}

View File

@@ -0,0 +1,32 @@
using OneScript.Contexts;
using OneSwiss.V8.Platform.Services;
using ScriptEngine.Machine.Contexts;
namespace OneSwiss.OneScript.Oscript;
[ContextClass("СервисRagent", "RagentService")]
public class RagentServiceWrapper(RagentService service) : AutoContext<RagentServiceWrapper>
{
public readonly RagentService Service = service;
[ContextProperty("Имя", "Name", CanWrite = false)]
public string Name => Service.Name;
[ContextProperty("Запущена", "IsActive", CanWrite = false)]
public bool IsActive => Service.IsActive;
[ContextProperty("Порт", "Port", CanWrite = false)]
public int Port => Service.Port;
[ContextProperty("ПортReg", "RegPort", CanWrite = false)]
public int RegPort => Service.RegPort;
[ContextProperty("КаталогКластера", "ClusterCatalog", CanWrite = false)]
public string ClusterCatalog => Service.ClusterCatalog;
[ContextProperty("Платформа", "Platform", CanWrite = false)]
public V8PlatformWrapper Platform { get; } = new(service.Platform);
[ContextProperty("ТипОтладки", "DebugType", CanWrite = false)]
public RagentDebugTypeWrapper DebugType { get; } = (RagentDebugTypeWrapper)service.DebugType;
}

View File

@@ -0,0 +1,30 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using OneScript.Contexts;
using OneSwiss.V8.Platform;
using OneSwiss.V8.Platform.Services;
using ScriptEngine.Machine.Contexts;
namespace OneSwiss.OneScript.Oscript;
[ContextClass("СервисRas", "RasService")]
public class RasServiceWrapper(RasService service) : AutoContext<RasServiceWrapper>
{
[ContextProperty("Имя", "Name", CanWrite = false)]
public string Name => service.Name;
[ContextProperty("Запущена", "IsActive", CanWrite = false)]
public bool IsActive => service.IsActive;
[ContextProperty("ХостRagent", "RagentHost", CanWrite = false)]
public string RagentHost => service.RagentHost;
[ContextProperty("ПортRagent", "RagentPort", CanWrite = false)]
public int RagentPort => service.Port;
[ContextProperty("Порт", "Port", CanWrite = false)]
public int Port => service.Port;
[ContextProperty("Платформа", "Platform", CanWrite = false)]
public V8PlatformWrapper Platform { get; } = new V8PlatformWrapper(service.Platform);
}

View File

@@ -0,0 +1,32 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using OneScript.Contexts;
using OneSwiss.V8.Platform;
using ScriptEngine.Machine.Contexts;
namespace OneSwiss.OneScript.Oscript;
[ContextClass("ПлатформаV8", "V8Platform")]
public class V8PlatformWrapper(V8Platform platform) : AutoContext<V8PlatformWrapper>
{
[ContextProperty("Путь", "Path", CanWrite = false)]
public string PlatformPath => platform.PlatformPath;
[ContextProperty("Существует1CV8", "Exists1CV8", CanWrite = false)]
public bool HasOnecV8 => platform.HasOnecV8;
[ContextProperty("Путь1CV8", "Path1CV8", CanWrite = false)]
public string OnecV8Path => platform.OnecV8Path;
[ContextProperty("СуществуетRac", "ExistsRac", CanWrite = false)]
public bool HasRac => platform.HasRac;
[ContextProperty("ПутьRac", "PathRac", CanWrite = false)]
public string RacPath => platform.RacPath;
[ContextProperty("СуществуетRas", "ExistsRas", CanWrite = false)]
public bool HasRas => platform.HasRas;
[ContextProperty("ПутьRas", "PathRas", CanWrite = false)]
public string RasPath => platform.RasPath;
[ContextProperty("СуществуетIbcmd", "ExistsIbcmd", CanWrite = false)]
public bool HasIbcmd => platform.HasIbcmd;
[ContextProperty("ПутьIbcmd", "PathIbcmd", CanWrite = false)]
public string IbcmdPath => platform.IbcmdPath;
[ContextProperty("Версия", "Version", CanWrite = false)]
public string Version => platform.Version;
}

View File

@@ -0,0 +1,14 @@
using OneScript.Contexts;
using OneSwiss.V8.Platform.Services;
using ScriptEngine.Machine.Contexts;
namespace OneSwiss.OneScript.Oscript;
[ContextClass("СлужбаV8", "V8Service")]
public class V8ServiceWrapper(V8Service item) : AutoContext<V8ServiceWrapper>
{
[ContextProperty("Имя", "Name", CanWrite = false)]
public string Name => item.Name;
[ContextProperty("Запущена", "IsActive", CanWrite = false)]
public bool IsActive => item.IsActive;
}