refactor: rename ScadaLink → ZB.MOM.WW.ScadaBridge (code + projects + namespaces)
Solution + 23 src projects + 26 test projects renamed; folders, csproj, namespaces, and ScadaLinkDbContext/ScadaBridgeDbContext class updated. ActorSystem "scadalink" → "scadabridge", Akka seed-node URLs migrated. SQL roles/logins, LDAP domains, CLI command name, and CLI config dir (~/.scadalink → ~/.scadabridge) also renamed. Build green; 5 Host.Tests fail awaiting SQL login rename in next commit. Pre-existing StaleTagMonitor timing flakes unchanged. Rename script committed at tools/rename-to-scadabridge.sh.
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
### Task 1: Trigger model + codecs
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/ScadaLink.Commons/Types/Enums/AlarmTriggerType.cs`
|
||||
- Modify: `src/ScadaLink.CentralUI/Components/Shared/ScriptTriggerConfigCodec.cs`
|
||||
- Modify: `src/ScadaLink.CentralUI/Components/Shared/AlarmTriggerConfigCodec.cs`
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.Commons/Types/Enums/AlarmTriggerType.cs`
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/ScriptTriggerConfigCodec.cs`
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/AlarmTriggerConfigCodec.cs`
|
||||
|
||||
**Step 1: Add the `Expression` alarm trigger type.**
|
||||
In `AlarmTriggerType.cs`, add `Expression` as the last enum member (append — do not reorder; the enum is persisted by value):
|
||||
@@ -46,12 +46,12 @@ public enum AlarmTriggerType
|
||||
- `Serialize`: `case AlarmTriggerType.Expression:` → `w.WriteString("expression", model.Expression ?? "");` (note: this codec always writes `attributeName` first — for Expression that key is unused; leave it written empty, harmless, or guard it. Prefer: skip the `attributeName` write when `type == Expression`.)
|
||||
|
||||
**Step 4: Build.**
|
||||
Run: `dotnet build src/ScadaLink.CentralUI/ScadaLink.CentralUI.csproj -nologo`
|
||||
Run: `dotnet build src/ZB.MOM.WW.ScadaBridge.CentralUI/ZB.MOM.WW.ScadaBridge.CentralUI.csproj -nologo`
|
||||
Expected: `Build succeeded`.
|
||||
|
||||
**Step 5: Commit.**
|
||||
```bash
|
||||
git add src/ScadaLink.Commons/Types/Enums/AlarmTriggerType.cs src/ScadaLink.CentralUI/Components/Shared/ScriptTriggerConfigCodec.cs src/ScadaLink.CentralUI/Components/Shared/AlarmTriggerConfigCodec.cs
|
||||
git add src/ZB.MOM.WW.ScadaBridge.Commons/Types/Enums/AlarmTriggerType.cs src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/ScriptTriggerConfigCodec.cs src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/AlarmTriggerConfigCodec.cs
|
||||
git commit -m "feat(triggers): add Expression to the script & alarm trigger codecs"
|
||||
```
|
||||
|
||||
@@ -60,15 +60,15 @@ git commit -m "feat(triggers): add Expression to the script & alarm trigger code
|
||||
### Task 2: Runtime expression evaluation
|
||||
|
||||
**Files:**
|
||||
- Create: `src/ScadaLink.SiteRuntime/Scripts/TriggerExpressionGlobals.cs`
|
||||
- Modify: `src/ScadaLink.SiteRuntime/Scripts/ScriptCompilationService.cs`
|
||||
- Modify: `src/ScadaLink.SiteRuntime/Actors/ScriptActor.cs`
|
||||
- Modify: `src/ScadaLink.SiteRuntime/Actors/AlarmActor.cs`
|
||||
- Create: `src/ZB.MOM.WW.ScadaBridge.SiteRuntime/Scripts/TriggerExpressionGlobals.cs`
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.SiteRuntime/Scripts/ScriptCompilationService.cs`
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.SiteRuntime/Actors/ScriptActor.cs`
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.SiteRuntime/Actors/AlarmActor.cs`
|
||||
|
||||
**Step 1: Create `TriggerExpressionGlobals`.**
|
||||
A read-only globals type backed by a snapshot dictionary. Exposes only attribute reads — no `Instance`/`Scripts`/`ExternalSystem`/`Database`/`Notify`. Mirror the shape of `ScopeAccessors` but read straight from the dict (no actor Ask). Missing key → `null`.
|
||||
```csharp
|
||||
namespace ScadaLink.SiteRuntime.Scripts;
|
||||
namespace ZB.MOM.WW.ScadaBridge.SiteRuntime.Scripts;
|
||||
|
||||
/// <summary>
|
||||
/// Read-only globals a trigger expression is compiled against. Exposes only
|
||||
@@ -135,12 +135,12 @@ Read the existing `Compile` (lines ~94-148) and factor the shared option-buildin
|
||||
- Same try/catch → `false` + log on throw.
|
||||
|
||||
**Step 5: Build.**
|
||||
Run: `dotnet build src/ScadaLink.Host/ScadaLink.Host.csproj -nologo`
|
||||
Run: `dotnet build src/ZB.MOM.WW.ScadaBridge.Host/ZB.MOM.WW.ScadaBridge.Host.csproj -nologo`
|
||||
Expected: `Build succeeded`.
|
||||
|
||||
**Step 6: Commit.**
|
||||
```bash
|
||||
git add src/ScadaLink.SiteRuntime/
|
||||
git add src/ZB.MOM.WW.ScadaBridge.SiteRuntime/
|
||||
git commit -m "feat(triggers): runtime expression trigger evaluation for scripts and alarms"
|
||||
```
|
||||
|
||||
@@ -149,9 +149,9 @@ git commit -m "feat(triggers): runtime expression trigger evaluation for scripts
|
||||
### Task 3: Trigger editor panels (CentralUI)
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/ScadaLink.CentralUI/Components/Shared/ScriptTriggerEditor.razor`
|
||||
- Modify: `src/ScadaLink.CentralUI/Components/Shared/AlarmTriggerEditor.razor`
|
||||
- Reference: `src/ScadaLink.CentralUI/Components/Shared/MonacoEditor.razor`, `src/ScadaLink.CentralUI/Components/Pages/Design/TemplateEdit.razor` (how the script Code editor is fed `SelfAttributes`/`Children`/`Parent`)
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/ScriptTriggerEditor.razor`
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/AlarmTriggerEditor.razor`
|
||||
- Reference: `src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/MonacoEditor.razor`, `src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Pages/Design/TemplateEdit.razor` (how the script Code editor is fed `SelfAttributes`/`Children`/`Parent`)
|
||||
|
||||
**Step 1: `ScriptTriggerEditor` — Expression panel.**
|
||||
- The codec already has the `Expression` kind (Task 1). Add `<option value="Expression">Expression — run when a boolean expression becomes true</option>` to the type `<select>`.
|
||||
@@ -168,12 +168,12 @@ git commit -m "feat(triggers): runtime expression trigger evaluation for scripts
|
||||
Both editors already receive `AvailableAttributes` (`IReadOnlyList<AlarmAttributeChoice>`). `MonacoEditor` wants `SelfAttributes` (`AttributeShape[]`) / `Children` / `Parent`. Add a small mapper from `AlarmAttributeChoice` → the Monaco metadata (Direct/Inherited → `SelfAttributes`; Composed → `Children` contexts). Keep it minimal — at least pass `SelfAttributes` so `Attributes["..."]` completion works.
|
||||
|
||||
**Step 4: Build.**
|
||||
Run: `dotnet build src/ScadaLink.CentralUI/ScadaLink.CentralUI.csproj -nologo`
|
||||
Run: `dotnet build src/ZB.MOM.WW.ScadaBridge.CentralUI/ZB.MOM.WW.ScadaBridge.CentralUI.csproj -nologo`
|
||||
Expected: `Build succeeded`.
|
||||
|
||||
**Step 5: Commit.**
|
||||
```bash
|
||||
git add src/ScadaLink.CentralUI/Components/Shared/
|
||||
git add src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/
|
||||
git commit -m "feat(ui/triggers): expression trigger panel in the script & alarm editors"
|
||||
```
|
||||
|
||||
@@ -182,7 +182,7 @@ git commit -m "feat(ui/triggers): expression trigger panel in the script & alarm
|
||||
### Task 4: Pre-deployment validation
|
||||
|
||||
**Files:**
|
||||
- Modify: `src/ScadaLink.TemplateEngine/.../ValidationService.cs` (the file with `ValidateScriptTriggerReferences` / `ExtractAttributeNameFromTriggerConfig`)
|
||||
- Modify: `src/ZB.MOM.WW.ScadaBridge.TemplateEngine/.../ValidationService.cs` (the file with `ValidateScriptTriggerReferences` / `ExtractAttributeNameFromTriggerConfig`)
|
||||
|
||||
**Step 1: Compile-check expression triggers.**
|
||||
In the validation pass, for any script/alarm whose trigger type is `Expression`, extract `expression` from `TriggerConfiguration` and compile-check it. The TemplateEngine project may not reference the SiteRuntime compiler — if so, do a Roslyn syntax/compile check using the same approach, or surface a clear "expression empty / invalid" check at minimum. Confirm the reference graph during execution; prefer reusing `CompileTriggerExpression` if reachable.
|
||||
@@ -192,8 +192,8 @@ Expression text references `Attributes["X"]`; extend the existing attribute-refe
|
||||
|
||||
**Step 3: Build + commit.**
|
||||
```bash
|
||||
dotnet build src/ScadaLink.Host/ScadaLink.Host.csproj -nologo
|
||||
git add src/ScadaLink.TemplateEngine/
|
||||
dotnet build src/ZB.MOM.WW.ScadaBridge.Host/ZB.MOM.WW.ScadaBridge.Host.csproj -nologo
|
||||
git add src/ZB.MOM.WW.ScadaBridge.TemplateEngine/
|
||||
git commit -m "feat(triggers): validate expression triggers pre-deployment"
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user