Skip to content

Commit bcd44db

Browse files
committed
reverting back diff patch fix & fixing some css for diffs
1 parent 7085a34 commit bcd44db

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {BsPlus} from "react-icons/bs"
1414
import {BiMinusCircle} from "react-icons/bi"
1515
import {Loading} from "./Loading"
1616
import {WOQLClientObj} from '../init-woql-client'
17+
import { getTypenameFromStoreObject } from "@apollo/client/cache/inmemory/helpers"
1718
/**
1819
*
1920
* @param {*} diff diff list
@@ -111,9 +112,10 @@ function DiffViewDocument ({documentID,diffObj, CRObject,propertyModifiedCount,f
111112
const { woqlClient } = WOQLClientObj()
112113

113114
const {getDocumentByBranches,
114-
error,
115-
originalValue,
116-
changedValue} = useDiff()
115+
error,
116+
originalValue,
117+
changedValue,
118+
setChangedValue} = useDiff()
117119

118120
const [clicked, setClicked]=useState(false)
119121

@@ -132,6 +134,17 @@ function DiffViewDocument ({documentID,diffObj, CRObject,propertyModifiedCount,f
132134
function handleTraverse (documentID) {
133135
onTraverse(documentID, setClicked)
134136
}
137+
138+
/*useEffect(() => {
139+
async function getChangedValue() {
140+
const clientCopy = woqlClient.copy()
141+
// apply patch on original value to get changed value
142+
// to get Sets in same order as that of original value
143+
let changedValueResult=await clientCopy.patch(originalValue, diffObj)
144+
if(setChangedValue) setChangedValue(changedValueResult)
145+
}
146+
if(diffObj && originalValue && woqlClient) getChangedValue()
147+
}, [diffObj, originalValue, woqlClient])*/
135148

136149
return <Accordion className="accordion__button padding-0 diff__accordian mb-3" id={eventKey} onSelect={getDocumentStatesOnClick}>
137150
<Accordion.Item eventKey={eventKey} className="border-0">
@@ -163,8 +176,8 @@ function DiffViewDocument ({documentID,diffObj, CRObject,propertyModifiedCount,f
163176
onHide={() => setClicked(false)}/>}
164177
{originalValue && changedValue &&
165178
<DiffViewer
166-
oldValue={originalValue}
167-
newValue={changedValue}
179+
oldValue={originalValue} //original
180+
newValue={changedValue} // changed
168181
oldValueHeader={<OriginHeader branch="main"/>}
169182
newValueHeader={<TrackingHeader branch={CRObject.name}/>}
170183
frame={frames}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ export function useDiff(){
4040
}
4141
originalValueResult = await clientCopy.getDocument({id: documentID})
4242
break
43+
/*default:
44+
if(CRObject.status === "Merged"){
45+
clientCopy.ref(CRObject.merge_commit_id)
46+
}else {
47+
clientCopy.checkout(CRObject.original_branch)
48+
}
49+
originalValueResult = await clientCopy.getDocument({id: documentID})*/
4350
default :
4451
clientCopy.checkout(CRObject.tracking_branch)
4552
changedValueResult = await clientCopy.getDocument({id: documentID})
@@ -115,6 +122,7 @@ export function useDiff(){
115122
getDocumentById,
116123
loading,
117124
error,
125+
setChangedValue,
118126
originalValue,
119127
changedValue}
120128
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ label.latlng-control-label {
154154

155155
/** diff classNames */
156156
.tdb__diff__original {
157-
color: var(--danger-color);
157+
color: var(--danger-color) !important;
158158
background-color: var(--danger-bg);
159159
border: 1px solid var(--danger-border-color);
160160
}
@@ -181,7 +181,7 @@ label.latlng-control-label {
181181
}
182182

183183
.tdb__diff__changed {
184-
color: var(--success-color);
184+
color: var(--success-color) !important;
185185
background-color: var(--success-bg);
186186
border: 1px solid var(--success-border-color);
187187
}

packages/tdb-documents-ui/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = {
4141
include: path.resolve(__dirname, "src"),
4242
exclude: /node_modules/,
4343
},
44-
{
44+
{
4545
test: /\.(css)$/,
4646
use: [
4747
MiniCssExtractPlugin.loader,

0 commit comments

Comments
 (0)