Skip to content

Commit

Permalink
data exchange roles
Browse files Browse the repository at this point in the history
Added authentification over buttons: create, load, send, copy, delete in DataExchangeView
  • Loading branch information
blazej.kuhajda committed Dec 10, 2024
1 parent b62822f commit 27497b2
Show file tree
Hide file tree
Showing 12 changed files with 276 additions and 73 deletions.
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>
10 changes: 10 additions & 0 deletions src/data/app/ix-blazor/librarytemplate.blazor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,19 @@ public static List<Role> CreateRoles()
new Role(can_skip_steps_in_sequence),
};


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;
}



public const string can_run_ground_mode = nameof(can_run_ground_mode);
public const string can_run_automat_mode = nameof(can_run_automat_mode);
public const string can_run_service_mode = nameof(can_run_service_mode);
Expand Down
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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AXOpen.Data
{
public static class DataExchangeRoleNames
{
public const string can_data_item_create = nameof(can_data_item_create);
public const string can_data_item_edit = nameof(can_data_item_edit);
public const string can_data_item_copy = nameof(can_data_item_copy);
public const string can_data_item_delete = nameof(can_data_item_delete);

public const string can_data_send_to_plc = nameof(can_data_send_to_plc);
public const string can_data_load_from_plc = nameof(can_data_send_to_plc);

public const string can_data_export = nameof(can_data_export);
public const string can_data_import = nameof(can_data_import);

}
}
Loading

0 comments on commit 27497b2

Please sign in to comment.