diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8eb90b8c..76637c8e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -26,7 +26,8 @@ If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. Microsoft Windows [Version 10.0.18363.1082]] - ix version - - simatix-ax version [eg. 4024.10] + - simatix-ax version (attach apax.yml file) + - hardware/software target type and version (e.g. S71516, PLCSIM Advanced) - other tools used (visual studio, vscode) **Additional context** diff --git a/.github/issue-branch.yml b/.github/issue-branch.yml new file mode 100644 index 00000000..2c57abf6 --- /dev/null +++ b/.github/issue-branch.yml @@ -0,0 +1,3 @@ +mode: chatops +branchName: '${issue.number}-${issue.title}' +openDraftPR: true \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/pull_request_template.md similarity index 92% rename from .github/PULL_REQUEST_TEMPLATE/pull_request_template.md rename to .github/pull_request_template.md index 8aca198d..df07f97e 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ b/.github/pull_request_template.md @@ -23,10 +23,13 @@ Please describe the tests that you ran to verify your changes. Provide instructi - [ ] Test B **Test Configuration**: -* simatix-ax version: + +* simatix-ax version (apax.yml): * ix version: -* Hardware PLC: -* Other hardware: +* PLC Target system: +* PLC Firmware version: +* OS System: +* Other relevant hardware: # Checklist: diff --git a/.github/workflows/create_issue.yml b/.github/workflows/create_issue.yml new file mode 100644 index 00000000..806772f2 --- /dev/null +++ b/.github/workflows/create_issue.yml @@ -0,0 +1,17 @@ +on: + issues: + types: [assigned] + issue_comment: + types: [created] + pull_request: + types: [closed] + +jobs: + create_issue_branch_job: + runs-on: ubuntu-latest + steps: + - name: Create Issue Branch + uses: robvanderleek/create-issue-branch@main + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 143dd8b5..fbccce39 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -6,13 +6,7 @@ on: paths: - 'src/**' - 'cake/**' - - '.github/**' - pull_request: - branches: [ "dev" ] - paths: - - 'src/**' - - 'cake/**' - - '.github/**' + - '.github/**' workflow_dispatch: jobs: @@ -33,5 +27,14 @@ jobs: run: dotnet build cake/Build.csproj - name: "Run build script" - run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 1 + env: + GH_TOKEN : ${{ secrets.GH_TOKEN }} + run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 2 --do-publish true + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Test report + path: 'TestResults/*.xml' + reporter: dotnet-trx diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index c9186aa9..7f2e40b7 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -33,5 +33,14 @@ jobs: run: dotnet build cake/Build.csproj - name: "Run build script" - run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 100 --do-publish true + env: + GH_TOKEN : ${{ secrets.GH_TOKEN }} + run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 100 --do-publish true --do-publish-release true + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Test report + path: 'TestResults/*.xml' + reporter: dotnet-trx diff --git a/.github/workflows/pr-dev.yml b/.github/workflows/pr-dev.yml new file mode 100644 index 00000000..6d27cfdf --- /dev/null +++ b/.github/workflows/pr-dev.yml @@ -0,0 +1,37 @@ +name: pr-dev + +on: + pull_request: + branches: [ "dev" ] + paths: + - 'src/**' + - 'cake/**' + - '.github/**' + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + configuration: [Release] + + runs-on: [self-hosted, Windows, X64, L2] # For a list of available runner types, refer to + # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: '0' + + - name: "Build script" + run: dotnet build cake/Build.csproj + + - name: "Run build script" + run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 1 + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Test report + path: 'TestResults/*.xml' + reporter: dotnet-trx diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f49f9d2b..3f3587e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,5 +33,14 @@ jobs: run: dotnet build cake/Build.csproj - name: "Run build script" - run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 100 --do-publish true + env: + GH_TOKEN : ${{ secrets.GH_TOKEN }} + run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 100 --do-publish true --do-publish-release true + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Test report + path: 'TestResults/*.xml' + reporter: dotnet-trx diff --git a/.gitignore b/.gitignore index f0864664..8e7e590f 100644 --- a/.gitignore +++ b/.gitignore @@ -403,3 +403,4 @@ ix/.g/** .apax/ /src/apax/stc-generic-x64 +TestResults/ diff --git a/GitVersion.yml b/GitVersion.yml index abc83129..964e3d3b 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,5 +1,5 @@ mode: ContinuousDeployment -next-version: 0.12.0 +next-version: 0.13.0 branches: main: regex: ^master$|^main$ diff --git a/README.md b/README.md index 309dc4f7..1c1ecede 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ -# [WIP] RUNNING SOME POST PUBLISH TESTS - ![](assets/pics/banner_wider.png) + +[![dev](https://github.com/ix-ax/ix/actions/workflows/dev.yml/badge.svg?branch=dev)](https://github.com/ix-ax/ix/actions/workflows/dev.yml) +[![preview](https://github.com/ix-ax/ix/actions/workflows/release.yml/badge.svg?branch=releases%2Fv0)](https://github.com/ix-ax/ix/actions/workflows/release.yml) +[![master](https://github.com/ix-ax/ix/actions/workflows/master.yml/badge.svg?branch=master)](https://github.com/ix-ax/ix/actions/workflows/master.yml) +![semver](https://img.shields.io/badge/semver-0.10.0-blue) +[![GitHub license](https://badgen.net/github/license/Naereen/Strapdown.js)](https://github.com/ix-ax/ix/blob/master/LICENSE) + + # IX The **IX** is a series of tools that extend SIMATIC AX (Automation Xpansion) with a flexible and powerful connection with .NET ecosystem. IX includes a compiler (`ixc`) that translates PLC data structures into C# (PLC .NET Twin), which makes the PLC data available in a structured way for any .NET application. Furthermore, presentation libraries provide additional features for the automated rendering of PLC data in the UI/HMI. diff --git a/SECURITY.md b/SECURITY.md index 0aaa143b..0266f23f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -14,6 +14,6 @@ ix is in development; we will address the security issues in the latest pre-rele ## Reporting a Vulnerability **Please do not disclose the vulnerability in the publicly available parts of this repo.** -The vulnerabilities should be reported to the following email ix-team@kurhajec.com +The vulnerabilities should be reported to the following email team@ixcite.tech We will address the security issue in a separate workflow. diff --git a/cake/BuildContext.cs b/cake/BuildContext.cs index af5ccda8..de17da26 100644 --- a/cake/BuildContext.cs +++ b/cake/BuildContext.cs @@ -5,6 +5,7 @@ // https://github.com/ix-ax/ix/blob/master/LICENSE // Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md +using System.Collections.Generic; using System.IO; using Cake.Common.Tools.DotNet; using Cake.Common.Tools.DotNet.Build; @@ -19,6 +20,8 @@ public class BuildContext : FrostingContext { public string Artifacts => Path.Combine(Environment.WorkingDirectory.FullPath, "..//artifacts//"); + public string TestResults => Path.Combine(Environment.WorkingDirectory.FullPath, "..//TestResults//"); + public string WorkDirName => Environment.WorkingDirectory.GetDirectoryName(); public string ApiDocumentationDir => Path.GetFullPath(Path.Combine(Environment.WorkingDirectory.FullPath, "..//docs//api//")); @@ -55,8 +58,9 @@ public BuildContext(ICakeContext context, BuildParameters buildParameters) Verbosity = buildParameters.Verbosity, Configuration = buildParameters.Configuration, NoRestore = true, - NoBuild = true - + NoBuild = true, + DiagnosticOutput = true, + VSTestReportPath = TestResults, }; DotNetRunSettings = new DotNetRunSettings() @@ -68,4 +72,6 @@ public BuildContext(ICakeContext context, BuildParameters buildParameters) NoRestore = true, }; } + + public IEnumerable TargetFrameworks { get; } = new List() { "net6.0", "net7.0" }; } \ No newline at end of file diff --git a/cake/BuildParameters.cs b/cake/BuildParameters.cs index 6a1d7650..3c35d6d7 100644 --- a/cake/BuildParameters.cs +++ b/cake/BuildParameters.cs @@ -30,4 +30,7 @@ public class BuildParameters [Option('l', "test-level", Required = false, Default = 1, HelpText = "Test level 1 - 3")] public int TestLevel { get; set; } + + [Option('r', "do-publish-release", Required = false, Default = false, HelpText = "Publishes release on GH")] + public bool DoPublishRelease { get; set; } } \ No newline at end of file diff --git a/cake/FilteredSolution/FilteredSolution.cs b/cake/FilteredSolution/FilteredSolution.cs new file mode 100644 index 00000000..e7db360c --- /dev/null +++ b/cake/FilteredSolution/FilteredSolution.cs @@ -0,0 +1,25 @@ +// Build +// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. +// Contributors: https://github.com/ix-ax/ix/graphs/contributors +// See the LICENSE file in the repository root for more information. +// https://github.com/ix-ax/ix/blob/master/LICENSE +// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md + +using System.Collections.Generic; +using System.IO; +using Newtonsoft.Json; + +namespace Build.FilteredSolution; + +public class FilteredSolution +{ + public string path { get; set; } + public List projects { get; set; } + + public static SolutionRoot Parse(string pathToFilteredSolution) + { + var json = File.ReadAllText(pathToFilteredSolution); + SolutionRoot solution = JsonConvert.DeserializeObject(json); + return solution; + } +} \ No newline at end of file diff --git a/cake/FilteredSolution/SolutionRoot.cs b/cake/FilteredSolution/SolutionRoot.cs new file mode 100644 index 00000000..84544434 --- /dev/null +++ b/cake/FilteredSolution/SolutionRoot.cs @@ -0,0 +1,13 @@ +// Build +// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. +// Contributors: https://github.com/ix-ax/ix/graphs/contributors +// See the LICENSE file in the repository root for more information. +// https://github.com/ix-ax/ix/blob/master/LICENSE +// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md + +using Build.FilteredSolution; + +public class SolutionRoot +{ + public FilteredSolution solution { get; set; } +} \ No newline at end of file diff --git a/cake/Program.cs b/cake/Program.cs index 63810991..d1d07c1d 100644 --- a/cake/Program.cs +++ b/cake/Program.cs @@ -16,12 +16,14 @@ using System.Net; using System.Text; using System.Threading.Tasks; +using Build.FilteredSolution; using Cake.Common; using Cake.Common.IO; using Cake.Common.Tools.DotNet; using Cake.Common.Tools.DotNet.Clean; using Cake.Core.Diagnostics; using Cake.Core.IO; +using Cake.Core.Tooling; using Cake.Frosting; using Cake.Powershell; using CliWrap; @@ -60,7 +62,8 @@ public sealed class CleanUpTask : FrostingTask public override void Run(BuildContext context) { context.DotNetClean(Path.Combine(context.RootDir, "ix.sln"), new DotNetCleanSettings() { Verbosity = context.BuildParameters.Verbosity}); - context.CleanDirectory(context.Artifacts); + context.CleanDirectory(context.Artifacts); + context.CleanDirectory(context.TestResults); } } @@ -140,15 +143,15 @@ public override void Run(BuildContext context) if (context.BuildParameters.TestLevel == 1) { - context.DotNetTest(Path.Combine(context.RootDir, "ix-L1-tests.slnf"), context.DotNetTestSettings); + RunTestsFromFilteredSolution(context, Path.Combine(context.RootDir, "ix-L1-tests.slnf")); } else if (context.BuildParameters.TestLevel == 2) { - context.DotNetTest(Path.Combine(context.RootDir, "ix-L2-tests.slnf"), context.DotNetTestSettings); + RunTestsFromFilteredSolution(context, Path.Combine(context.RootDir, "ix-L2-tests.slnf")); } else if (context.BuildParameters.TestLevel == 3) { - context.DotNetTest(Path.Combine(context.RootDir, "ix-L3-tests.slnf"), context.DotNetTestSettings); + RunTestsFromFilteredSolution(context, Path.Combine(context.RootDir, "ix-L3-tests.slnf")); } else { @@ -160,13 +163,28 @@ public override void Run(BuildContext context) UploadTestPlc(context, workingDirectory, targetIp, targetPlatform); - context.DotNetTest(Path.Combine(context.RootDir, "ix.sln"), context.DotNetTestSettings); + RunTestsFromFilteredSolution(context, Path.Combine(context.RootDir, "ix-L3-tests.slnf")); } } + private static void RunTestsFromFilteredSolution(BuildContext context, string filteredSolutionFile) + { + foreach (var project in FilteredSolution.Parse(filteredSolutionFile).solution.projects + .Select(p => new FileInfo(Path.Combine(context.RootDir, p))) + .Where(p => p.Name.ToUpperInvariant().Contains("TEST"))) + { + foreach (var framework in context.TargetFrameworks) + { + context.DotNetTestSettings.VSTestReportPath = Path.Combine(context.TestResults, $"{project.Name}_{framework}.xml"); + context.DotNetTestSettings.Framework = framework; + context.DotNetTest(Path.Combine(project.FullName), context.DotNetTestSettings); + } + } + } + private static void UploadTestPlc(BuildContext context, string workingDirectory, string targetIp, string targetPlatform) { @@ -234,7 +252,24 @@ public override void Run(BuildContext context) foreach (var templateCsProjFile in templateCsProjFiles) { - var packagesToUpdate = new List() { "Ix.Abstractions", "Ix.Connector", "Ix.Connector.Sax.WebAPI" }; + var packagesToUpdate = new List() + { + "Ix.Abstractions", + "Ix.Connector", + "Ix.Connector.S71500.WebAPI", + "Ix.Presentation.Blazor.Controls", + "Ix.Presentation.Blazor" + }; + + foreach (var packageId in packagesToUpdate) + { + ix.nuget.update.Program.Update(new Options() { NewVersion = GitVersionInformation.SemVer, PackageId = packageId, FileToUpdate = templateCsProjFile }); + } + } + var templateToolDotnetTools = Directory.EnumerateFiles(templatesDirectory, "dotnet-tools.json", SearchOption.AllDirectories); + foreach (var templateCsProjFile in templateToolDotnetTools) + { + var packagesToUpdate = new List() { "ix.ixc" }; foreach (var packageId in packagesToUpdate) { ix.nuget.update.Program.Update(new Options() { NewVersion = GitVersionInformation.SemVer, PackageId = packageId, FileToUpdate = templateCsProjFile }); @@ -377,7 +412,7 @@ public sealed class PublishReleaseTask : FrostingTask { public override void Run(BuildContext context) { - if (!context.BuildParameters.DoPublish) + if (!context.BuildParameters.DoPublishRelease) { context.Log.Warning($"Skipping package release."); return; diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 00000000..40aece7d --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +www.ixcite.tech \ No newline at end of file diff --git a/docs/_coverpage.md b/docs/_coverpage.md index 334c9642..3733636e 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,5 +1,8 @@ +# INDUSTRIAL AUTOMATION EXPANSION + ![](_media/readme/logo-color-sm.png) -# INDUSTRIAL AUTOMATION EXPANSION +## OPEN SOURCE FOR INDUSTRIAL AUTOMATION ## Bind SIMATIC AX based projects with .NET ecosystem + diff --git a/docs/articles/blazor/RENDERABLECONTENT.md b/docs/articles/blazor/RENDERABLECONTENT.md index 31ca361e..9c618943 100644 --- a/docs/articles/blazor/RENDERABLECONTENT.md +++ b/docs/articles/blazor/RENDERABLECONTENT.md @@ -173,7 +173,7 @@ testIxComponent: IxComponent; ### **Layouts** Auto-generated UI can be customized by layouts. -More information about layout is in **[LAYOUTS](LAYOUTS.MD)** file. +More information about layout is in **[LAYOUTS](LAYOUTS.md)** file.
### **Styling** diff --git a/docs/articles/compiler/ATTRIBUTES.md b/docs/articles/compiler/ATTRIBUTES.md index aa84e54a..b3d16cef 100644 --- a/docs/articles/compiler/ATTRIBUTES.md +++ b/docs/articles/compiler/ATTRIBUTES.md @@ -62,3 +62,8 @@ CLASS PUBLIC MyClass END_VAR END_CLASS ~~~ + + +### See also + +#### [RenderIgnore](../blazor/RENDERABLECONTENT.md#renderignore-and-custom-labels) \ No newline at end of file diff --git a/src/ix-L3-tests.slnf b/src/ix-L3-tests.slnf index 9a44e75f..7c1e4e38 100644 --- a/src/ix-L3-tests.slnf +++ b/src/ix-L3-tests.slnf @@ -2,19 +2,40 @@ "solution": { "path": "ix.sln", "projects": [ + "ix.abstractions\\src\\Ix.Abstractions\\Ix.Abstractions.csproj", + "ix.blazor\\src\\Ix.Presentation.Blazor.Controls\\Ix.Presentation.Blazor.Controls.csproj", + "ix.blazor\\src\\Ix.Presentation.Blazor\\Ix.Presentation.Blazor.csproj", "ix.blazor\\tests\\sandbox\\ComponentsExamples\\ComponentsExamples.csproj", "ix.blazor\\tests\\sandbox\\Ix.RenderableContent.Tests\\Ix.RenderableContent.Tests.csproj", "ix.blazor\\tests\\sandbox\\IxBlazor.App\\IxBlazor.App.csproj", "ix.blazor\\tests\\sandbox\\ax-blazor-example\\ix\\ax-blazor-example.csproj", + "ix.compiler\\src\\IX.Compiler\\Ix.Compiler.csproj", + "ix.compiler\\src\\IX.Cs.Compiler\\Ix.Compiler.Cs.csproj", + "ix.compiler\\src\\Ix.Compiler.Abstractions\\Ix.Compiler.Abstractions.csproj", + "ix.compiler\\src\\ixc\\Ix.ixc.csproj", "ix.compiler\\tests\\IX.CompilerTests\\Ix.CompilerTests.csproj", "ix.compiler\\tests\\Ix.Compiler.CsTests\\Ix.Compiler.CsTests.csproj", "ix.compiler\\tests\\Ix.ixc.Tests\\Ix.ixc.Tests.csproj", + "ix.connectors\\src\\Ix.Connector.S71500.WebAPI\\Ix.Connector.S71500.WebAPI.csproj", + "ix.connectors\\src\\Ix.Connector\\Ix.Connector.csproj", + "ix.connectors\\tests\\Ix.Connector.Sax.WebAPITests\\Ix.Connector.S71500.WebAPITests.csproj", "ix.connectors\\tests\\Ix.ConnectorLegacyTests\\Ix.ConnectorLegacyTests.csproj", "ix.connectors\\tests\\Ix.ConnectorTests\\Ix.ConnectorTests\\Ix.ConnectorTests.csproj", "ix.connectors\\tests\\ax-test-project\\ix\\ax_test_project.csproj", "ix.connectors\\tests\\exploring\\Webserver.Api.Exploratory\\Webserver.Api.Exploratory.csproj", "ix.connectors\\tests\\exploring\\exploratory.consoleapp\\exploratory.consoleapp.csproj", - "ix.tools\\tests\\ix.nuget.update.Tests\\ix.nuget.update.Tests.csproj" + "ix.examples\\hello.world.console\\hello.world.console.plc\\ix\\hello.world.console.plc.csproj", + "ix.examples\\hello.world.console\\hello.world.console\\hello.world.console.csproj", + "ix.templates\\working\\ix.templates.csproj", + "ix.templates\\working\\templates\\ixblazor\\ixblazor.twin\\ixblazor.csproj", + "ix.templates\\working\\templates\\ixblazor\\ixblazor\\ixblazor.app.csproj", + "ix.templates\\working\\templates\\ixconsole\\ixconsole.twin\\ixconsole.csproj", + "ix.templates\\working\\templates\\ixconsole\\ixconsole\\ixconsole.app.csproj", + "ix.templates\\working\\templates\\ixtwin\\ixtwin.csproj", + "ix.tools\\src\\ix.nuget.update\\ix.nuget.update.csproj", + "ix.tools\\tests\\ix.nuget.update.Tests\\ix.nuget.update.Tests.csproj", + "sanbox\\integration\\ix-integration-blazor\\ix-integration-blazor.csproj", + "sanbox\\integration\\ix-integration-plc\\ix\\ix-integration-plc.csproj" ] } } \ No newline at end of file diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/RenderableContent/RenderableContentControl.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/RenderableContent/RenderableContentControl.cs index 41b46cff..1deff47b 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/RenderableContent/RenderableContentControl.cs +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/RenderableContent/RenderableContentControl.cs @@ -144,6 +144,9 @@ private RenderFragment CreatePrimitiveComponent(ITwinPrimitive twinPrimitive, IR if (primitiveComponent == null) return; __builder.OpenComponent(1, primitiveComponent.GetType()); __builder.AddAttribute(2, "Onliner", twinPrimitive); + + bool hasReadOnly = twinPrimitive.ReadWriteAccess == Connector.ValueTypes.ReadWriteAccess.Read; + __builder.AddAttribute(3, "IsReadOnly", hasReadOnly); __builder.CloseComponent(); }; @@ -167,12 +170,14 @@ private RenderFragment CreateComplexComponent(ITwinObject twin, IRenderableCompo __builder.CloseComponent(); }; - private RenderFragment CreateEnumComponent(EnumeratorDiscriminatorAttribute enumDiscriminatorAttribute, ITwinElement kid, IRenderableComponent component) => __builder => + private RenderFragment CreateEnumComponent(EnumeratorDiscriminatorAttribute enumDiscriminatorAttribute, ITwinPrimitive kid, IRenderableComponent component) => __builder => { if (component == null) return; __builder.OpenComponent(0, component.GetType()); __builder.AddAttribute(1, "Onliner", kid); __builder.AddAttribute(2, "EnumDiscriminatorAttribute", enumDiscriminatorAttribute); + bool hasReadOnly = kid.ReadWriteAccess == Connector.ValueTypes.ReadWriteAccess.Read; + __builder.AddAttribute(3, "IsReadOnly", hasReadOnly); __builder.CloseComponent(); }; diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/RenderableContent/RenderableContentControl.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/RenderableContent/RenderableContentControl.razor index 323c94a4..71411120 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/RenderableContent/RenderableContentControl.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/RenderableContent/RenderableContentControl.razor @@ -118,7 +118,7 @@ if (IsEnumerator(kid)) { var enumDiscriminatorAttribute = AttributesHandler.GetEnumeratorDiscriminatorAttribute(kid); - @GenerateEnum(enumDiscriminatorAttribute, kid) + @GenerateEnum(enumDiscriminatorAttribute, (ITwinPrimitive)kid) } else if (kid is OnlinerBase) { @@ -186,7 +186,7 @@ }; - private RenderFragment GenerateEnum(EnumeratorDiscriminatorAttribute enumDiscriminatorAttribute, ITwinElement kid) => __builder => + private RenderFragment GenerateEnum(EnumeratorDiscriminatorAttribute enumDiscriminatorAttribute, ITwinPrimitive kid) => __builder => { var enumKidType = kid.GetType(); var (baseName, genericTypeArg) = GetGenericInfo(enumKidType); @@ -199,7 +199,7 @@ { if (IsEnumerator(element)) { - @GenerateEnum(AttributesHandler.GetEnumeratorDiscriminatorAttribute(element), element) + @GenerateEnum(AttributesHandler.GetEnumeratorDiscriminatorAttribute(element), (ITwinPrimitive)element) } else { diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBaseControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBaseControlView.cs deleted file mode 100644 index ef9ea3a5..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBaseControlView.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online.Control -{ - public partial class OnlinerBaseControlView - { - [Parameter] - public OnlinerBase Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateValuesOnChange(Onliner); - } - - private bool IsNumeric(Type type) - { - if (type == null) return false; - switch (Type.GetTypeCode(type)) - { - case TypeCode.Byte: - case TypeCode.Decimal: - case TypeCode.Double: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.SByte: - case TypeCode.Single: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - } - return false; - } - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBaseControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBaseControlView.razor index 9a335c25..ecf7b68e 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBaseControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBaseControlView.razor @@ -1,29 +1,44 @@ -@inherits RenderableComponentBase -@typeparam T +@typeparam T +@inherits TemplateBaseOnline
- +
- @if (IsNumeric(typeof(T))) - { - - } - else - { - - } +
@Onliner.AccessStatus.FailureReason
-
\ No newline at end of file +
+ +@code{ + + private string IsNumeric(Type type) + { + if (type == null) return "text"; + switch (Type.GetTypeCode(type)) + { + case TypeCode.Byte: + case TypeCode.Decimal: + case TypeCode.Double: + case TypeCode.Int16: + case TypeCode.Int32: + case TypeCode.Int64: + case TypeCode.SByte: + case TypeCode.Single: + case TypeCode.UInt16: + case TypeCode.UInt32: + case TypeCode.UInt64: + return "number"; + } + return "text"; + } +} \ No newline at end of file diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBoolControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBoolControlView.cs deleted file mode 100644 index 5f530afa..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBoolControlView.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online.Control -{ - public partial class OnlinerBoolControlView - { - [Parameter] - public OnlinerBool Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateValuesOnChange(Onliner); - } - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBoolControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBoolControlView.razor index 3c60c6d0..33de98c8 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBoolControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerBoolControlView.razor @@ -1,12 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseOnline
- +
-
diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateControlView.cs deleted file mode 100644 index e020ed9c..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateControlView.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online.Control -{ - public partial class OnlinerDateControlView - { - [Parameter] - public OnlinerDate Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateValuesOnChange(Onliner); - } - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateControlView.razor index 848a88cc..f9758744 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateControlView.razor @@ -1,12 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseOnline
- +
-
diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateTimeControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateTimeControlView.cs deleted file mode 100644 index 3c247460..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateTimeControlView.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online.Control -{ - public partial class OnlinerDateTimeControlView - { - [Parameter] - public OnlinerDateTime Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateValuesOnChange(Onliner); - } - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateTimeControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateTimeControlView.razor index d5b182c0..48bc7dc3 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateTimeControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Control/OnlinerDateTimeControlView.razor @@ -1,12 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseOnline
- +
-
- +
-
-
\ No newline at end of file +
+ +@code +{ + private void ValueChanged(ChangeEventArgs args) + { + try + { + var parsedTimeSpan = TimeSpan.Parse(args.Value.ToString()); + Onliner.Cyclic = parsedTimeSpan; + + } + catch + { + //do nothing + } + + } +} \ No newline at end of file diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBaseDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBaseDisplayView.cs deleted file mode 100644 index 19b1101b..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBaseDisplayView.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online.Display -{ - public partial class OnlinerBaseDisplayView - { - [Parameter] - public OnlinerBase Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateValuesOnChange(Onliner); - } - - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBaseDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBaseDisplayView.razor index e77f6965..ea9fa621 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBaseDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBaseDisplayView.razor @@ -1,15 +1,14 @@ -@inherits RenderableComponentBase -@typeparam T - +@typeparam T +@inherits TemplateBaseOnline
- +
- diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBoolDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBoolDisplayView.cs deleted file mode 100644 index e2bd4ff9..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBoolDisplayView.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online.Display -{ - public partial class OnlinerBoolDisplayView - { - [Parameter] - public OnlinerBool Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateValuesOnChange(Onliner); - } - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBoolDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBoolDisplayView.razor index 7cde90c7..f922853e 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBoolDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerBoolDisplayView.razor @@ -1,12 +1,12 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseOnline
- +
- diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateDisplayView.cs deleted file mode 100644 index 600b4b6c..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateDisplayView.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online.Display -{ - public partial class OnlinerDateDisplayView - { - [Parameter] - public OnlinerDate Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateValuesOnChange(Onliner); - } - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateDisplayView.razor index bc76a379..b07a149a 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateDisplayView.razor @@ -1,14 +1,14 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseOnline
- +
-
diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateTimeDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateTimeDisplayView.cs deleted file mode 100644 index ebe2d0ab..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateTimeDisplayView.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online.Display -{ - public partial class OnlinerDateTimeDisplayView - { - [Parameter] - public OnlinerDateTime Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateValuesOnChange(Onliner); - } - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateTimeDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateTimeDisplayView.razor index 3787eab7..166767ea 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateTimeDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerDateTimeDisplayView.razor @@ -1,13 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseOnline
- +
- diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerTimeOfDayDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerTimeOfDayDisplayView.cs deleted file mode 100644 index 49fc1527..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerTimeOfDayDisplayView.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online.Display -{ - public partial class OnlinerTimeOfDayDisplayView - { - [Parameter] - public OnlinerTimeOfDay Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateValuesOnChange(Onliner); - } - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerTimeOfDayDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerTimeOfDayDisplayView.razor index 1659283b..c62a7ef1 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerTimeOfDayDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/Display/OnlinerTimeOfDayDisplayView.razor @@ -1,13 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseOnline
- +
- diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/TemplateBaseOnline.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/TemplateBaseOnline.cs new file mode 100644 index 00000000..9335761f --- /dev/null +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/TemplateBaseOnline.cs @@ -0,0 +1,29 @@ +using Ix.Connector.ValueTypes; +using Microsoft.AspNetCore.Components; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ix.Presentation.Blazor.Controls.Templates.Base.Online +{ + public partial class TemplateBaseOnline + { + [Parameter] + public OnlinerBase Onliner { get; set; } + + [Parameter] + public bool IsReadOnly { get; set; } + + internal string AccessStatus { get; set; } + internal string ComponentId { get; set; } + + protected override void OnInitialized() + { + UpdateValuesOnChange(Onliner); + AccessStatus = Onliner.AccessStatus.Failure ? "is-invalid" : ""; + ComponentId = Onliner.GetSymbolTail() + "_" + Guid.NewGuid().ToString(); + } + } +} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Complex/StComplexControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/TemplateBaseOnline.razor similarity index 50% rename from src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Complex/StComplexControlView.razor rename to src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/TemplateBaseOnline.razor index 9285884a..cde4d75b 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Complex/StComplexControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Online/TemplateBaseOnline.razor @@ -1,4 +1,2 @@ @inherits RenderableComponentBase - -

@TwinObject.AttributeName

- +@typeparam T \ No newline at end of file diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBaseShadowControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBaseShadowControlView.cs deleted file mode 100644 index de05d823..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBaseShadowControlView.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Shadow.Control -{ - public partial class OnlinerBaseShadowControlView - { - [Parameter] - public OnlinerBase Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateShadowValuesOnChange(Onliner); - - } - private bool IsNumeric(Type type) - { - if (type == null) return false; - switch (Type.GetTypeCode(type)) - { - case TypeCode.Byte: - case TypeCode.Decimal: - case TypeCode.Double: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.SByte: - case TypeCode.Single: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - } - return false; - } - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBaseShadowControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBaseShadowControlView.razor index b0be4ea7..f33ef662 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBaseShadowControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBaseShadowControlView.razor @@ -1,29 +1,45 @@ -@inherits RenderableComponentBase -@typeparam T +@typeparam T +@inherits TemplateBaseShadow
- +
- @if (IsNumeric(typeof(T))) - { - - } - else - { - - } + + +
@Onliner.AccessStatus.FailureReason
-
\ No newline at end of file +
+ +@code +{ + private string IsNumeric(Type type) + { + if (type == null) return "text"; + switch (Type.GetTypeCode(type)) + { + case TypeCode.Byte: + case TypeCode.Decimal: + case TypeCode.Double: + case TypeCode.Int16: + case TypeCode.Int32: + case TypeCode.Int64: + case TypeCode.SByte: + case TypeCode.Single: + case TypeCode.UInt16: + case TypeCode.UInt32: + case TypeCode.UInt64: + return "number"; + } + return "text"; + } +} \ No newline at end of file diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBoolShadowControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBoolShadowControlView.cs deleted file mode 100644 index 9023f709..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBoolShadowControlView.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Shadow.Control -{ - public partial class OnlinerBoolShadowControlView - { - [Parameter] - public OnlinerBool Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateShadowValuesOnChange(Onliner); - } - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBoolShadowControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBoolShadowControlView.razor index 0c77ab4e..4a334d37 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBoolShadowControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerBoolShadowControlView.razor @@ -1,12 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseShadow
- +
-
diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateShadowControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateShadowControlView.cs deleted file mode 100644 index d99593ed..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateShadowControlView.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Shadow.Control -{ - public partial class OnlinerDateShadowControlView - { - [Parameter] - public OnlinerDate Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateShadowValuesOnChange(Onliner); - } - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateShadowControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateShadowControlView.razor index d3e468bb..935ddc2d 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateShadowControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateShadowControlView.razor @@ -1,12 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseShadow
- +
-
diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateTimeShadowControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateTimeShadowControlView.cs deleted file mode 100644 index 1de42f15..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateTimeShadowControlView.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Shadow.Control -{ - public partial class OnlinerDateTimeShadowControlView - { - [Parameter] - public OnlinerDateTime Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateShadowValuesOnChange(Onliner); - } - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateTimeShadowControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateTimeShadowControlView.razor index 31fceab0..8855b2c6 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateTimeShadowControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Control/OnlinerDateTimeShadowControlView.razor @@ -1,12 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseShadow
- +
-
- +
-
-
\ No newline at end of file +
+ +@code +{ + private void ValueChanged(ChangeEventArgs args) + { + try + { + Onliner.Shadow = TimeSpan.Parse(args.Value.ToString()); + } + catch + { + //do nothing + } + + } +} \ No newline at end of file diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerBaseShadowDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerBaseShadowDisplayView.cs deleted file mode 100644 index a2f0caae..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerBaseShadowDisplayView.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Shadow.Display -{ - public partial class OnlinerBaseShadowDisplayView - { - [Parameter] - public OnlinerBase Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateShadowValuesOnChange(Onliner); - } - - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerBaseShadowDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerBaseShadowDisplayView.razor index f7b02db1..5d39d1e2 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerBaseShadowDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerBaseShadowDisplayView.razor @@ -1,14 +1,14 @@ -@inherits RenderableComponentBase -@typeparam T +@typeparam T +@inherits TemplateBaseShadow
- +
-
- +
- diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateShadowDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateShadowDisplayView.cs deleted file mode 100644 index 84652a5b..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateShadowDisplayView.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Shadow.Display -{ - public partial class OnlinerDateShadowDisplayView - { - [Parameter] - public OnlinerDate Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateShadowValuesOnChange(Onliner); - } - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateShadowDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateShadowDisplayView.razor index 9adf6362..bee3bd5c 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateShadowDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateShadowDisplayView.razor @@ -1,13 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseShadow
- +
- diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateTimeShadowDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateTimeShadowDisplayView.cs deleted file mode 100644 index a5e6a5c9..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateTimeShadowDisplayView.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Shadow.Display -{ - public partial class OnlinerDateTimeShadowDisplayView - { - [Parameter] - public OnlinerDateTime Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateShadowValuesOnChange(Onliner); - } - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateTimeShadowDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateTimeShadowDisplayView.razor index 3144b3d4..08be559f 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateTimeShadowDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerDateTimeShadowDisplayView.razor @@ -1,13 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseShadow
- +
- diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerTimeOfDayShadowDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerTimeOfDayShadowDisplayView.cs deleted file mode 100644 index ecc10c9c..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerTimeOfDayShadowDisplayView.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector.ValueTypes; -using System; - -namespace Ix.Presentation.Blazor.Controls.Templates.Base.Shadow.Display -{ - public partial class OnlinerTimeOfDayShadowDisplayView - { - [Parameter] - public OnlinerTimeOfDay Onliner { get; set; } - - private string id = Guid.NewGuid().ToString(); - - protected override void OnInitialized() - { - UpdateShadowValuesOnChange(Onliner); - } - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerTimeOfDayShadowDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerTimeOfDayShadowDisplayView.razor index 8bcd7529..4dead035 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerTimeOfDayShadowDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/Display/OnlinerTimeOfDayShadowDisplayView.razor @@ -1,13 +1,13 @@ -@inherits RenderableComponentBase +@inherits TemplateBaseShadow
- +
- diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/TemplateBaseShadow.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/TemplateBaseShadow.cs new file mode 100644 index 00000000..e9ab6159 --- /dev/null +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/TemplateBaseShadow.cs @@ -0,0 +1,29 @@ +using Ix.Connector.ValueTypes; +using Microsoft.AspNetCore.Components; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ix.Presentation.Blazor.Controls.Templates.Base.Shadow +{ + public partial class TemplateBaseShadow + { + [Parameter] + public OnlinerBase Onliner { get; set; } + + [Parameter] + public bool IsReadOnly { get; set; } + + internal string AccessStatus { get; set; } + internal string ComponentId { get; set; } + + protected override void OnInitialized() + { + UpdateShadowValuesOnChange(Onliner); + AccessStatus = Onliner.AccessStatus.Failure ? "is-invalid" : ""; + ComponentId = Onliner.GetSymbolTail() + "_" + Guid.NewGuid().ToString(); + } + } +} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/TemplateBaseShadow.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/TemplateBaseShadow.razor new file mode 100644 index 00000000..cde4d75b --- /dev/null +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Base/Shadow/TemplateBaseShadow.razor @@ -0,0 +1,2 @@ +@inherits RenderableComponentBase +@typeparam T \ No newline at end of file diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Complex/StComplexControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Complex/StComplexControlView.cs deleted file mode 100644 index 6cd78df0..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Complex/StComplexControlView.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using Ix.Connector; - -namespace Ix.Presentation.Blazor.Controls.Templates.Complex -{ - public partial class StComplexControlView - { - [Parameter] - public ITwinObject TwinObject { get; set; } - - - protected override void OnInitialized() - { - UpdateValuesOnChange(TwinObject); - } - - } -} diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Control/EnumeratorContainerControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Control/EnumeratorContainerControlView.razor index ae05d915..e258121b 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Control/EnumeratorContainerControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Control/EnumeratorContainerControlView.razor @@ -1,13 +1,15 @@ -@inherits RenderableComponentBase -@typeparam T +@typeparam T +@inherits EnumeratorsBaseOnline
- +
- @foreach (var name in Names) { diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Display/EnumeratorContainerDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Display/EnumeratorContainerDisplayView.cs deleted file mode 100644 index c9fb559e..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Display/EnumeratorContainerDisplayView.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System; -using Microsoft.AspNetCore.Components; -using Ix.Connector; -using Ix.Connector.ValueTypes; -using Ix.Presentation.Blazor; - -namespace Ix.Presentation.Blazor.Controls.Templates.Enumerators.Online.Display -{ - public partial class EnumeratorContainerDisplayView - { - [Parameter] - public OnlinerBase Onliner { get; set; } - - [Parameter] - public EnumeratorDiscriminatorAttribute EnumDiscriminatorAttribute { get; set; } - - - public EnumToIntConverter EnumToIntConverter { get; set; } - - protected override void OnInitialized() - { - EnumToIntConverter = new EnumToIntConverter(EnumDiscriminatorAttribute); - UpdateValuesOnChange(Onliner); - base.OnInitialized(); - } - } -} - - diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Display/EnumeratorContainerDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Display/EnumeratorContainerDisplayView.razor index 415e8e6a..4d35da79 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Display/EnumeratorContainerDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Display/EnumeratorContainerDisplayView.razor @@ -1,14 +1,15 @@ -@inherits RenderableComponentBase -@typeparam T +@typeparam T +@inherits EnumeratorsBaseOnline
- +
-
@Onliner.AccessStatus.FailureReason diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Control/EnumeratorContainerControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/EnumeratorsBaseOnline.cs similarity index 59% rename from src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Control/EnumeratorContainerControlView.cs rename to src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/EnumeratorsBaseOnline.cs index 713dfd85..6f73dbb4 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/Control/EnumeratorContainerControlView.cs +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/EnumeratorsBaseOnline.cs @@ -1,34 +1,35 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System; -using Microsoft.AspNetCore.Components; -using Ix.Connector; +using Ix.Connector; using Ix.Connector.ValueTypes; -using Ix.Presentation.Blazor; +using Microsoft.AspNetCore.Components; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; -namespace Ix.Presentation.Blazor.Controls.Templates.Enumerators.Online.Control +namespace Ix.Presentation.Blazor.Controls.Templates.Enumerators.Online { - public partial class EnumeratorContainerControlView + public partial class EnumeratorsBaseOnline { [Parameter] public OnlinerBase Onliner { get; set; } [Parameter] public EnumeratorDiscriminatorAttribute EnumDiscriminatorAttribute { get; set; } + [Parameter] + public bool IsReadOnly { get; set; } + public string AccessStatus { get; set; } public Array Names { get; set; } public EnumToIntConverter EnumToIntConverter { get; set; } - + internal string ComponentId { get; set; } protected override void OnInitialized() { EnumToIntConverter = new EnumToIntConverter(EnumDiscriminatorAttribute); Names = Enum.GetNames(EnumDiscriminatorAttribute.EnumeratorType); UpdateValuesOnChange(Onliner); + AccessStatus = Onliner.AccessStatus.Failure ? "is-invalid" : ""; + ComponentId = Onliner.GetSymbolTail() + "_" + Guid.NewGuid().ToString(); base.OnInitialized(); } - + } } diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/EnumeratorsBaseOnline.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/EnumeratorsBaseOnline.razor new file mode 100644 index 00000000..cde4d75b --- /dev/null +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Online/EnumeratorsBaseOnline.razor @@ -0,0 +1,2 @@ +@inherits RenderableComponentBase +@typeparam T \ No newline at end of file diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Control/EnumeratorContainerShadowControlView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Control/EnumeratorContainerShadowControlView.razor index aee704a7..e9b7be28 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Control/EnumeratorContainerShadowControlView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Control/EnumeratorContainerShadowControlView.razor @@ -1,13 +1,15 @@ -@inherits RenderableComponentBase -@typeparam T +@typeparam T +@inherits EnumeratorsBaseShadow
- +
- @foreach (var name in Names) { diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Display/EnumeratorContainerShadowDisplayView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Display/EnumeratorContainerShadowDisplayView.cs deleted file mode 100644 index b85982d0..00000000 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Display/EnumeratorContainerShadowDisplayView.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System; -using Microsoft.AspNetCore.Components; -using Ix.Connector; -using Ix.Connector.ValueTypes; -using Ix.Presentation.Blazor; - -namespace Ix.Presentation.Blazor.Controls.Templates.Enumerators.Shadow.Display -{ - public partial class EnumeratorContainerShadowDisplayView - { - [Parameter] - public OnlinerBase Onliner { get; set; } - - [Parameter] - public EnumeratorDiscriminatorAttribute EnumDiscriminatorAttribute { get; set; } - - - public EnumToIntConverter EnumToIntConverter { get; set; } - - protected override void OnInitialized() - { - EnumToIntConverter = new EnumToIntConverter(EnumDiscriminatorAttribute); - UpdateValuesOnChange(Onliner); - base.OnInitialized(); - } - } -} - - diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Display/EnumeratorContainerShadowDisplayView.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Display/EnumeratorContainerShadowDisplayView.razor index a388df15..e86904a5 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Display/EnumeratorContainerShadowDisplayView.razor +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Display/EnumeratorContainerShadowDisplayView.razor @@ -1,14 +1,15 @@ -@inherits RenderableComponentBase -@typeparam T +@typeparam T +@inherits EnumeratorsBaseShadow
- +
-
@Onliner.AccessStatus.FailureReason diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Control/EnumeratorContainerShadowControlView.cs b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/EnumeratorsBaseShadow.cs similarity index 58% rename from src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Control/EnumeratorContainerShadowControlView.cs rename to src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/EnumeratorsBaseShadow.cs index 4f56d997..414cb0b6 100644 --- a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/Control/EnumeratorContainerShadowControlView.cs +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/EnumeratorsBaseShadow.cs @@ -1,34 +1,34 @@ -// Ix.Presentation.Blazor.Controls -// Copyright (c) 2023 Peter Kurhajec (PTKu), MTS, and Contributors. All Rights Reserved. -// Contributors: https://github.com/ix-ax/ix/graphs/contributors -// See the LICENSE file in the repository root for more information. -// https://github.com/ix-ax/ix/blob/master/LICENSE -// Third party licenses: https://github.com/ix-ax/ix/blob/master/notices.md - -using System; -using Microsoft.AspNetCore.Components; -using Ix.Connector; +using Ix.Connector; using Ix.Connector.ValueTypes; -using Ix.Presentation.Blazor; +using Microsoft.AspNetCore.Components; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; -namespace Ix.Presentation.Blazor.Controls.Templates.Enumerators.Shadow.Control +namespace Ix.Presentation.Blazor.Controls.Templates.Enumerators.Shadow { - public partial class EnumeratorContainerShadowControlView + public partial class EnumeratorsBaseShadow { [Parameter] public OnlinerBase Onliner { get; set; } [Parameter] public EnumeratorDiscriminatorAttribute EnumDiscriminatorAttribute { get; set; } + [Parameter] + public bool IsReadOnly { get; set; } + public string AccessStatus { get; set; } public Array Names { get; set; } public EnumToIntConverter EnumToIntConverter { get; set; } - + internal string ComponentId { get; set; } protected override void OnInitialized() { EnumToIntConverter = new EnumToIntConverter(EnumDiscriminatorAttribute); Names = Enum.GetNames(EnumDiscriminatorAttribute.EnumeratorType); UpdateValuesOnChange(Onliner); + AccessStatus = Onliner.AccessStatus.Failure ? "is-invalid" : ""; + ComponentId = Onliner.GetSymbolTail() + "_" + Guid.NewGuid().ToString(); base.OnInitialized(); } - } } diff --git a/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/EnumeratorsBaseShadow.razor b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/EnumeratorsBaseShadow.razor new file mode 100644 index 00000000..cde4d75b --- /dev/null +++ b/src/ix.blazor/src/Ix.Presentation.Blazor.Controls/Templates/Enumerators/Shadow/EnumeratorsBaseShadow.razor @@ -0,0 +1,2 @@ +@inherits RenderableComponentBase +@typeparam T \ No newline at end of file diff --git a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/prgWeatherStations.html b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/prgWeatherStations.html index 5cb6a072..3e78cb4e 100644 --- a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/prgWeatherStations.html +++ b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/prgWeatherStations.html @@ -37,10 +37,10 @@
- +
- +
@@ -134,4 +134,5 @@
-
\ No newline at end of file +
+ diff --git a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestEnum.html b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestEnum.html index 86190b03..ef9522ab 100644 --- a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestEnum.html +++ b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestEnum.html @@ -1,10 +1,10 @@ 
- +
- diff --git a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestLayoutOverWrite.html b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestLayoutOverWrite.html index 3c4e4c0a..48dab846 100644 --- a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestLayoutOverWrite.html +++ b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestLayoutOverWrite.html @@ -119,10 +119,10 @@
- +
- +
diff --git a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnore.html b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnore.html deleted file mode 100644 index 60e0a4c8..00000000 --- a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnore.html +++ /dev/null @@ -1,92 +0,0 @@ -
-
-
-
-
- -
-
- -
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
-
- -
-
- -
-
-
-
-
-
\ No newline at end of file diff --git a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnoreControl.html b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnoreControl.html new file mode 100644 index 00000000..f525d830 --- /dev/null +++ b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnoreControl.html @@ -0,0 +1,93 @@ + +
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnoreDisplay.html b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnoreDisplay.html new file mode 100644 index 00000000..68ce41e0 --- /dev/null +++ b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnoreDisplay.html @@ -0,0 +1,92 @@ +
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnoreShadowDisplayControl.html b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnoreShadowDisplayControl.html new file mode 100644 index 00000000..dae778d0 --- /dev/null +++ b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/HtmlFiles/stTestRenderIgnoreShadowDisplayControl.html @@ -0,0 +1,81 @@ +
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/RenderableContentTests.cs b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/RenderableContentTests.cs index e8b58059..f1fdc596 100644 --- a/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/RenderableContentTests.cs +++ b/src/ix.blazor/tests/sandbox/Ix.RenderableContent.Tests/RenderableContentTests.cs @@ -89,10 +89,10 @@ public void Render_stTestEnum_Success() } [Fact] - public void Render_stTestRenderIgnore_UniformGrid_TwoIgnored() + public void Render_stTestRenderIgnore_Display_Date_Ignored() { // Arrange - var path = Path.Combine(_projectDirectory, "HtmlFiles", "stTestRenderIgnore.html"); + var path = Path.Combine(_projectDirectory, "HtmlFiles", "stTestRenderIgnoreDisplay.html"); var html = File.ReadAllText(path); // Act var cut = RenderComponent(param => param @@ -102,6 +102,35 @@ public void Render_stTestRenderIgnore_UniformGrid_TwoIgnored() cut.MarkupMatches(html); } + [Fact] + public void Render_stTestRenderIgnore_Control_Bool_Ignored() + { + // Arrange + var path = Path.Combine(_projectDirectory, "HtmlFiles", "stTestRenderIgnoreControl.html"); + var html = File.ReadAllText(path); + // Act + var cut = RenderComponent(param => param + .Add(p => p.Context, _fixture.Connector.testingProgram.testRenderIgnore) + .Add(p => p.Presentation, "Control")); + // Assert + cut.MarkupMatches(html); + } + + [Fact] + public void Render_stTestRenderIgnore_ShadowDisplayControl_DateAndBool_Ignored() + { + // Arrange + var path = Path.Combine(_projectDirectory, "HtmlFiles", "stTestRenderIgnoreShadowDisplayControl.html"); + var html = File.ReadAllText(path); + // Act + var cut = RenderComponent(param => param + .Add(p => p.Context, _fixture.Connector.testingProgram.testRenderIgnore) + .Add(p => p.Presentation, "ShadowDisplay-ShadowControl")); + // Assert + cut.MarkupMatches(html); + } + + [Fact] public void Render_stTestEmpty_Success() { diff --git a/src/ix.blazor/tests/sandbox/ax-blazor-example/ix.config.json b/src/ix.blazor/tests/sandbox/ax-blazor-example/ix.config.json index 64b13a5a..543f25b0 100644 --- a/src/ix.blazor/tests/sandbox/ax-blazor-example/ix.config.json +++ b/src/ix.blazor/tests/sandbox/ax-blazor-example/ix.config.json @@ -1 +1 @@ -{"OutputProjectFolder":"ix","AxProjectFolder":"C:\\W\\Develop\\gh\\ix-ax\\ix\\src\\ix.blazor\\tests\\sandbox\\ax-blazor-example"} \ No newline at end of file +{"OutputProjectFolder":"ix"} \ No newline at end of file diff --git a/src/ix.blazor/tests/sandbox/ax-blazor-example/ix/.g/Onliners/stTestRenderIgnore.g.cs b/src/ix.blazor/tests/sandbox/ax-blazor-example/ix/.g/Onliners/stTestRenderIgnore.g.cs index 664a9df3..a84c2b33 100644 --- a/src/ix.blazor/tests/sandbox/ax-blazor-example/ix/.g/Onliners/stTestRenderIgnore.g.cs +++ b/src/ix.blazor/tests/sandbox/ax-blazor-example/ix/.g/Onliners/stTestRenderIgnore.g.cs @@ -8,7 +8,6 @@ public partial class stTestRenderIgnore : Ix.Connector.ITwinObject [RenderIgnore()] public OnlinerInt testInteger { get; } - [RenderIgnore("Display", "ShadowDisplay")] public OnlinerInt testUInteger { get; } public OnlinerString testString { get; } @@ -21,8 +20,10 @@ public partial class stTestRenderIgnore : Ix.Connector.ITwinObject public OnlinerLReal testLReal { get; } + [RenderIgnore("Display", "ShadowDisplay")] public OnlinerBool testBool { get; } + [RenderIgnore("Control", "ShadowControl")] public OnlinerDate TestDate { get; } public OnlinerDateTime TestDateTime { get; } diff --git a/src/ix.blazor/tests/sandbox/ax-blazor-example/src/stTestRenderIgnore.st b/src/ix.blazor/tests/sandbox/ax-blazor-example/src/stTestRenderIgnore.st index 934df907..d8748c15 100644 --- a/src/ix.blazor/tests/sandbox/ax-blazor-example/src/stTestRenderIgnore.st +++ b/src/ix.blazor/tests/sandbox/ax-blazor-example/src/stTestRenderIgnore.st @@ -4,7 +4,6 @@ CLASS stTestRenderIgnore {#ix-set:AttributeName = "<#Integer From PLC#>"} testInteger : INT; {#ix-set:AttributeName = "<#UInteger From PLC#>"} - {#ix-attr:[RenderIgnore("Display","ShadowDisplay")]} testUInteger : INT; {#ix-set:AttributeName = "<#STRING From PLC#>"} testString : STRING; @@ -16,8 +15,10 @@ CLASS stTestRenderIgnore testReal : REAL; {#ix-set:AttributeName = "<#LREAL From PLC#>"} testLReal : LREAL; + {#ix-attr:[RenderIgnore("Display","ShadowDisplay")]} {#ix-set:AttributeName = "<#BOOL From PLC#>"} testBool : BOOL; + {#ix-attr:[RenderIgnore("Control","ShadowControl")]} {#ix-set:AttributeName = "<#DATE From PLC#>"} TestDate : DATE; {#ix-set:AttributeName = "<#DATE_AND_TIME From PLC#>"} diff --git a/src/ix.compiler/src/IX.Compiler/IxConfig.cs b/src/ix.compiler/src/IX.Compiler/IxConfig.cs index 0d8b224b..7a42dad8 100644 --- a/src/ix.compiler/src/IX.Compiler/IxConfig.cs +++ b/src/ix.compiler/src/IX.Compiler/IxConfig.cs @@ -31,39 +31,31 @@ public IxConfig() /// public const string CONFIG_FILE_NAME = "ix.config.json"; + + private string _outputProjectFolder = "ix"; + /// /// Gets or sets the output folder for the Ix project. /// - private string _outputProjectFolder = "ix"; - public string OutputProjectFolder { - get { return _outputProjectFolder.Replace("\\", Path.DirectorySeparatorChar.ToString()); } - set { _outputProjectFolder = value; } + get => _outputProjectFolder.Replace("\\", Path.DirectorySeparatorChar.ToString()); + set => _outputProjectFolder = value; } - //public string OutputProjectFolder { get; set; } = "ix"; + + private string _axProjectFolder; /// /// Gets or sets the output folder for the Ix project. /// - private string _axProjectFolder; - + [JsonIgnore] public string AxProjectFolder { - get { - if(_axProjectFolder != null) - { - return _axProjectFolder.Replace("\\",Path.DirectorySeparatorChar.ToString()); - } - - return _axProjectFolder; - } - set { _axProjectFolder = value; } + get => _axProjectFolder.Replace("\\",Path.DirectorySeparatorChar.ToString()); + set => _axProjectFolder = value; } - //public string AxProjectFolder { get; set; } - /// /// Gets updated or creates default config for given AX project. /// @@ -101,6 +93,11 @@ public static IxConfig UpdateAndGetIxConfig(string directory, ICompilerOptions c ixConfig = JsonConvert.DeserializeObject(r.ReadToEnd()); } + if (ixConfig != null) + { + ixConfig.AxProjectFolder = directory; + } + return ixConfig; } @@ -110,7 +107,14 @@ public static IxConfig RetrieveIxConfig(string ixConfigFilePath) try { using StreamReader r = new StreamReader(ixConfigFilePath); - return JsonConvert.DeserializeObject(r.ReadToEnd()); + var config = JsonConvert.DeserializeObject(r.ReadToEnd()); + if (config != null) + { + var fi = new FileInfo(ixConfigFilePath); + config.AxProjectFolder = fi.DirectoryName; + } + + return config; } catch (Exception ex) { diff --git a/src/ix.compiler/src/IX.Cs.Compiler/CsProject.cs b/src/ix.compiler/src/IX.Cs.Compiler/CsProject.cs index cf51bff2..f74d17dd 100644 --- a/src/ix.compiler/src/IX.Cs.Compiler/CsProject.cs +++ b/src/ix.compiler/src/IX.Cs.Compiler/CsProject.cs @@ -83,14 +83,37 @@ private void EnsureCsProjFile() var expectedCsProjFile = Path.Combine(IxProject.OutputFolder, $"{MakeValidFileName(IxProject.AxProject.ProjectInfo.Name)}.csproj"); +var defaultCsProjectWhenNotProvidedByTemplate = +$@" + + net6.0 + enable + enable + + + + + + + + + + +"; + + Policy .Handle() .WaitAndRetry(5, a => TimeSpan.FromMilliseconds(500)) .Execute(() => { if (!File.Exists(expectedCsProjFile)) - File.Copy(Path.Combine(GetExecutingAssemblyPath(), "Cs", "csproj-template.xml"), - expectedCsProjFile); + { + using (var swr = new StreamWriter(expectedCsProjFile)) + { + swr.Write(defaultCsProjectWhenNotProvidedByTemplate); + } + } }); } diff --git a/src/ix.compiler/tests/Ix.CompilerTests/IxConfigTests.cs b/src/ix.compiler/tests/Ix.CompilerTests/IxConfigTests.cs index db96f479..4de32c0f 100644 --- a/src/ix.compiler/tests/Ix.CompilerTests/IxConfigTests.cs +++ b/src/ix.compiler/tests/Ix.CompilerTests/IxConfigTests.cs @@ -84,7 +84,7 @@ public void RetrieveIxConfig_should_read_existing_config() var result = IxConfig.RetrieveIxConfig(ixConfigFile); Assert.True(File.Exists(ixConfigFile)); Assert.Equal($"..{Path.DirectorySeparatorChar}ix", result.OutputProjectFolder); - Assert.Equal(Path.Combine("samples","plt","lib3"), result.AxProjectFolder); + Assert.True(result.AxProjectFolder.EndsWith(Path.Combine("samples", "plt", "lib3"))); } [Fact] diff --git a/src/ix.compiler/tests/integration/actual/app/ix.config.json b/src/ix.compiler/tests/integration/actual/app/ix.config.json index 745bcab6..543f25b0 100644 --- a/src/ix.compiler/tests/integration/actual/app/ix.config.json +++ b/src/ix.compiler/tests/integration/actual/app/ix.config.json @@ -1 +1 @@ -{"OutputProjectFolder":"ix","AxProjectFolder":"C:\\W\\Develop\\gh\\ix-ax\\ix\\src\\ix.compiler\\tests\\integration\\actual\\app"} \ No newline at end of file +{"OutputProjectFolder":"ix"} \ No newline at end of file diff --git a/src/ix.compiler/tests/integration/actual/lib1/ix.config.json b/src/ix.compiler/tests/integration/actual/lib1/ix.config.json index cce85671..543f25b0 100644 --- a/src/ix.compiler/tests/integration/actual/lib1/ix.config.json +++ b/src/ix.compiler/tests/integration/actual/lib1/ix.config.json @@ -1 +1 @@ -{"OutputProjectFolder":"ix","AxProjectFolder":"C:\\W\\Develop\\gh\\ix-ax\\ix\\src\\ix.compiler\\tests\\integration\\actual\\lib1\\ix\\..\\../lib1"} \ No newline at end of file +{"OutputProjectFolder":"ix"} \ No newline at end of file diff --git a/src/ix.compiler/tests/integration/actual/lib2/ix.config.json b/src/ix.compiler/tests/integration/actual/lib2/ix.config.json index b74ad57a..543f25b0 100644 --- a/src/ix.compiler/tests/integration/actual/lib2/ix.config.json +++ b/src/ix.compiler/tests/integration/actual/lib2/ix.config.json @@ -1 +1 @@ -{"OutputProjectFolder":"ix","AxProjectFolder":"C:\\W\\Develop\\gh\\ix-ax\\ix\\src\\ix.compiler\\tests\\integration\\actual\\lib2"} \ No newline at end of file +{"OutputProjectFolder":"ix"} \ No newline at end of file diff --git a/src/ix.connectors/tests/ax-test-project/ix.config.json b/src/ix.connectors/tests/ax-test-project/ix.config.json index fbc5ae4c..543f25b0 100644 --- a/src/ix.connectors/tests/ax-test-project/ix.config.json +++ b/src/ix.connectors/tests/ax-test-project/ix.config.json @@ -1 +1 @@ -{"OutputProjectFolder":"ix","AxProjectFolder":"C:\\W\\Develop\\gh\\ix-ax\\ix\\src\\ix.connectors\\tests\\ax-test-project"} \ No newline at end of file +{"OutputProjectFolder":"ix"} \ No newline at end of file diff --git a/src/ix.examples/hello.world.console/hello.world.console.plc/ix.config.json b/src/ix.examples/hello.world.console/hello.world.console.plc/ix.config.json index 7009bd4e..543f25b0 100644 --- a/src/ix.examples/hello.world.console/hello.world.console.plc/ix.config.json +++ b/src/ix.examples/hello.world.console/hello.world.console.plc/ix.config.json @@ -1 +1 @@ -{"OutputProjectFolder":"ix","AxProjectFolder":"C:\\W\\Develop\\gh\\ix-ax\\ix\\src\\ix.examples\\hello.world.console\\hello.world.console.plc"} \ No newline at end of file +{"OutputProjectFolder":"ix"} \ No newline at end of file diff --git a/src/ix.tools/src/ix.nuget.update/ix.nuget.update.csproj b/src/ix.tools/src/ix.nuget.update/ix.nuget.update.csproj index 36ed09ab..3a142e8f 100644 --- a/src/ix.tools/src/ix.nuget.update/ix.nuget.update.csproj +++ b/src/ix.tools/src/ix.nuget.update/ix.nuget.update.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net7.0;net6.0 enable enable diff --git a/src/ix.tools/tests/ix.nuget.update.Tests/ix.nuget.update.Tests.csproj b/src/ix.tools/tests/ix.nuget.update.Tests/ix.nuget.update.Tests.csproj index 8cf1020c..9da678c4 100644 --- a/src/ix.tools/tests/ix.nuget.update.Tests/ix.nuget.update.Tests.csproj +++ b/src/ix.tools/tests/ix.nuget.update.Tests/ix.nuget.update.Tests.csproj @@ -1,7 +1,7 @@  - net7.0 + net7.0;net6.0 false diff --git a/src/sanbox/integration/ix-integration-blazor/Pages/AutoRendering.razor b/src/sanbox/integration/ix-integration-blazor/Pages/AutoRendering.razor index 550a4543..9adb4dcb 100644 --- a/src/sanbox/integration/ix-integration-blazor/Pages/AutoRendering.razor +++ b/src/sanbox/integration/ix-integration-blazor/Pages/AutoRendering.razor @@ -1,5 +1,5 @@ @page "/AutoRendering" -@using ix_integration_plc + Rendering @@ -45,7 +45,26 @@ +

--------------------------------

+ +

Render ignore(s)

+ +

This structures presentation type is Control attribute

+

+ Members annotated with [RenderIgnore("Control")] must not be displayed. +

+ + + + +

This structures presentation type is Display attribute

+

+ Members annotated with [RenderIgnore("Display")] must not be displayed. +

+ @code { } diff --git a/src/sanbox/integration/ix-integration-blazor/Pages/ShadowProperties.razor b/src/sanbox/integration/ix-integration-blazor/Pages/ShadowProperties.razor new file mode 100644 index 00000000..206c3dbd --- /dev/null +++ b/src/sanbox/integration/ix-integration-blazor/Pages/ShadowProperties.razor @@ -0,0 +1,7 @@ +@page "/ShadowProperties" + + + + + diff --git a/src/sanbox/integration/ix-integration-blazor/Pages/_Layout.cshtml b/src/sanbox/integration/ix-integration-blazor/Pages/_Layout.cshtml index 25e1d436..bc5da3ec 100644 --- a/src/sanbox/integration/ix-integration-blazor/Pages/_Layout.cshtml +++ b/src/sanbox/integration/ix-integration-blazor/Pages/_Layout.cshtml @@ -8,10 +8,10 @@ - - + + @@ -29,6 +29,8 @@
+ +