Skip to content

Commit e64e158

Browse files
committed
2 parents 86563fe + ef01619 commit e64e158

File tree

16 files changed

+247
-197
lines changed

16 files changed

+247
-197
lines changed

.github/workflows/main_workflow.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Use Node.js ${{ matrix.node-version }}
1818
uses: actions/setup-node@v2
1919
with:
20-
node-version: 16
20+
node-version: 18
2121
- run: npm i
2222
- name: Build
2323
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'pull_request' }}
@@ -47,18 +47,18 @@ jobs:
4747
AUDIENCE="https://terminuscloud/users"
4848
' > .env
4949
npm run build-terminusx
50-
- name: Set up Cloud SDK
51-
uses: google-github-actions/setup-gcloud@v0
52-
with:
53-
project_id: ${{ secrets.GCLOUD_PROJECT }}
54-
service_account_key: ${{ secrets.GCLOUD_SERVICE_ACCOUNT_KEY }}
55-
export_default_credentials: true
56-
- name: Upload tdb-dashboard dev
50+
- name: Upload tdb-dashboard to dev s3
5751
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
58-
run: gsutil -h "Cache-Control:public, max-age=60" cp -r packages/tdb-dashboard/dist/* "gs://${{ secrets.GCLOUD_DEV_BUCKET }}/"
59-
- name: Upload tdb-dashboard prod
52+
env:
53+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
54+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
55+
run: aws s3 sync packages/tdb-dashboard/dist/ s3://${{ secrets.S3_DEV_BUCKET }} --region=${{ secrets.AWS_REGION }}
56+
- name: Upload tdb-dashboard to prod s3
6057
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v') }}
61-
run: gsutil -h "Cache-Control:public, max-age=60" cp -r packages/tdb-dashboard/dist/* "gs://${{ secrets.GCLOUD_BUCKET }}/"
58+
env:
59+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
60+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
61+
run: aws s3 sync packages/tdb-dashboard/dist/ s3://${{ secrets.S3_PROD_BUCKET }} --region=${{ secrets.AWS_REGION }}
6262
- name: Clean cloudflare cache
6363
if: ${{ github.event_name != 'pull_request' }}
6464
run: python3 .ci/clean_cloudflare_cache.py ${{ github.ref }}
@@ -76,7 +76,7 @@ jobs:
7676
- name: Use Node.js ${{ matrix.node-version }}
7777
uses: actions/setup-node@v2
7878
with:
79-
node-version: 16
79+
node-version: 18
8080
- run: npm i
8181
- name: Build local dashboard
8282
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/v') }}
@@ -108,7 +108,7 @@ jobs:
108108
- name: Use Node.js ${{ matrix.node-version }}
109109
uses: actions/setup-node@v2
110110
with:
111-
node-version: 16
111+
node-version: 18
112112
registry-url: 'https://registry.npmjs.org'
113113
- name: Build packages
114114
run: npm i && npm run build --ws

package-lock.json

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ const ViewHeader = ({type, id, setView, setShowCRModal, setClickedDelete}) => {
183183
<div className="col-md-6">
184184
<strong className="text-success">
185185
<span className="mr-1 h6 fst-italic">{CONST.VIEW_DOCUMENT}:</span>
186-
<span className="fw-bolder h6"> {type}/{id} </span>
186+
<span className="fw-bolder h6"> {id} </span>
187187
</strong>
188-
<CopyButton text={`${type}/${id}`} title={`Copy Document ID`}/>
188+
<CopyButton text={`${id}`} title={`Copy Document ID`}/>
189189
</div>
190190
<ViewFramesButton/>
191191
<ToggleJsonAndFormControl onClick={setView}/>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ export const NoDataProductSelected = (props) => {
2525
img: "https://ichef.bbci.co.uk/news/976/cpsprodpb/4F49/production/_125879202_legorussia.png",
2626
description: "This data product features Lego sets and their individual components and the relationships between them. It is an excellent example of organizations that have interconnected components and parts within their product offerings."
2727
},
28-
/*{
29-
name: "Star_Wars",
28+
{
29+
name: "star_wars",
3030
label: "Relationships Between People, Real Estate, & Equipment",
3131
img: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQHkosbW26brusDap1E3y2GV6pnIRsjg-9Rc1CdJRuMJjrJ1O6fJs_x2bjcGjBUCB_wkTE&usqp=CAU",
3232
description: "This data product features a Star Wars dataset and their individual components and how they are all connected and is a good example of the relationships between people and things."
33-
},*/
33+
},
3434
{
3535
name: "nuclear",
3636
label: "The Complex Energy Sector",

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,29 +125,44 @@ export const Output = () => {
125125
}
126126
}*/
127127

