Skip to content

Commit a162ee5

Browse files
committed
beautifying message
1 parent 326d5ef commit a162ee5

File tree

5 files changed

+71
-16
lines changed

5 files changed

+71
-16
lines changed

packages/tdb-dashboard/src/App.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,3 +1201,28 @@ pre.CodeMirror-line > span > span.cm-string {
12011201
/* line-height: 1.5 !important; */
12021202
min-height: 49px!important;
12031203
}
1204+
1205+
/** custom alert error message */
1206+
.alert_danger_text {
1207+
color: #842029 !important;
1208+
}
1209+
1210+
.alert_danger {
1211+
background-color: #f8d7da !important;
1212+
border: 1px solid #f5c2c7 !important;
1213+
}
1214+
1215+
.alert_more_info_border {
1216+
border: 1px solid #842029 !important;
1217+
}
1218+
1219+
.alert_btn_close {
1220+
color: #842029 !important;
1221+
box-sizing: content-box;
1222+
width: 1em;
1223+
height: 1em;
1224+
padding: 0.25em 0.25em;
1225+
border: 0;
1226+
border-radius: 0.375rem;
1227+
opacity: 0.4;
1228+
}

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

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@ import {AiOutlineCheckCircle, AiOutlineWarning} from "react-icons/ai"
66
import {BiErrorCircle} from "react-icons/bi"
77
import {BsInfoCircle} from "react-icons/bs"
88
import {queryTimeDisplay} from "./utils"
9+
import { FaTimes, FaExclamationTriangle } from "react-icons/fa"
10+
11+
12+
/**
13+
*
14+
* @param {*} type document Type
15+
* @returns a close button icon
16+
*/
17+
const AlertCloseButton = ({ className, onClick }) => {
18+
// on close button display document list table
19+
return <Button variant="light"
20+
className={`${className} d-contents`}
21+
style={{display: "contents"}}
22+
tilte={`Close`}
23+
onClick={onClick}>
24+
<FaTimes/>
25+
</Button>
26+
}
927

1028
export const Alerts = ({message, type, onCancel, time}) => {
1129
const [hiddenAlerts, setHiddenAlerts] = React.useState([])
@@ -38,17 +56,18 @@ export const Alerts = ({message, type, onCancel, time}) => {
3856

3957
if(type == TERMINUS_DANGER)
4058
return <Alert
41-
className="text-break"
42-
variant="danger"
59+
//className="text-break"
60+
//variant="danger"
61+
className="alert_danger alert_danger_text"
4362
show={shouldShowAlert("danger")}
4463
onClose={() => onClose("danger")}>
4564

4665
<div className="d-flex justify-content-between">
47-
<div>
48-
<BiErrorCircle className="me-1" />
49-
<strong>Error: </strong> {message}
50-
</div>
51-
<Button variant="close" size="xs" onClick={() => onClose("danger")} />
66+
<div className="w-100">
67+
<FaExclamationTriangle className="me-1 mb-1" />
68+
<strong>Oops! Something went wrong.</strong> {message}
69+
</div>
70+
<AlertCloseButton className={"alert_btn_close alert_danger_text"} onClick={() => onClose("danger")}/>
5271
</div>
5372
</Alert>
5473

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import {format, subSeconds} from "date-fns"
33
//import deAT from 'date-fns/locale/de-AT/index'
44
//import {XSD_DATA_TYPE_PREFIX, XDD_DATA_TYPE_PREFIX} from "./constants"
55
import {FiCopy} from "react-icons/fi"
6-
import React from "react"
6+
import React, {useState} from "react"
77
import {VscGitPullRequestDraft} from "react-icons/vsc"
88
import {VscGitPullRequest} from "react-icons/vsc"
99
import {VscCheck} from "react-icons/vsc"
1010
import {AiOutlineCheck} from "react-icons/ai"
11+
import Stack from 'react-bootstrap/Stack';
1112
import Badge from "react-bootstrap/Badge"
1213
import Button from "react-bootstrap/Button"
1314
import {
@@ -16,6 +17,7 @@ import {
1617
MERGED,
1718
SUBMITTED
1819
} from "./constants"
20+
import { ErrorDisplay } from "./ErrorDisplay"
1921

2022
export const isArray = (arr) => {
2123
if (!Array.isArray(arr) || !arr.length) {
@@ -321,12 +323,21 @@ export function sortAlphabetically (list, byID) {
321323
}
322324

323325
// function which displays CR Conflict errors
324-
export function getCRConflictError (errorData) {
325-
let message = "It looks like there are conflicts, fix these conflicts and then update or exit the Change Request"
326-
return <div>
327-
{message}
326+
export const getCRConflictError = (errorData) => {
327+
//const [showError, setShowError] = useState(false)
328+
let message = "It looks like there are conflicts, fix these conflicts and then update or exit the Change Request"
329+
330+
return <ErrorDisplay errorData={errorData} message={message}/>
331+
332+
/*let message = "It looks like there are conflicts, fix these conflicts and then update or exit the Change Request"
333+
return <div className="w-100">
334+
<Stack direction="horizontal" gap={3} className="w-100">
335+
<div>{message}</div>
336+
<Button className="ms-auto btn btn-sm alert_danger alert_danger_text">More Info</Button>
337+
</Stack>
338+
328339
<pre>{JSON.stringify(errorData, null, 2)}</pre>
329-
</div>
340+
</div>*/
330341
}
331342

332343
export function decodeUrl(id){

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ export function formatErrorMessage (err){
4343
}else if(err.data){
4444
if( err.data["api:message"] === "Incorrect authentication information"){
4545
message = "Incorrect authentication information, wrong username or password"
46-
}else if (err.data["api:status"]==="api:conflict"){
46+
}else if (err.data["api:status"]==="api:conflict") {
4747
message = getCRConflictError(err.data["api:witnesses"])
48-
}else if (err.data["api:message"]=== "Schema check failure"){
48+
}else if (err.data["api:message"]=== "Schema check failure") {
4949
message = `${err.data["api:message"]} ${JSON.stringify(err.data["system:witnesses"], null, 2)}`
5050
}else{
5151
message = err.data["api:message"]

packages/tdb-dashboard/src/pages/ChangeDiff.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const CRAction = ({}) => {
4343
return <ChangeDiffComponent/>
4444

4545
// if needRebase
46-
return <React.Fragment>
46+
return <React.Fragment>
4747
{errorMessage && <Alerts message={errorMessage} type={CONST.TERMINUS_DANGER} onCancel={setError}/>}
4848
<Card className="update__change__request__card">
4949
<Card.Header className="w-100">

0 commit comments

Comments
 (0)