Skip to content

Commit

Permalink
Merge pull request #22 from h4570/develop
Browse files Browse the repository at this point in the history
Some updates
  • Loading branch information
h4570 authored Feb 13, 2022
2 parents 85bee33 + ae0eac9 commit 71d40bc
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class LsblkPartitionInfo : IPartitionInfo
public string DeviceName => $"/dev/{Name}";
public string Name { get; set; }
public string MountingPoint { get; set; }
public bool IsMain => MountingPoint != null && MountingPoint.Equals("/");
public bool IsMain => MountingPoint != null && (MountingPoint.Equals("/") || MountingPoint.StartsWith("/boot"));
public int MemoryInMB { get; set; }
public string Uuid { get; set; }
}
Expand Down
2 changes: 1 addition & 1 deletion backend/OSCommander/OSCommander.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0-preview.3.21201.4" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="NCrontab.Signed" Version="3.3.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="SSH.NET" Version="2020.0.1" />
Expand Down
19 changes: 13 additions & 6 deletions backend/OSCommander/SystemInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,26 @@ private static string GetCpuName(string cpuInfo)
{
try
{
const string cpuNameBeginning = "model name";
var cpuNameBeginning = "model name";
var cpuNameLine = cpuInfo
.Split("\n")
.FirstOrDefault(c => c.ToLower().StartsWith(cpuNameBeginning));
if (cpuNameLine == null)
{
cpuNameBeginning = "hardware";
cpuNameLine = cpuInfo
.Split("\n")
.FirstOrDefault(c => c.ToLower().StartsWith(cpuNameBeginning));
}
if (cpuNameLine == null)
throw new CommandResponseParsingException("Line with CPU name was not found.");
var parts = cpuNameLine
var result = cpuNameLine
.Substring(cpuNameBeginning.Length)
.Replace("\t", string.Empty)
.Replace("\r", string.Empty)
.Split(" ")
.Where(c => c.Trim() != string.Empty)
.ToList();
if (parts.Count >= 4) return parts[3];
.Trim();
if (result.StartsWith(":")) result = result.Substring(1);
return result.Trim();
throw new CommandResponseParsingException("Line with CPU name is incorrect.");
}
catch (Exception ex)
Expand Down
12 changes: 6 additions & 6 deletions backend/OSCommanderTests/OSCommanderTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<PackageReference Include="coverlet.msbuild" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0-preview.3.21201.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.5" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.5" />
<PackageReference Include="coverlet.collector" Version="3.1.0">
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion backend/OSCommanderTests/SystemInformationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void GetKernelNameTest_Bad_Exception()
public void GetCPUInfoTest_Good()
{
var res = _good.GetCPUInfo();
Assert.Equal("ARMv7", res.Name);
Assert.Equal("ARMv7 Processor rev 3 (v7l)", res.Name);
Assert.Equal(2.7M, res.PercentageUsage);
Assert.Equal(48.5M, res.Temperature);
}
Expand Down
24 changes: 13 additions & 11 deletions backend/WebApi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,21 @@ public void ConfigureServices(IServiceCollection services)
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
services.AddAuthentication(IISDefaults.AuthenticationScheme);
services.Configure<ConfigEnvironment>(Configuration.GetSection("configuration:" + envName));
services.AddControllers().AddNewtonsoftJson();
services.AddOData(opt =>
opt.AddModel("odata", GetEdmModel())
.Select()
.Expand()
.Filter()
.Count()
.OrderBy()
.SetMaxTop(100)
services.AddControllers()
.AddNewtonsoftJson()
.AddOData(opt => opt
.AddRouteComponents("odata", GetEdmModel())
.Select()
.Expand()
.Filter()
.Count()
.OrderBy()
.SetMaxTop(100)
);

services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "ArmNas", Version = "v1" });
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Armnas", Version = "v1" });
c.DocInclusionPredicate((_, api) => api.HttpMethod != null); // oData fix
});
services.AddOdataSwaggerSupport();
Expand All @@ -79,7 +81,7 @@ public void Configure(IApplicationBuilder app) // , IWebHostEnvironment env
InitializeDatabase(app);
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ArmNas"));
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Armnas"));
app.UseRouting();
app.UseAuthorization();
app.UseCors();
Expand Down
26 changes: 13 additions & 13 deletions backend/WebApi/WebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.8" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="8.0.0-rc" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0-preview.3.21201.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0-preview.3.21201.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0-preview.3.21201.2">
<PackageReference Include="AutoMapper" Version="11.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0-preview.3.21201.4" />
<PackageReference Include="Microsoft.OData.ModelBuilder" Version="1.0.6" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.OData.ModelBuilder" Version="1.0.8" />
<PackageReference Include="OData.Swagger" Version="1.0.0" />
<PackageReference Include="RestSharp" Version="106.12.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.5" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.12.0" />
<PackageReference Include="System.Linq.Async" Version="5.0.0" />
<PackageReference Include="RestSharp" Version="107.3.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.15.1" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
const odataMessages = this.odata.messages.entities();
this.newMessages = await odataMessages
.filter({ hasBeenRead: false })
.top(10)
.top(30)
.get()
.toPromise()
.then(c => c.entities);
Expand Down

0 comments on commit 71d40bc

Please sign in to comment.