Skip to content

Commit c66fe98

Browse files
committed
progress
1 parent 8027521 commit c66fe98

File tree

5 files changed

+9
-97
lines changed

5 files changed

+9
-97
lines changed

packages/tdb-dashboard/src/components/DiffView.js

Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -180,98 +180,6 @@ function DiffViewDocument ({documentID,diffObj, CRObject,propertyModifiedCount,f
180180
</Accordion>
181181
}
182182

183-
/**
184-
*
185-
* @param {*} diffs diff list
186-
* @param {*} trackingBranchDocumentList document list of tracking branch
187-
* @param {*} originBranchDocumentList document list of origin branch
188-
* @returns
189-
*/
190-
export const DiffView_OLD = ({diffs, CRObject, start, setStart }) => {
191-
const {woqlClient} = WOQLClientObj()
192-
193-
// I need to copy the woqlClient and set the original_branch
194-
// to get the right frame
195-
const woqlClientCopy = woqlClient.copy()
196-
woqlClientCopy.checkout(CRObject.original_branch)
197-
198-
const {frames,getDocumentFrames} = useTDBDocuments(woqlClientCopy)
199-
// pagination constants
200-
const [activePage, setActivePage]=useState(1)
201-
const [current, setCurrent]=useState(0)
202-
203-
const [page, setPage] = useState(start)
204-
205-
let elements=[], paginationItems=[]
206-
207-
let divide = Math.ceil(diffs.length/DIFFS_PER_PAGE_LIMIT)
208-
209-
useEffect(() => {
210-
getDocumentFrames()
211-
},[])
212-
// function to handle on click of page
213-
function handlePagination(number) {
214-
alert(number)
215-
/*let position=DIFFS_PER_PAGE_LIMIT * (number-1)
216-
217-
setCurrent(position)
218-
setActivePage(number) */
219-
220-
}
221-
222-
// populate pagination Item
223-
/*for (let number = 1; number <= divide; number++) {
224-
paginationItems.push(
225-
<Pagination.Item key={number} active={number === activePage} onClick={(e) => handlePagination(number)}>
226-
{number}
227-
</Pagination.Item>
228-
)
229-
}*/
230-
231-
if(!frames) return <Loading message={`Loading Frames ...`}/>
232-
if(!diffs) return <Loading message={`Loading Diffs ...`}/>
233-
234-
235-
// looping through diff lists
236-
for(let start=current; start<(current + DIFFS_PER_PAGE_LIMIT); start++) {
237-
238-
if(start >= diffs.length) continue
239-
240-
const propertyModifiedCount = getPropertyModifiedCount(diffs[start])
241-
const diffObj = diffs[start]
242-
const action = diffObj["@op"] || "Change"
243-
const actionKey = `@${action.toLowerCase()}`
244-
const eventKey= diffObj[actionKey] && diffObj[actionKey]["@id"] ? diffObj[actionKey]["@id"] : diffObj["@id"]
245-
const docType = diffObj[actionKey] && diffObj[actionKey]["@type"] ? diffObj[actionKey]["@type"] : diffObj["@type"]
246-
247-
// this are the diff panel for document
248-
elements.push(
249-
<React.Fragment key={`item__${start}`}>
250-
<DiffViewDocument frames={frames} key={actionKey}
251-
action={action}
252-
docType={docType}
253-
propertyModifiedCount={propertyModifiedCount}
254-
documentID={eventKey}
255-
diffObj={diffObj}
256-
CRObject={CRObject}/>
257-
</React.Fragment>
258-
)
259-
}
260-
261-
return <React.Fragment>
262-
{elements}
263-
<Row className="w-100">
264-
<Col/>
265-
<Col>
266-
<Pagination className="justify-content-center ">
267-
<Pagination.Prev onClick={(e) => handlePagination(e)}/>
268-
<Pagination.Next onClick={(e) => handlePagination(e)}/>
269-
</Pagination>
270-
</Col>
271-
<Col/>
272-
</Row>
273-
</React.Fragment>
274-
}
275183

276184
/**
277185
*
@@ -292,7 +200,7 @@ export const DiffView = ({diffs, CRObject, start, setStart }) => {
292200

293201
let elements=[]
294202

295-
203+
296204
useEffect(() => {
297205
getDocumentFrames()
298206
},[])

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ export function displayBBoxDocument (props, args, property, id) {
489489

490490
return <TDBBBoxDocuments config={config}/>
491491
}
492-
492+
493493

494494
// ARRAY
495495
export function displayArrayWidgets (props, args, extracted, property, expand, id, hideFieldLabel, linked_to) {
@@ -508,6 +508,7 @@ export function displayArrayWidgets (props, args, extracted, property, expand, i
508508
required: true,
509509
mode: args.mode,
510510
args: args,
511+
hideFieldLabel: hideFieldLabel,
511512
//fieldUIFrame: fieldUIFrame,
512513
onChange: (data, selectedField) => handleArrayOnChange(data, selectedField),
513514
//defaultClassName: defaultClassName,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const getDisplay = (props, args, property) => {
2222
let id = props.id, linked_to=props.linked_to
2323
let extracted=args.reference[linked_to]
2424
let expand=props.isArray ? true : props.expand
25-
return display.displayArrayWidgets(props, args, extracted, property, expand, id, hideFieldLabel, linked_to)
25+
return display.displayArrayWidgets(props, args, extracted, property, expand, id, true, linked_to)
2626
}
2727
else if(util.isSubDocumentType(field)){
2828
// SUBDOCUMENT TYPE

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export const typeHelper = (documentFrame, property, fullFrame, isArray) => {
1414
return CONST.BOOLEAN_TYPE
1515
return CONST.STRING_TYPE
1616
}
17+
else if(util.isOneOfDataType(documentFrame, property)) {
18+
// ONE OF TYPE
19+
return [ CONST.STRING_TYPE, CONST.OBJECT_TYPE ]
20+
}
1721
else if(util.isSubDocumentType(field)){
1822
// SUBDOCUMENT TYPE
1923
//return [ "null", CONST.OBJECT_TYPE ]

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ export function makeMandatoryFrames (args, property) {
3737
// assign default value if sys unit
3838
layout["default"]=[]
3939
}
40-
41-
40+
4241
let uiLayout = uiHelper(args, property)
4342

4443
return { layout, uiLayout }

0 commit comments

Comments
 (0)