Skip to content

Commit

Permalink
Refactor field types in WorkflowStatus, Variable, IncidentState, Moni…
Browse files Browse the repository at this point in the history
…torStatus, IncidentSeverity, and ScheduledMaintenanceState components
  • Loading branch information
simlarsen committed Apr 11, 2024
1 parent fcfb3f7 commit c1150c0
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Common/Types/Workflow/WorkflowStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ enum WorkflowStatus {
Success = 'Success',
Error = 'Error',
Timeout = 'Timeout',
WorkflowCountExceeded = 'WorkflowCountExceeded',
WorkflowCountExceeded = 'Workflow Count Exceeded',
}

export default WorkflowStatus;
3 changes: 2 additions & 1 deletion CommonUI/src/Components/Filters/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ const FilterComponent: FunctionComponent<ComponentProps> = (
filter.type === FieldType.Phone ||
filter.type === FieldType.Name ||
filter.type === FieldType.Port ||
filter.type === FieldType.URL)
filter.type === FieldType.URL ||
filter.type === FieldType.ObjectID)
) {
filterData[
filter.key
Expand Down
15 changes: 1 addition & 14 deletions Dashboard/src/Pages/Settings/IncidentSeverity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,7 @@ const IncidentSeverityPage: FunctionComponent<PageComponentProps> = (
order: true,
}}
filters={[
{
field: {
name: true,
},
title: 'Name',
type: FieldType.Text,
},
{
field: {
description: true,
},
title: 'Description',
type: FieldType.Text,
},

]}
columns={[
{
Expand Down
15 changes: 1 addition & 14 deletions Dashboard/src/Pages/Settings/IncidentState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,7 @@ const IncidentsPage: FunctionComponent<PageComponentProps> = (
order: true,
}}
filters={[
{
field: {
name: true,
},
title: 'Name',
type: FieldType.Text,
},
{
field: {
description: true,
},
title: 'Description',
type: FieldType.Text,
},

]}
columns={[
{
Expand Down
15 changes: 1 addition & 14 deletions Dashboard/src/Pages/Settings/MonitorStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,7 @@ const Monitors: FunctionComponent<PageComponentProps> = (
priority: true,
}}
filters={[
{
field: {
name: true,
},
type: FieldType.Text,
title: 'Name',
},
{
field: {
description: true,
},
type: FieldType.Text,
title: 'Description',
},

]}
columns={[
{
Expand Down
15 changes: 1 addition & 14 deletions Dashboard/src/Pages/Settings/ScheduledMaintenanceState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,7 @@ const ScheduledMaintenancesPage: FunctionComponent<PageComponentProps> = (
order: true,
}}
filters={[
{
field: {
name: true,
},
title: 'Name',
type: FieldType.Text,
},
{
field: {
description: true,
},
title: 'Description',
type: FieldType.Text,
},

]}
columns={[
{
Expand Down
20 changes: 19 additions & 1 deletion Dashboard/src/Pages/Settings/TeamView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { Green, Yellow } from 'Common/Types/BrandColors';
import DashboardNavigation from '../../Utils/Navigation';
import BaseModel from 'Common/Models/BaseModel';
import { FormProps } from 'CommonUI/src/Components/Forms/BasicForm';
import ProjectUser from '../../Utils/ProjectUser';

const TeamView: FunctionComponent<PageComponentProps> = (
props: PageComponentProps
Expand Down Expand Up @@ -149,12 +150,29 @@ const TeamView: FunctionComponent<PageComponentProps> = (
deleteButtonText="Remove Member"
viewPageRoute={RouteUtil.populateRouteParams(props.pageRoute)}
filters={[
{
field: {
user:true,
},
type: FieldType.Entity,
title: 'User',
filterEntityType: User,
fetchFilterDropdownOptions: async () => {
return await ProjectUser.fetchProjectUsersAsDropdownOptions(
DashboardNavigation.getProjectId()!
);
},
filterDropdownField: {
label: 'name',
value: '_id',
},
},
{
field: {
hasAcceptedInvitation: true,
},
type: FieldType.Boolean,
title: 'Status',
title: 'Accepted Invite',
},
]}
columns={[
Expand Down
17 changes: 13 additions & 4 deletions Dashboard/src/Pages/Workflow/View/Logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Modal, { ModalWidth } from 'CommonUI/src/Components/Modal/Modal';
import BadDataException from 'Common/Types/Exception/BadDataException';
import WorkflowStatus from 'Common/Types/Workflow/WorkflowStatus';
import WorkflowStatusElement from 'CommonUI/src/Components/Workflow/WorkflowStatus';
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';

const Delete: FunctionComponent<PageComponentProps> = (
_props: PageComponentProps
Expand Down Expand Up @@ -73,33 +74,41 @@ const Delete: FunctionComponent<PageComponentProps> = (
showRefreshButton={true}
viewPageRoute={Navigation.getCurrentRoute()}
filters={[
{
field: {
_id: true,
},
title: 'Run ID',
type: FieldType.ObjectID,
},
{
field: {
workflowStatus: true,
},
title: 'Workflow Status',
type: FieldType.Text,
type: FieldType.Dropdown,
filterDropdownOptions: DropdownUtil.getDropdownOptionsFromEnum(WorkflowStatus)
},
{
field: {
createdAt: true,
},
title: 'Scheduled At',
type: FieldType.DateTime,
type: FieldType.Date,
},
{
field: {
startedAt: true,
},
title: 'Started At',
type: FieldType.DateTime,
type: FieldType.Date,
},
{
field: {
completedAt: true,
},
title: 'Completed At',
type: FieldType.DateTime,
type: FieldType.Date,
},
]}
columns={[
Expand Down
2 changes: 1 addition & 1 deletion Dashboard/src/Pages/Workflow/View/Variable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const Workflows: FunctionComponent<PageComponentProps> = (
},
{
title: 'Created At',
type: FieldType.DateTime,
type: FieldType.Date,
field: {
createdAt: true,
},
Expand Down

0 comments on commit c1150c0

Please sign in to comment.