WIP
This commit is contained in:
@@ -47,7 +47,7 @@ namespace gaseous_server.Controllers
|
|||||||
[Route("{MetadataMapId}")]
|
[Route("{MetadataMapId}")]
|
||||||
[ProducesResponseType(typeof(gaseous_server.Models.Game), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(gaseous_server.Models.Game), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||||
[ResponseCache(CacheProfileName = "5Minute")]
|
[ResponseCache(CacheProfileName = "None")]
|
||||||
public async Task<ActionResult> Game(long MetadataMapId)
|
public async Task<ActionResult> Game(long MetadataMapId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -849,6 +849,11 @@ namespace gaseous_server.Controllers
|
|||||||
MetadataManagement.AddMetadataMapItem(MetadataMapId, metadataMapItem.SourceType, metadataMapItem.SourceId, metadataMapItem.Preferred);
|
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));
|
return Ok(Classes.MetadataManagement.GetMetadataMap(MetadataMapId));
|
||||||
|
@@ -12,7 +12,9 @@ function SetupPage() {
|
|||||||
mappingScript.src = '/pages/settings/mapping.js';
|
mappingScript.src = '/pages/settings/mapping.js';
|
||||||
document.head.appendChild(mappingScript);
|
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
|
// populate games page
|
||||||
gameData = result;
|
gameData = result;
|
||||||
console.log(gameData);
|
console.log(gameData);
|
||||||
@@ -649,7 +651,13 @@ class RomManagement {
|
|||||||
itemSectionHeaderRadio.style.margin = '0px';
|
itemSectionHeaderRadio.style.margin = '0px';
|
||||||
itemSectionHeaderRadio.style.height = 'unset';
|
itemSectionHeaderRadio.style.height = 'unset';
|
||||||
itemSectionHeaderRadio.addEventListener('change', () => {
|
itemSectionHeaderRadio.addEventListener('change', () => {
|
||||||
|
metadataMap.metadataMapItems.forEach(element => {
|
||||||
|
element.preferred = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
element.preferred = true;
|
||||||
console.log('Selected: ' + element.sourceType);
|
console.log('Selected: ' + element.sourceType);
|
||||||
|
console.log(metadataMap);
|
||||||
});
|
});
|
||||||
if (element.preferred == true) {
|
if (element.preferred == true) {
|
||||||
itemSectionHeaderRadio.checked = true;
|
itemSectionHeaderRadio.checked = true;
|
||||||
@@ -706,7 +714,17 @@ class RomManagement {
|
|||||||
|
|
||||||
// setup the buttons
|
// setup the buttons
|
||||||
let okButton = new ModalButton('OK', 1, callingObject, async function (callingObject) {
|
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);
|
metadataModal.addButton(okButton);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user