Skip to content

Commit

Permalink
Merge pull request #356 from ix-ax/dev-2311-wip-on-template
Browse files Browse the repository at this point in the history
Dev 2311 wip on template
  • Loading branch information
PTKu committed Mar 15, 2024
2 parents e0bf5ea + b2d36d3 commit 4d0e1e0
Show file tree
Hide file tree
Showing 47 changed files with 1,031 additions and 826 deletions.
2 changes: 2 additions & 0 deletions scripts/build_test_docu.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ dotnet ixd `
.\src\components.elements\ctrl `
.\src\components.rexroth.drives\ctrl `
.\src\components.festo.drives\ctrl `
.\src\components.kuka.robotics\ctrl `
.\src\components.mitsubishi.robotics\ctrl `
.\src\template.axolibrary\ctrl `
-o .\docfx\apictrl\

Expand Down
6 changes: 3 additions & 3 deletions src/components.pneumatics/ctrl/apax.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "@ix-ax/axopen.components.pneumatics"
version : '0.0.0-dev.0'
version: '0.0.0-dev.0'
type: lib
targets:
- llvm
Expand All @@ -12,9 +12,9 @@ variables:
AXUNIT_TARGET_IP: "172.20.30.110"
SIM_ENABLED: "true"
devDependencies:
"@ix-ax/ax-sdk" : '0.0.0-dev.0'
"@ix-ax/ax-sdk": '0.0.0-dev.0'
dependencies:
"@ix-ax/axopen.components.abstractions" : '0.0.0-dev.0'
"@ix-ax/axopen.components.abstractions": '0.0.0-dev.0'
scripts:
download:
- START=$(date +%s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<div class="border border-2 rounded">
<div class="d-flex align-items-center justify-content-center" title="@Component.Symbol">
@RenderDialogIcon()
<h3 class="title m-2">@PlcLocalizer[Component._caption.Cyclic]</h3>
<h3 class="title m-2">@Component._caption.GetCyclic()</h3>
@RenderDialogIcon()
</div>

<div class="d-flex justify-content-center ">
<h3 class="title m-2">@PlcLocalizer[@Component._text.Cyclic]</h3>
<h3 class="title m-2">@Component._text.GetCyclic()</h3>
</div>

<div class="d-flex justify-content-center ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,11 @@ await Task.Run(() => {
}
});
}


public static async Task<AxoMessageObserver> CreateAndInitialize(AxoMessageProvider provider, RenderableComponentBase unitBaseSpotView)
{
var observer = AxoMessageObserver.Create(provider, unitBaseSpotView);
await observer.InitializeUpdate();
return observer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
var ast = await AuthenticationStateProvider.GetAuthenticationStateAsync();
if (Observer?.Provider is {Messengers: not null })
{
foreach (var messenger in Observer.Provider.Messengers)
foreach (var messenger in Observer.Provider.Messengers.Where(p =>p.State == eAxoMessengerState.NotActiveWaitingAckn))
{
messenger.Acknowledge(ast.User.Identity);
}
Expand Down
26 changes: 10 additions & 16 deletions src/data/app/ix-blazor/librarytemplate.blazor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using AXOpen.Data.MongoDb;
using AXOpen.Data.Json;


var builder = WebApplication.CreateBuilder(args);

var jsonRepositoryLocation = CreateJsonRepositoryDirectory();
Expand Down Expand Up @@ -58,11 +59,9 @@
//persistentRepository = new JsonRepositorySettings<AXOpen.Data.PersistentRecord>(persistentLocation).Factory();

// *** MONGO REPOSITORY ***
AXOpen.Data.MongoDb.Repository.InitializeFactory(mongoConnectionString: "mongodb://localhost:27017",
mongoDatabaseName: "AxOpenData",
user: "user",
userpw: "userpwd");
persistentRepository = AXOpen.Data.MongoDb.Repository.Factory<AXOpen.Data.PersistentRecord>("PersistentData");


persistentRepository = AXOpen.Data.MongoDb.Repository.Factory<AXOpen.Data.PersistentRecord>(new MongoDbRepositorySettings<AXOpen.Data.PersistentRecord>("mongodb://localhost:27017", "AxOpenData", "PersistentData"));


Entry.Plc.AxoDataPersistentContext.DataManager.InitializeRemoteDataExchange(
Expand All @@ -87,12 +86,9 @@
//Station_1_DataRepository = new JsonRepositorySettings<Pocos.AxoDataFramentsExchangeExample.Station_1_Data>(Station_1_Location).Factory();

// *** MONGO REPOSITORY ***
AXOpen.Data.MongoDb.Repository.InitializeFactory(mongoConnectionString: "mongodb://localhost:27017",
mongoDatabaseName: "AxOpenData",
user: "user",
userpw: "userpwd");
SharedDataHeaderDataRepository = AXOpen.Data.MongoDb.Repository.Factory<Pocos.AxoDataFramentsExchangeExample.SharedDataHeaderData>("SharedDataHeader");
Station_1_DataRepository = AXOpen.Data.MongoDb.Repository.Factory<Pocos.AxoDataFramentsExchangeExample.Station_1_Data>("Station_1");

SharedDataHeaderDataRepository = AXOpen.Data.MongoDb.Repository.Factory<Pocos.AxoDataFramentsExchangeExample.SharedDataHeaderData>(new MongoDbRepositorySettings<Pocos.AxoDataFramentsExchangeExample.SharedDataHeaderData>("mongodb://localhost:27017", "AxOpenData", "SharedDataHeader"));
Station_1_DataRepository = AXOpen.Data.MongoDb.Repository.Factory<Pocos.AxoDataFramentsExchangeExample.Station_1_Data>(new MongoDbRepositorySettings<Pocos.AxoDataFramentsExchangeExample.Station_1_Data>("mongodb://localhost:27017", "AxOpenData", "Station_1"));

var AxoProcessDataManager = Entry.Plc.AxoDataFragmentsExchangeContext.DataManager.CreateBuilder<AxoDataFramentsExchangeExample.AxoProcessDataManager>();

Expand All @@ -114,11 +110,9 @@
//AxoProcessDataRepository = new JsonRepositorySettings<Pocos.AxoDataExchangeExample.AxoProcessData>(ProcessDataLocation).Factory();

// *** MONGO REPOSITORY ***
AXOpen.Data.MongoDb.Repository.InitializeFactory(mongoConnectionString: "mongodb://localhost:27017",
mongoDatabaseName: "AxOpenData",
user: "user",
userpw: "userpwd");
AxoProcessDataRepository = AXOpen.Data.MongoDb.Repository.Factory<Pocos.AxoDataExchangeExample.AxoProcessData>("AxoDataExchangeExample");


AxoProcessDataRepository = AXOpen.Data.MongoDb.Repository.Factory<Pocos.AxoDataExchangeExample.AxoProcessData>(new MongoDbRepositorySettings<Pocos.AxoDataExchangeExample.AxoProcessData>("mongodb://localhost:27017", "AxOpenData","AxoDataExchangeExample"));

Entry.Plc.AxoDataExchangeContext.DataManager.InitializeRemoteDataExchange(AxoProcessDataRepository);
//</SetUpAxoDataExchange>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ public MongoDbRepositorySettings(string connectionString, string databaseName, s
}


/// <summary>
/// Creates new instance of <see cref="MongoDbRepositorySettings{T}"/> for a <see cref="MongoDbRepository{T}"/> with NON-SECURED access.
/// </summary>
/// <param name="connectionString">Database connection string</param>
/// <param name="databaseName">Database name</param>
/// <param name="collectionName">Collection name</param>
/// <param name="idExpression">Id expression</param>
public MongoDbRepositorySettings(string connectionString, string databaseName, string collectionName, Expression<Func<T, object>> idExpression)
{
SetupSerialisationAndMapping(idExpression);
Client = GetClient(connectionString);
Database = GetDatabase(databaseName);
Collection = GetCollection(collectionName);
}

/// <summary>
/// Creates new instance of <see cref="MongoDbRepositorySettings{T}"/> for a <see cref="MongoDbRepository{T}"/> with secured access.
/// </summary>
Expand All @@ -55,6 +70,7 @@ public MongoDbRepositorySettings(string connectionString, string databaseName, s
Collection = GetCollection(collectionName);
}


/// <summary>
/// Initializes a new instance of the <see cref="MongoDbRepositorySettings{T}"/> class for a
/// <see cref="MongoDbRepository{T}"/> with secured access. This constructor sets up the MongoDB
Expand Down
136 changes: 68 additions & 68 deletions src/data/src/repositories/MongoDb/RepositoryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ namespace AXOpen.Data.MongoDb
{
public static class Repository
{
private static string MongoConnectionString { get; set; }
private static string MongoDatabaseName { get; set; }
private static MongoDbCredentials Credentials { get; set; }
//private static string MongoConnectionString { get; set; }
//private static string MongoDatabaseName { get; set; }
//private static MongoDbCredentials Credentials { get; set; }

/// <summary>
/// Initializes the MongoDB repository factory with default connection settings.
/// </summary>
/// <param name="mongoConnectionString">The MongoDB connection string.</param>
/// <param name="mongoDatabaseName">The name of the MongoDB database.</param>
/// <param name="user">The username for database access.</param>
/// <param name="userpw">The password for database access.</param>
public static void InitializeFactory(string mongoConnectionString = "mongodb://localhost:27017",
string mongoDatabaseName = "AxOpenData",
string user = "user",
string userpw = "userpwd")
{
MongoConnectionString = mongoConnectionString;
MongoDatabaseName = mongoDatabaseName;
Credentials = new MongoDbCredentials(MongoDatabaseName, user, userpw);
}
///// <summary>
///// Initializes the MongoDB repository factory with default connection settings.
///// </summary>
///// <param name="mongoConnectionString">The MongoDB connection string.</param>
///// <param name="mongoDatabaseName">The name of the MongoDB database.</param>
///// <param name="user">The username for database access.</param>
///// <param name="userpw">The password for database access.</param>
//public static void InitializeFactory(string mongoConnectionString = "mongodb://localhost:27017",
// string mongoDatabaseName = "AxOpenData",
// string user = "user",
// string userpw = "userpwd")
//{
// MongoConnectionString = mongoConnectionString;
// MongoDatabaseName = mongoDatabaseName;
// Credentials = new MongoDbCredentials(MongoDatabaseName, user, userpw);
//}

/// <summary>
/// Creates a repository for a specific type using the provided repository settings.
Expand All @@ -47,57 +47,57 @@ public static IRepository<T> Factory<T>(this MongoDbRepositorySettings<T> parame
}
}

/// <summary>
/// Creates a repository for a specific type and collection name.
/// </summary>
/// <typeparam name="T">The type of the data object for the repository.</typeparam>
/// <param name="collectionName">The name of the MongoDB collection.</param>
/// <returns>An instance of <see cref="IRepository{T}"/>.</returns>
/// <exception cref="Exception">Thrown when repository creation fails.</exception>
public static IRepository<T> Factory<T>(string collectionName) where T : IBrowsableDataObject
{
try
{
var settings = new MongoDbRepositorySettings<T>(
connectionString: MongoConnectionString,
databaseName: MongoDatabaseName,
collectionName: collectionName,
credentials: Credentials);
///// <summary>
///// Creates a repository for a specific type and collection name.
///// </summary>
///// <typeparam name="T">The type of the data object for the repository.</typeparam>
///// <param name="collectionName">The name of the MongoDB collection.</param>
///// <returns>An instance of <see cref="IRepository{T}"/>.</returns>
///// <exception cref="Exception">Thrown when repository creation fails.</exception>
//public static IRepository<T> Factory<T>(string collectionName) where T : IBrowsableDataObject
//{
// try
// {
// var settings = new MongoDbRepositorySettings<T>(
// connectionString: MongoConnectionString,
// databaseName: MongoDatabaseName,
// collectionName: collectionName,
// credentials: Credentials);

return new MongoDbRepository<T>(settings);
}
catch (Exception ex)
{
throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex);
}
}
// return new MongoDbRepository<T>(settings);
// }
// catch (Exception ex)
// {
// throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex);
// }
//}

/// <summary>
/// Creates a repository for a specific type, collection name, and ID expression.
/// </summary>
/// <typeparam name="T">The type of the data object for the repository.</typeparam>
/// <param name="collectionName">The name of the MongoDB collection.</param>
/// <param name="idExpression">An expression defining the property to use as the MongoDB '_id'.</param>
/// <returns>An instance of <see cref="IRepository{T}"/>.</returns>
/// <exception cref="Exception">Thrown when repository creation fails.</exception>
public static IRepository<T> Factory<T>(string collectionName,Expression<Func<T,object>> idExpression) where T : IBrowsableDataObject
{
try
{
var settings = new MongoDbRepositorySettings<T>(
connectionString: MongoConnectionString,
databaseName: MongoDatabaseName,
collectionName: collectionName,
credentials: Credentials,
idExpression : idExpression
);
///// <summary>
///// Creates a repository for a specific type, collection name, and ID expression.
///// </summary>
///// <typeparam name="T">The type of the data object for the repository.</typeparam>
///// <param name="collectionName">The name of the MongoDB collection.</param>
///// <param name="idExpression">An expression defining the property to use as the MongoDB '_id'.</param>
///// <returns>An instance of <see cref="IRepository{T}"/>.</returns>
///// <exception cref="Exception">Thrown when repository creation fails.</exception>
//public static IRepository<T> Factory<T>(MongoDbRepositorySettings<T> settings, Expression<Func<T, object>> idExpression) where T : IBrowsableDataObject
//{
// try
// {
// var settings = new MongoDbRepositorySettings<T>(
// connectionString: MongoConnectionString,
// databaseName: MongoDatabaseName,
// collectionName: collectionName,
// credentials: Credentials,
// idExpression: idExpression
// );

return new MongoDbRepository<T>(settings);
}
catch (Exception ex)
{
throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex);
}
}
// return new MongoDbRepository<T>(settings);
// }
// catch (Exception ex)
// {
// throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex);
// }
//}
}
}
12 changes: 6 additions & 6 deletions src/data/this.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "axopen_repository_integrati
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_ax_sdk", "..\sdk-ax\ctrl\ix\ix_ax_ax_sdk.csproj", "{5DA36EFB-55C4-4386-AD4C-99AC7783E12E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security.Blazor", "..\Security\src\AXOpen.Security.Blazor\AXOpen.Security.Blazor.csproj", "{52AC8CD2-AA13-42FD-AFA7-F53C213D4731}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security.Blazor", "..\security\src\AXOpen.Security.Blazor\AXOpen.Security.Blazor.csproj", "{52AC8CD2-AA13-42FD-AFA7-F53C213D4731}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security", "..\Security\src\AXOpen.Security\AXOpen.Security.csproj", "{60C84F3C-1ECC-4553-975B-02DB599A083C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security", "..\security\src\AXOpen.Security\AXOpen.Security.csproj", "{60C84F3C-1ECC-4553-975B-02DB599A083C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_simatic1500", "..\simatic1500\ctrl\ix\ix_ax_axopen_simatic1500.csproj", "{74C7FC26-1CFB-45AF-BF08-296531C7AFAD}"
EndProject
Expand Down Expand Up @@ -123,13 +123,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ctrl", "..\sdk-ax\ctrl", "{
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sdk-ax", "..\sdk-ax", "{EC2CC8A1-A290-4331-8418-01B4589134A7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security.Blazor", "..\Security\src\AXOpen.Security.Blazor", "{747FF901-E6DE-424A-B72A-19CD5DB2EC35}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security.Blazor", "..\security\src\AXOpen.Security.Blazor", "{747FF901-E6DE-424A-B72A-19CD5DB2EC35}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security", "..\Security\src\AXOpen.Security", "{155C38C3-B5F1-4B8C-9CEE-A0E480050212}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security", "..\security\src\AXOpen.Security", "{155C38C3-B5F1-4B8C-9CEE-A0E480050212}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "..\Security\src", "{D0B64D79-991E-40A9-8124-4EE6A520F0C8}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "..\security\src", "{D0B64D79-991E-40A9-8124-4EE6A520F0C8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Security", "..\Security", "{C15F8A3D-3A08-46A6-8C5B-2E0532ECE434}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "security", "..\security", "{C15F8A3D-3A08-46A6-8C5B-2E0532ECE434}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ix", "..\simatic1500\ctrl\ix", "{6FF72005-D3B5-4BD6-8412-E13F37F67D54}"
EndProject
Expand Down
2 changes: 1 addition & 1 deletion src/templates.simple/ax/src/BaseUnit/Unit.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NAMESPACE axosimple.BaseUnit
/// Represents controlled units and high level task coordination.
///</summary>
{S7.extern=ReadWrite}
CLASS PUBLIC Unit
CLASS PUBLIC UnitBase
EXTENDS AXOpen.Core.AxoObject IMPLEMENTS axosimple.IUnit
VAR PUBLIC

Expand Down
Loading

0 comments on commit 4d0e1e0

Please sign in to comment.