Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changes related to Patroni logs and console warnings #498

Merged
merged 9 commits into from
Sep 29, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="SkiaSharp" Version="2.88.3" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.3" />
<PackageReference Include="MsgReader" Version="4.2.1" />
<PackageReference Include="MsgReader" Version="5.1.0" />
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="22.1.37" />
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="22.1.37" />
<PackageReference Include="Syncfusion.HtmlToPdfConverter.QtWebKit.Net.Core" Version="20.3.0.56" />
Expand Down
233 changes: 171 additions & 62 deletions MCS.FOI.S3FileConversion/MCS.FOI.MSGToPDF/MSGFileProcessor.cs

Large diffs are not rendered by default.

327 changes: 225 additions & 102 deletions api/reviewer_api/models/AnnotationSections.py

Large diffs are not rendered by default.

450 changes: 299 additions & 151 deletions api/reviewer_api/models/Annotations.py

Large diffs are not rendered by default.

49 changes: 29 additions & 20 deletions api/reviewer_api/models/RedactionLayers.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from .db import db, ma
from .db import db, ma
from .default_method_result import DefaultMethodResult
from datetime import datetime as datetime2
from sqlalchemy import or_, and_, text
import logging


class RedactionLayer(db.Model):
__tablename__ = 'RedactionLayers'
__tablename__ = "RedactionLayers"
# Defining the columns
redactionlayerid = db.Column(db.Integer, primary_key=True,autoincrement=True)
name = db.Column(db.String(255), unique=False, nullable=False)
description = db.Column(db.String(255), unique=False, nullable=False)
redactionlayerid = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(255), unique=False, nullable=False)
description = db.Column(db.String(255), unique=False, nullable=False)
sortorder = db.Column(db.String(100), unique=False, nullable=True)
isactive = db.Column(db.Boolean, unique=False, nullable=False)
createdby = db.Column(db.String(120), unique=False, nullable=True)
Expand All @@ -20,7 +21,7 @@ class RedactionLayer(db.Model):
@classmethod
def getall(cls, ministryrequestid):
try:
sql = '''select rl.*, case when sq.count is null then 0 else sq.count end as count
sql = """select rl.*, case when sq.count is null then 0 else sq.count end as count
from public."RedactionLayers" rl left join (
select redactionlayerid as rlid, count(redactionlayerid)
from public."Annotations" a
Expand All @@ -30,16 +31,19 @@ def getall(cls, ministryrequestid):
where foiministryrequestid = :ministryrequestid and a.isactive = true
and (dd.deleted is false or dd.deleted is null)
group by redactionlayerid
) sq on sq.rlid = rl.redactionlayerid
'''
rs = db.session.execute(text(sql), {'ministryrequestid': ministryrequestid})
return [{
'redactionlayerid': row['redactionlayerid'],
'name': row['name'],
'description': row['description'],
'sortorder': row['sortorder'],
'count': row['count'],
} for row in rs]
) as sq on sq.rlid = rl.redactionlayerid
"""
rs = db.session.execute(text(sql), {"ministryrequestid": ministryrequestid})
return [
{
"redactionlayerid": row["redactionlayerid"],
"name": row["name"],
"description": row["description"],
"sortorder": row["sortorder"],
"count": row["count"],
}
for row in rs
]
except Exception as ex:
logging.error(ex)
finally:
Expand All @@ -49,14 +53,19 @@ def getall(cls, ministryrequestid):
def getredlineredactionlayer(cls):
try:
pageflag_schema = RedactionLayerSchema(many=False)
query = db.session.query(RedactionLayer).filter_by(isactive=True, name ='Redline').order_by(RedactionLayer.sortorder.desc()).first()
query = (
db.session.query(RedactionLayer)
.filter_by(isactive=True, name="Redline")
.order_by(RedactionLayer.sortorder.desc())
.first()
)
return pageflag_schema.dump(query)
except Exception as ex:
logging.error(ex)
finally:
db.session.close()
db.session.close()


class RedactionLayerSchema(ma.Schema):
class Meta:
fields = ('redactionlayerid', 'name', 'description','sortorder')
fields = ("redactionlayerid", "name", "description", "sortorder")
4 changes: 2 additions & 2 deletions web/src/apiManager/services/docReviewerService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ export const fetchPDFTronLicense = (
if (res.data) {
callback(res.data);
} else {
throw new Error("Error while triggering download final package");
throw new Error("Error in fetching PDFTronLicense");
}
})
.catch((error:any) => {
errorCallback("Error in triggering download final package:",error);
errorCallback("Error in fetching PDFTronLicense:",error);
});
return response;
};
2 changes: 1 addition & 1 deletion web/src/components/FOI/Home/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ContextMenu = ({

const popoverEnter = (e: any) => {
setOrgListAnchorPosition(
e.currentTarget.getBoundingClientRect()
e?.currentTarget?.getBoundingClientRect()
);
setOpenConsultPopup(true)
};
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/FOI/Home/DocumentSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ const DocumentSelector = ({
}
setOpenContextPopup(true);
setAnchorPosition(
e.currentTarget.getBoundingClientRect()
e?.currentTarget?.getBoundingClientRect()
);
setDisableHover(true);
}
Expand Down
57 changes: 33 additions & 24 deletions web/src/components/FOI/Home/Redlining.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,11 @@ const Redlining = React.forwardRef(
let displayedDoc =
pageMappedDocs.stitchedPageLookup[annot.getPageNumber()];
let individualPageNo = displayedDoc.page;
annot.setCustomData(
"originalPageNo",
JSON.stringify(individualPageNo - 1)
);
annot.setCustomData("originalPageNo", `${individualPageNo - 1}`);
});
let _annotationtring =
docInstance.Core.annotationManager.exportAnnotations({
annotList: annotations,
annotationList: annotations,
useDisplayAuthor: true,
});
_annotationtring.then(async (astr) => {
Expand Down Expand Up @@ -707,11 +704,11 @@ const Redlining = React.forwardRef(
if (!!parentRedaction) {
annotations[i].setCustomData(
"existingId",
parentRedaction?.Id
`${parentRedaction?.Id}`
);
annotations[i].setCustomData(
"existingFreeTextId",
_selectedAnnotations?.Id
`${_selectedAnnotations?.Id}`
);
}
} else {
Expand All @@ -722,22 +719,25 @@ const Redlining = React.forwardRef(
});
}
annotations[i].NoMove = true;
annotations[i].setCustomData("docid", displayedDoc.docid);
annotations[i].setCustomData(
"docid",
`${displayedDoc.docid}`
);
annotations[i].setCustomData(
"docversion",
displayedDoc.docversion
`${displayedDoc.docversion}`
);
annotations[i].setCustomData(
"redactionlayerid",
currentLayer.redactionlayerid
`${currentLayer.redactionlayerid}`
);
annotations[i].IsHoverable = false;
});
setPageSelections(pageSelectionList);
let annot = annots[0].children[0];
let astr =
await docInstance.Core.annotationManager.exportAnnotations({
annotList: annotations,
annotationList: annotations,
useDisplayAuthor: true,
});
setNewRedaction({
Expand All @@ -750,18 +750,21 @@ const Redlining = React.forwardRef(
for (let annot of annotations) {
displayedDoc =
pageMappedDocs.stitchedPageLookup[Number(annot.PageNumber)];
annot.setCustomData("docid", displayedDoc.docid);
annot.setCustomData("docversion", displayedDoc.docversion);
annot.setCustomData("docid", `${displayedDoc.docid}`);
annot.setCustomData(
"docversion",
`${displayedDoc.docversion}`
);
annot.setCustomData(
"redactionlayerid",
currentLayer.redactionlayerid
`${currentLayer.redactionlayerid}`
);
annot.NoMove = true;
}

let astr =
await docInstance.Core.annotationManager.exportAnnotations({
annotList: annotations,
annotationList: annotations,
useDisplayAuthor: true,
});

Expand Down Expand Up @@ -1160,8 +1163,11 @@ const Redlining = React.forwardRef(
"sections",
JSON.stringify(getSections(sections, redactionSectionsIds))
);
childAnnotation.setCustomData("docid", displayedDoc.docid);
childAnnotation.setCustomData("docversion", displayedDoc.docversion);
childAnnotation.setCustomData("docid", `${displayedDoc.docid}`);
childAnnotation.setCustomData(
"docversion",
`${displayedDoc.docversion}`
);
}
const doc = docViewer.getDocument();
let pageNumber = parseInt(node.attributes.page) + 1;
Expand Down Expand Up @@ -1254,10 +1260,10 @@ const Redlining = React.forwardRef(
"sections",
JSON.stringify(getSections(sections, redactionSectionsIds))
);
childAnnotation.setCustomData("docid", displayedDoc.docid);
childAnnotation.setCustomData("docid", `${displayedDoc.docid}`);
childAnnotation.setCustomData(
"docversion",
displayedDoc.docversion
`${displayedDoc.docversion}`
);
}
const doc = docViewer.getDocument();
Expand Down Expand Up @@ -1346,7 +1352,7 @@ const Redlining = React.forwardRef(
);
annot.setAutoSizeType("auto");
annot.setContents(redactionSections);
annot.setCustomData("parentRedaction", redaction.Id);
annot.setCustomData("parentRedaction", `${redaction.Id}`);
annot.setCustomData(
"sections",
JSON.stringify(getSections(sections, redactionSectionsIds))
Expand All @@ -1368,7 +1374,10 @@ const Redlining = React.forwardRef(
"text/html"
);
let customData = JSON.parse(txt.documentElement.textContent);
annot.setCustomData("existingId", customData.existingFreeTextId);
annot.setCustomData(
"existingId",
`${customData.existingFreeTextId}`
);
//Setting the existing annotationId in the new annotations for deleting
//from backend.
let existingFreeTextAnnot = annotManager.getAnnotationById(
Expand All @@ -1378,8 +1387,8 @@ const Redlining = React.forwardRef(
customData.existingId
);
if (!!existingFreeTextAnnot && !!existingRedactAnnot) {
existingFreeTextAnnot.setCustomData("isDelete", true);
existingRedactAnnot.setCustomData("isDelete", true);
existingFreeTextAnnot.setCustomData("isDelete", `${true}`);
existingRedactAnnot.setCustomData("isDelete", `${true}`);
annotationsToDelete.push(existingFreeTextAnnot);
annotationsToDelete.push(existingRedactAnnot);
}
Expand Down Expand Up @@ -1426,7 +1435,7 @@ const Redlining = React.forwardRef(
annotationList.push(annotManager.getAnnotationById(name));
}
astr = await annotManager.exportAnnotations({
annotList: annotationList,
annotationList: annotationList,
useDisplayAuthor: true,
});
saveAnnotation(
Expand Down