diff --git a/apps/dicom-connect/table.js b/apps/dicom-connect/table.js index 031c25dce..223fa1e3e 100644 --- a/apps/dicom-connect/table.js +++ b/apps/dicom-connect/table.js @@ -185,8 +185,9 @@ function initialize() { return '
'; case 'unsync': // return btn - const seriesId = row['0020000E']['Value'][0] - return `
`; // + const seriesId = row['0020000E']['Value'][0]; + const modality = row['00080060']['Value'][0]; + return `
`; // case 'syncing': // return downloading // return '
'; @@ -300,8 +301,11 @@ $(document).ready(function() { }); -function syncSeries(source, studyId, seriesId) { - console.log(`syncSeries: ${source}, ${studyId}, ${seriesId}`) +async function syncSeries(source_url, study, series, modality) { + console.log(source_url, study, series, modality); + const result = await store.syncSeries('../../../', {source_url, study, series, modality}) + console.log('syncSeries:'); + console.log(result); } function checkSeriesStatus() { diff --git a/core/Store.js b/core/Store.js index 65ed127eb..57ff35c84 100644 --- a/core/Store.js +++ b/core/Store.js @@ -36,6 +36,7 @@ function objToParamStr(obj) { class Store { constructor(base, validation, config) { this.base = base || './data/'; + this.validation = validation || {}; this.config = config; } @@ -945,7 +946,34 @@ class Store { body: JSON.stringify(update), }); } - + /*** + * dicom api start + * + */ + async syncSeries(baseUrl, data = {}) { + // the data structure: + // const {source_url, study, series, modality} = data + + const suffix = 'loader/dicomWeb/importSeries'; + const url = baseUrl + suffix; + // Default options are marked with * + const response = await fetch(url, { + method: "POST", + mode: "cors", + cache: "no-cache", + headers: { + "Content-Type": "application/json", + }, + redirect: "follow", + referrerPolicy: "no-referrer", + body: JSON.stringify(data), + }); + return response.json(); + } + /*** + * dicom api end + * + */ addPresetLabels(labels) { const suffix = 'Presetlabels/add'; const url = this.base + suffix;