Skip to content

Commit

Permalink
Remove dev.orcasound.net data (#164)
Browse files Browse the repository at this point in the history
* Remove dev.orcasound.net data

Only use live.orcasound.net since dev.orcasound.net should not have a
separate database.

Also display "Live" and "Unknown" as types

Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler authored Oct 19, 2024
1 parent 3e41132 commit 97705e0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
2 changes: 0 additions & 2 deletions OrcanodeMonitor/Core/Fetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class Fetcher
private static TimeZoneInfo _pacificTimeZone = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles");
private static HttpClient _httpClient = new HttpClient();
private static string _orcasoundProdSite = "live.orcasound.net";
private static string _orcasoundDevSite = "dev.orcasound.net";
private static string _orcasoundFeedsUrlPath = "/api/json/feeds";
private static string _dataplicityDevicesUrl = "https://apps.dataplicity.com/devices/";
private static string _mezmoViewsUrl = "https://api.mezmo.com/v1/config/view";
Expand Down Expand Up @@ -886,7 +885,6 @@ public async static Task UpdateOrcasoundDataAsync(OrcanodeMonitorContext context
try
{
await UpdateOrcasoundSiteDataAsync(context, _orcasoundProdSite, foundList, unfoundList);
await UpdateOrcasoundSiteDataAsync(context, _orcasoundDevSite, foundList, unfoundList);

// Mark any remaining unfound nodes as absent.
foreach (var unfoundNode in unfoundList)
Expand Down
20 changes: 13 additions & 7 deletions OrcanodeMonitor/Models/Orcanode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,24 +350,30 @@ public OrcanodeOnlineStatus S3StreamStatus
}
}

private bool IsDev
public string Type
{
get
{
if (this.S3Bucket.StartsWith("dev"))
{
return true;
return "Dev";
}
if (this.DataplicityName.ToLower().StartsWith("dev"))
if (this.DataplicityName.StartsWith("live", StringComparison.OrdinalIgnoreCase))
{
return true;
return "Prod";
}
return false;
if (this.DataplicityName.StartsWith("dev", StringComparison.OrdinalIgnoreCase))
{
return "Dev";
}
if (this.DataplicityName.StartsWith("beta", StringComparison.OrdinalIgnoreCase))
{
return "Beta";
}
return "Unknown";
}
}

public string Type => IsDev ? "Dev" : "Prod";

public string OrcasoundOnlineStatusString {
get
{
Expand Down
12 changes: 12 additions & 0 deletions OrcanodeMonitor/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@
<p/>
<h4 style="text-align: left;">Legend</h4>
<ul style="text-align: left;">
<li>
<b>Type Beta</b>: The node is in beta testing.
</li>
<li>
<b>Type Dev</b>: The node is a developer node.
</li>
<li>
<b>Type Prod</b>: The node is a production node.
</li>
<li>
<b>Type Unknown</b>: The node is type is unknown.
</li>
<li>
<b>Dataplicity Absent</b>: Dataplicity does not know about the node.
</li>
Expand Down
14 changes: 7 additions & 7 deletions OrcanodeMonitor/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ public string NodeDataplicityUpgradeColor(Orcanode node)
public async Task OnGetAsync()
{
var nodes = await _databaseContext.Orcanodes.ToListAsync();
_nodes = nodes.Where(n => n.DataplicityConnectionStatus != OrcanodeOnlineStatus.Absent ||
n.OrcasoundStatus != OrcanodeOnlineStatus.Absent ||
(n.S3StreamStatus != OrcanodeOnlineStatus.Absent &&
n.S3StreamStatus != OrcanodeOnlineStatus.Unauthorized))
.OrderByDescending(n => n.Type)
.ThenBy(n => n.DisplayName)
.ToList();
_nodes = nodes.Where(n => ((n.DataplicityConnectionStatus != OrcanodeOnlineStatus.Absent) ||
(n.OrcasoundStatus != OrcanodeOnlineStatus.Absent) ||
(n.S3StreamStatus != OrcanodeOnlineStatus.Absent &&
n.S3StreamStatus != OrcanodeOnlineStatus.Unauthorized)) &&
(n.OrcasoundHost != "dev.orcasound.net"))
.OrderBy(n => n.DisplayName)
.ToList();
}
}
}

0 comments on commit 97705e0

Please sign in to comment.