Settings UI changes complete

This commit is contained in:
Michael Green
2024-10-28 11:00:51 +11:00
parent f99eec2eec
commit f19214ba6b
6 changed files with 179 additions and 53 deletions

View File

@@ -311,6 +311,12 @@ namespace gaseous_server.Controllers
HasheousHost = Config.MetadataConfiguration.HasheousHost, HasheousHost = Config.MetadataConfiguration.HasheousHost,
HasheousSubmitFixes = (bool)Config.MetadataConfiguration.HasheousSubmitFixes, HasheousSubmitFixes = (bool)Config.MetadataConfiguration.HasheousSubmitFixes,
HasheousAPIKey = Config.MetadataConfiguration.HasheousAPIKey HasheousAPIKey = Config.MetadataConfiguration.HasheousAPIKey
},
MetadataSource = new SystemSettingsModel.MetadataSourceItem()
{
Source = Config.MetadataConfiguration.MetadataSource,
IGDBClientId = Config.IGDB.ClientId,
IGDBClientSecret = Config.IGDB.Secret
} }
}; };
@@ -334,6 +340,9 @@ namespace gaseous_server.Controllers
Config.MetadataConfiguration.HasheousHost = model.SignatureSource.HasheousHost; Config.MetadataConfiguration.HasheousHost = model.SignatureSource.HasheousHost;
Config.MetadataConfiguration.HasheousAPIKey = model.SignatureSource.HasheousAPIKey; Config.MetadataConfiguration.HasheousAPIKey = model.SignatureSource.HasheousAPIKey;
Config.MetadataConfiguration.HasheousSubmitFixes = model.SignatureSource.HasheousSubmitFixes; Config.MetadataConfiguration.HasheousSubmitFixes = model.SignatureSource.HasheousSubmitFixes;
Config.MetadataConfiguration.MetadataSource = model.MetadataSource.Source;
Config.IGDB.ClientId = model.MetadataSource.IGDBClientId;
Config.IGDB.Secret = model.MetadataSource.IGDBClientSecret;
Config.UpdateConfig(); Config.UpdateConfig();
} }
@@ -776,6 +785,7 @@ namespace gaseous_server.Controllers
public int MinimumLogRetentionPeriod { get; set; } public int MinimumLogRetentionPeriod { get; set; }
public bool EmulatorDebugMode { get; set; } public bool EmulatorDebugMode { get; set; }
public SignatureSourceItem SignatureSource { get; set; } public SignatureSourceItem SignatureSource { get; set; }
public MetadataSourceItem MetadataSource { get; set; }
public class SignatureSourceItem public class SignatureSourceItem
{ {
@@ -784,5 +794,12 @@ namespace gaseous_server.Controllers
public string HasheousAPIKey { get; set; } public string HasheousAPIKey { get; set; }
public bool HasheousSubmitFixes { get; set; } public bool HasheousSubmitFixes { get; set; }
} }
public class MetadataSourceItem
{
public HasheousClient.Models.MetadataModel.MetadataSources Source { get; set; }
public string IGDBClientId { get; set; }
public string IGDBClientSecret { get; set; }
}
} }
} }

View File

@@ -553,6 +553,7 @@ FROM
Favourites ON Game.Id = Favourites.GameId AND Favourites.UserId = @userid " + whereClause + " " + havingClause + " " + orderByClause; Favourites ON Game.Id = Favourites.GameId AND Favourites.UserId = @userid " + whereClause + " " + havingClause + " " + orderByClause;
List<Games.MinimalGameItem> RetVal = new List<Games.MinimalGameItem>(); List<Games.MinimalGameItem> RetVal = new List<Games.MinimalGameItem>();
Console.WriteLine(sql);
DataTable dbResponse = db.ExecuteCMD(sql, whereParams, new Database.DatabaseMemoryCacheOptions(CacheEnabled: true, ExpirationSeconds: 60)); DataTable dbResponse = db.ExecuteCMD(sql, whereParams, new Database.DatabaseMemoryCacheOptions(CacheEnabled: true, ExpirationSeconds: 60));
// get count // get count

View File

