Skip to content

Commit 71af89f

Browse files
[SQ] improvements
1 parent 58119f5 commit 71af89f

18 files changed

Lines changed: 223 additions & 214 deletions

reqifviewer/Components/AttributeDefinitionsComponent.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@
6161
/// </summary>
6262
private string reqifIdentifier;
6363

64-
/// <summary>
65-
/// Method invoked when the component has received parameters from its parent in the render tree,
66-
/// and the incoming values have been assigned to properties.
67-
/// </summary>
64+
/// <summary>
65+
/// Method invoked when the component has received parameters from its parent in the render tree,
66+
/// and the incoming values have been assigned to properties.
67+
/// </summary>
6868
protected override void OnParametersSet()
6969
{
7070
var attributeDefinition = this.AttributeDefinitions.FirstOrDefault();
7171

7272
try
7373
{
74-
this.reqifIdentifier = attributeDefinition.SpecType.ReqIFContent.DocumentRoot.TheHeader.Identifier;
74+
this.reqifIdentifier = attributeDefinition?.SpecType.ReqIFContent.DocumentRoot.TheHeader.Identifier;
7575
}
7676
catch (Exception e)
7777
{

reqifviewer/Components/SpecObjectsComponent.razor

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -19,74 +19,74 @@ limitations under the License.
1919
@using Serilog
2020

2121
<RadzenDataGrid Count="@count" PageSize="10" AllowPaging="true" AllowColumnResize="true" Data="@this.SpecObjects" TItem="SpecObject">
22-
<Columns>
23-
<RadzenDataGridColumn TItem="SpecObject" Title="Name">
24-
<Template Context="specObject">
25-
<a href="reqif/@this.reqifIdentifier/specobject/@specObject?.Identifier">
26-
@(new MarkupString(specObject?.ExtractDisplayName().ToString()))
27-
</a>
28-
</Template>
29-
</RadzenDataGridColumn>
30-
<RadzenDataGridColumn TItem="SpecObject" Title="Spec Object Type">
31-
<Template Context="specObject">
32-
<a href="reqif/@this.reqifIdentifier/spectype/@specObject?.SpecType?.Identifier">@specObject?.SpecType?.LongName</a>
33-
</Template>
34-
</RadzenDataGridColumn>
35-
<RadzenDataGridColumn TItem="SpecObject" Property="Identifier" Title="Identifier">
36-
<Template Context="specObject">
37-
<a href="reqif/@this.reqifIdentifier/specobject/@specObject?.Identifier">@specObject?.Identifier</a>
38-
</Template>
39-
</RadzenDataGridColumn>
40-
<RadzenDataGridColumn TItem="SpecObject" Property="Description" Title="Description" />
41-
<RadzenDataGridColumn TItem="SpecObject" Property="LastChange" Title="Last Change" />
42-
<RadzenDataGridColumn TItem="SpecObject" Title="Alternative Id">
43-
<Template Context="specObject">
44-
@specObject?.AlternativeId?.Identifier
45-
</Template>
46-
</RadzenDataGridColumn>
47-
</Columns>
22+
<Columns>
23+
<RadzenDataGridColumn TItem="SpecObject" Title="Name">
24+
<Template Context="specObject">
25+
<a href="reqif/@this.reqifIdentifier/specobject/@specObject?.Identifier">
26+
@(new MarkupString(specObject?.ExtractDisplayName().ToString()))
27+
</a>
28+
</Template>
29+
</RadzenDataGridColumn>
30+
<RadzenDataGridColumn TItem="SpecObject" Title="Spec Object Type">
31+
<Template Context="specObject">
32+
<a href="reqif/@this.reqifIdentifier/spectype/@specObject?.SpecType?.Identifier">@specObject?.SpecType?.LongName</a>
33+
</Template>
34+
</RadzenDataGridColumn>
35+
<RadzenDataGridColumn TItem="SpecObject" Property="Identifier" Title="Identifier">
36+
<Template Context="specObject">
37+
<a href="reqif/@this.reqifIdentifier/specobject/@specObject?.Identifier">@specObject?.Identifier</a>
38+
</Template>
39+
</RadzenDataGridColumn>
40+
<RadzenDataGridColumn TItem="SpecObject" Property="Description" Title="Description" />
41+
<RadzenDataGridColumn TItem="SpecObject" Property="LastChange" Title="Last Change" />
42+
<RadzenDataGridColumn TItem="SpecObject" Title="Alternative Id">
43+
<Template Context="specObject">
44+
@specObject?.AlternativeId?.Identifier
45+
</Template>
46+
</RadzenDataGridColumn>
47+
</Columns>
4848
</RadzenDataGrid>
4949

5050
@code {
5151

52-
/// <summary>
53-
/// Gets or sets the <see cref="IEnumerable{SpecObject}"/>
54-
/// </summary>
55-
[Parameter]
56-
public IEnumerable<SpecObject> SpecObjects { get; set; }
52+
/// <summary>
53+
/// Gets or sets the <see cref="IEnumerable{SpecObject}"/>
54+
/// </summary>
55+
[Parameter]
56+
public IEnumerable<SpecObject> SpecObjects { get; set; }
5757

58-
/// <summary>
59-
/// a value that states the total amount of <see cref="SpecObject"/>s in the reqif file
60-
/// </summary>
61-
private int count;
58+
/// <summary>
59+
/// a value that states the total amount of <see cref="SpecObject"/>s in the reqif file
60+
/// </summary>
61+
private int count;
6262

63-
/// <summary>
64-
/// The unique identifier of the container ReqIF document
65-
/// </summary>
66-
private string reqifIdentifier;
63+
/// <summary>
64+
/// The unique identifier of the container ReqIF document
65+
/// </summary>
66+
private string reqifIdentifier;
6767

68-
/// <summary>
69-
/// The Title of the ReqIF document
70-
/// </summary>
71-
private string title;
68+
/// <summary>
69+
/// The Title of the ReqIF document
70+
/// </summary>
71+
private string title;
7272

73-
/// <summary>
74-
/// Method invoked when the component has received parameters from its parent in the render tree,
75-
/// and the incoming values have been assigned to properties.
76-
/// </summary>
77-
protected override void OnParametersSet()
78-
{
79-
this.count = this.SpecObjects.Count();
80-
var specObject = this.SpecObjects.FirstOrDefault();
81-
82-
try
83-
{
84-
this.reqifIdentifier = specObject.SpecType.ReqIFContent.DocumentRoot.TheHeader.Identifier;
85-
this.title = specObject.SpecType.ReqIFContent.DocumentRoot.TheHeader.Title;
86-
}
87-
catch (Exception e)
88-
{
89-
Log.ForContext<SpecObjectsComponent>().Error(e, "OnParametersSet Failed");
90-
}
91-
}
73+
/// <summary>
74+
/// Method invoked when the component has received parameters from its parent in the render tree,
75+
/// and the incoming values have been assigned to properties.
76+
/// </summary>
77+
protected override void OnParametersSet()
78+
{
79+
this.count = this.SpecObjects.Count();
80+
var specObject = this.SpecObjects.FirstOrDefault();
81+
82+
try
83+
{
84+
this.reqifIdentifier = specObject?.SpecType.ReqIFContent.DocumentRoot.TheHeader.Identifier;
85+
this.title = specObject?.SpecType.ReqIFContent.DocumentRoot.TheHeader.Title;
86+
}
87+
catch (Exception e)
88+
{
89+
Log.ForContext<SpecObjectsComponent>().Error(e, "OnParametersSet Failed");
90+
}
91+
}
9292
}

reqifviewer/Components/SpecificationsComponent.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
try
6363
{
64-
this.reqifIdentifier = specification.ReqIFContent.DocumentRoot.TheHeader.Identifier;
64+
this.reqifIdentifier = specification?.ReqIFContent.DocumentRoot.TheHeader.Identifier;
6565
}
6666
catch (Exception e)
6767
{

reqifviewer/Pages/AttributeDefinition/AttributeDefinitionDetailsPage.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ else
137137

138138
var reqIf = this.ReqIfLoaderService.ReqIFData.SingleOrDefault(x => x.TheHeader.Identifier == this.ReqIF);
139139

140-
var spectType = reqIf.CoreContent.SpecTypes.SingleOrDefault(x => x.Identifier == this.SpecType);
140+
var spectType = reqIf?.CoreContent.SpecTypes.SingleOrDefault(x => x.Identifier == this.SpecType);
141141

142-
this.attributeDefinition = this.attributeDefinition = spectType.SpecAttributes.SingleOrDefault(x => x.Identifier == this.Identifier);
142+
this.attributeDefinition = this.attributeDefinition = spectType?.SpecAttributes.SingleOrDefault(x => x.Identifier == this.Identifier);
143143
}
144144
catch (Exception e)
145145
{

reqifviewer/Pages/DataTypeDefinition/DataTypeDefinitionDetailsPage.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ else
213213

214214
var reqIf = this.ReqIfLoaderService.ReqIFData.SingleOrDefault(x => x.TheHeader.Identifier == this.ReqIF);
215215

216-
this.datatypeDefinition = reqIf.CoreContent.DataTypes.SingleOrDefault(x => x.Identifier == DatatypeDefinition);
216+
this.datatypeDefinition = reqIf?.CoreContent.DataTypes.SingleOrDefault(x => x.Identifier == DatatypeDefinition);
217217
}
218218
catch (Exception e)
219219
{

reqifviewer/Pages/DataTypeDefinition/DataTypeDefinitionPage.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ else
113113

114114
this.reqIf = this.ReqIfLoaderService.ReqIFData.SingleOrDefault(x => x.TheHeader.Identifier == this.Identifier);
115115

116-
this.datatypeDefinitions = reqIf.CoreContent.DataTypes;
116+
this.datatypeDefinitions = this.reqIf?.CoreContent.DataTypes;
117117

118-
this.count = this.datatypeDefinitions.Count();
118+
this.count = this.datatypeDefinitions != null ? this.datatypeDefinitions.Count() : 0;
119119
}
120120
catch (Exception e)
121121
{

reqifviewer/Pages/ExternalObjects/ExternalObjectDetailsPage.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ else
9595

9696
var reqIf = this.ReqIfLoaderService.ReqIFData.SingleOrDefault(x => x.TheHeader.Identifier == this.ReqIF);
9797

98-
var externalObjects = reqIf.CoreContent.QueryExternalObjects().ToList();
98+
var externalObjects = reqIf?.CoreContent.QueryExternalObjects().ToList();
9999

100-
var externalObjectUri = Identifier.Base64Decode();
100+
var externalObjectUri = this.Identifier.Base64Decode();
101101

102-
this.externalObject = externalObjects.SingleOrDefault(x => x.Uri == externalObjectUri);
102+
this.externalObject = externalObjects?.SingleOrDefault(x => x.Uri == externalObjectUri);
103103

104104
this.base64Payload = await this.QueryExternalObjectPayloadData();
105105
}

reqifviewer/Pages/ExternalObjects/ExternalObjectPage.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ else
106106

107107
this.reqIf = this.ReqIfLoaderService.ReqIFData.SingleOrDefault(x => x.TheHeader.Identifier == this.Identifier);
108108

109-
this.externalObjects = reqIf.CoreContent.QueryExternalObjects().ToList();
109+
this.externalObjects = this.reqIf?.CoreContent.QueryExternalObjects().ToList();
110110

111-
this.count = this.externalObjects.Count();
111+
this.count = this.externalObjects != null ? this.externalObjects.Count() : 0;
112112
}
113113
catch (Exception e)
114114
{

reqifviewer/Pages/SpecObject/SpecObjectDetailsPage.razor

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ else
160160
/// </summary>
161161
private bool isLoading = true;
162162

163-
/// <summary>
164-
/// Method invoked when the component has received parameters from its parent in the render tree,
165-
/// and the incoming values have been assigned to properties.
166-
/// </summary>
163+
/// <summary>
164+
/// Method invoked when the component has received parameters from its parent in the render tree,
165+
/// and the incoming values have been assigned to properties.
166+
/// </summary>
167167
protected override async Task OnParametersSetAsync()
168168
{
169169
isLoading = false;
@@ -182,7 +182,7 @@ else
182182

183183
var reqIf = this.ReqIfLoaderService.ReqIFData.SingleOrDefault(x => x.TheHeader.Identifier == this.ReqIF);
184184

185-
this.specObject = reqIf.CoreContent.SpecObjects.SingleOrDefault(x => x.Identifier == SpecObject);
185+
this.specObject = reqIf?.CoreContent.SpecObjects.SingleOrDefault(x => x.Identifier == SpecObject);
186186

187187
this.externalObjectPayloads = await this.specObject.QueryBase64PayloadsAsync(this.ReqIfLoaderService);
188188

reqifviewer/Pages/SpecObject/SpecObjectPage.razor

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
}
3232
else
3333
{
34-
<RadzenHeading Size="H1" style="display: inline-block" Text="@($"{reqIf?.TheHeader.Title} - Spec Objects")"></RadzenHeading>
34+
<RadzenHeading Size="H1" style="display: inline-block" Text="@($"{reqIf?.TheHeader.Title} - Spec Objects")"></RadzenHeading>
3535

36-
<SpecObjectsComponent SpecObjects="@this.specObjects" />
36+
<SpecObjectsComponent SpecObjects="@this.specObjects" />
3737
}
3838

3939
@code {
@@ -54,10 +54,10 @@ else
5454
/// </summary>
5555
private IEnumerable<SpecObject> specObjects;
5656

57-
/// <summary>
58-
/// The <see cref="ReqIF"/> object that is loaded on the page
59-
/// </summary>
60-
private ReqIF reqIf;
57+
/// <summary>
58+
/// The <see cref="ReqIF"/> object that is loaded on the page
59+
/// </summary>
60+
private ReqIF reqIf;
6161

6262
/// <summary>
6363
/// Asynchronous Component initialization
@@ -83,8 +83,7 @@ else
8383

8484
this.reqIf = this.ReqIfLoaderService.ReqIFData.SingleOrDefault(x => x.TheHeader.Identifier == this.Identifier);
8585

86-
this.specObjects = this.reqIf.CoreContent.SpecObjects;
87-
86+
this.specObjects = this.reqIf?.CoreContent.SpecObjects;
8887
}
8988
catch (Exception e)
9089
{

0 commit comments

Comments
 (0)