Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/AasxCsharpLibrary/AdminShellUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,18 @@ public static void SetFieldLazyValue(
return;
}

// list of strings is vary common, therefore a special case is justified
if (tut?.IsGenericType == true
&& tut.GetGenericTypeDefinition() == typeof(List<>)
&& tut.GetGenericArguments().Count() == 1
&& tut.GetGenericArguments()[0] == typeof(string)
&& value is IEnumerable<string> vstr2)
{
var lststr = vstr2.ToList();
f.SetValue(obj, lststr);
return;
}

// 2024-01-04: make function more suitable for <DateTime?>
switch (Type.GetTypeCode(tut))
{
Expand Down
14 changes: 14 additions & 0 deletions src/AasxCsharpLibrary/Extensions/ExtendEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,20 @@ public static IEnumerable<IConceptDescription> AllConceptDescriptions(this AasCo
yield return cd;
}

/// <summary>
/// Enumerates any Identifiables in the Environment. Will not return <c>null</c>.
/// Is tolerant, if the list is <c>null</c>.
/// </summary>
public static IEnumerable<IIdentifiable> AllIdentifiables(this AasCore.Aas3_0.IEnvironment env)
{
foreach (var aas in env.AllAssetAdministrationShells())
yield return aas;
foreach (var sm in env.AllSubmodels())
yield return sm;
foreach (var cd in env.AllConceptDescriptions())
yield return cd;
}

/// <summary>
/// Returns the number of AssetAdministrationShells.
/// Is tolerant, if the list is <c>null</c>.
Expand Down
3 changes: 2 additions & 1 deletion src/AasxIntegrationBase/AnyUI/AnyUiContextPlusDialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ public async virtual Task<AnyUiDialogueDataLogMessage> MenuExecuteSystemCommand(
string caption,
string workDir,
string cmd,
string args)
string args,
string[] ignoreError = null)
{
await Task.Yield();
throw new NotImplementedException("MenuExecuteSystemCommand");
Expand Down
10 changes: 10 additions & 0 deletions src/AasxIntegrationBase/LogInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,18 @@ public void Append(StoredPrint sp)
/// </summary>
public int NumberErrors = 0;

/// <summary>
/// Incremented for each blue (important) message
/// </summary>
public int NumberBlues = 0;

/// <summary>
/// Clears errors
/// </summary>
public void ClearNumberErrors()
{
NumberErrors = 0;
NumberBlues = 0;
}

#region //////// Append to Log
Expand All @@ -282,6 +288,10 @@ public void Info(string msg, params object[] args)
/// </summary>
public void Info(StoredPrint.Color color, string msg, params object[] args)
{
if (color == StoredPrint.Color.Red)
NumberErrors++;
if (color == StoredPrint.Color.Blue)
NumberBlues++;
var p = new StoredPrint(color, String.Format(msg, args));
Append(p);
}
Expand Down
3 changes: 3 additions & 0 deletions src/AasxPackageExplorer/AasxPackageExplorer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@

<ItemGroup>
<Folder Include="FlyoutsForPlugins\" />
<None Update="query-presets.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="data-spec-presets.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
4 changes: 2 additions & 2 deletions src/AasxPackageExplorer/MainWindow.CommandBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public async Task CommandExecution_RedrawAllAsync()
/// </summary>
public bool ScriptModeShutdown = false;

public async Task<int> ExecuteMainMenuCommand(string menuItemName, params object[] args)
public async Task<int> ExecuteMainMenuCommand(string menuItemName, bool scriptMode, params object[] args)
{
if (menuItemName?.HasContent() != true)
{
Expand All @@ -123,7 +123,7 @@ public async Task<int> ExecuteMainMenuCommand(string menuItemName, params object
var ticket = new AasxMenuActionTicket()
{
MenuItem = mi,
ScriptMode = true,
ScriptMode = scriptMode,
ArgValue = new AasxMenuArgDictionary()
};

Expand Down
3 changes: 2 additions & 1 deletion src/AasxPackageExplorer/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@
<Label x:Name="LabelNumberErrors"
DockPanel.Dock="Right" MinWidth="60" Margin="2,3,2,2" Padding="2,0,2,0"
VerticalContentAlignment="Center" BorderBrush="LightGray" BorderThickness="1"
Content="No errors"/>
Content="No errors"
MouseDown="LabelNumberErrors_MouseDown"/>

<Grid DockPanel.Dock="Right">
<Grid.RowDefinitions>
Expand Down
63 changes: 60 additions & 3 deletions src/AasxPackageExplorer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ private async void Window_Loaded(object sender, RoutedEventArgs e)

// Package Central starting ..
PackageCentral.CentralRuntimeOptions = UiBuildRuntimeOptionsForMainAppLoad();
PackageCentral.ExecuteMainCommand = this;

// start with empty repository and load, if given by options
RepoListControl.PackageCentral = PackageCentral;
Expand Down Expand Up @@ -1285,12 +1286,16 @@ private async void Window_Loaded(object sender, RoutedEventArgs e)
};

// what happens on a file drop -> dispatch
RepoListControl.FileDrop += (senderList, fr, files) =>
RepoListControl.FileDrop += async (senderList, fr, files) =>
{
// access
if (files == null || files.Length < 1)
return;

// hand over the full list for potential bulk adding
if (fr != null)
await fr.AddByListOfAasxFn(PackageCentral, files);

// more than one?
foreach (var fn in files)
{
Expand Down Expand Up @@ -1387,6 +1392,11 @@ private async void Window_Loaded(object sender, RoutedEventArgs e)

if (container == null)
Log.Singleton.Error($"Failed to auto-load AASX from {location}");
else if (container.Env?.AasEnv != null && container.Env.AasEnv.AllIdentifiables().Count() < 1)
{
Log.Singleton.Info(StoredPrint.Color.Blue,
$"Auto-load request seem to result in empty data! Auto-load location: {location}");
}
else
UiLoadPackageWithNew(PackageCentral.MainItem,
takeOverContainer: container, onlyAuxiliary: false, indexItems: true,
Expand Down Expand Up @@ -1525,6 +1535,9 @@ private void ToolFindReplace_ResultSelected(AasxSearchUtil.SearchResultItem resu
onlyReFocus: true));
}

private string _lastMessageBlue = "";
private string _lastMessageError = "";

private void MainTimer_HandleLogMessages()
{
// pop log messages from the plug-ins into the Stored Prints in Log
Expand All @@ -1551,20 +1564,23 @@ private void MainTimer_HandleLogMessages()
}
case StoredPrint.Color.Blue:
{
_lastMessageBlue = "" + sp.msg;
Message.Background = Brushes.LightBlue;
Message.Foreground = Brushes.Black;
Message.FontWeight = FontWeights.Normal;
break;
}
case StoredPrint.Color.Yellow:
{
_lastMessageBlue = "" + sp.msg;
Message.Background = Brushes.Yellow;
Message.Foreground = Brushes.Black;
Message.FontWeight = FontWeights.Bold;
break;
}
case StoredPrint.Color.Red:
{
_lastMessageError = "" + sp.msg;
Message.Background = new SolidColorBrush(Color.FromRgb(0xd4, 0x20, 0x44)); // #D42044
Message.Foreground = Brushes.White;
Message.FontWeight = FontWeights.Bold;
Expand All @@ -1590,14 +1606,21 @@ private void MainTimer_HandleLogMessages()

// always tell the errors
var ne = Log.Singleton.NumberErrors;
var nb = Log.Singleton.NumberBlues;
if (ne > 0)
{
LabelNumberErrors.Content = "Errors: " + ne;
LabelNumberErrors.Background = new SolidColorBrush(Color.FromRgb(0xd4, 0x20, 0x44)); // #D42044
}
else
if (nb > 0)
{
LabelNumberErrors.Content = "Major: " + nb;
LabelNumberErrors.Background = Brushes.LightBlue;
}
else
{
LabelNumberErrors.Content = "No errors";
LabelNumberErrors.Content = "No attention";
LabelNumberErrors.Background = Brushes.White;
}
}
Expand Down Expand Up @@ -3224,6 +3247,8 @@ private async Task ButtonHistory_ObjectRequested(object sender, VisualElementHis
/// </summary>
public void StatusLineClear()
{
_lastMessageBlue = "";
_lastMessageError = "";
Log.Singleton.ClearNumberErrors();
Message.Content = "";
Message.Background = Brushes.White;
Expand All @@ -3232,6 +3257,29 @@ public void StatusLineClear()
SetProgressDownload();
}

public void ShowLastMessage(StoredPrint.Color showColor)
{
switch (showColor)
{
case StoredPrint.Color.Blue:
{
Message.Content = "" + _lastMessageBlue;
Message.Background = Brushes.LightBlue;
Message.Foreground = Brushes.Black;
Message.FontWeight = FontWeights.Normal;
break;
}
case StoredPrint.Color.Red:
{
Message.Content = "" + _lastMessageError;
Message.Background = new SolidColorBrush(Color.FromRgb(0xd4, 0x20, 0x44)); // #D42044
Message.Foreground = Brushes.White;
Message.FontWeight = FontWeights.Bold;
break;
}
}
}

/// <summary>
/// Show log in a window / list perceivable for the user.
/// </summary>
Expand Down Expand Up @@ -3290,6 +3338,16 @@ private void ButtonReport_Click(object sender, RoutedEventArgs e)
}
}

private void LabelNumberErrors_MouseDown(object sender, MouseButtonEventArgs e)
{
// something important
if (Log.Singleton.NumberErrors > 0 && _lastMessageError?.HasContent() == true)
ShowLastMessage(StoredPrint.Color.Red);
else
if (Log.Singleton.NumberBlues > 0 && _lastMessageBlue?.HasContent() == true)
ShowLastMessage(StoredPrint.Color.Blue);
}

/// <summary>
/// Take a screenshot and save to file
/// </summary>
Expand Down Expand Up @@ -4519,6 +4577,5 @@ private async void Button_Click(object sender, RoutedEventArgs e)
}
}


}
}
32 changes: 18 additions & 14 deletions src/AasxPackageExplorer/options-debug.MIHO.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
/* If set, start in editor mode instead of browse mode. */
"EditMode": true
/* If set, do not start in hinting mode. */,
"NoHints": true
/* This file shall be loaded as main package at start of application | Arg: <path> */,
"AasxToLoad": "http://localhost:8081/shells/aHR0cHM6Ly9hZG1pbi1zaGVsbC1pby9pZHRhL2Fhcy9Qcm9kdWN0Q2hhbmdlTm90aWZpY2F0aW9ucy8xLzA"
"NoHints": true,
/* This file shall be loaded as main package at start of application | Arg: <path> */
// "AasxToLoad": "http://localhost:8081/shells/aHR0cHM6Ly9hZG1pbi1zaGVsbC1pby9pZHRhL2Fhcy9Qcm9kdWN0Q2hhbmdlTm90aWZpY2F0aW9ucy8xLzA"
// "AasxToLoad": "http://localhost:8081/shells/aHR1cHM6Ly9hZG1pbi1zaGVsbC1pby9pZHRhL2Fhcy9Qcm9kdWN0Q2hhbmdlTm90aWZpY2F0aW9ucy8xLzA"
// "AasxToLoad": "C:\\Users\\Micha\\Desktop\\test-smt-on-basyx\\IDTA_02036-1-0_SMT_ProductChangeNotification_Draft_v35_manual_fixes.aasx"
"AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\SMT\\IDTA 02036-1-0_Submodel_ProductChangeNotification\\IDTA_02036-1-0_SMT_ProductChangeNotification_Draft_v40_add_podman.aasx"
/* This file shall be loaded as aux package at start of application | Arg: <path> */,
"AuxToLoad": null
/* List of pathes to a JSON, defining a set of AasxPackage-Files, which serve as repository. | Arg: <path> */,
Expand All @@ -31,18 +33,18 @@
"Method": "Ask", // None, Ask, Basic, CertificateStore, File, InteractiveEntry, Secret
"Username": "Admin",
"Password": "",
// "Password": "SuperSafePasswd",
// "Password": "superSafePasswd",
// "AuthServer": "",
"AuthServer": "https://www.admin-shell-io.com/50001/.well-known/openid-configuration", // for rest of authentication
// "AuthServer": "https://credential.aas-voyager.com/token", // for secret based OpenID Connect
"CertFile": "",
"CertPassword": "",
"CertPick": "GEANT",
// "CertPick" : "",
// "SecretId": "",
"SecretId": "aorzelski@phoenixcontact.com",
// "SecretValue": "",
"SecretValue": "aorzelski@phoenixcontact.com-secret"
// "CertPick": "GEANT",
"CertPick": "",
"SecretId": "",
// "SecretId": "aorzelski@phoenixcontact.com",
"SecretValue": ""
// "SecretValue": "aorzelski@phoenixcontact.com-secret"
}
},
{
Expand Down Expand Up @@ -75,15 +77,15 @@
/* Maximum parallel write operations, such as HTTP uploads. */,
"MaxParallelWriteOps": 1
/* For connecting to repositories/ registry, default pagination limit. */,
"DefaultConnectPageLimit" : 20
"DefaultConnectPageLimit": 20
/* If not -1, the left of window | Arg: <pixel> */,
"WindowLeft": -1
/* If not -1, the top of window | Arg: <pixel> */,
"WindowTop": -1
/* If not -1, the width of window | Arg: <pixel> */,
"WindowWidth": 900
"WindowWidth": 1440
/* If not -1, the height of window | Arg: <pixel> */,
"WindowHeight": 600
"WindowHeight": 584
/* If set, then maximize window on application startup */,
"WindowMaximized": false
/* Template string for the id of an AAS. Could contain up to 16 placeholders of: D = decimal digit, X = hex digit, A = alphanumerical digit | Arg: <string> */,
Expand Down Expand Up @@ -112,14 +114,16 @@
"ExtensionsPresetFile": "extension-presets.json"
/* Path to JSON file defining data specification presets. | Arg: <path> */,
"DataSpecPresetFile": "data-spec-presets.json"
/* Path to JSON file defining query presets. */,
"QueryPresetFile": "query-presets.json"
/* Home address of the content browser on startup, on change of AASX | Arg: <URL> */,
"ContentHome": "https://github.com/eclipse-aaspe/package-explorer/blob/main/README.md"
/* If unset, use transparent flyover dialogs, where possible */,
"UseFlyovers": true
/* If other then -1, then time in ms for the splash window to stay on the screen. | Arg: <milli-secs> */,
"SplashTime": 0
/* Fraction of main window with dedicated to left column of screen when resizing window. | Arg: Percent 0-100.0 */,
"PercentageLeftColumn": 12.0
"PercentageLeftColumn": 15.0
/* Fraction of main window with dedicated to right column of screen (content section) when resizing window. | Arg: Percent 0-100.0 */,
"PercentageRightColumn": 60.0
/* If true, use always internal browser */,
Expand Down
1 change: 1 addition & 0 deletions src/AasxPackageExplorer/options-debug.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"ExtensionsPresetFile": "extension-presets.json",
"IdentifierKeyValuePairsFile": "local-identifier-presets.json",
"DataSpecPresetFile": "data-spec-presets.json",
"QueryPresetFile": "query-presets.json",
"ContentHome": "https://github.com/admin-shell/io/blob/master/README.md",
"UseFlyovers": true,
"SplashTime": 0,
Expand Down
Loading
Loading