WIP
This commit is contained in:
@@ -47,7 +47,7 @@ namespace gaseous_server.Controllers
|
||||
[Route("{MetadataMapId}")]
|
||||
[ProducesResponseType(typeof(gaseous_server.Models.Game), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ResponseCache(CacheProfileName = "5Minute")]
|
||||
[ResponseCache(CacheProfileName = "None")]
|
||||
public async Task<ActionResult> Game(long MetadataMapId)
|
||||
{
|
||||
try
|
||||
@@ -849,6 +849,11 @@ namespace gaseous_server.Controllers
|
||||
MetadataManagement.AddMetadataMapItem(MetadataMapId, metadataMapItem.SourceType, metadataMapItem.SourceId, metadataMapItem.Preferred);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MetadataMap.MetadataMapItem existingMetadataMapItem = existingMetadataMap.MetadataMapItems.FirstOrDefault(x => x.SourceType == HasheousClient.Models.MetadataSources.None);
|
||||
MetadataManagement.UpdateMetadataMapItem(MetadataMapId, existingMetadataMapItem.SourceType, existingMetadataMapItem.SourceId, metadataMapItem.Preferred);
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(Classes.MetadataManagement.GetMetadataMap(MetadataMapId));
|
||||
|
@@ -12,7 +12,9 @@ function SetupPage() {
|
||||
mappingScript.src = '/pages/settings/mapping.js';
|
||||
document.head.appendChild(mappingScript);
|
||||
|
||||
ajaxCall('/api/v1.1/Games/' + gameId, 'GET', function (result) {
|
||||
let nonce = (Math.random() + 1).toString(36).substring(7);
|
||||
|
||||
ajaxCall('/api/v1.1/Games/' + gameId + '?nonce=' + nonce, 'GET', function (result) {
|
||||
// populate games page
|
||||
gameData = result;
|
||||
console.log(gameData);
|
||||
@@ -649,7 +651,13 @@ class RomManagement {
|
||||
itemSectionHeaderRadio.style.margin = '0px';
|
||||
itemSectionHeaderRadio.style.height = 'unset';
|
||||
itemSectionHeaderRadio.addEventListener('change', () => {
|
||||
metadataMap.metadataMapItems.forEach(element => {
|
||||
element.preferred = false;
|
||||
});
|
||||
|
||||
element.preferred = true;
|
||||
console.log('Selected: ' + element.sourceType);
|
||||
console.log(metadataMap);
|
||||
});
|
||||
if (element.preferred == true) {
|
||||
itemSectionHeaderRadio.checked = true;
|
||||
@@ -706,7 +714,17 @@ class RomManagement {
|
||||
|
||||
// setup the buttons
|
||||
let okButton = new ModalButton('OK', 1, callingObject, async function (callingObject) {
|
||||
metadataModal.close();
|
||||
let model = metadataMap.metadataMapItems;
|
||||
|
||||
await fetch('/api/v1.1/Games/' + gameId + '/metadata', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(model)
|
||||
}).then(response => response.json()).then(result => {
|
||||
location.reload(true);
|
||||
});
|
||||
});
|
||||
metadataModal.addButton(okButton);
|
||||
|
||||
|
Reference in New Issue
Block a user