diff --git a/exact/exact/annotations/static/annotations/js/exact-image-viewer.js b/exact/exact/annotations/static/annotations/js/exact-image-viewer.js index fc5f17f5..589d72b0 100644 --- a/exact/exact/annotations/static/annotations/js/exact-image-viewer.js +++ b/exact/exact/annotations/static/annotations/js/exact-image-viewer.js @@ -37,6 +37,7 @@ class EXACTViewer { this.filterImage = new OpenseadragonFilteringViewer(this.viewer); this.pluginHandler = new PluginHandler(this.imageId, gHeaders, this.viewer); this.screeningTool = new ScreeningTool(imageInformation, user_id, gHeaders, this.viewer); + this.imageProperties = new ShowImageProperties(this.viewer, this.imageId); console.log(`${this.constructor.name} loaded for id ${this.imageId}`); @@ -841,7 +842,7 @@ class EXACTViewerLocalAnnotations extends EXACTViewer { this.asthmaAnalysis = new AsthmaAnalysis(this.imageId, this.viewer, this.exact_sync); this.showAnnotationProperties = new ShowAnnotationProperties(this.viewer, this.exact_sync); - + let team_id = parseInt($('#team_id').html()); this.teamTool = new TeamTool(this.viewer, team_id); this.processingTool = new ProcessingTool(this.viewer, this.imageId); diff --git a/exact/exact/annotations/static/annotations/js/show-image-properties.js b/exact/exact/annotations/static/annotations/js/show-image-properties.js new file mode 100644 index 00000000..0e9488c7 --- /dev/null +++ b/exact/exact/annotations/static/annotations/js/show-image-properties.js @@ -0,0 +1,49 @@ +function include_server_subdir(url) { + sub_dir = window.location.pathname.split("/annotations/")[0] + if (sub_dir === "") { return url } else { return sub_dir + url } +} + + + +class ShowImageProperties{ + constructor(viewer, imageId) { + + this.viewer = viewer; + this.imageId = imageId; + + this.updateImageInfo(viewer, imageId); + } + + updateImageInfo(viewer, imageId) { + // get current environment + let gCsrfToken = $('[name="csrfmiddlewaretoken"]').first().val(); + + let gHeaders = { + "Content-Type": 'application/json', + "X-CSRFTOKEN": gCsrfToken + }; + + let url = include_server_subdir('/images/api/image/metadata/'+imageId+'/'); + $.ajax(url, { + type: 'GET', headers: gHeaders, dataType: 'json', + success: function (data) { + + let table = "" + for (let [key,value] of Object.entries(data.meta_data)) { + table += ""+data.meta_data_dict[key]+""+value+'' + } + $("#image_info_table").html(table) +// window.dispatchEvent(new CustomEvent("sync_ProcessingJobListLoaded", {"detail": context})); + }, + error: function (request, status, error) { + if (request.responseText !== undefined) { + $.notify(request.responseText, { position: "bottom center", className: "error" }); + } else { + $.notify(`Server ERR_CONNECTION_TIMED_OUT`, { position: "bottom center", className: "error" }); + } + } + }); + + + } +} \ No newline at end of file diff --git a/exact/exact/annotations/templates/annotations/annotate.html b/exact/exact/annotations/templates/annotations/annotate.html index f968ed2b..740b8a5b 100644 --- a/exact/exact/annotations/templates/annotations/annotate.html +++ b/exact/exact/annotations/templates/annotations/annotate.html @@ -39,6 +39,7 @@ + @@ -176,6 +177,10 @@
{{ selected_image.name }}
role="tab" aria-controls="home">Annotation + {% if HasMediaFiles %} + + + {% if HasMediaFiles %}