Skip to content

Commit

Permalink
Merge pull request #467 from ix-ax/466-_NEW-FEATURE_log_button_action…
Browse files Browse the repository at this point in the history
…_in_DataExchange_Edit_window

* Create draft PR for #466

* dataexchange user action loging

* Double akc on button send data to PLC

* data exchange roles

Added authentification over buttons: create, load, send, copy, delete in DataExchangeView

* reload data record after canceled edit in modal window

* fix refactored method in dataexchange

* update upax file for app, entry, certs

* certs

* cert

* some change

* fixed an issue with dependency

---------

Co-authored-by: blazej.kuhajda <blazej.kuhajda@mts.sk>
Co-authored-by: Peter Kurhajec <61538034+PTKu@users.noreply.github.com>
  • Loading branch information
PTKu and blazej.kuhajda authored Dec 11, 2024
2 parents 51752e3 + daa5504 commit 6b01411
Show file tree
Hide file tree
Showing 24 changed files with 472 additions and 111 deletions.
2 changes: 1 addition & 1 deletion src/ax.axopen.hwlibrary/ctrl/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ files:
devDependencies:
"@ix-ax/ax-sdk": '0.0.0-dev.0'
catalogs:
"@ax/simatic-ax": ^2405.2.0
"@ax/simatic-ax": 2405.2.0
dependencies:
"@ix-ax/ax.axopen.min": '0.0.0-dev.0'
"@ax/simatic-1500-distributedio": 7.0.1
Expand Down
19 changes: 19 additions & 0 deletions src/data/app/SystemConstants/plc_line_HwIdentifiers.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CONFIGURATION HardwareIDs
VAR_GLOBAL CONSTANT
plc_line_HwID : UINT := UINT#32;
plc_line_Rail_0_HwID : UINT := UINT#257;
plc_line_plc_line_HwID : UINT := UINT#48;
plc_line_plc_line_CPU_display_1_HwID : UINT := UINT#54;
plc_line_plc_line_Card_reader_writer_1_HwID : UINT := UINT#51;
plc_line_plc_line_DP_interface_1_HwID : UINT := UINT#60;
plc_line_plc_line_OPC_UA_1_HwID : UINT := UINT#117;
plc_line_plc_line_profinet_x1_HwID : UINT := UINT#64;
plc_line_plc_line_profinet_x1_Port_1_HwID : UINT := UINT#65;
plc_line_plc_line_profinet_x1_Port_2_HwID : UINT := UINT#66;
plc_line_plc_line_profinet_x2_HwID : UINT := UINT#72;
plc_line_plc_line_profinet_x2_Port_3_HwID : UINT := UINT#73;
plc_line_plc_line_virtual_communication_interface_HwID : UINT := UINT#135;
profinet_plc_line_HwID : UINT := UINT#256;

END_VAR
END_CONFIGURATION
5 changes: 5 additions & 0 deletions src/data/app/SystemConstants/plc_line_IoAddresses.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONFIGURATION IoAddresses
VAR_GLOBAL

END_VAR
END_CONFIGURATION
6 changes: 5 additions & 1 deletion src/data/app/apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ dependencies:
"@ix-ax/axopen.data": '0.0.0-dev.0'
"@ix-ax/ax.axopen.app": '0.0.0-dev.0'
"@ix-ax/axopen.simatic1500": '0.0.0-dev.0'
installStrategy: strict
# this is just temporary to test new features
# upto the moment of releasing new catalog
# installStrategy: strict
"@ix-ax/ax.latest.packages": '0.0.0-dev.0'
installStrategy: overridable
apaxVersion: 3.3.1
scripts:
# For proper execution of these scripts, the following variables need to be defined as environment variables or local variables.
Expand Down
19 changes: 19 additions & 0 deletions src/data/app/certs/plc_line/plc_line.cer
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDqTCCApGgAwIBAgIUWIyy2tceYfRUs4uPo6KZXlgGQY8wDQYJKoZIhvcNAQELBQAwgYYxCzAJ
BgNVBAYTAlhYMRIwEAYDVQQIDAlTdGF0ZU5hbWUxETAPBgNVBAcMCENpdHlOYW1lMRQwEgYDVQQK
DAtDb21wYW55TmFtZTEbMBkGA1UECwwSQ29tcGFueVNlY3Rpb25OYW1lMR0wGwYDVQQDDBRDb21t
b25OYW1lT3JIb3N0bmFtZTAeFw0yNDEyMTAxMDI3MTFaFw0yNTEyMTAxMDI3MTFaMIGGMQswCQYD
VQQGEwJYWDESMBAGA1UECAwJU3RhdGVOYW1lMREwDwYDVQQHDAhDaXR5TmFtZTEUMBIGA1UECgwL
Q29tcGFueU5hbWUxGzAZBgNVBAsMEkNvbXBhbnlTZWN0aW9uTmFtZTEdMBsGA1UEAwwUQ29tbW9u
TmFtZU9ySG9zdG5hbWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCmr6liRyZbj0WO
0rxgaGmbR+RB/petCLZXE7zWjVbctSnVHSZOHpRR0MGcdl1Py9LmD4OCBLr227dZBn94E4xZLxFc
LiuIxfxoTLgRdt3mmdaZTdQ1cyhB/vMoYbPlwt1UXXKhZWpJl0k7kyrBE1eilGoBj5QzE/740cVJ
MWZ2TwGOSpzdTDGzCTKwUHiEUdgldslHzf+On5kwPVuYPxyvLF2AtJ3sJOg3Me3W6l39nDXkT2SQ
CcnGiELF0k06UNOS2q+r8mg8uOltNVBkdjnEoTWzMCRx+XHNfiliJPqK3hO6QHuZEP2UZA+6HRrk
jkhopEaaLOE528aVCXqgg+itAgMBAAGjDTALMAkGA1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggEB
AHzLOYXsUK0aTHtY2VZEg03MgvHrxI3lfCWQNo0/lhkedhxBkHF8/I9IHlZxaSTCElfKVnEsb9JW
JI6zK8UNLei2Sy6qwpHnePQZPkl9usaRn/AmgybEDUZk8vZ/RhAPgTvi8zGZTLU+oIvZ9gL46PUa
/b+YYgGtu2ax+OSz7ZUVqyGeL9mF7mNjGRP+i01qF6DeemhO1YCXw4zdK12z5t3qc/wKJkAdGTun
BF06KgzJIY6Q2jrrC6mtIQou7UdmPSkpWegLLYfk3gPMVbw5Na8puIM1EDE28fFNJb9VABs3prtp
gRfWVdYDCg9/agYD1kR4ZbJZeu6/+I5GUod5DUE=
-----END CERTIFICATE-----
29 changes: 0 additions & 29 deletions src/data/app/hwc/plc_line.hwl.json