@@ -96,4 +96,12 @@ CREATE VIEW view_UserTimeTracking AS
SELECT *, DATE_ADD( SELECT *, DATE_ADD(
SessionTime, INTERVAL SessionLength MINUTE SessionTime, INTERVAL SessionLength MINUTE
) AS SessionEnd ) AS SessionEnd
FROM UserTimeTracking; FROM UserTimeTracking;
CREATE INDEX idx_game_name ON Game (`Name`);
CREATE INDEX idx_game_totalratingcount ON Game (TotalRatingCount);
CREATE INDEX idx_alternativename_game ON AlternativeName (Game);
CREATE INDEX idx_gamestate_romid ON GameState (RomId);
CREATE INDEX idx_gamestate_ismediagroup_userid ON GameState (IsMediaGroup, UserId);
CREATE INDEX idx_rommediagroup_gameid ON RomMediaGroup (GameId);
CREATE INDEX idx_favourites_userid_gameid ON Favourites (UserId, GameId);

View File

@@ -129,6 +129,15 @@
head.appendChild(newLink); head.appendChild(newLink);
} }
// wait for all scripts to load
do {
if (typeof getQueryString === "function") {
break;
}
console.log("Waiting for scripts to load...");
await new Promise(r => setTimeout(r, 100));
} while (typeof getQueryString !== "function");
// start the application // start the application
console.log("Starting Gaseous"); console.log("Starting Gaseous");
console.log("App Version: " + AppVersion); console.log("App Version: " + AppVersion);
@@ -157,8 +166,9 @@
let pageSelection = getQueryString('page', 'string'); let pageSelection = getQueryString('page', 'string');
if (!pageSelection) { if (!pageSelection) {
pageSelection = GetPreference("DefaultHomePage", 'home'); pageSelection = GetPreference("DefaultHomePage", "home");
} }
console.log("Loading page: " + pageSelection);
await LoadPageContent(pageSelection, 'content'); await LoadPageContent(pageSelection, 'content');
} else { } else {
// user is not signed in - load login page // user is not signed in - load login page

View File

@@ -3,55 +3,120 @@
</div> </div>
<div class="section"> <div class="section">
<div class="section-header">Metadata Sources</div> <div class="section-header">Metadata Settings</div>
<div class="section-body"> <div class="section-body">
<table> <div class="section">
<tr> <div class="section-header">Source</div>
<td style="width: 25%;"> <div class="section-body">
Signature Source <table style="width: 100%;">
</td> <tr>
<td> <td style="width: 30%;">
<input type="radio" name="settings_signaturesource" id="settings_signaturesource_local" Signature Source
value="LocalOnly" </td>
onclick="document.getElementById('settings_hasheoushost_row').style.display = 'none';"> <td>
<label for="settings_signaturesource_local">Local Only</label> <input type="radio" name="settings_signaturesource" id="settings_signaturesource_local"
</td> value="LocalOnly">
</tr> <label for="settings_signaturesource_local">Local Only</label>
<tr> </td>
<td></td> </tr>
<td> <tr>
<input type="radio" name="settings_signaturesource" id="settings_signaturesource_hasheous" <td></td>
value="Hasheous" <td>
onclick="document.getElementById('settings_hasheoushost_row').style.display = '';"> <input type="radio" name="settings_signaturesource" id="settings_signaturesource_hasheous"
<label for="settings_signaturesource_hasheous">Hasheous</label> value="Hasheous">
</td> <label for="settings_signaturesource_hasheous">Hasheous</label>
</tr> </td>
<tr id="settings_hasheoushost_row" style="display: none;"> </tr>
<td>
Hasheous Host <tr>
</td> <td style="width: 30%;">
<td> Metadata Source
<input type="url" id="settings_signaturesource_hasheoushost" style="width: 90%;"> </td>
</td> <td>
</tr> <input type="radio" name="settings_metadatasource" id="settings_metadatasource_none"
<tr> value="None">
<td> <label for="settings_metadatasource_none">None</label>
<label for="settings_hasheoussubmit">Submit updates to Hasheous when fixing ROM matches</label> </td>
</td> </tr>
<td> <tr>
<input type="checkbox" id="settings_hasheoussubmit" onchange="toggleHasheousAPIKey(this);"> <td></td>
</td> <td>
</tr> <input type="radio" name="settings_metadatasource" id="settings_metadatasource_hasheous"
<tr id="settings_hasheousapikey_row" style="display: none;"> value="Hasheous">
<td> <label for="settings_metadatasource_hasheous">IGDB via Hasheous Proxy</label>
Hasheous API key </td>
</td> </tr>
<td> <tr>
<input type="text" id="settings_hasheousapikey" style="width: 90%;"> <td></td>
</td> <td>
</tr> <input type="radio" name="settings_metadatasource" id="settings_metadatasource_igdb"
</table> value="IGDB">
<label for="settings_metadatasource_igdb">IGDB</label>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="section-header">IGDB Configuration</div>
<div class="section-body">
<table style="width: 100%;">
<tr id="settings_igdbclientid_row">
<td style="width: 30%;">
IGDB Client ID
</td>
<td>
<input type="text" id="settings_igdbclientid" style="width: 90%;">
</td>
</tr>
<tr id="settings_igdbclientkey_row">
<td style="width: 30%;">
IGDB Client Key
</td>
<td>
<input type="text" id="settings_igdbclientkey" style="width: 90%;">
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="section-header">Hasheous Configuration</div>
<div class="section-body">
<table style="width: 100%;">
<tr id="settings_hasheoushost_row">
<td style="width: 30%;">
Hasheous Host
</td>
<td>
<input type="url" id="settings_signaturesource_hasheoushost" style="width: 90%;">
</td>
</tr>
<tr>
<td>
<label for="settings_hasheoussubmit">Submit updates to Hasheous when fixing ROM
matches</label>
</td>
<td>
<input type="checkbox" id="settings_hasheoussubmit" onchange="toggleHasheousAPIKey(this);">
</td>
</tr>
<tr id="settings_hasheousapikey_row">
<td style="width: 30%;">
Hasheous API key
</td>
<td>
<input type="text" id="settings_hasheousapikey" style="width: 90%;">
</td>
</tr>
</table>
</div>
</div>
</div> </div>
</div>
<div class="section">
<div class="section-header">Logging</div> <div class="section-header">Logging</div>
<div class="section-body"> <div class="section-body">
<table> <table>
@@ -85,6 +150,8 @@
</tr> </tr>
</table> </table>
</div> </div>
</div>
<div class="section">
<div class="section-header">Emulator</div> <div class="section-header">Emulator</div>
<div class="section-body"> <div class="section-body">
<table> <table>
@@ -95,9 +162,10 @@
</tr> </tr>
</table> </table>
</div> </div>
<div style="text-align: right;"> </div>
<button id="settings_tasktimers_new" onclick="setSystemSettings();">Save</button>
</div> <div style="text-align: right;">
<button id="settings_tasktimers_new" onclick="setSystemSettings();">Save</button>
</div> </div>
<script> <script>

View File

@@ -21,11 +21,28 @@ function getSystemSettings() {
case "Hasheous": case "Hasheous":
document.getElementById('settings_signaturesource_hasheous').checked = true; document.getElementById('settings_signaturesource_hasheous').checked = true;
document.getElementById('settings_hasheoushost_row').style.display = '';
break; break;
} }
switch (result.metadataSource.source) {
case "None":
document.getElementById('settings_metadatasource_none').checked = true;
break;
case "Hasheous":
document.getElementById('settings_metadatasource_hasheous').checked = true;
break;
case "IGDB":
document.getElementById('settings_metadatasource_igdb').checked = true;
break;
}
document.getElementById('settings_igdbclientid').value = result.metadataSource.igdbClientId;
document.getElementById('settings_igdbclientkey').value = result.metadataSource.igdbClientSecret;
document.getElementById('settings_signaturesource_hasheoushost').value = result.signatureSource.hasheousHost; document.getElementById('settings_signaturesource_hasheoushost').value = result.signatureSource.hasheousHost;
let hasheousSubmitCheck = document.getElementById('settings_hasheoussubmit'); let hasheousSubmitCheck = document.getElementById('settings_hasheoussubmit');
@@ -56,6 +73,11 @@ function setSystemSettings() {
"alwaysLogToDisk": alwaysLogToDisk, "alwaysLogToDisk": alwaysLogToDisk,
"minimumLogRetentionPeriod": Number(retentionValue), "minimumLogRetentionPeriod": Number(retentionValue),
"emulatorDebugMode": document.getElementById('settings_emulator_debug').checked, "emulatorDebugMode": document.getElementById('settings_emulator_debug').checked,
"metadataSource": {
"Source": $("input[type='radio'][name='settings_metadatasource']:checked").val(),
"IgdbClientId": document.getElementById('settings_igdbclientid').value,
"IgdbClientSecret": document.getElementById('settings_igdbclientkey').value
},
"signatureSource": { "signatureSource": {
"Source": $("input[type='radio'][name='settings_signaturesource']:checked").val(), "Source": $("input[type='radio'][name='settings_signaturesource']:checked").val(),
"HasheousHost": document.getElementById('settings_signaturesource_hasheoushost').value, "HasheousHost": document.getElementById('settings_signaturesource_hasheoushost').value,