Skip to content

Commit

Permalink
Refactors inspector dialog (#437)
Browse files Browse the repository at this point in the history
- inspector dialog now displays pertinent dialog
- removes dialog injection, each inspector uses dedicated instance
  • Loading branch information
PTKu authored Oct 4, 2024
1 parent 49b17b3 commit 0b09a10
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 48 deletions.
13 changes: 6 additions & 7 deletions src/inspectors/ctrl/src/AxoInspector.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ NAMESPACE AXOpen.Inspectors
_isOverInspected: BOOL;
_busy : BOOL;
_commonData: REF_TO AxoInspectorData;
_originalOverallResult : IAxoComprehensiveResult;
_originalOverallResult : IAxoComprehensiveResult;
END_VAR

VAR PUBLIC
_DL : AXOpen.Inspectors.AxoInspectorDialog;
END_VAR

/// <summary>
/// Check, if data are overinspected (attempts of inspections is larger than maximum number of allowed retries)
Expand Down Expand Up @@ -80,13 +83,9 @@ NAMESPACE AXOpen.Inspectors
inRetryStep: IAxoStep;
inTerminateStep: IAxoStep;
END_VAR

VAR_IN_OUT
inoDialog : AxoInspectorDialog;
END_VAR


// here if is coordinator missing, it should provide message to call it with WithCoordinator method
inoDialog.Show(REF(THIS), inRetryStep, inTerminateStep);
_DL.Show(REF(THIS), inRetryStep, inTerminateStep);

END_METHOD

Expand Down
6 changes: 1 addition & 5 deletions src/inspectors/ctrl/src/interfaces/IInspector.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ NAMESPACE AXOpen.Inspectors
inRetryStep: IAxoStep;
inTerminateStep: IAxoStep;
END_VAR

VAR_IN_OUT
inoDialog : AxoInspectorDialog;
END_VAR


END_METHOD

METHOD RestoreInspectorTask : BOOL
Expand Down
6 changes: 1 addition & 5 deletions src/inspectors/ctrl/src/interfaces/IOnFail.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ NAMESPACE AXOpen.Inspectors
VAR_INPUT
inRetryStep: AXOpen.Core.IAxoStep;
inTerminateStep: AXOpen.Core.IAxoStep;
END_VAR

VAR_IN_OUT
inoDialog : AxoInspectorDialog;
END_VAR
END_VAR
END_METHOD


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,29 @@
@inherits AxoDialogBaseView<AxoInspectorDialog>
@inject AuthenticationStateProvider _asp


<div class="border border-2 rounded">

<div class="border border-2 rounded p-3">
<h3>Inspection failed, you will need to decide what's next...</h3>
<p>@Component.Symbol</p>

<div class="d-flex justify-content-center ">

<div class="d-flex flex-column align-items-center">
<div>

<h5>@Description</h5>
@if (Inspector != null)
{
<RenderableContentControl Context="Inspector" Presentation="Status" />
}
else
{
<p>Loading inspector... if it's taking long, something is wrong</p>
}

<!-- Renderable content control at the top -->
<RenderableContentControl Context="Component.GetParent()" Presentation="Status"/>
</div>
<div class="d-flex justify-content-center ">
<button type="button" class="btn btn-secondary m-2 w-50" disabled="@RetryDisabled" @onclick="Retry">Retry</button>

<button type="button" class="btn btn-secondary m-2 w-50" @onclick="Terminate">Terminate</button>

<button type="button" class="btn btn-secondary m-2 w-50" @onclick="Override">Override</button>
<div class="mt-3" style="width: 100%;">
<!-- Buttons in a row, centered horizontally -->
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-secondary m-2 w-50" disabled="@RetryDisabled" @onclick="Retry">Retry</button>
<button type="button" class="btn btn-secondary m-2 w-50" @onclick="Terminate">Terminate</button>
<button type="button" class="btn btn-secondary m-2 w-50" @onclick="Override">Override</button>
</div>
</div>

</div>
<div>

<div class="mt-4">
@if (!_asp.GetAuthenticationStateAsync().Result.User.Identity.IsAuthenticated)
{
<p>You are not authorized, please <a href="Identity/Account/Login">Log In</a>.</p>
<p>You are not authorized, please <a href="Identity/Account/Login">Log In</a>.</p>
}

</div>
</div>




Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected override void OnAfterRender(bool firstRender)
try
{
// _inspectorIndentity property is subscribed in the method base.AddToPolling()
var parent = Component.GetConnector().IdentityProvider.GetTwinByIdentity(Component._inspectorIndentity.Cyclic);
var parent = Component.GetParent();

if (parent != null)
{
Expand Down

0 comments on commit 0b09a10

Please sign in to comment.