Skip to content

Commit

Permalink
[Add] menu implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sam.gerene committed Dec 8, 2021
1 parent 3f1c2c0 commit 610eff0
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The reqifviewer is a web application to inspect and navigate [ReqIF](https://www.omg.org/spec/ReqIF/1.2/About-ReqIF/) files. The web application is developed using Blazor and depends on [ReqIFSharp](https://reqifsharp.org) for [ReqIF](https://www.omg.org/spec/ReqIF/1.2/About-ReqIF/) processing.

> Visit https://reqifviewer.reqifsharp.org to see the application in action.
> Visit https://viewer.reqifsharp.org to see the application in action.
## Build and Deploy using Docker

Expand All @@ -23,4 +23,4 @@ $ ./solutionfolder# docker push rheagroup/reqifviewer:latest

## Autodeployment

reqifviewer is dockerized and pushed to [dockerhub](https://hub.docker.com/repository/docker/rheagroup/reqifviewer) using a GitHub action that is triggered by pushing a **tag** that has the following naming convention `web-app-x.y.z`, where x.y.z is the version numbr following [SEMVER](https://semver.org/). The server where the docker container is hosted automatically pulls latest using [watchtower](https://github.com/containrrr/watchtower), find it at https://reqifviewer.reqifsharp.org.
reqifviewer is dockerized and pushed to [dockerhub](https://hub.docker.com/repository/docker/rheagroup/reqifviewer) using a GitHub action that is triggered by pushing a **tag** that has the following naming convention `web-app-x.y.z`, where x.y.z is the version numbr following [SEMVER](https://semver.org/). The server where the docker container is hosted automatically pulls latest using [watchtower](https://github.com/containrrr/watchtower), find it at https://viewer.reqifsharp.org.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<Company>RHEA System S.A.</Company>
<Title>ReqifViewer.Infrastructure</Title>
<Version>0.0.1</Version>
<Version>0.1.0</Version>
<Description>Shared Infrastructure</Description>
<Copyright>Copyright © RHEA System S.A.</Copyright>
<Authors>Sam Gerené</Authors>
Expand Down
7 changes: 6 additions & 1 deletion ReqifViewer.Infrastructure/Services/IReqIFLoaderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

namespace ReqifViewer.Infrastructure.Services
{
using System;
using System.IO;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

using ReqIFSharp;
Expand Down Expand Up @@ -60,5 +60,10 @@ public interface IReqIFLoaderService
/// <see cref="SourceStream"/>
/// </summary>
void Reset();

/// <summary>
/// Event Handler that is invoked when the <see cref="ReqIFLoaderService"/> has either loaded data or has been reset
/// </summary>
event EventHandler<IEnumerable<ReqIF>> ReqIfChanged;
}
}
13 changes: 11 additions & 2 deletions ReqifViewer.Infrastructure/Services/ReqIFLoaderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

namespace ReqifViewer.Infrastructure.Services
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using ReqIFSharp;

Expand Down Expand Up @@ -66,8 +66,10 @@ public async Task Load(Stream reqIFStream)

var reqIfDeserializer = new ReqIFDeserializer();
result = reqIfDeserializer.Deserialize(this.SourceStream);

this.ReqIFData = result;

ReqIfChanged?.Invoke(this, this.ReqIFData);
}

/// <summary>
Expand All @@ -78,6 +80,13 @@ public void Reset()
{
this.SourceStream = null;
this.ReqIFData = null;

ReqIfChanged?.Invoke(this, null);
}

/// <summary>
/// Event Handler that is invoked when the <see cref="ReqIFLoaderService"/> has either loaded data or has been reset
/// </summary>
public event EventHandler<IEnumerable<ReqIF>> ReqIfChanged;
}
}
8 changes: 5 additions & 3 deletions reqifviewer/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@

@code {

bool sidebarExpanded = false;
bool bodyExpanded = true;
string version = string.Empty;
private bool sidebarExpanded = false;

private bool bodyExpanded = true;

private string version = string.Empty;

/// <summary>
/// Method invoked when the component is ready to start, having received its
Expand Down
56 changes: 54 additions & 2 deletions reqifviewer/Shared/SideMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,42 @@
limitations under the License.
------------------------------------------------------------------------------->

@using ReqifViewer.Infrastructure.Services
@using ReqIFSharp

@inject IReqIFLoaderService reqIfLoaderService

<RadzenSidebar @bind-Expanded="@Expanded">
<ChildContent>
<div style="padding: 1rem">
</div>
<div style="padding: 1rem"></div>
<RadzenPanelMenu>
<RadzenPanelMenuItem Text="Home" Icon="home" Path="/"></RadzenPanelMenuItem>

@if (this.reqifLoaded)
{
@foreach (var reqif in this.reqIfLoaderService.ReqIFData)
{
<RadzenPanelMenuItem Text=@($"ReqIF {reqif.TheHeader.Title}")>
<RadzenPanelMenuItem Text="Specifications">

@foreach (var specification in reqif.CoreContent.Specifications)
{
<RadzenPanelMenuItem Text="@specification.LongName" Path=@($"/specification/{specification.Identifier}")></RadzenPanelMenuItem>
}
</RadzenPanelMenuItem>

<RadzenPanelMenuItem Text="Spec Objects" Path="/specobjects"></RadzenPanelMenuItem>
<RadzenPanelMenuItem Text="Data Types" Path="/datatypes"></RadzenPanelMenuItem>
<RadzenPanelMenuItem Text="Specification Types">
<RadzenPanelMenuItem Text="Spec Object Types" Path="/specobjecttypes"></RadzenPanelMenuItem>
<RadzenPanelMenuItem Text="Specification Types" Path="/specificationtypes"></RadzenPanelMenuItem>
<RadzenPanelMenuItem Text="Spec Relation Types" Path="/specerlationtypes"></RadzenPanelMenuItem>
</RadzenPanelMenuItem>

</RadzenPanelMenuItem>
}
}

<RadzenPanelMenuItem Text="About" Icon="search" Path="about"></RadzenPanelMenuItem>
</RadzenPanelMenu>
</ChildContent>
Expand All @@ -38,4 +68,26 @@
/// </summary>
[Parameter]
public EventCallback<bool> ExpandedChanged { get; set; }

private bool reqifLoaded = false;

protected override void OnInitialized()
{
this.reqIfLoaderService.ReqIfChanged += ReqIfLoaderServiceOnReqIfChanged;
}

private void ReqIfLoaderServiceOnReqIfChanged(object sender, IEnumerable<ReqIF> reqIfs)
{
if (reqIfs == null || !reqIfs.Any())
{
this.reqifLoaded = false;
}
else
{
this.reqifLoaded = true;
}

this.StateHasChanged();
}

}
2 changes: 1 addition & 1 deletion reqifviewer/reqifviewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<Company>RHEA System S.A.</Company>
<Title>reqifviewer</Title>
<Version>0.0.2</Version>
<Version>0.1.0</Version>
<Description>Web Application to inspect ReqIF files</Description>
<Copyright>Copyright © RHEA System S.A.</Copyright>
<Authors>Sam Gerené</Authors>
Expand Down

0 comments on commit 610eff0

Please sign in to comment.