Skip to content

Commit 1a62a4c

Browse files
committed
merge changes
2 parents 5ad339e + 401886c commit 1a62a4c

16 files changed

+60
-52
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@ import React, {useRef, useState} from "react"
22
import {Alert, Modal, Button, Form} from "react-bootstrap"
33
import {ChangeRequest} from "../hooks/ChangeRequest"
44
import {useNavigate} from "react-router-dom"
5-
import {WOQLClientObj} from '../init-woql-client'
65

76
export const CreateChangeRequestModal = ({showModal, setShowModal , updateViewMode, type}) => {
8-
const {
9-
woqlClient
10-
} = WOQLClientObj()
117
const nameRef = useRef(null);
128
const messageRef = useRef(null);
13-
const {loading,errorMessage,setError,createChangeRequest} = ChangeRequest(woqlClient)
9+
const {loading,errorMessage,setError,createChangeRequest} = ChangeRequest()
1410
const navigate = useNavigate()
1511

1612
const closeModal = () => {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import OverlayTrigger from "react-bootstrap/OverlayTrigger"
2222
import Row from "react-bootstrap/Row"
2323
import {DocumentsGraphqlTable} from "./DocumentsGraphqlTable"
2424
import {WOQLClientObj} from '../init-woql-client'
25+
import {CreateChangeRequestModal} from "../components/CreateChangeRequestModal"
2526

2627
// button to view frames
2728
const ViewFramesButton = () => {
@@ -178,8 +179,6 @@ const ViewHeader = ({type, id, setView, setShowCRModal, setClickedDelete}) => {
178179
else setClickedDelete(Date.now())
179180
}
180181

181-
182-
183182
return <Stack direction="horizontal" gap={3} className="w-100">
184183
<div className="col-md-6">
185184
<strong className="text-success">

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ export const DocumentWoqlTable = () => {
9595

9696
// on click document table row
9797
function onRowClick (row) {
98-
const fullId = row["id"]
99-
navigate(`${UTILS.encodeURISegment(fullId)}`)
98+
let fullId = row.original['@id']
99+
100+
let fullIdEncode = btoa(fullId)
101+
navigate(fullIdEncode)
100102
}
101103

102104

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const ToggleActions = ({ message }) => {
2727
if(res){
2828
setCurrentCRObject(false)
2929
exitChangeRequestBranch()
30-
navigate(`/${organization}/${dataProduct}`)
30+
navigate(`/${organization}/${dataProduct}/change_requests?status=${status}`)
3131
}
3232
}
3333
if(action) doAction()

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import React, {useRef, useState} from "react"
22
import {Alert, Modal, Button, Form} from "react-bootstrap"
33
import {ChangeRequest} from "../hooks/ChangeRequest"
4-
import {WOQLClientObj} from '../init-woql-client'
54

65
export const SubmitChangeRequestModal = ({showModal, setShowModal , updateParent, updateChangeRequestID}) => {
76
const messageRef = useRef(null);
8-
const {woqlClient} = WOQLClientObj()
9-
const {loading,errorMessage,setError,updateChangeRequestStatus} = ChangeRequest(woqlClient)
7+
const {loading,errorMessage,setError,updateChangeRequestStatus} = ChangeRequest()
108

119
const closeModal = () => setShowModal(false)
1210

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,3 +329,13 @@ export function getCRConflictError (errorData) {
329329
</div>
330330
}
331331

332+
export function decodeUrl(id){
333+
let idDecode
334+
try{
335+
idDecode= atob(id)
336+
}catch(err){
337+
return undefined
338+
}
339+
return idDecode
340+
}
341+

packages/tdb-dashboard/src/hooks/BranchControl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import { ChangeRequest } from "./ChangeRequest"
99
// we have the branches list only in document explorer and in time travel
1010
export function BranchControl (updateTable) {
1111
const {woqlClient,
12-
ref,
12+
ref,
1313
setHead,
1414
branch,
1515
// branches,
1616
// branchNeedReload,
1717
setConsoleTime} = WOQLClientObj()
1818

19-
const {getChangeRequestList} = ChangeRequest(woqlClient)
19+
const {getChangeRequestList} = ChangeRequest()
2020
if(!woqlClient) return ""
2121
const dataProduct = woqlClient.db()
2222

packages/tdb-dashboard/src/hooks/ChangeRequest.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import React, {useState} from "react";
22
//import { ClientObj } from "../cms-init-client"
33
//import {errorMessageFormatter} from "../utils/errorMessage"
44

5-
// import {WOQLClientObj} from '../init-woql-client'
5+
import {WOQLClientObj} from '../init-woql-client'
66
import { formatErrorMessage } from './hookUtils'
7-
8-
export function ChangeRequest(woqlClient){
7+
8+
export function ChangeRequest(){
9+
const {woqlClient} = WOQLClientObj()
910
const [loading, setLoading] = useState(false)
1011
const [errorMessage, setError] = useState(false)
1112
const [changeRequestList, setChangeRequestList] = useState([])

packages/tdb-dashboard/src/hooks/DocumentHook.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { WOQLClientObj } from "../init-woql-client";
66

77
// to be review this
88
export function CheckStatusObj() {
9-
const {woqlClient:client, currentChangeRequest} = WOQLClientObj()
10-
const {getChangeRequestByID} = ChangeRequest(client)
9+
const {currentChangeRequest} = WOQLClientObj()
10+
const {getChangeRequestByID} = ChangeRequest()
1111

1212
async function checkStatus (){
1313
const CRObject = await getChangeRequestByID(currentChangeRequest)

packages/tdb-dashboard/src/hooks/hookUtils.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,18 @@ export function getBaseUrlFeedback(){
3838

3939
export function formatErrorMessage (err){
4040
let message = err.message
41-
if(err.data && err.data["api:message"]){
42-
if( err.data["api:message"] === "Incorrect authentication information"){
43-
return "Incorrect authentication information, wrong username or password"
44-
}
45-
message = err.data["api:message"]
46-
}else if (message.indexOf("Network Error")>-1){
41+
if (message.indexOf("Network Error")>-1){
4742
message = "Network Error"
48-
}
49-
else if (err.data && err.data["api:status"] && err.data["api:status"]==="api:conflict") {
50-
message = getCRConflictError(err.data["api:witnesses"])
43+
}else if(err.data && err.data["api:message"]){
44+
if( err.data["api:message"] === "Incorrect authentication information"){
45+
message = "Incorrect authentication information, wrong username or password"
46+
}else if (err.data["api:status"]==="api:conflict"){
47+
message = getCRConflictError(err.data["api:witnesses"])
48+
}else if (err.data["api:message"]=== "Schema check failure"){
49+
message = `${err.data["api:message"]} ${JSON.stringify(err.data["system:witnesses"], null, 2)}`
50+
}else{
51+
message = err.data["api:message"]
52+
}
5153
}
5254
return message
5355
}

0 commit comments

Comments
 (0)