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,
HasheousSubmitFixes = (bool)Config.MetadataConfiguration.HasheousSubmitFixes,
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.HasheousAPIKey = model.SignatureSource.HasheousAPIKey;
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();
}
@@ -776,6 +785,7 @@ namespace gaseous_server.Controllers
public int MinimumLogRetentionPeriod { get; set; }
public bool EmulatorDebugMode { get; set; }
public SignatureSourceItem SignatureSource { get; set; }
public MetadataSourceItem MetadataSource { get; set; }
public class SignatureSourceItem
{
@@ -784,5 +794,12 @@ namespace gaseous_server.Controllers
public string HasheousAPIKey { 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;
List<Games.MinimalGameItem> RetVal = new List<Games.MinimalGameItem>();
Console.WriteLine(sql);
DataTable dbResponse = db.ExecuteCMD(sql, whereParams, new Database.DatabaseMemoryCacheOptions(CacheEnabled: true, ExpirationSeconds: 60));
// get count

View File

@@ -96,4 +96,12 @@ CREATE VIEW view_UserTimeTracking AS
SELECT *, DATE_ADD(
SessionTime, INTERVAL SessionLength MINUTE
) 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);
}
// 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
console.log("Starting Gaseous");
console.log("App Version: " + AppVersion);
@@ -157,8 +166,9 @@
let pageSelection = getQueryString('page', 'string');
if (!pageSelection) {
pageSelection = GetPreference("DefaultHomePage", 'home');
pageSelection = GetPreference("DefaultHomePage", "home");
}
console.log("Loading page: " + pageSelection);
await LoadPageContent(pageSelection, 'content');
} else {
// user is not signed in - load login page

View File

@@ -3,55 +3,120 @@
</div>
<div class="section">
<div class="section-header">Metadata Sources</div>
<div class="section-header">Metadata Settings</div>
<div class="section-body">
<table>
<tr>
<td style="width: 25%;">
Signature Source
</td>
<td>
<input type="radio" name="settings_signaturesource" id="settings_signaturesource_local"
value="LocalOnly"
onclick="document.getElementById('settings_hasheoushost_row').style.display = 'none';">
<label for="settings_signaturesource_local">Local Only</label>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="radio" name="settings_signaturesource" id="settings_signaturesource_hasheous"
value="Hasheous"
onclick="document.getElementById('settings_hasheoushost_row').style.display = '';">
<label for="settings_signaturesource_hasheous">Hasheous</label>
</td>
</tr>
<tr id="settings_hasheoushost_row" style="display: none;">
<td>
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" style="display: none;">
<td>
Hasheous API key
</td>
<td>
<input type="text" id="settings_hasheousapikey" style="width: 90%;">
</td>
</tr>
</table>
<div class="section">
<div class="section-header">Source</div>
<div class="section-body">
<table style="width: 100%;">
<tr>
<td style="width: 30%;">
Signature Source
</td>
<td>
<input type="radio" name="settings_signaturesource" id="settings_signaturesource_local"
value="LocalOnly">
<label for="settings_signaturesource_local">Local Only</label>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="radio" name="settings_signaturesource" id="settings_signaturesource_hasheous"
value="Hasheous">
<label for="settings_signaturesource_hasheous">Hasheous</label>
</td>
</tr>
<tr>
<td style="width: 30%;">
Metadata Source
</td>
<td>
<input type="radio" name="settings_metadatasource" id="settings_metadatasource_none"
value="None">
<label for="settings_metadatasource_none">None</label>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="radio" name="settings_metadatasource" id="settings_metadatasource_hasheous"
value="Hasheous">
<label for="settings_metadatasource_hasheous">IGDB via Hasheous Proxy</label>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="radio" name="settings_metadatasource" id="settings_metadatasource_igdb"
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 class="section">
<div class="section-header">Logging</div>
<div class="section-body">
<table>
@@ -85,6 +150,8 @@
</tr>
</table>
</div>
</div>
<div class="section">
<div class="section-header">Emulator</div>
<div class="section-body">
<table>
@@ -95,9 +162,10 @@
</tr>
</table>
</div>
<div style="text-align: right;">
<button id="settings_tasktimers_new" onclick="setSystemSettings();">Save</button>
</div>
</div>
<div style="text-align: right;">
<button id="settings_tasktimers_new" onclick="setSystemSettings();">Save</button>
</div>
<script>

View File

@@ -21,11 +21,28 @@ function getSystemSettings() {
case "Hasheous":
document.getElementById('settings_signaturesource_hasheous').checked = true;
document.getElementById('settings_hasheoushost_row').style.display = '';
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;
let hasheousSubmitCheck = document.getElementById('settings_hasheoussubmit');
@@ -56,6 +73,11 @@ function setSystemSettings() {
"alwaysLogToDisk": alwaysLogToDisk,
"minimumLogRetentionPeriod": Number(retentionValue),
"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": {
"Source": $("input[type='radio'][name='settings_signaturesource']:checked").val(),
"HasheousHost": document.getElementById('settings_signaturesource_hasheoushost').value,