Skip to content

Commit 3729576

Browse files
committed
merge newDoc
2 parents 8289b31 + b892bcc commit 3729576

29 files changed

+28413
-2601
lines changed

package-lock.json

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

packages/tdb-dashboard/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"react": "^18.2.0",
7777
"react-anchor-link-smooth-scroll": "^1.0.12",
7878
"react-bootstrap": "^2.7.0",
79+
"react-bootstrap-pagination-control": "^1.0.5",
7980
"react-codemirror2": "^7.2.1",
8081
"react-collapsed": "^3.6.0",
8182
"react-collapsible-component": "^1.3.4",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const Alerts = ({message, type, onCancel, time}) => {
6565
<div className="d-flex justify-content-between">
6666
<div className="w-100">
6767
<FaExclamationTriangle className="me-1 mb-1" />
68-
<strong>Oops! Something went wrong.</strong>
68+
<strong>ERROR: </strong>
6969
<div className="text-wrap">{message}</div>
7070
</div>
7171
<AlertCloseButton className={"alert_btn_close alert_danger_text"} onClick={() => onClose("danger")}/>

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {BiMinusCircle} from "react-icons/bi"
1515
import {Loading} from "./Loading"
1616
import {useTDBDocuments} from "@terminusdb/terminusdb-documents-ui"
1717
import {WOQLClientObj} from '../init-woql-client'
18+
19+
import { PaginationControl } from 'react-bootstrap-pagination-control';
1820
/**
1921
*
2022
* @param {*} diff diff list
@@ -134,7 +136,7 @@ function DiffViewDocument ({documentID,diffObj, CRObject,propertyModifiedCount,f
134136
onTraverse(documentID, setClicked)
135137
}
136138

137-
return <Accordion className="accordion__button padding-0 diff__accordian" id={eventKey} onSelect={getDocumentStatesOnClick}>
139+
return <Accordion className="accordion__button padding-0 diff__accordian mb-3" id={eventKey} onSelect={getDocumentStatesOnClick}>
138140
<Accordion.Item eventKey={eventKey} className="border-0">
139141
<Accordion.Header className="w-100 bg-secondary rounded">
140142
<Stack direction="horizontal" gap={1} className="w-100">
@@ -197,23 +199,20 @@ export const DiffView = ({diffs, CRObject}) => {
197199
const [activePage, setActivePage]=useState(1)
198200
const [current, setCurrent]=useState(0)
199201

202+
const [page, setPage] = useState(1)
203+
200204
let elements=[], paginationItems=[]
201205

202-
let divide = diffs.length/DIFFS_PER_PAGE_LIMIT
206+
let divide = Math.ceil(diffs.length/DIFFS_PER_PAGE_LIMIT)
203207

204208
useEffect(() => {
205209
getDocumentFrames()
206210
},[])
207211
// function to handle on click of page
208212
function handlePagination(number) {
209-
if(number > activePage) {
210-
let newCurrent=current+DIFFS_PER_PAGE_LIMIT+1
211-
setCurrent(newCurrent)
212-
}
213-
else {
214-
let newCurrent=current-DIFFS_PER_PAGE_LIMIT-1
215-
setCurrent(newCurrent)
216-
}
213+
let position=DIFFS_PER_PAGE_LIMIT * (number-1)
214+
215+
setCurrent(position)
217216
setActivePage(number)
218217

219218
}
@@ -232,10 +231,10 @@ export const DiffView = ({diffs, CRObject}) => {
232231

233232

234233
// looping through diff lists
235-
for(let start=current; start<=(current + DIFFS_PER_PAGE_LIMIT); start++) {
234+
for(let start=current; start<(current + DIFFS_PER_PAGE_LIMIT); start++) {
236235

237236
if(start >= diffs.length) continue
238-
237+
239238
const propertyModifiedCount = getPropertyModifiedCount(diffs[start])
240239
const diffObj = diffs[start]
241240
const action = diffObj["@op"] || "Change"
@@ -260,9 +259,20 @@ export const DiffView = ({diffs, CRObject}) => {
260259
return <React.Fragment>
261260
{elements}
262261
<Row className="w-100">
263-
<Col/>
262+
<Col/>
264263
<Col>
265-
<Pagination className="justify-content-center ">{paginationItems}</Pagination>
264+
{/*<Pagination className="justify-content-center ">{paginationItems}</Pagination>*/}
265+
<PaginationControl
266+
page={page}
267+
between={3}
268+
total={diffs.length}
269+
limit={5}
270+
changePage={(page) => {
271+
setPage(page)
272+
handlePagination(page)
273+
}}
274+
ellipsis={1}
275+
/>
266276
</Col>
267277
<Col/>
268278
</Row>

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

Lines changed: 0 additions & 171 deletions
This file was deleted.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function makeArrayFrames(args, property, arrayType) {
100100
}
101101
return { layout, uiLayout }
102102
}
103-
if(mode === CONST.VIEW &&
103+
if(mode === CONST.VIEW &&
104104
documentFrame[property].hasOwnProperty(CONST.CLASS) &&
105105
documentFrame[property][CONST.CLASS] === CONST.FEATURE &&
106106
documentFrame.hasOwnProperty("type") &&
@@ -114,6 +114,7 @@ export function makeArrayFrames(args, property, arrayType) {
114114
}
115115
return { layout, uiLayout }
116116
}
117+
117118

118119
function showEachField(props) {
119120
return template.ArrayFieldTemplate(argsHolder, props, property)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const ArrayFieldTemplate = ({ args, props, property, items, handleAdd, ha
2626
*/
2727
const [update, setUpdate] = useState({})
2828
const [refresh, setRefresh] = useState(Date.now())
29-
29+
3030
//console.log("props", props)
3131

3232
let { extractedDocumentation, mode } = args
@@ -55,7 +55,7 @@ export const ArrayFieldTemplate = ({ args, props, property, items, handleAdd, ha
5555
{update && <GetFieldDisplay args={args}
5656
props={props}
5757
element={element}
58-
id={id}
58+
id={id}
5959
update={update}
6060
setUpdate={setUpdate}
6161
property={property}/>}

0 commit comments

Comments
 (0)