Skip to content

Commit

Permalink
Fix: #83 Show error message for update dda status & Headertext of mod…
Browse files Browse the repository at this point in the history
…al should not show to next line if its overflowing instead show ...
  • Loading branch information
MARZOOQUE authored and georgepadayatti committed Apr 6, 2024
1 parent 2fb66e7 commit 725293d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/container/DDAgreements/ViewDDAgreementModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export default function ViewDataAgreementModal(props: Props) {
<Box className="dd-modal-container">
<form>
<Box className="dd-modal-header">
<Box pl={2}>
<Typography color="#F3F3F6">
<Box pl={2} style={{ width: "90%" }}>
<Typography className="dd-modal-header-text ">
View Data Disclosure Agreement: {selectedData?.purpose}
</Typography>
{mode !== "Create" && (
Expand Down
9 changes: 1 addition & 8 deletions src/container/DDAgreements/dataPolicyCardModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,7 @@ export default function DataAgreementPolicyCardModal(props: Props) {
name: "Agreement Period",
value:selectedData.agreementPeriod,
},
{
name: "Blink",
value: "",
},
{
name: "did:mydata",
value: "",
},

];

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const StyledTableCell = styled(TableCell)({
fontWeight: "lighter !important",
fontSize: "14px !important",
border: "1px solid #D7D6D6",
textTransform: "capitalize",
});

const StyledTableRow = styled(TableRow)({
Expand All @@ -46,6 +45,20 @@ const DDAtable = ({
}) => {
const { t } = useTranslation("translation");

const getStatus = (status) => {
if (status === "unlisted") {
return "Unlisted";
} else if (status === "awaitingForApproval") {
return "In Review";
} else if (status === "approved") {
return "Approved";
} else if (status === "rejected") {
return "Rejected";
} else if (status === "listed") {
return "Listed";
}
};

return (
<RootTableContainer>
<Table aria-label="simple table">
Expand All @@ -61,12 +74,12 @@ const DDAtable = ({
<TableBody>
{tabledata?.dataDisclosureAgreements?.length > 0 ? (
tabledata.dataDisclosureAgreements.map((row, index) => (
<StyledTableRow key={index}>
<StyledTableRow key={row.templateId}>
<StyledTableCell>{row.purpose}</StyledTableCell>
<StyledTableCell>
<VersionDropdown record={row} />
</StyledTableCell>
<StyledTableCell>{row.status}</StyledTableCell>
<StyledTableCell>{getStatus(row.status)}</StyledTableCell>
<StyledTableCell>{row.lawfulBasis}</StyledTableCell>
<StyledTableCell
style={{
Expand Down
6 changes: 3 additions & 3 deletions src/container/DDAgreements/generalModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export default function GeneralModal(props: Props) {
<Drawer anchor="right" open={open}>
<Box className="dd-modal-container">
<Box className="dd-modal-header">
<Box pl={2}>
<Typography color="#F3F3F6">
<Box pl={2} style={{ width: "90%" }}>
<Typography className="dd-modal-header-text ">
{headerText}: {selectedData?.purpose}
</Typography>
<Typography color="#F3F3F6">
Expand Down Expand Up @@ -93,7 +93,7 @@ export default function GeneralModal(props: Props) {
value={confirmationTextInput}
onChange={handleCancelConfirmationText}
size="small"
sx={{marginTop:"5px"}}
sx={{ marginTop: "5px" }}
/>
</Box>
</Box>
Expand Down
38 changes: 28 additions & 10 deletions src/container/DDAgreements/listDDAModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import CloseIcon from "@mui/icons-material/Close";
import { useTranslation } from "react-i18next";
import { HttpService } from "../../service/HttpService";
import SnackbarComponent from "../../component/notification";

interface Props {
open: boolean;
Expand All @@ -37,8 +38,10 @@ export default function ListDDAModal(props: Props) {
confirmButtonText,
} = props;
const [isOk, setIsOk] = useState(false);
const [status, setStatus] = useState("");
const [status, setStatus] = useState("");
const { t } = useTranslation("translation");
const [openSnackBar, setOpenSnackBar] = useState(false);
const [error, setError] = useState("");

useEffect(() => {
if (selectedData && selectedData.status) {
Expand All @@ -59,14 +62,18 @@ export default function ListDDAModal(props: Props) {
status: status,
};

HttpService.updateDDAStatus(selectedData?.templateId, payload).then(
() => {
HttpService.updateDDAStatus(selectedData?.templateId, payload)
.then(() => {
setOpen(false);
setIsOk(false);
setStatus("");
setRefetchTable(!refetchTable);
}
);
})
.catch((error) => {
console.log("error", error.response.data.error);
setError(error.response.data.error);
setOpenSnackBar(true);
});
}
};

Expand All @@ -75,8 +82,14 @@ export default function ListDDAModal(props: Props) {
<Drawer anchor="right" open={open}>
<Box className="dd-modal-container">
<Box className="dd-modal-header">
<Box pl={2}>
<Typography color="#F3F3F6">
<SnackbarComponent
open={openSnackBar}
setOpen={setOpenSnackBar}
message={error}
topStyle={100}
/>
<Box pl={2} style={{ width: "90%" }}>
<Typography className="dd-modal-header-text ">
{headerText}: {selectedData?.purpose}
</Typography>
<Typography color="#F3F3F6">
Expand Down Expand Up @@ -112,12 +125,17 @@ export default function ListDDAModal(props: Props) {
variant="outlined"
sx={{ marginTop: "5px" }}
size="small"
defaultValue=""
>
<MenuItem value="unlisted">Unlisted</MenuItem>
<MenuItem value="awaitingForApproval">
Awaiting for Approval
</MenuItem>
<MenuItem value="awaitingForApproval">In Review</MenuItem>
<MenuItem value="listed">Listed</MenuItem>
<MenuItem value="approved" disabled>
Approved
</MenuItem>
<MenuItem value="rejected" disabled>
Rejected
</MenuItem>
</Select>
</Box>
</Box>
Expand Down
7 changes: 7 additions & 0 deletions src/container/DDAgreements/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,10 @@
border-radius: 0 !important;
border: 1px solid #EAEAEA !important;
}

.dd-modal-header-text {
color: #F3F3F6;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
}

0 comments on commit 725293d

Please sign in to comment.