Skip to content

Commit c9ec5fd

Browse files
committed
changes to support profiledb
1 parent 6b3cc1c commit c9ec5fd

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

packages/tdb-documents-ui/src/oneOfTypeFrames/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ function extractPropertyFrames (extractedProperties) {
6161

6262
// retrieves layout of object data types one ofs
6363
function getDocumentLayout(choiceDocument, choiceDocumentFrames, oneOfLinkedClassName, args) {
64-
let {fullFrame, item, frame, uiFrame, mode, formData, onTraverse, onSelect, documentation, setChainedData} = args
64+
let {fullFrame, item, frame, uiFrame, mode, formData, onTraverse, onSelect, documentation, docType} = args
6565

6666
let choiceSubDocument=choiceDocumentFrames.hasOwnProperty("@class") ? choiceDocumentFrames["@class"] : choiceDocumentFrames
6767
let choiceSubDocumentFrame = fullFrame[choiceSubDocument]
6868

6969
// get documentation from frame
7070
let extractedDocumentation= choiceSubDocumentFrame.hasOwnProperty(CONST.DOCUMENTATION) ? choiceSubDocumentFrame[CONST.DOCUMENTATION] : []
71-
let exractedProperties = getProperties(fullFrame, item, choiceSubDocumentFrame, uiFrame, mode, formData, onTraverse, onSelect, extractedDocumentation, setChainedData)
71+
let exractedProperties = getProperties(fullFrame, item, choiceSubDocumentFrame, uiFrame, mode, formData, onTraverse, onSelect, extractedDocumentation, docType)
7272

7373
console.log("exractedProperties sub", exractedProperties)
7474
exractedProperties.properties["@type"]={

packages/tdb-documents-ui/src/oneOfTypeFrames/oneOfTypeFrames.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as CONST from "../constants"
2-
import {getProperties} from "../FrameHelpers"
32
import * as util from "../utils"
43
import * as helper from "./helpers"
54

packages/tdb-documents-ui/src/utils.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ export function isFilled (item, formData){
460460
return false
461461
}
462462

463+
463464
/**
464465
*
465466
* @param {*} frame - full frame from a data product
@@ -471,21 +472,34 @@ export function isFilled (item, formData){
471472
if(frame.hasOwnProperty(item) && frame[item].hasOwnProperty(CONST.DOCUMENTATION)) {
472473
let docArr=[]
473474
if(language) {
474-
frame[item][CONST.DOCUMENTATION].map(doc => {
475+
if(Array.isArray(frame[item][CONST.DOCUMENTATION])) {
476+
// expecting an array with multi language definitions
477+
frame[item][CONST.DOCUMENTATION].map(doc => {
478+
let obj={}
479+
for(var things in doc) {
480+
obj[things]=doc[things]
481+
}
482+
obj[CONST.SELECTED_LANGUAGE]=language
483+
docArr.push(obj)
484+
})
485+
}
486+
else if (typeof frame[item][CONST.DOCUMENTATION] === CONST.OBJECT_TYPE){
487+
// expecting an object
475488
let obj={}
476-
for(var things in doc) {
477-
obj[things]=doc[things]
489+
for(var things in frame[item][CONST.DOCUMENTATION]) {
490+
obj[things]=frame[item][CONST.DOCUMENTATION][things]
478491
}
479492
obj[CONST.SELECTED_LANGUAGE]=language
480-
docArr.push(obj)
481-
})
493+
docArr.push(obj)
494+
}
482495
documentation=docArr
483496
}
484497
else documentation = frame[item][CONST.DOCUMENTATION]
485498
}
486499
return documentation
487500
}
488501

502+
489503
/**
490504
*
491505
* @param {*} documentation - documentation object which contains labels and comments

0 commit comments

Comments
 (0)