128-
let testFrames ={
128+
let testFrames = {
129129
"@context": {
130-
"@base": "terminusdb:///documentation/data/",
131-
"@schema": "terminusdb:///documentation/schema#",
130+
"@base": "terminusdb:///data/",
131+
"@schema": "terminusdb:///schema#",
132132
"@type": "Context"
133133
},
134-
"Body": {
134+
"body": {
135+
"@key": {
136+
"@type": "Random"
137+
},
135138
"@metadata": {
136139
"render_as": {
137-
"value": "markdown"
140+
"optMarkDown": "markdown",
141+
"setMarkDown": "markdown"
138142
}
139143
},
140144
"@type": "Class",
141-
"value": "xsd:string"
145+
"optMarkDown": {
146+
"@class": "xsd:string",
147+
"@type": "Optional"
148+
},
149+
"setMarkDown": {
150+
"@class": "xsd:string",
151+
"@type": "Set"
152+
},
153+
"text": {
154+
"@class": "xsd:string",
155+
"@type": "Set"
156+
}
142157
}
143-
144158
}
159+
145160
return <div className="w-100">
146161
<DiffViewer
147162
oldValue={doc[OLD_VALUE]}
148163
newValue={doc[CHANGED_VALUE]}
149164
frame={testFrames}
150-
type={"Body"}
165+
type={"body"}
151166
diffPatch={diff}/>
152167
</div>
153168
}

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

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,28 @@
11
/** Review DependencyRelation - boolean field | Geometry */
22
export const oldData = {
3-
/*"Body": {
4-
"@id": "Body/c4a7f457e606df038ba5f6b4089e1e4cc5ddc8f0d5ad6fed1bb2a49d43378252",
5-
"@type": "Body",
6-
"value": "---\n__Advertisement :)__\n\n- __[pica](https://nodeca.github.io/pica/demo/)__ - high quality and fast image\n resize in browser.\n- __[babelfish](https://github.com/nodeca/babelfish/)__ - developer friendly\n i18n with plurals support and easy syntax.\n\nYou will like those projects!\n\n---\n\n# h1 Heading 8-)\n## h2 Heading\n### h3 Heading\n#### h4 Heading\n##### h5 Heading\n###### h6 Heading\n\n\n## Horizontal Rules\n\n___\n\n---\n\n***\n\n\n## Typographic replacements\n\nEnable typographer option to see result.\n\n(c) (C) (r) (R) (tm) (TM) (p) (P) +-\n\ntest.. test... test..... test?..... test!....\n\n!!!!!! ???? ,, -- ---\n\n\"Smartypants, double quotes\" and 'single quotes'\n\n\n## Emphasis\n\n**This is bold text**\n\n__This is bold text__\n\n*This is italic text*\n\n_This is italic text_\n\n~~Strikethrough~~\n\n\n## Blockquotes\n\n\n> Blockquotes can also be nested...\n>> ...by using additional greater-than signs right next to each other...\n> > > ...or with spaces between arrows.\n\n\n## Lists\n\nUnordered\n\n+ Create a list b",
7-
},*/
8-
"job": {
9-
"@id": "job/16c3c5ff4003bb3d53d876504ac89703fffc378338154a5abffd012892aef332",
10-
"@type": "job",
11-
"company": "company",
12-
"title": "saddsa",
13-
"nonUnfoldable_property": "nonUnfoldable_property/239729wqdsad8921973",
14-
"section": {
15-
"@id": "category/215b036f11acf6b0be2e698ece217193ca9adf1eeadb8c7872f7690e93100730",
16-
"@type": "category",
17-
"name": "ddd",
18-
"notes": "crappy",
19-
"has_other": {
20-
"@id": "subCategory/215b036f11acf6b0be2e698ece217193ca9adf1eeadb8c7872f7690e93100730",
21-
"@type": "subCategory",
22-
"description": "elaborate descr",
23-
}
24-
}
3+
"body": {
4+
"@id": "body/6230f55d381076aa7f94b6b01a7a7ae1692ef40c44e233a52c1c280b5d339839",
5+
"@type": "body",
6+
"optMarkDown": "### opt",
7+
"setMarkDown": [
8+
"### set 1",
9+
"### set 2"
10+
],
11+
"text": ["text1", "text2", "text3", "2","text4org", "5", "5"]
2512
}
2613
}
2714

2815

2916
export const changedData = {
30-
"Body": {
31-
/*"@id": "Body/c4a7f457e606df038ba5f6b4089e1e4cc5ddc8f0d5ad6fed1bb2a49d43378252",*/
32-
"@type": "Body",
33-
"value": "---\n__Advertisement :)__\n\n- __[pica](https://nodeca.github.io/pica/demo/)__ - high quality and fast image\n resize in browser.\n- __[babelfish](https://github.com/nodeca/babelfish/)__ - developer friendly\n i18n with plurals support and easy syntax.\n\nYou will like those projects!\n\n---\n\n# h1 Heading 8-)\n## h2 Heading\n### h3 Heading\n#### h4 Heading\n##### h5 Heading\n###### h6 Heading\n\n\n## Horizontal Rules\n\n___\n\n---\n\n***\n\n\n## Typographic replacements\n\nEnable typographer option to see result.\n\n(c) (C) (r) (R) (tm) (TM) (p) (P) +-\n\ntest.. test... test..... test?..... test!....\n\n!!!!!! ???? ,, -- ---\n\n\"Smartypants, double quotes\" and 'single quotes'\n\n\n## Emphasis\n\n**This is bold text**\n\n__This is bold text__\n\n*This is italic text*\n\n_This is italic text_\n\n~~Strikethrough~~\n\n\n## Blockquotes\n\n\n> Blockquotes can also be nested...\n>> ...by using additional greater-than signs right next to each other...\n> > > ...or with spaces between arrows.\n\n\n## Lists\n\nUnordered\n\n+ Create a list b",
34-
},
35-
"job": {
36-
"@id": "job/16c3c5ff4003bb3d53d876504ac89703fffc378338154a5abffd012892aef332",
37-
"@type": "job",
38-
"company": "company",
39-
"title": "saddsa",
40-
"nonUnfoldable_property": "nonUnfoldable_property/239729wqdsad8921973",
41-
"section": {
42-
"@id": "category/215b036f11acf6b0be2e698ece217193ca9adf1eeadb8c7872f7690e93100730",
43-
"@type": "category",
44-
"name": "ddd",
45-
"notes": "crappy new data",
46-
"has_other": {
47-
"@id": "subCategory/215b036f11acf6b0be2e698ece217193ca9adf1eeadb8c7872f7690e93100730",
48-
"@type": "subCategory",
49-
"description": "elaborate descr",
50-
}
51-
}
17+
"body": {
18+
"@id": "body/6230f55d381076aa7f94b6b01a7a7ae1692ef40c44e233a52c1c280b5d339839",
19+
"@type": "body",
20+
"optMarkDown": "### opt changed",
21+
"setMarkDown": [
22+
"### set 1 changed",
23+
"### set 2"
24+
],
25+
"text": ["text1changed", "text2", "text3ch", "2", "text4", "5", "5"]
5226
}
5327
}
5428
/*

packages/tdb-documents-ui/src/css/terminusdb__styles.css

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,10 @@ div.leaflet-popup-content-wrapper > div.leaflet-popup-content {
542542

543543
/** REACT DIFF VIEWER FOR MARKDOWN **/
544544
/** hide changed diff from original react-diff-viewer */
545-
div.diff_react_viewer_original > table.css-1ri4lr5-diff-container > tbody > tr.css-1n7ec1i-line td:nth-last-child(-n+3) {
545+
/*div.diff_react_viewer_original > table.css-1ri4lr5-diff-container > tbody > tr.css-1n7ec1i-line td:nth-last-child(-n+3) {
546+
display: none !important;
547+
}*/
548+
div.diff_react_viewer_original table.css-1ri4lr5-diff-container tbody tr.css-1n7ec1i-line td.css-1pm82w3-diff-added {
546549
display: none !important;
547550
}
548551

@@ -563,7 +566,11 @@ div.diff_react_viewer_original > table.css-1ri4lr5-diff-container > tbody > tr.c
563566
}
564567

565568
/** hide original diff from changed react-diff-viewer */
566-
div.diff_react_viewer_changed > table.css-1ri4lr5-diff-container > tbody > tr.css-1n7ec1i-line td:nth-child(-n+3) {
569+
/*div.diff_react_viewer_changed > table.css-1ri4lr5-diff-container > tbody > tr.css-1n7ec1i-line td:nth-child(-n+3) {
570+
display: none !important;
571+
}*/
572+
573+
div.diff_react_viewer_changed table.css-1ri4lr5-diff-container tbody tr.css-1n7ec1i-line td.css-14exn69-diff-removed {
567574
display: none !important;
568575
}
569576

@@ -744,7 +751,8 @@ form.rjsf label.control-label:after { content: ""; }
744751

745752
/* hide anyof select from document links in edit and view mode */
746753
.tdb__edit__document__link .panel .form-group select.form-control,
747-
.tdb__view__document__link .panel .form-group select.form-control{
754+
.tdb__view__document__link .panel .form-group select.form-control,
755+
.tdb__view__document__link + .panel {
748756
display: none !important;
749757
}
750758

packages/tdb-documents-ui/src/diffs/arrayFieldDiffs.js

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,17 @@ function patchListOperation (diff, item, tagOriginalUI, tagChangedUI) {
105105
}
106106
else {
107107
// copy list swap operation
108-
diff[DIFFCONST.REST][DIFFCONST.REST].map(rest => {
109-
let {originalUI, changedUI} = swapOperation(rest)
110-
tagOriginalUI[item].push(originalUI)
111-
tagChangedUI[item].push(changedUI)
112-
})
108+
if(Array.isArray(diff[DIFFCONST.REST][DIFFCONST.REST])) {
109+
diff[DIFFCONST.REST][DIFFCONST.REST].map(rest => {
110+
let {originalUI, changedUI} = swapOperation(rest)
111+
tagOriginalUI[item].push(originalUI)
112+
tagChangedUI[item].push(changedUI)
113+
})
114+
}
115+
else {
116+
// at this point this will be patch operation - if not we will need a check here to see if @op is patch
117+
patchListOperation (diff[DIFFCONST.REST][DIFFCONST.REST], item, tagOriginalUI, tagChangedUI)
118+
}
113119

114120
}
115121
}
@@ -339,7 +345,7 @@ function getCss(props, item, tagUI) {
339345

340346

341347
// ALL ARRAY FIELDS
342-
export function getArrayFieldDiffs(diff, item, oldValue, newValue) {
348+
export function getArrayFieldDiffs(diff, item, oldValue, newValue, metaDataConfig) {
343349

344350
let originalUIFrame={}, changedUIFrame={}
345351

@@ -420,7 +426,15 @@ export function getArrayFieldDiffs(diff, item, oldValue, newValue) {
420426
// when @before is null - we will check form data here
421427
let css = getCss(props, item, tagOriginalUI)
422428
let data=getFormData(props.formData, css)
423-
return displayElements(data, item, props.schema, tagOriginalUI)
429+
/*if(metaDataConfig) {
430+
css= css === "tdb__diff__original" ? "diff_react_viewer_original mb-3" : ""
431+
return <DisplayArrayMarkdown data={data}
432+
item={item}
433+
newValue={newValue}
434+
oldValue={oldValue}
435+
css={css}/>
436+
}
437+
else */return displayElements(data, item, props.schema, tagOriginalUI, metaDataConfig)
424438
}
425439

426440
/**
@@ -433,7 +447,15 @@ export function getArrayFieldDiffs(diff, item, oldValue, newValue) {
433447
// when @after is null - we will check form data here
434448
let css = getCss(props, item, tagChangedUI)
435449
let data=getFormData(props.formData, css)
436-
return displayElements(data, item, props.schema, tagChangedUI)
450+
/*if(metaDataConfig) {
451+
css=css === "tdb__diff__changed" ? "diff_react_viewer_changed mb-3" : ""
452+
return <DisplayArrayMarkdown data={data}
453+
item={item}
454+
newValue={newValue}
455+
oldValue={oldValue}
456+
css={css}/>
457+
}
458+
else*/ return displayElements(data, item, props.schema, tagChangedUI, metaDataConfig)
437459
}
438460

439461
originalUIFrame[CONST.DIFF] = displayOriginal

packages/tdb-documents-ui/src/diffs/dataFieldDiffs.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as DIFFCONST from "./diff.constants"
2-
import {DIFF} from "../constants"
2+
import { DIFF, MARKDOWN } from "../constants"
33
import * as util from "./diffComponents"
4+
import { getMarkdownFieldDiffs } from "./markdownFieldDiffs"
45

56
/**
67
*
@@ -53,7 +54,15 @@ function getClassNamesForDiffs(diff) {
5354

5455

5556
// ALL SWAP VALUE OPERATIONS
56-
export function getDataFieldDiffs(diff) {
57+
export function getDataFieldDiffs(diff, metaDataConfig) {
58+
59+
if(metaDataConfig) {
60+
if(metaDataConfig.metaDataType === MARKDOWN) {
61+
// display as markdown
62+
let ui=getMarkdownFieldDiffs(metaDataConfig)
63+
return ui
64+
}
65+
}
5766

5867
if(!diff.hasOwnProperty(DIFFCONST.OPERATION)) {
5968
let originalUIFrame=[], changedUIFrame=[]
@@ -72,5 +81,5 @@ export function getDataFieldDiffs(diff) {
7281

7382
let {originalUIFrame, changedUIFrame}=getClassNamesForDiffs(diff)
7483

75-
return {originalUIFrame, changedUIFrame}
84+
return { originalUIFrame, changedUIFrame }
7685
}

0 commit comments

Comments
 (0)