Skip to content

Commit

Permalink
Merge branch 'dev-marshal' into dev-AA-4446-marshal
Browse files Browse the repository at this point in the history
  • Loading branch information
abin-aot committed Sep 29, 2023
2 parents aec7094 + 5381bbb commit c955dbf
Show file tree
Hide file tree
Showing 11 changed files with 952 additions and 556 deletions.
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
250 changes: 189 additions & 61 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
88 changes: 88 additions & 0 deletions web/src/components/FOI/Home/Edit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { ReactComponent as EditLogo } from "../../../assets/images/icon-pencil-line.svg";

const disableMultiSelectEdit = (_selectedAnnotations: any) => {
if (_selectedAnnotations && _selectedAnnotations.length > 0) {
return _selectedAnnotations.some(
(obj: any) =>
obj.Subject !== "Redact" && obj.getCustomData("sections") === ""
);
}
return true;
};

//START: Bulk Edit using Multi Select Option
const MultiSelectEdit = ({docInstance, editRedactions}: any) => {
let _selectedAnnotations =
docInstance?.Core?.annotationManager.getSelectedAnnotations();
const disableEdit = disableMultiSelectEdit(_selectedAnnotations);
const _selectedRedactions = _selectedAnnotations?.filter(
(obj: any) =>
obj.Subject !== "Redact" && obj.getCustomData("sections") !== ""
);
return (
<button
type="button"
className="Button ActionButton"
style={disableEdit ? { cursor: "default" } : {}}
onClick={() => {
editRedactions(
docInstance?.Core?.annotationManager,
docInstance?.Core?.annotationManager.exportAnnotations({
annotationList: _selectedRedactions,
useDisplayAuthor: true,
})
);
}}
disabled={disableEdit}
>
<div
className="Icon"
style={disableEdit ? { color: "#868e9587" } : {}}
>
<EditLogo />
</div>
</button>
);
};
//END: Bulk Edit using Multi Select Option


const Edit = ({instance, editAnnotation}: any) => {
let _selectedAnnotations = instance?.Core?.annotationManager.getSelectedAnnotations();
const disableEdit = _selectedAnnotations.some(
(obj: any) =>
obj.Subject !== "Redact" && obj.getCustomData("sections") === ""
);
const _selectedRedaction = _selectedAnnotations.filter(
(obj: any) => obj.Subject === "Redact"
);
return (
<button
type="button"
className="Button ActionButton"
style={disableEdit ? { cursor: "default" } : {}}
onClick={() => {
editAnnotation(
instance?.Core?.annotationManager,
instance?.Core?.annotationManager.exportAnnotations({
annotationList: _selectedRedaction,
useDisplayAuthor: true,
})
);
}}
disabled={disableEdit}
>
<div
className="Icon"
style={disableEdit ? { color: "#868e9587" } : {}}
>
<EditLogo />
</div>
</button>
);
};

export {
MultiSelectEdit,
Edit
};
Loading

0 comments on commit c955dbf

Please sign in to comment.