зеркало из https://github.com/microsoft/CDM.git
update to match exp branch
This commit is contained in:
Родитель
3d558e2407
Коммит
4a0ba08ee9
|
@ -225,6 +225,59 @@
|
|||
}
|
||||
|
||||
|
||||
.property_table
|
||||
{
|
||||
border:1px solid black;
|
||||
border-collapse: collapse;
|
||||
margin: 4px;
|
||||
}
|
||||
.property_table_header
|
||||
{
|
||||
padding: 3px;
|
||||
}
|
||||
.property_table_header_label
|
||||
{
|
||||
border:1px solid black;
|
||||
font-size: medium;
|
||||
font-weight: bolder;
|
||||
color:black;
|
||||
text-align: right;
|
||||
padding: 3px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
.property_table_header_value
|
||||
{
|
||||
border:1px solid black;
|
||||
font-size: large;
|
||||
font-weight: bold;
|
||||
color:mediumblue;
|
||||
padding: 3px;
|
||||
padding-left: 6px;
|
||||
}
|
||||
.property_table_detail
|
||||
{
|
||||
padding: 2px;
|
||||
}
|
||||
.property_table_detail_label
|
||||
{
|
||||
border:1px solid black;
|
||||
font-size: smaller;
|
||||
font-weight: bolder;
|
||||
color:black;
|
||||
text-align: right;
|
||||
padding: 3px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
.property_table_detail_value
|
||||
{
|
||||
border:1px solid black;
|
||||
font-size: normal;
|
||||
font-weight: bolder;
|
||||
color:mediumblue;
|
||||
padding: 3px;
|
||||
padding-left: 6px;
|
||||
}
|
||||
|
||||
|
||||
.trait_table
|
||||
{
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -26,7 +26,7 @@ class DPEntityImpl {
|
|||
this.$type = "LocalEntity";
|
||||
this.name = "";
|
||||
this.description = "";
|
||||
this.dataCategory = "";
|
||||
//this.dataCategory = "";
|
||||
//this.pii = "Unclassified";
|
||||
this.schemas = new Array();
|
||||
this.annotations = new Array();
|
||||
|
@ -82,12 +82,17 @@ class Converter {
|
|||
this.relationshipsType = "none";
|
||||
this.partitionPattern = "$1.csv";
|
||||
this.schemaUriBase = "";
|
||||
this.schemaVersion = "";
|
||||
}
|
||||
getPostFix() {
|
||||
return (this.schemaVersion ? "." + this.schemaVersion : "") + ".dplx";
|
||||
}
|
||||
convertEntities(entities, dpName) {
|
||||
let dp = new DataPoolImpl();
|
||||
dp.name = dpName;
|
||||
let entitiesIncluded = new Set();
|
||||
let relationshipsSeen = new Array();
|
||||
let postFix = this.getPostFix();
|
||||
for (let iEnt = 0; iEnt < entities.length; iEnt++) {
|
||||
const cdmEntity = entities[iEnt];
|
||||
// remember what was sent to pick out the 'good' relationships at the end
|
||||
|
@ -101,7 +106,7 @@ class Converter {
|
|||
if (this.bindingType === "byol")
|
||||
dpEnt.partitions.push(new DPPartitionImpl(this.partitionPattern, dpEnt.name));
|
||||
// datacategory is the same as name for cdm
|
||||
dpEnt.dataCategory = dpEnt.name;
|
||||
//dpEnt.dataCategory = dpEnt.name;
|
||||
// get the traits of the entity
|
||||
let rtsEnt = cdmEntity.getResolvedTraits();
|
||||
// the trait 'is.CDM.attributeGroup' contains a table of references to the 'special' attribute groups contained by the entity.
|
||||
|
@ -125,6 +130,7 @@ class Converter {
|
|||
let expectedEnding = `/${dpEnt.name}/hasAttributes/attributesAddedAtThisScope`;
|
||||
if (agPath.endsWith(expectedEnding))
|
||||
agPath = agPath.slice(0, agPath.length - expectedEnding.length);
|
||||
agPath += postFix;
|
||||
// caller might want some other prefix
|
||||
agPath = this.schemaUriBase + agPath;
|
||||
dpEnt.schemas.push(agPath);
|
||||
|
@ -206,42 +212,24 @@ class Converter {
|
|||
return dp;
|
||||
}
|
||||
traits2DataType(rts) {
|
||||
let isBig = false;
|
||||
let isSmall = false;
|
||||
let baseType = "unclassified";
|
||||
let l = rts.set.length;
|
||||
for (let i = 0; i < l; i++) {
|
||||
const raName = rts.set[i].traitName;
|
||||
switch (raName) {
|
||||
case "is.dataFormat.big":
|
||||
isBig = true;
|
||||
break;
|
||||
case "is.dataFormat.small":
|
||||
isSmall = true;
|
||||
break;
|
||||
case "is.dataFormat.integer":
|
||||
baseType = "int";
|
||||
baseType = "int64";
|
||||
break;
|
||||
case "is.dataFormat.floatingPoint":
|
||||
baseType = "float";
|
||||
baseType = "double";
|
||||
break;
|
||||
case "is.dataFormat.characters":
|
||||
case "is.dataFormat.byte":
|
||||
case "is.dataFormat.character":
|
||||
baseType = "string";
|
||||
break;
|
||||
case "is.dataFormat.bytes":
|
||||
baseType = "string";
|
||||
break;
|
||||
case "is.dataFormat.date":
|
||||
if (baseType == "time")
|
||||
baseType = "dateTime";
|
||||
else
|
||||
baseType = "date";
|
||||
break;
|
||||
case "is.dataFormat.time":
|
||||
if (baseType == "date")
|
||||
baseType = "dateTime";
|
||||
else
|
||||
baseType = "time";
|
||||
case "is.dataFormat.date":
|
||||
baseType = "dateTime";
|
||||
break;
|
||||
case "is.dataFormat.boolean":
|
||||
baseType = "boolean";
|
||||
|
@ -253,13 +241,6 @@ class Converter {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// and now throw away everything we just learned and smash into this set :)
|
||||
if (baseType == "float")
|
||||
baseType = "double";
|
||||
if (baseType == "int")
|
||||
baseType = "int64";
|
||||
if (baseType == "date" || baseType == "time")
|
||||
baseType = "dateTime";
|
||||
return baseType;
|
||||
}
|
||||
traits2DataCategory(rts) {
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
controller.listContainer = document.getElementsByClassName("list_container")[0];
|
||||
controller.statusPane = document.getElementsByClassName("status_pane")[0];
|
||||
controller.traitsPane = document.getElementsByClassName("traits_pane")[0];
|
||||
controller.propertiesPane = document.getElementsByClassName("properties_pane")[0];
|
||||
controller.JsonPane = document.getElementsByClassName("json_pane")[0];
|
||||
controller.DplxPane = document.getElementsByClassName("dplx_pane")[0];
|
||||
controller.backButton = document.getElementById("back_tool_button");
|
||||
|
@ -218,6 +219,7 @@
|
|||
</span>
|
||||
<span class="fixed_container" id="tab_host_pane">
|
||||
<span class="detail_container" style="background-color: var(--back-alternate1);">
|
||||
<span class="tab" id="property_tab" style="background-color: var(--back-alternate1)" onclick="onclickDetailTab('property_tab')">Properties</span>
|
||||
<span class="tab" id="trait_tab" style="background-color: var(--back-alternate1)" onclick="onclickDetailTab('trait_tab')">Traits</span>
|
||||
<span class="tab" id="json_tab" style="background-color: var(--back-alternate1)" onclick="onclickDetailTab('json_tab')">JSON</span>
|
||||
<span class="tab" id="status_tab" style="background-color: var(--back-alternate2)" onclick="onclickDetailTab('status_tab')">Status</span>
|
||||
|
@ -236,6 +238,8 @@
|
|||
</span>
|
||||
<span class="traits_pane">
|
||||
</span>
|
||||
<span class="properties_pane">
|
||||
</span>
|
||||
<span class="json_pane">
|
||||
</span>
|
||||
<span class="dplx_pane">
|
||||
|
|
|
@ -45,6 +45,8 @@ function init() {
|
|||
controller.statusPane.messageHandle = messageHandleDetailStatus;
|
||||
controller.traitsPane.messageHandlePing = messageHandlePingParent;
|
||||
controller.traitsPane.messageHandle = messageHandleDetailTraits;
|
||||
controller.propertiesPane.messageHandlePing = messageHandlePingParent;
|
||||
controller.propertiesPane.messageHandle = messageHandleDetailProperties;
|
||||
controller.JsonPane.messageHandlePing = messageHandlePingParent;
|
||||
controller.JsonPane.messageHandle = messageHandleDetailJson;
|
||||
controller.DplxPane.messageHandlePing = messageHandlePingParent;
|
||||
|
@ -201,7 +203,7 @@ function messageHandlePingMainControl(messageType, data1, data2) {
|
|||
else if (controller.appState === "resolveMode") {
|
||||
if (messageType === "resolveModeResult") {
|
||||
if (data1) {
|
||||
controller.mainContainer.messageHandle("detailTabSelect", "trait_tab", null);
|
||||
controller.mainContainer.messageHandle("detailTabSelect", "property_tab", null);
|
||||
// associate the resolved entity objects with the navigation id
|
||||
indexResolvedEntities();
|
||||
}
|
||||
|
@ -212,13 +214,14 @@ function messageHandlePingMainControl(messageType, data1, data2) {
|
|||
}
|
||||
function fileListToNavData(fileList) {
|
||||
let noUX = new Set();
|
||||
noUX.add("primitives.cdm.json");
|
||||
noUX.add("foundations.cdm.json");
|
||||
noUX.add("meanings.cdm.json");
|
||||
noUX.add("dwConcepts.cdm.json");
|
||||
noUX.add("_allImports.cdm.json");
|
||||
noUX.add("cdsConcepts.cdm.json");
|
||||
noUX.add("wellKnownCDSAttributeGroups.cdm.json");
|
||||
noUX.add("schema");
|
||||
noUX.add("primitives");
|
||||
noUX.add("foundations");
|
||||
noUX.add("meanings");
|
||||
noUX.add("dwConcepts");
|
||||
noUX.add("_allImports");
|
||||
noUX.add("cdsConcepts");
|
||||
noUX.add("wellKnownCDSAttributeGroups");
|
||||
let iFolder = 1;
|
||||
let root = { id: `Folder${iFolder}`, name: "", entities: null, folders: null };
|
||||
iFolder++;
|
||||
|
@ -245,8 +248,8 @@ function fileListToNavData(fileList) {
|
|||
for (let iFile = 0; iFile < fileList.length; iFile++) {
|
||||
let file = fileList[iFile];
|
||||
if (file.name.endsWith(".cdm.json")) {
|
||||
let makeUX = !noUX.has(file.name);
|
||||
let entName = file.name.slice(0, file.name.length - ".cdm.json".length);
|
||||
let entName = file.name.slice(0, file.name.indexOf("."));
|
||||
let makeUX = !noUX.has(entName);
|
||||
let f;
|
||||
let path = (file.webkitRelativePath && file.webkitRelativePath.length) ? file.webkitRelativePath : "";
|
||||
// the first dir name is this and path ends with file. so cleanup
|
||||
|
@ -968,12 +971,105 @@ function messageHandleDetailTraits(messageType, data1, data2) {
|
|||
}
|
||||
}
|
||||
}
|
||||
function messageHandleDetailProperties(messageType, data1, data2) {
|
||||
if (messageType == "detailTabSelect") {
|
||||
this.style.display = (data1 != "property_tab") ? "none" : "block";
|
||||
return;
|
||||
}
|
||||
let resolvedObject;
|
||||
let isAtt = false;
|
||||
if (messageType == "navigateEntitySelect") {
|
||||
if (data2) {
|
||||
resolvedObject = data2.entity.getResolvedEntity();
|
||||
}
|
||||
}
|
||||
if (messageType == "listItemSelect") {
|
||||
if (data1.resolvedName) {
|
||||
resolvedObject = data1;
|
||||
isAtt = true;
|
||||
}
|
||||
else {
|
||||
// assume entity
|
||||
resolvedObject = data1.entity.getResolvedEntity();
|
||||
}
|
||||
}
|
||||
if (resolvedObject) {
|
||||
while (this.childNodes.length > 0)
|
||||
this.removeChild(this.lastChild);
|
||||
let propertyTable = controller.document.createElement("table");
|
||||
propertyTable.className = "property_table";
|
||||
let propertyRow = controller.document.createElement("tr");
|
||||
propertyRow.className = "property_table_header";
|
||||
propertyTable.appendChild(propertyRow);
|
||||
let propertyLabel = controller.document.createElement("td");
|
||||
propertyLabel.className = "property_table_header_label";
|
||||
propertyRow.appendChild(propertyLabel);
|
||||
let propertyValue = controller.document.createElement("td");
|
||||
propertyValue.className = "property_table_header_value";
|
||||
propertyRow.appendChild(propertyValue);
|
||||
propertyLabel.appendChild(controller.document.createTextNode(isAtt ? "Attribute" : "Entity"));
|
||||
propertyValue.appendChild(controller.document.createTextNode(resolvedObject.resolvedName));
|
||||
let addRow = (propName) => {
|
||||
let val = resolvedObject[propName];
|
||||
if (val != undefined) {
|
||||
propertyRow = controller.document.createElement("tr");
|
||||
propertyRow.className = "property_table_detail";
|
||||
propertyTable.appendChild(propertyRow);
|
||||
propertyLabel = controller.document.createElement("td");
|
||||
propertyLabel.className = "property_table_detail_label";
|
||||
propertyRow.appendChild(propertyLabel);
|
||||
propertyValue = controller.document.createElement("td");
|
||||
propertyValue.className = "property_table_detail_value";
|
||||
propertyRow.appendChild(propertyValue);
|
||||
propertyLabel.appendChild(controller.document.createTextNode(propName));
|
||||
if (typeof (val) == "string")
|
||||
propertyValue.appendChild(controller.document.createTextNode(val));
|
||||
else if (val instanceof Array) {
|
||||
var pre = controller.document.createElement("pre");
|
||||
var code = controller.document.createElement("code");
|
||||
pre.appendChild(code);
|
||||
var json = JSON.stringify(val, null, 2);
|
||||
code.appendChild(controller.document.createTextNode(json));
|
||||
propertyValue.appendChild(pre);
|
||||
}
|
||||
else
|
||||
propertyValue.appendChild(controller.document.createTextNode(val.toString()));
|
||||
}
|
||||
};
|
||||
if (isAtt) {
|
||||
addRow("displayName");
|
||||
addRow("description");
|
||||
addRow("isPrimaryKey");
|
||||
addRow("dataFormat");
|
||||
addRow("maximumLength");
|
||||
addRow("maximumValue");
|
||||
addRow("minimumValue");
|
||||
addRow("isReadOnly");
|
||||
addRow("isNullable");
|
||||
addRow("creationSequence");
|
||||
addRow("sourceName");
|
||||
addRow("valueConstrainedToList");
|
||||
addRow("defaultValue");
|
||||
}
|
||||
else {
|
||||
addRow("displayName");
|
||||
addRow("description");
|
||||
addRow("version");
|
||||
addRow("primaryKey");
|
||||
addRow("cdmSchemas");
|
||||
addRow("sourceName");
|
||||
}
|
||||
this.appendChild(propertyTable);
|
||||
}
|
||||
}
|
||||
function messageHandleButton(messageType, data1, data2) {
|
||||
}
|
||||
function copyActivePane() {
|
||||
var activePane;
|
||||
if (controller.statusPane.style.display != "none")
|
||||
activePane = controller.statusPane;
|
||||
else if (controller.propertiesPane.style.display != "none")
|
||||
activePane = controller.propertiesPane;
|
||||
else if (controller.traitsPane.style.display != "none")
|
||||
activePane = controller.traitsPane;
|
||||
else if (controller.JsonPane.style.display != "none")
|
||||
|
|
Загрузка…
Ссылка в новой задаче