Skip to content

Commit

Permalink
Refactor filter handling and permissions in EmailLog and IncidentNote…
Browse files Browse the repository at this point in the history
…Templates components
  • Loading branch information
simlarsen committed Apr 10, 2024
1 parent e85f216 commit f6642d5
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 7 deletions.
50 changes: 45 additions & 5 deletions Dashboard/src/Pages/Settings/EmailLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Columns from 'CommonUI/src/Components/ModelTable/Columns';
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
import CustomSMTPElement from '../../Components/CustomSMTP/CustomSMTPView';
import ProjectSmtpConfig from 'Model/Models/ProjectSmtpConfig';
import Filter from 'CommonUI/src/Components/ModelTable/Filter';

const EmailLogs: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
Expand All @@ -28,6 +29,44 @@ const EmailLogs: FunctionComponent<PageComponentProps> = (
const [EmailText, setEmailText] = useState<string>('');
const [EmailModelTitle, setEmailModalTitle] = useState<string>('');

const filters: Array<Filter<EmailLog>> = [
{
field: {
_id: true,
},
title: 'Log ID',
type: FieldType.Text,
},
{
field: {
fromEmail: true,
},
title: 'From Email',
type: FieldType.Email,
},
{
field: {
toEmail: true,
},
title: 'To Email',
type: FieldType.Email,
},
{
field: {
createdAt: true,
},
title: 'Sent at',
type: FieldType.DateTime,
},
{
field: {
status: true,
},
title: 'Status',
type: FieldType.Text,
},
];

const modelTableColumns: Columns<EmailLog> = [
{
field: {
Expand All @@ -44,13 +83,13 @@ const EmailLogs: FunctionComponent<PageComponentProps> = (
/>
);
},
isFilterable: false,

},
{
field: {
fromEmail: true,
},
isFilterable: true,


title: 'From Email',
type: FieldType.Email,
Expand All @@ -60,7 +99,7 @@ const EmailLogs: FunctionComponent<PageComponentProps> = (
field: {
toEmail: true,
},
isFilterable: true,


title: 'To Email',
type: FieldType.Email,
Expand All @@ -71,7 +110,7 @@ const EmailLogs: FunctionComponent<PageComponentProps> = (
},
title: 'Sent at',
type: FieldType.DateTime,
isFilterable: true,

},
{
field: {
Expand All @@ -96,7 +135,7 @@ const EmailLogs: FunctionComponent<PageComponentProps> = (

return <></>;
},
isFilterable: true,

},
];

Expand Down Expand Up @@ -155,6 +194,7 @@ const EmailLogs: FunctionComponent<PageComponentProps> = (
},
},
]}
filters={filters}
isViewable={false}
cardProps={{
title: 'Email Logs',
Expand Down
21 changes: 19 additions & 2 deletions Dashboard/src/Pages/Settings/IncidentNoteTemplates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,39 @@ const IncidentNoteTemplates: FunctionComponent<PageComponentProps> = (
showRefreshButton={true}
showFilterButton={true}
viewPageRoute={RouteUtil.populateRouteParams(props.pageRoute)}
filters={[
{
field: {
templateName: true,
},
type: FieldType.Text,
title: 'Template Name',
},
{
field: {
templateDescription: true,
},
title: 'Template Description',
type: FieldType.Text,
},

]}
columns={[
{
field: {
templateName: true,
},
title: 'Name',
type: FieldType.Text,
isFilterable: true,

},
{
field: {
templateDescription: true,
},
title: 'Description',
type: FieldType.Text,
isFilterable: true,

},
]}
/>
Expand Down

0 comments on commit f6642d5

Please sign in to comment.