diff --git a/packages/tdb-dashboard/src/components/constants.js b/packages/tdb-dashboard/src/components/constants.js
index 8f9833ee..705ca5f7 100644
--- a/packages/tdb-dashboard/src/components/constants.js
+++ b/packages/tdb-dashboard/src/components/constants.js
@@ -477,6 +477,7 @@ export const COMMENT="Comment"
export const APPROVE="Approve"
export const REJECT="Reject"
export const UPDATE_BRANCH="Update Change Request"
+export const NEED_REBASE="needRebase"
// review component constants
export const REVIEW_OPTIONS = [
diff --git a/packages/tdb-dashboard/src/components/utils.js b/packages/tdb-dashboard/src/components/utils.js
index bcd4ed1b..4504338f 100644
--- a/packages/tdb-dashboard/src/components/utils.js
+++ b/packages/tdb-dashboard/src/components/utils.js
@@ -320,3 +320,12 @@ export function sortAlphabetically (list, byID) {
})
}
+// function which displays CR Conflict errors
+export function getCRConflictError (errorData) {
+ let message = "It looks like there are conflicts, fix these conflicts and then update or exit the Change Request"
+ return
+ {message}
+
{JSON.stringify(errorData, null, 2)}
+
+}
+
diff --git a/packages/tdb-dashboard/src/hooks/hookUtils.js b/packages/tdb-dashboard/src/hooks/hookUtils.js
index a45a8a4f..570649e5 100644
--- a/packages/tdb-dashboard/src/hooks/hookUtils.js
+++ b/packages/tdb-dashboard/src/hooks/hookUtils.js
@@ -1,4 +1,5 @@
import { localSettings } from "../../localSettings";
+import { getCRConflictError } from "../components/utils"
export function getOptions(token){
const options = {
@@ -45,5 +46,8 @@ export function formatErrorMessage (err){
}else if (message.indexOf("Network Error")>-1){
message = "Network Error"
}
+ else if (err.data && err.data["api:status"] && err.data["api:status"]==="api:conflict") {
+ message = getCRConflictError(err.data["api:witnesses"])
+ }
return message
}
\ No newline at end of file
diff --git a/packages/tdb-dashboard/src/pages/ChangeDiff.js b/packages/tdb-dashboard/src/pages/ChangeDiff.js
index 65c1a8e3..458b01aa 100644
--- a/packages/tdb-dashboard/src/pages/ChangeDiff.js
+++ b/packages/tdb-dashboard/src/pages/ChangeDiff.js
@@ -21,6 +21,7 @@ import {Messages} from "../components/Messages"
import {ReviewComponent} from "../components/ReviewComponent"
import Spinner from 'react-bootstrap/Spinner';
import {extractID} from "../components/utils"
+import { Alerts } from "../components/Alerts"
const CRAction = ({}) => {
const {
@@ -31,10 +32,11 @@ const CRAction = ({}) => {
const {
rebaseChangeRequestBranch,
loading,
- error
+ errorMessage,
+ setError
} = ChangeRequest()
- const rebaseHandler = async ()=>{
+ const rebaseHandler = async ()=>{
const changeRequestDoc = await rebaseChangeRequestBranch(extractID(currentCRObject["@id"]))
if(changeRequestDoc && setCurrentCRObject){
setCurrentCRObject(changeRequestDoc)
@@ -42,7 +44,7 @@ const CRAction = ({}) => {
}
// loading while waiting for currentCRObject
- if(!currentCRObject) return
+ if(!currentCRObject.hasOwnProperty(CONST.NEED_REBASE)) return
//{currentCRObject.needRebase && currentCRObject.status !== "Merged" &&
@@ -50,36 +52,39 @@ const CRAction = ({}) => {
return
// if needRebase
- return
-
- {`You are in Change Request `}
-
-
-
-
-
-
This Change Request is out of date
-
-
-
Merge latest changes from
-
- into this Change Request
-
-
-
-
-
+ return
+ {errorMessage && }
+
+
+ {`You are in Change Request `}
+
+
+
+
+
+
This Change Request is out of date
+
+
+
Merge latest changes from
+
+ into this Change Request
+
+
+
+
+
+
}
@@ -113,8 +118,6 @@ export const ChangeDiff = () => {
if(!client) return
- console.log("currentCRObject", currentCRObject)
-
return