Restructure JS module
This commit is contained in:
parent
ec1b0dee80
commit
beb9ecb29b
115
js/ds.js
115
js/ds.js
@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
const MAPBOX_TOKEN = 'pk.eyJ1Ijoibmljb3BhIiwiYSI6ImNsZmNiZGN0ZTJzbGgzdG8xYnZxOXRvd28ifQ.nvK1VYF6lwPpA094cL83KQ';
|
||||
import * as resmap from './resmap.js';
|
||||
/**
|
||||
* @namespace DataSpace
|
||||
*/
|
||||
@ -8,116 +9,14 @@ const DataSpace = {};
|
||||
DataSpace.BASE_URL = 'http://dataspace.ispc.cnr.it';
|
||||
DataSpace.RES_ENDPOINT = '/resources/';
|
||||
DataSpace.FILES_URI = `${DataSpace.BASE_URL}/files/uploadedfiles/`;
|
||||
DataSpace.OBJECT_ORDER = {
|
||||
"Object Type" : null,
|
||||
"Object ID" : null,
|
||||
"Object Excavation code" : null,
|
||||
"Object Chronology" : null,
|
||||
"Object Era" : null,
|
||||
"Object Geographical Context of Discovery" : null,
|
||||
"Object Dimensions" : null,
|
||||
"Object Material" : null,
|
||||
"Object Description" : null,
|
||||
"Object Conservation State" : null,
|
||||
"Object Reused?" : null,
|
||||
"Object Project" : null,
|
||||
"Object Compiler" : null,
|
||||
"Object Bibliography" : null,
|
||||
};
|
||||
DataSpace.CONTEXT_ORDER = {
|
||||
"Context Name" : null,
|
||||
"Context Typology" : null,
|
||||
"Context Chronology" : null,
|
||||
"Context Era" : null,
|
||||
"Context Surface" : null,
|
||||
"Context Square meters" : null,
|
||||
"Context Quality of the marble used/extracted" : null,
|
||||
"Context Description" : null,
|
||||
"Context Traces of extraction tools" : null,
|
||||
"Context Amount of debris (cm3)" : null,
|
||||
"Context Presence of unfinished materials" : null,
|
||||
"Context Collections for the lifting machine" : null,
|
||||
"Context Current status" : null,
|
||||
"Context Streets of contention" : null,
|
||||
"Context Project" : null,
|
||||
"Context Compiler" : null,
|
||||
"Context Bibliography" : null,
|
||||
};
|
||||
const OBJECT_REPORT = new Map();
|
||||
OBJECT_REPORT.set(
|
||||
'before-gallery',
|
||||
{
|
||||
"Object Type" : null,
|
||||
"Object ID" : null,
|
||||
"Object Excavation code" : null,
|
||||
"Object Chronology" : null,
|
||||
"Object Era" : null,
|
||||
"Object Geographical Context of Discovery" : null,
|
||||
"Object Dimensions" : null,
|
||||
"Object Material" : null,
|
||||
}
|
||||
);
|
||||
OBJECT_REPORT.set(
|
||||
'after-gallery-1-col',
|
||||
{
|
||||
"Object Description" : null,
|
||||
"Object Conservation State" : null,
|
||||
}
|
||||
);
|
||||
OBJECT_REPORT.set(
|
||||
'after-gallery-2-col',
|
||||
{
|
||||
"Object Reused?" : null,
|
||||
"Object Project" : null,
|
||||
"Object Compiler" : null,
|
||||
"Object Bibliography" : null,
|
||||
}
|
||||
);
|
||||
const CONTEXT_REPORT = new Map();
|
||||
CONTEXT_REPORT.set(
|
||||
'before-gallery',
|
||||
{
|
||||
"Context Name" : null,
|
||||
"Context Typology" : null,
|
||||
"Context Chronology" : null,
|
||||
"Context Era" : null,
|
||||
"Context Surface" : null,
|
||||
"Context Square meters" : null,
|
||||
"Context Quality of the marble used/extracted" : null,
|
||||
"Context Quantity of extracted material (cm3)" : null,
|
||||
"Context Traces of extraction tools" : null,
|
||||
"Context Amount of debris (cm3)" : null,
|
||||
"Context Presence of unfinished materials" : null,
|
||||
"Context Collections for the lifting machine" : null,
|
||||
"Context Current status" : null,
|
||||
"Context Streets of contention" : null
|
||||
}
|
||||
);
|
||||
CONTEXT_REPORT.set(
|
||||
'after-gallery-1-col',
|
||||
{
|
||||
"Context Description" : null,
|
||||
}
|
||||
);
|
||||
CONTEXT_REPORT.set(
|
||||
'after-gallery-2-col',
|
||||
{
|
||||
|
||||
"Context Project" : null,
|
||||
"Context Compiler" : null,
|
||||
"Context Bibliography" : null,
|
||||
}
|
||||
);
|
||||
DataSpace.OBJECT_REPORT = OBJECT_REPORT;
|
||||
DataSpace.CONTEXT_REPORT = CONTEXT_REPORT;
|
||||
// TODO maybe these assignments are non needed?
|
||||
DataSpace.RESOURCE_REPORT = {
|
||||
'Object' : DataSpace.OBJECT_REPORT,
|
||||
'Context' : DataSpace.CONTEXT_REPORT,
|
||||
'Object' : resmap.OBJECT_REPORT,
|
||||
'Context' : resmap.CONTEXT_REPORT,
|
||||
};
|
||||
/**
|
||||
* Populate partial objects from
|
||||
* resource object based on Map
|
||||
* @todo
|
||||
* @param {object} resource
|
||||
* @param {string} resType
|
||||
*
|
||||
@ -182,12 +81,6 @@ DataSpace.renderReport = function (report, images)
|
||||
|
||||
let resType = resKeys[0].split(' ')[0];
|
||||
|
||||
const reportOrder = {
|
||||
'Object' : this.OBJECT_ORDER,
|
||||
'Context' : this.CONTEXT_ORDER,
|
||||
};
|
||||
|
||||
resource = Object.assign(reportOrder[resType], resource);
|
||||
const geoJSON = JSON.parse(
|
||||
resource[`${resType} Coordinates`]
|
||||
.replaceAll('\'', '"')
|
||||
|
67
js/resmap.js
Normal file
67
js/resmap.js
Normal file
@ -0,0 +1,67 @@
|
||||
const OBJECT_REPORT = new Map();
|
||||
OBJECT_REPORT.set(
|
||||
'before-gallery',
|
||||
{
|
||||
"Object Type" : null,
|
||||
"Object ID" : null,
|
||||
"Object Excavation code" : null,
|
||||
"Object Chronology" : null,
|
||||
"Object Era" : null,
|
||||
"Object Geographical Context of Discovery" : null,
|
||||
"Object Dimensions" : null,
|
||||
"Object Material" : null,
|
||||
}
|
||||
);
|
||||
OBJECT_REPORT.set(
|
||||
'after-gallery-1-col',
|
||||
{
|
||||
"Object Description" : null,
|
||||
"Object Conservation State" : null,
|
||||
}
|
||||
);
|
||||
OBJECT_REPORT.set(
|
||||
'after-gallery-2-col',
|
||||
{
|
||||
"Object Reused?" : null,
|
||||
"Object Project" : null,
|
||||
"Object Compiler" : null,
|
||||
"Object Bibliography" : null,
|
||||
}
|
||||
);
|
||||
const CONTEXT_REPORT = new Map();
|
||||
CONTEXT_REPORT.set(
|
||||
'before-gallery',
|
||||
{
|
||||
"Context Name" : null,
|
||||
"Context Typology" : null,
|
||||
"Context Chronology" : null,
|
||||
"Context Era" : null,
|
||||
"Context Surface" : null,
|
||||
"Context Square meters" : null,
|
||||
"Context Quality of the marble used/extracted" : null,
|
||||
"Context Quantity of extracted material (cm3)" : null,
|
||||
"Context Traces of extraction tools" : null,
|
||||
"Context Amount of debris (cm3)" : null,
|
||||
"Context Presence of unfinished materials" : null,
|
||||
"Context Collections for the lifting machine" : null,
|
||||
"Context Current status" : null,
|
||||
"Context Streets of contention" : null
|
||||
}
|
||||
);
|
||||
CONTEXT_REPORT.set(
|
||||
'after-gallery-1-col',
|
||||
{
|
||||
"Context Description" : null,
|
||||
}
|
||||
);
|
||||
CONTEXT_REPORT.set(
|
||||
'after-gallery-2-col',
|
||||
{
|
||||
|
||||
"Context Project" : null,
|
||||
"Context Compiler" : null,
|
||||
"Context Bibliography" : null,
|
||||
}
|
||||
);
|
||||
|
||||
export {OBJECT_REPORT, CONTEXT_REPORT};
|
@ -98,7 +98,7 @@
|
||||
<div class="column col-3">
|
||||
<div class="tile tile-centered text-small pt-2">
|
||||
<div class="tile-icon">
|
||||
<img height="30px" class="img-fit-contain" src="/img/favicon_dataspace.svg" />
|
||||
<img height="30px" class="img-fit-contain" src="../img/favicon_dataspace.svg" />
|
||||
</div>
|
||||
<div class="tile-content">
|
||||
2023 All rights reserved
|
||||
|
Loading…
Reference in New Issue
Block a user