This file was deleted.

14 changes: 14 additions & 0 deletions src/data/app/hwc/plc_line.hwl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Devices:
- Name: plc_line
Modules:
- Apply:
TemplateName: 6ES7516-3AP03-0AB0_v3_1
Arguments:
PLCName: plc_line
IpAddress_X1: 10.10.10.120/24
ProfinetDeviceName_X1: plc_line_x1
IoSystems:
- Name: profinet_plc_line
ControllerInterfaces:
- Ref: plc_line/plc_line/profinet_x1

32 changes: 19 additions & 13 deletions src/data/app/ix-blazor/librarytemplate.blazor/App.razor
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
@using librarytemplate.blazor.hmi.Shared;
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
@using AxOpen.Security.Service
@using librarytemplate.blazor.hmi.Shared;


<CascadingAuthenticationState>
<Router AppAssembly="@typeof(App).Assembly"
AdditionalAssemblies="new[] { typeof(BlazorSecurity).Assembly}">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
</CascadingAuthenticationState>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@page "/Security/UserAdministration"
<div class="ms-5">
<AxOpen.Security.Views.SecurityManagementView />
</div>
52 changes: 25 additions & 27 deletions src/data/app/ix-blazor/librarytemplate.blazor/Program.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using System.Data;
using AXOpen.Core;
using AxOpen.Security.Services;
using AXSharp.Presentation.Blazor.Services;
using AXSharp.Connector;
using AXOpen.Base.Data;
using AxOpen.Security.Entities;
using System.Reflection;
using AxOpen.Security;
using Serilog;
using AxOpen.Security.Entities;
using AxOpen.Security.Services;
using AXOpen;
using AXOpen.Base.Data;
using AXOpen.Data.Json;
using AXOpen.Data.MongoDb;
using AXOpen.Logging;
using AXSharp.Connector;
using AXSharp.Presentation.Blazor.Services;
using librarytemplate;
using AXOpen.Data.InMemory;
using AXOpen.Data.MongoDb;
using AXOpen.Data.Json;

using Serilog;
using System.Data;
using System.Reflection;

var builder = WebApplication.CreateBuilder(args);

Expand All @@ -41,13 +36,13 @@
fileSizeLimitBytes: 100000)
.MinimumLevel.Debug()
.CreateLogger());

await Entry.Plc.Connector.IdentityProvider.ConstructIdentitiesAsync();

AxoApplication.CreateBuilder().ConfigureLogger(new SerilogLogger(new LoggerConfiguration()
.WriteTo.Console().MinimumLevel.Verbose()
.CreateLogger()));


//<SetUpAxoDataPersistentExchange>
IRepository<AXOpen.Data.PersistentRecord> persistentRepository;

Expand All @@ -60,17 +55,14 @@

// *** MONGO REPOSITORY ***


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


