|
|
|
|
@ -87,21 +87,28 @@ function openQueryDialog(dataset) {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function submitFileMapping(click_event, movie_id, rel_path) { |
|
|
|
|
async function submitFileMapping(click_event, movie_id, rel_path) { |
|
|
|
|
click_event.preventDefault(); |
|
|
|
|
console.log('movie_id: ' + movie_id); |
|
|
|
|
console.log('rel_path: ' + rel_path); |
|
|
|
|
// TODO:
|
|
|
|
|
// - make query with POST
|
|
|
|
|
// - display errors
|
|
|
|
|
// - display success
|
|
|
|
|
// - update link class to file_stored
|
|
|
|
|
// - close query box
|
|
|
|
|
|
|
|
|
|
query_str = CREATE_MAPPING_PATH + '?movie_id=' + movie_id + '&rel_path=' + rel_path; |
|
|
|
|
fetchJSON(query_str, function(json) { |
|
|
|
|
query_str = CREATE_MAPPING_PATH; |
|
|
|
|
params = new FormData(); |
|
|
|
|
params.append('movie_id', movie_id); |
|
|
|
|
params.append('rel_path', rel_path); |
|
|
|
|
|
|
|
|
|
const response = await fetch(CREATE_MAPPING_PATH, { body: params, method: 'POST' }); |
|
|
|
|
try { |
|
|
|
|
const json = await response.json(); |
|
|
|
|
console.log(json); |
|
|
|
|
}); |
|
|
|
|
} catch (e) { |
|
|
|
|
logError('error in submitFileMapping(), ' + e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function parseResponse(json, node) { |
|
|
|
|
@ -166,13 +173,13 @@ function fetchJSON(url, responseFunc, node=null) {
|
|
|
|
|
|
|
|
|
|
return response.json(); |
|
|
|
|
}) |
|
|
|
|
.then(function(json) { |
|
|
|
|
(node == null) ? responseFunc(json) : responseFunc(json, node); |
|
|
|
|
}) |
|
|
|
|
// TODO: don't catch errors in responseFunc
|
|
|
|
|
.catch(function(error) { |
|
|
|
|
logError('fetch error: ' + error); |
|
|
|
|
return null; |
|
|
|
|
}) |
|
|
|
|
.then(function(json) { |
|
|
|
|
if (json != null) |
|
|
|
|
(node == null) ? responseFunc(json) : responseFunc(json, node); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|