Skip to content

Commit e9cbe4f

Browse files
committed
Merge branch 'newDoc' of https://github.com/terminusdb/terminusdb-dashboard into newDoc
2 parents f196172 + be1949e commit e9cbe4f

File tree

9 files changed

+285
-201
lines changed

9 files changed

+285
-201
lines changed

packages/tdb-documents-ui/diff/src/Output.js

Lines changed: 233 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import {DiffViewer} from '@terminusdb/terminusdb-documents-ui'
44
import {OLD_VALUE, CHANGED_VALUE} from "./constants"
55
import {getSelectedTypeData} from "./functions"
66
import {oldData, changedData} from "./diff.constants"
7-
import "../../src/css/terminusdb__styles"
7+
import '../../src/css/terminusdb__darkly.css'
8+
89

910
export const Output = () => {
1011
const {
@@ -27,7 +28,7 @@ export const Output = () => {
2728
useEffect(() => {
2829
async function getDiffs(tdbClient) {
2930
//console.log("doc", doc)
30-
let result_patch = await tdbClient.getJSONDiff(oldData["Person"], changedData["Person"])
31+
let result_patch = await tdbClient.getJSONDiff(oldData["Definition"], changedData["Definition"])
3132
setDiff(result_patch)
3233
}
3334
if(tdbClient) {
@@ -256,10 +257,14 @@ export const Output = () => {
256257
"@type": "Random"
257258
},
258259
"@type": "Class",
259-
"likes": {
260+
"likes": {
261+
"@class": "xsd:string",
262+
"@type": "List"
263+
}
264+
/*"likes": {
260265
"@class": "Animal",
261266
"@type": "List"
262-
},
267+
},*/
263268
/*"favorite_subject": {
264269
"@class": [
265270
{
@@ -277,7 +282,7 @@ export const Output = () => {
277282
"@class": "xsd:string",
278283
"@type": "Optional"
279284
},*/
280-
"manYAddress": {
285+
/*"manYAddress": {
281286
"@class": {
282287
"@class": "Address",
283288
"@subdocument": []
@@ -358,15 +363,234 @@ export const Output = () => {
358363
},
359364
"@type": "Class",
360365
"likes": "Animal"
366+
},
367+
"Test": {
368+
"@key": {
369+
"@type": "Random"
370+
},
371+
"@type": "Class",
372+
"new": {
373+
"@class": "xsd:string",
374+
"@type": "List"
375+
},
376+
361377
}
362378
}
379+
380+
const CODE_FRAMES = {
381+
"@context": {
382+
"@base": "terminusdb:///documentation/data/",
383+
"@schema": "terminusdb:///documentation/schema#",
384+
"@type": "Context"
385+
},
386+
"Application": {
387+
"@inherits": [
388+
"Documented",
389+
"Named",
390+
"Summarized"
391+
],
392+
"@type": "Class",
393+
"language": {
394+
"@id": "Language",
395+
"@type": "Enum",
396+
"@values": [
397+
"Python",
398+
"Javascript"
399+
]
400+
},
401+
"license": "xsd:string",
402+
"modules": {
403+
"@class": "Module",
404+
"@type": "Set"
405+
},
406+
"name": "xsd:string",
407+
"summary": {
408+
"@class": "xsd:string",
409+
"@type": "Optional"
410+
},
411+
"version": "xsd:string"
412+
},
413+
"Class": {
414+
"@inherits": [
415+
"Documented",
416+
"Named",
417+
"Summarized"
418+
],
419+
"@type": "Class",
420+
"memberFunction": "Definition",
421+
"memberVariable": "Parameter",
422+
"name": "xsd:string",
423+
"summary": {
424+
"@class": "xsd:string",
425+
"@type": "Optional"
426+
}
427+
},
428+
"Definition": {
429+
"@inherits": [
430+
"Documented",
431+
"Named",
432+
"Summarized"
433+
],
434+
"@oneOf": [
435+
{
436+
"parameters": {
437+
"@class": "Parameter",
438+
"@dimensions": 1,
439+
"@type": "Array"
440+
},
441+
"receives": {
442+
"@class": "Parameter",
443+
"@dimensions": 1,
444+
"@type": "Array"
445+
}
446+
},
447+
{
448+
"returns": "Returns",
449+
"returns_multiple": {
450+
"@class": "Returns",
451+
"@dimensions": 1,
452+
"@type": "Array"
453+
},
454+
"void": "sys:Unit",
455+
"yields": "Returns"
456+
}
457+
],
458+
"@type": "Class",
459+
"name": "xsd:string",
460+
"summary": {
461+
"@class": "xsd:string",
462+
"@type": "Optional"
463+
}
464+
/*"examples": {
465+
"@class": "xsd:string",
466+
"@dimensions": 1,
467+
"@type": "Array"
468+
},
469+
"extendedSummary": "xsd:string",
470+
"index": {
471+
"@class": "xsd:integer",
472+
"@type": "Optional"
473+
},
474+
"notes": "xsd:string",
475+
"raises": {
476+
"@class": "Exception",
477+
"@type": "Set"
478+
},
479+
"references": "xsd:string",
480+
"section": {
481+
"@class": "xsd:string",
482+
"@type": "Optional"
483+
},
484+
"seeAlso": {
485+
"@class": "Definition",
486+
"@type": "Set"
487+
},
488+
"signature": "xsd:string",
489+
}*/
490+
},
491+
"Documented": {
492+
"@abstract": [],
493+
"@inherits": [
494+
"Named",
495+
"Summarized"
496+
],
497+
"@type": "Class",
498+
"name": "xsd:string",
499+
"summary": {
500+
"@class": "xsd:string",
501+
"@type": "Optional"
502+
}
503+
},
504+
"Exception": {
505+
"@inherits": [
506+
"Documented",
507+
"Named",
508+
"Summarized"
509+
],
510+
"@type": "Class",
511+
"name": "xsd:string",
512+
"paramters": {
513+
"@class": "xsd:string",
514+
"@dimensions": 1,
515+
"@type": "Array"
516+
},
517+
"summary": {
518+
"@class": "xsd:string",
519+
"@type": "Optional"
520+
}
521+
},
522+
"Language": {
523+
"@type": "Enum",
524+
"@values": [
525+
"Python",
526+
"Javascript"
527+
]
528+
},
529+
"Module": {
530+
"@inherits": [
531+
"Documented",
532+
"Named",
533+
"Summarized"
534+
],
535+
"@type": "Class",
536+
"classes": {
537+
"@class": "Class",
538+
"@type": "Set"
539+
},
540+
"definitions": {
541+
"@class": "Definition",
542+
"@type": "Set"
543+
},
544+
"name": "xsd:string",
545+
"summary": {
546+
"@class": "xsd:string",
547+
"@type": "Optional"
548+
}
549+
},
550+
"Named": {
551+
"@abstract": [],
552+
"@type": "Class",
553+
"name": "xsd:string"
554+
},
555+
"Parameter": {
556+
"@inherits": [
557+
"Documented",
558+
"Named",
559+
"Summarized"
560+
],
561+
"@type": "Class",
562+
"default": "xsd:string",
563+
"name": "xsd:string",
564+
"summary": {
565+
"@class": "xsd:string",
566+
"@type": "Optional"
567+
},
568+
"type": "xsd:string"
569+
},
570+
"Returns": {
571+
"@type": "Class",
572+
"name": {
573+
"@class": "xsd:string",
574+
"@type": "Optional"
575+
},
576+
"type": "xsd:string"
577+
},
578+
"Summarized": {
579+
"@abstract": [],
580+
"@type": "Class",
581+
"summary": {
582+
"@class": "xsd:string",
583+
"@type": "Optional"
584+
}
585+
}
586+
}
363587

364588
return <div className="w-100">
365589
<DiffViewer
366-
oldValue={oldData["Person"]}
367-
newValue={changedData["Person"]}
368-
frame={testFrames}
369-
type={"Person"}
590+
oldValue={oldData["Definition"]}
591+
newValue={changedData["Definition"]}
592+
frame={CODE_FRAMES}
593+
type={"Definition"}
370594
onTraverse={handleTraverse}
371595
diffPatch={diff}/>
372596
</div>

packages/tdb-documents-ui/diff/src/diff.constants.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** Review DependencyRelation - boolean field | Geometry */
22
export const oldData = {
3+
"Test": {new: ["X", "Y", "Z", "A", "B"]},
34
"Sys": {
45
"rdfProperty": {
56
"@lang":"ka",
@@ -168,12 +169,24 @@ export const oldData = {
168169
}
169170
}
170171
},
172+
},
173+
"Definition": {
174+
"@id": "Definition/031b8d459e60df9ea656b686ec656928177d788d595051312f872fb8bd9b1df5",
175+
"@type": "Definition",
176+
"name": "ok",
177+
"parameters": [
178+
"P/13",
179+
"P/23",
180+
"P/3"
181+
],
182+
"returns": "Returns/NEW6091821362531aed8af24944c8dffe5a9ceeea1e572e2fb27c84029a49b6e732",
183+
"summary": "NEW Check whether the TerminusDB server is still OK.\n Status is not OK when this function returns false\n or throws an exception (mostly ConnectTimeout)"
171184
}
172185
}
173186

174187

175188
export const changedData = {
176-
189+
"Test": {new: ["X", "Y", "Z"]},
177190
"Sys": {
178191
"rdfProperty": {
179192
"@lang":"ka",
@@ -328,6 +341,17 @@ export const changedData = {
328341
/*}
329342
}
330343
},*/
344+
},
345+
"Definition": {
346+
"@id": "Definition/031b8d459e60df9ea656b686ec656928177d788d595051312f872fb8bd9b1df5",
347+
"@type": "Definition",
348+
"name": "ok",
349+
"parameters": [
350+
"P/1",
351+
"P/2"
352+
],
353+
"returns": "Returns/6091821362531aed8af24944c8dffe5a9ceeea1e572e2fb27c84029a49b6e732",
354+
"summary": "Check whether the TerminusDB server is still OK.\n Status is not OK when this function returns false\n or throws an exception (mostly ConnectTimeout)"
331355
}
332356
}
333357

packages/tdb-documents-ui/src/arrayHelpers/nestedArrayTemplates.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import * as util from "../utils"
1010
import { TDBLabel } from "../components/LabelComponent"
1111
import { getDisplay } from "../helpers/fieldDisplay"
1212
import { getPlaceholder } from "../helpers/placeholderHelper"
13-
import { GetFieldDisplay } from "./templates"
14-
13+
import { GetFieldDisplay, DisplayExtraElements } from "./templates"
1514

1615

1716

@@ -100,7 +99,7 @@ export const ArrayFieldTemplate = ({ args, props, property, items, handleAdd, ha
10099
</Button>}
101100
</Stack>
102101
})}
103-
102+
{mode === CONST.VIEW && <DisplayExtraElements args={args} property={props.title} props={props}/>}
104103
{props.canAdd && (
105104
<div>
106105
<Button data-cy={`add_${label}`}

packages/tdb-documents-ui/src/arrayHelpers/templates.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ export const GetFieldDisplay = ({ args, props, element, id, property, setUpdate,
4949
return <span>
5050
{fieldDisplay()}
5151
</span>
52-
}
52+
}
5353

54-
const DisplayExtraElements = ({ args, props, property }) => {
54+
export const DisplayExtraElements = ({ args, props, property }) => {
5555
if(args.uiFrame && args.uiFrame.hasOwnProperty(property)) {
5656
// no extra elements available from DiffViewer at this point
5757
if(props.items.length === args.uiFrame[property].length) return <React.Fragment/>

0 commit comments

Comments
 (0)