Entry.Plc.AxoDataPersistentContext.DataManager.InitializeRemoteDataExchange(
Entry.Plc.AxoDataPersistentContext.PersistentRootObject,
Entry.Plc.AxoDataPersistentContext.DataManager.InitializeRemoteDataExchange(
Entry.Plc.AxoDataPersistentContext.PersistentRootObject,
persistentRepository
);
//</SetUpAxoDataPersistentExchange>


//<SetUpAxoDataFragmentExchange>
IRepository<Pocos.AxoDataFramentsExchangeExample.SharedDataHeaderData> SharedDataHeaderDataRepository;
IRepository<Pocos.AxoDataFramentsExchangeExample.Station_1_Data> Station_1_DataRepository;
Expand All @@ -97,7 +89,6 @@
AxoProcessDataManager.InitializeRemoteDataExchange();
//</SetUpAxoDataFragmentExchange>


//<SetUpAxoDataExchange>
IRepository<Pocos.AxoDataExchangeExample.AxoProcessData> AxoProcessDataRepository;

Expand All @@ -111,8 +102,7 @@

// *** MONGO REPOSITORY ***


AxoProcessDataRepository = AXOpen.Data.MongoDb.Repository.Factory<Pocos.AxoDataExchangeExample.AxoProcessData>(new MongoDbRepositorySettings<Pocos.AxoDataExchangeExample.AxoProcessData>("mongodb://localhost:27017", "AxOpenData","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 Expand Up @@ -143,7 +133,6 @@

app.Run();


static string CreateJsonRepositoryDirectory(string path = "..\\..\\..\\..\\..\\JSONREPOS\\")
{
var executingAssemblyFile = new FileInfo(Assembly.GetExecutingAssembly().Location);
Expand All @@ -157,7 +146,6 @@ static string CreateJsonRepositoryDirectory(string path = "..\\..\\..\\..\\..\\J

static (IRepository<User>, IRepository<Group>) SetUpJsonSecurityRepository(string repositoryDirectory)
{

IRepository<User> userRepo = new JsonRepository<User>(new JsonRepositorySettings<User>(Path.Combine(repositoryDirectory, "Users")));
IRepository<Group> groupRepo = new JsonRepository<Group>(new JsonRepositorySettings<Group>(Path.Combine(repositoryDirectory, "Groups")));

Expand All @@ -178,6 +166,16 @@ public static List<Role> CreateRoles()
new Role(can_skip_steps_in_sequence),
};

//roles.Add(new Role(AXOpen.Data.DataExchangeRoleNames.can_data_item_create));
// ...

foreach (var item in typeof(AXOpen.Data.DataExchangeRoleNames).
GetFields(BindingFlags.Public | BindingFlags.Static).
Where(f => f.FieldType == typeof(string)))
{
roles.Add(new Role(item.Name));
}

return roles;
}

Expand All @@ -187,4 +185,4 @@ public static List<Role> CreateRoles()
public const string process_settings_access = nameof(process_settings_access);
public const string process_traceability_access = nameof(process_traceability_access);
public const string can_skip_steps_in_sequence = nameof(can_skip_steps_in_sequence);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@inherits LayoutComponentBase

<PageTitle>librarytemplate.blazor</PageTitle>

<TopRow />
<div class="page">
<div class="sidebar">
<NavMenu />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,19 @@
<span class="oi oi-plus" aria-hidden="true"></span> Persistent Data
</NavLink>
</div>

<div class="nav-item px-3">
<NavLink class="nav-link" href="documentation">
<span class="oi oi-plus" aria-hidden="true"></span> Documentation
</NavLink>
</div>

<div class="nav-item px-3">
<NavLink class="nav-link" href="Security/UserAdministration">
<span class="oi oi-person" aria-hidden="true"></span> User Administration
</NavLink>
</div>

</nav>
</div>

Expand Down
49 changes: 49 additions & 0 deletions src/data/app/ix-blazor/librarytemplate.blazor/Shared/TopRow.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@using System.Globalization
@inject NavigationManager NavigationManager

<div class="top-row px-2">
<a href="">
<img src="logo-no-background.svg" width="50" />
</a>


<div class="ms-auto">
<select class="form-control" @bind="Culture" @bind:event="oninput">
@foreach (var culture in supportedCultures)
{
<option data value="@culture">@culture.NativeName</option>
}
</select>
</div>
<div class="ms-5">
<AxOpen.Security.Views.LoginDisplay />
</div>
</div>

@code {
private CultureInfo[] supportedCultures = new[]
{
new CultureInfo("en-US"),
new CultureInfo("sk-SK"),
new CultureInfo("es-ES")
};

private CultureInfo Culture
{
get => CultureInfo.CurrentCulture;
set
{
// Prevent unnecessary navigation
if (!Equals(CultureInfo.CurrentCulture, value) && !Equals(CultureInfo.CurrentUICulture, value))
{
var cultureEscaped = Uri.EscapeDataString(value.Name);
NavigationManager.NavigateTo($"/culture?culture={cultureEscaped}", true);
}
}
}

protected override void OnInitialized()
{
Culture = CultureInfo.CurrentCulture;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.top-row {
background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5;
height: 3.5rem;
display: flex;
align-items: center;
}

@media (max-width: 769px) {
.IAmHereIndicator {
display: none;
}
}
Loading

0 comments on commit 6b01411

Please sign in to comment.