mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
fix lint.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
enum CustomFieldType {
|
||||
Text = 'Text',
|
||||
Text = 'Text',
|
||||
Number = 'Number',
|
||||
Boolean = 'Boolean'
|
||||
Boolean = 'Boolean',
|
||||
}
|
||||
|
||||
export default CustomFieldType;
|
||||
export default CustomFieldType;
|
||||
|
||||
@@ -46,46 +46,36 @@ enum Permission {
|
||||
CanInviteProjectTeamMembers = 'CanInviteProjectTeamMembers',
|
||||
CanEditProjectTeamPermissions = 'CanEditProjectTeamPermissions',
|
||||
|
||||
|
||||
CanCreateProjectProbe = 'CanCreateProjectProbe',
|
||||
CanDeleteProjectProbe = 'CanDeleteProjectProbe',
|
||||
CanEditProjectProbe = 'CanEditProjectProbe',
|
||||
CanReadProjectProbe = 'CanReadProjectProbe',
|
||||
|
||||
|
||||
|
||||
CanCreateMonitorCustomField = 'CanCreateMonitorCustomField',
|
||||
CanDeleteMonitorCustomField = 'CanDeleteMonitorCustomField',
|
||||
CanEditMonitorCustomField = 'CanEditMonitorCustomField',
|
||||
CanReadMonitorCustomField = 'CanReadMonitorCustomField',
|
||||
|
||||
|
||||
CanCreateScheduledMaintenanceCustomField = 'CanCreateScheduledMaintenanceCustomField',
|
||||
CanDeleteScheduledMaintenanceCustomField = 'CanDeleteScheduledMaintenanceCustomField',
|
||||
CanEditScheduledMaintenanceCustomField = 'CanEditScheduledMaintenanceCustomField',
|
||||
CanReadScheduledMaintenanceCustomField = 'CanReadScheduledMaintenanceCustomField',
|
||||
|
||||
|
||||
|
||||
CanCreateStatusPageCustomField = 'CanCreateStatusPageCustomField',
|
||||
CanDeleteStatusPageCustomField = 'CanDeleteStatusPageCustomField',
|
||||
CanEditStatusPageCustomField = 'CanEditStatusPageCustomField',
|
||||
CanReadStatusPageCustomField = 'CanReadStatusPageCustomField',
|
||||
|
||||
|
||||
|
||||
CanCreateIncidentCustomField = 'CanCreateIncidentCustomField',
|
||||
CanDeleteIncidentCustomField = 'CanDeleteIncidentCustomField',
|
||||
CanEditIncidentCustomField = 'CanEditIncidentCustomField',
|
||||
CanReadIncidentCustomField = 'CanReadIncidentCustomField',
|
||||
|
||||
|
||||
CanCreateProjectIncident = 'CanCreateProjectIncident',
|
||||
CanDeleteProjectIncident = 'CanDeleteProjectIncident',
|
||||
CanEditProjectIncident = 'CanEditProjectIncident',
|
||||
CanReadProjectIncident = 'CanReadProjectIncident',
|
||||
|
||||
|
||||
CanCreateStatusPageSubscriber = 'CanCreateStatusPageSubscriber',
|
||||
CanDeleteStatusPageSubscriber = 'CanDeleteStatusPageSubscriber',
|
||||
CanEditStatusPageSubscriber = 'CanEditStatusPageSubscriber',
|
||||
@@ -96,60 +86,50 @@ enum Permission {
|
||||
CanEditStatusPagePrivateUser = 'CanEditStatusPagePrivateUser',
|
||||
CanReadStatusPagePrivateUser = 'CanReadStatusPagePrivateUser',
|
||||
|
||||
|
||||
CanCreateProjectDomain = 'CanCreateProjectDomain',
|
||||
CanDeleteProjectDomain = 'CanDeleteProjectDomain',
|
||||
CanEditProjectDomain = 'CanEditProjectDomain',
|
||||
CanReadProjectDomain = 'CanReadProjectDomain',
|
||||
|
||||
|
||||
CanCreateStatusPageHeaderLink = 'CanCreateStatusPageHeaderLink',
|
||||
CanDeleteStatusPageHeaderLink = 'CanDeleteStatusPageHeaderLink',
|
||||
CanEditStatusPageHeaderLink = 'CanEditStatusPageHeaderLink',
|
||||
CanReadStatusPageHeaderLink = 'CanReadStatusPageHeaderLink',
|
||||
|
||||
|
||||
CanCreateStatusPageFooterLink = 'CanCreateStatusPageFooterLink',
|
||||
CanDeleteStatusPageFooterLink = 'CanDeleteStatusPageFooterLink',
|
||||
CanEditStatusPageFooterLink = 'CanEditStatusPageFooterLink',
|
||||
CanReadStatusPageFooterLink = 'CanReadStatusPageFooterLink',
|
||||
|
||||
|
||||
CanCreateStatusPageResource = 'CanCreateStatusPageResource',
|
||||
CanDeleteStatusPageResource = 'CanDeleteStatusPageResource',
|
||||
CanEditStatusPageResource = 'CanEditStatusPageResource',
|
||||
CanReadStatusPageResource = 'CanReadStatusPageResource',
|
||||
|
||||
|
||||
CanCreateWorkflow = 'CanCreateWorkflow',
|
||||
CanDeleteWorkflow = 'CanDeleteWorkflow',
|
||||
CanEditWorkflow = 'CanEditWorkflow',
|
||||
CanReadWorkflow = 'CanReadWorkflow',
|
||||
|
||||
|
||||
CanDeleteProject = 'CanDeleteProject',
|
||||
CanEditProject = 'CanEditProject',
|
||||
CanReadProject = 'CanReadProject',
|
||||
|
||||
|
||||
CanCreateWorkflowLog = 'CanCreateWorkflowLog',
|
||||
CanDeleteWorkflowLog = 'CanDeleteWorkflowLog',
|
||||
CanEditWorkflowLog = 'CanEditWorkflowLog',
|
||||
CanReadWorkflowLog = 'CanReadWorkflowLog',
|
||||
|
||||
|
||||
CanCreateWorkflowVariable = 'CanCreateWorkflowVariable',
|
||||
CanDeleteWorkflowVariable = 'CanDeleteWorkflowVariable',
|
||||
CanEditWorkflowVariable = 'CanEditWorkflowVariable',
|
||||
CanReadWorkflowVariable = 'CanReadWorkflowVariable',
|
||||
|
||||
|
||||
CanCreateStatusPageGroup = 'CanCreateStatusPageGroup',
|
||||
CanDeleteStatusPageGroup = 'CanDeleteStatusPageGroup',
|
||||
CanEditStatusPageGroup = 'CanEditStatusPageGroup',
|
||||
CanReadStatusPageGroup = 'CanReadStatusPageGroup',
|
||||
|
||||
|
||||
CanCreateStatusPageDomain = 'CanCreateStatusPageDomain',
|
||||
CanDeleteStatusPageDomain = 'CanDeleteStatusPageDomain',
|
||||
CanEditStatusPageDomain = 'CanEditStatusPageDomain',
|
||||
@@ -187,7 +167,6 @@ enum Permission {
|
||||
CanDeleteScheduledMaintenancePublicNote = 'CanDeleteScheduledMaintenancePublicNote',
|
||||
CanReadScheduledMaintenancePublicNote = 'CanReadScheduledMaintenancePublicNote',
|
||||
|
||||
|
||||
CanCreateProjectScheduledMaintenance = 'CanCreateProjectScheduledMaintenance',
|
||||
CanDeleteProjectScheduledMaintenance = 'CanDeleteProjectScheduledMaintenance',
|
||||
CanEditProjectScheduledMaintenance = 'CanEditProjectScheduledMaintenance',
|
||||
@@ -1444,7 +1423,6 @@ export class PermissionHelper {
|
||||
isAccessControlPermission: false,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
permission: Permission.CanCreateMonitorCustomField,
|
||||
title: 'Can Create Monitor Custom Field',
|
||||
@@ -1478,7 +1456,6 @@ export class PermissionHelper {
|
||||
isAccessControlPermission: false,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
permission: Permission.CanCreateIncidentCustomField,
|
||||
title: 'Can Create Incident Custom Field',
|
||||
@@ -1512,7 +1489,6 @@ export class PermissionHelper {
|
||||
isAccessControlPermission: false,
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
permission: Permission.CanCreateStatusPageCustomField,
|
||||
title: 'Can Create Status Page Custom Field',
|
||||
@@ -1546,8 +1522,6 @@ export class PermissionHelper {
|
||||
isAccessControlPermission: false,
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
permission: Permission.CanCreateScheduledMaintenanceCustomField,
|
||||
title: 'Can Create Scheduled Maintenance Custom Field',
|
||||
@@ -1581,12 +1555,6 @@ export class PermissionHelper {
|
||||
isAccessControlPermission: false,
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
permission: Permission.CanCreateProjectIncident,
|
||||
title: 'Can Create Incident',
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
|
||||
import React, { FunctionComponent, ReactElement, useEffect, useState } from 'react';
|
||||
import React, {
|
||||
FunctionComponent,
|
||||
ReactElement,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import BaseModel from 'Common/Models/BaseModel';
|
||||
import Card from '../Card/Card';
|
||||
import ModelAPI from '../../Utils/ModelAPI/ModelAPI';
|
||||
import ModelAPI, { ListResult } from '../../Utils/ModelAPI/ModelAPI';
|
||||
import { LIMIT_PER_PROJECT } from 'Common/Types/Database/LimitMax';
|
||||
import ComponentLoader from '../ComponentLoader/ComponentLoader';
|
||||
import ErrorMessage from '../ErrorMessage/ErrorMessage';
|
||||
@@ -18,8 +22,8 @@ export interface ComponentProps {
|
||||
title: string;
|
||||
description: string;
|
||||
modelId: ObjectID;
|
||||
modelType: { new(): BaseModel };
|
||||
customFieldType: { new(): BaseModel };
|
||||
modelType: { new (): BaseModel };
|
||||
customFieldType: { new (): BaseModel };
|
||||
projectId: ObjectID;
|
||||
name: string;
|
||||
}
|
||||
@@ -27,31 +31,41 @@ export interface ComponentProps {
|
||||
const CustomFieldsDetail: FunctionComponent<ComponentProps> = (
|
||||
props: ComponentProps
|
||||
): ReactElement => {
|
||||
|
||||
|
||||
const [schemaList, setSchemaList] = useState<Array<BaseModel>>([]);
|
||||
const [error, setError] = useState<string>('');
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
const [model, setModel] = useState<BaseModel | null>(null);
|
||||
const [showModelForm, setShowModelForm] = useState<boolean>(false);
|
||||
|
||||
const onLoad = async () => {
|
||||
|
||||
const onLoad: Function = async (): Promise<void> => {
|
||||
try {
|
||||
// load schema.
|
||||
// load schema.
|
||||
setIsLoading(true);
|
||||
|
||||
const schemaList = await ModelAPI.getList<BaseModel>(props.customFieldType, {
|
||||
projectId: props.projectId
|
||||
} as any, LIMIT_PER_PROJECT, 0, {
|
||||
name: true,
|
||||
type: true,
|
||||
description: true
|
||||
} as any, {}, {})
|
||||
const schemaList: ListResult<BaseModel> =
|
||||
await ModelAPI.getList<BaseModel>(
|
||||
props.customFieldType,
|
||||
{
|
||||
projectId: props.projectId,
|
||||
} as any,
|
||||
LIMIT_PER_PROJECT,
|
||||
0,
|
||||
{
|
||||
name: true,
|
||||
type: true,
|
||||
description: true,
|
||||
} as any,
|
||||
{},
|
||||
{}
|
||||
);
|
||||
|
||||
const item = await ModelAPI.getItem<BaseModel>(props.modelType, props.modelId, {
|
||||
customFields: true
|
||||
} as any)
|
||||
const item: BaseModel | null = await ModelAPI.getItem<BaseModel>(
|
||||
props.modelType,
|
||||
props.modelId,
|
||||
{
|
||||
customFields: true,
|
||||
} as any
|
||||
);
|
||||
|
||||
setSchemaList(schemaList.data);
|
||||
setModel(item);
|
||||
@@ -62,104 +76,112 @@ const CustomFieldsDetail: FunctionComponent<ComponentProps> = (
|
||||
try {
|
||||
setError(
|
||||
(err as HTTPErrorResponse).message ||
|
||||
'Server Error. Please try again'
|
||||
'Server Error. Please try again'
|
||||
);
|
||||
} catch (e) {
|
||||
setError('Server Error. Please try again');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const onSave = async (data: JSONObject) => {
|
||||
};
|
||||
|
||||
const onSave: Function = async (data: JSONObject): Promise<void> => {
|
||||
try {
|
||||
// load schema.
|
||||
// load schema.
|
||||
setIsLoading(true);
|
||||
setShowModelForm(false);
|
||||
|
||||
await ModelAPI.updateById(props.modelType, props.modelId, {
|
||||
customFields: data
|
||||
customFields: data,
|
||||
});
|
||||
|
||||
await onLoad();
|
||||
|
||||
} catch (err) {
|
||||
setIsLoading(false);
|
||||
try {
|
||||
setError(
|
||||
(err as HTTPErrorResponse).message ||
|
||||
'Server Error. Please try again'
|
||||
'Server Error. Please try again'
|
||||
);
|
||||
} catch (e) {
|
||||
setError('Server Error. Please try again');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
onLoad();
|
||||
onLoad().catch();
|
||||
}, []);
|
||||
|
||||
|
||||
return (<Card title={props.title} description={props.description}
|
||||
buttons={[
|
||||
{
|
||||
title: "Edit Fields",
|
||||
buttonStyle: ButtonStyleType.NORMAL,
|
||||
onClick: () => {
|
||||
setShowModelForm(true)
|
||||
return (
|
||||
<Card
|
||||
title={props.title}
|
||||
description={props.description}
|
||||
buttons={[
|
||||
{
|
||||
title: 'Edit Fields',
|
||||
buttonStyle: ButtonStyleType.NORMAL,
|
||||
onClick: () => {
|
||||
setShowModelForm(true);
|
||||
},
|
||||
icon: IconProp.Edit,
|
||||
},
|
||||
icon: IconProp.Edit,
|
||||
]}
|
||||
>
|
||||
<div className="border-t border-gray-200 px-4 py-5 sm:px-6 -m-6 -mt-2">
|
||||
{isLoading && !error && <ComponentLoader />}
|
||||
{!isLoading && !error && schemaList.length === 0 && (
|
||||
<ErrorMessage error="No custom fields are added for this resource. Please add customm fields for this resource in project settings." />
|
||||
)}
|
||||
{error && <ErrorMessage error={error} />}
|
||||
{!model && <ErrorMessage error={'Item not found'} />}
|
||||
|
||||
}
|
||||
]}
|
||||
>
|
||||
<div className="border-t border-gray-200 px-4 py-5 sm:px-6 -m-6 -mt-2">
|
||||
{isLoading && !error && <ComponentLoader />}
|
||||
{!isLoading && !error && schemaList.length === 0 && <ErrorMessage error="No custom fields are added for this resource. Please add customm fields for this resource in project settings." />}
|
||||
{error && <ErrorMessage error={error} />}
|
||||
{!model && <ErrorMessage error={"Item not found"} />}
|
||||
{!isLoading && !error && model && (
|
||||
<Detail
|
||||
id={props.name}
|
||||
item={(model as any)['customFields'] || {}}
|
||||
fields={schemaList.map((schemaItem: BaseModel) => {
|
||||
return {
|
||||
key: [(schemaItem as any).name],
|
||||
title: (schemaItem as any).name,
|
||||
description: (schemaItem as any).description,
|
||||
fieldType: (schemaItem as any).type,
|
||||
placeholder: 'No data entered',
|
||||
};
|
||||
})}
|
||||
showDetailsInNumberOfColumns={1}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!isLoading && !error && model && <Detail
|
||||
id={props.name}
|
||||
item={(model as any)["customFields"] || {}}
|
||||
fields={schemaList.map((schemaItem: BaseModel) => {
|
||||
return {
|
||||
key: [(schemaItem as any).name],
|
||||
title: (schemaItem as any).name,
|
||||
description: (schemaItem as any).description,
|
||||
fieldType: (schemaItem as any).type,
|
||||
placeholder: "No data entered"
|
||||
}
|
||||
})}
|
||||
showDetailsInNumberOfColumns={1}
|
||||
/>}
|
||||
|
||||
{showModelForm && <BasicFormModal
|
||||
title={"Edit " + new props.modelType().singularName}
|
||||
onClose={() => setShowModelForm(false)}
|
||||
onSubmit={(data: JSONObject) => {
|
||||
onSave(data);
|
||||
}}
|
||||
formProps={{
|
||||
initialValues: (model as any)["customFields"] || {},
|
||||
fields: schemaList.map((schemaItem: BaseModel) => {
|
||||
return {
|
||||
field: {
|
||||
[(schemaItem as any).name]: true,
|
||||
},
|
||||
title: (schemaItem as any).name,
|
||||
description: (schemaItem as any).description,
|
||||
fieldType: (schemaItem as any).type,
|
||||
required: false,
|
||||
placeholder: ''
|
||||
}
|
||||
})
|
||||
}}
|
||||
/>}
|
||||
</div>
|
||||
</Card >)
|
||||
{showModelForm && (
|
||||
<BasicFormModal
|
||||
title={'Edit ' + new props.modelType().singularName}
|
||||
onClose={() => {
|
||||
return setShowModelForm(false);
|
||||
}}
|
||||
onSubmit={(data: JSONObject) => {
|
||||
onSave(data).catch();
|
||||
}}
|
||||
formProps={{
|
||||
initialValues: (model as any)['customFields'] || {},
|
||||
fields: schemaList.map((schemaItem: BaseModel) => {
|
||||
return {
|
||||
field: {
|
||||
[(schemaItem as any).name]: true,
|
||||
},
|
||||
title: (schemaItem as any).name,
|
||||
description: (schemaItem as any)
|
||||
.description,
|
||||
fieldType: (schemaItem as any).type,
|
||||
required: false,
|
||||
placeholder: '',
|
||||
};
|
||||
}),
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export default CustomFieldsDetail;
|
||||
|
||||
@@ -195,7 +195,9 @@ const Detail: Function = (props: ComponentProps): ReactElement => {
|
||||
</label>
|
||||
)}
|
||||
{field.description && (
|
||||
<p className={`${alignClassName} text-sm text-gray-400`}>{field.description}</p>
|
||||
<p className={`${alignClassName} text-sm text-gray-400`}>
|
||||
{field.description}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className={`mt-1 text-sm text-gray-900 ${alignClassName}`}>
|
||||
|
||||
@@ -45,13 +45,13 @@ export enum FormType {
|
||||
}
|
||||
|
||||
export interface ComponentProps<TBaseModel extends BaseModel> {
|
||||
modelType: { new(): TBaseModel };
|
||||
modelType: { new (): TBaseModel };
|
||||
id: string;
|
||||
onValidate?:
|
||||
| undefined
|
||||
| ((
|
||||
values: FormValues<TBaseModel>
|
||||
) => FormikErrors<FormValues<TBaseModel>>);
|
||||
| undefined
|
||||
| ((
|
||||
values: FormValues<TBaseModel>
|
||||
) => FormikErrors<FormValues<TBaseModel>>);
|
||||
fields: Fields<TBaseModel>;
|
||||
submitButtonText?: undefined | string;
|
||||
title?: undefined | string;
|
||||
@@ -61,8 +61,8 @@ export interface ComponentProps<TBaseModel extends BaseModel> {
|
||||
onCancel?: undefined | (() => void);
|
||||
name: string;
|
||||
onSuccess?:
|
||||
| undefined
|
||||
| ((data: TBaseModel | JSONObjectOrArray | Array<TBaseModel>) => void);
|
||||
| undefined
|
||||
| ((data: TBaseModel | JSONObjectOrArray | Array<TBaseModel>) => void);
|
||||
cancelButtonText?: undefined | string;
|
||||
maxPrimaryButtonWidth?: undefined | boolean;
|
||||
apiUrl?: undefined | URL;
|
||||
@@ -75,8 +75,8 @@ export interface ComponentProps<TBaseModel extends BaseModel> {
|
||||
modelIdToEdit?: ObjectID | undefined;
|
||||
onError?: ((error: string) => void) | undefined;
|
||||
onBeforeCreate?:
|
||||
| ((item: TBaseModel | BaseModel) => Promise<TBaseModel | BaseModel>)
|
||||
| undefined;
|
||||
| ((item: TBaseModel | BaseModel) => Promise<TBaseModel | BaseModel>)
|
||||
| undefined;
|
||||
saveRequestOptions?: RequestOptions | undefined;
|
||||
doNotFetchExistingModel?: boolean | undefined;
|
||||
}
|
||||
@@ -96,7 +96,6 @@ const ModelForm: Function = <TBaseModel extends BaseModel>(
|
||||
const getSelectFields: Function = (): Select<TBaseModel> => {
|
||||
const select: Select<TBaseModel> = {};
|
||||
for (const field of props.fields) {
|
||||
|
||||
const key: string | null = field.field
|
||||
? (Object.keys(field.field)[0] as string)
|
||||
: null;
|
||||
@@ -132,7 +131,6 @@ const ModelForm: Function = <TBaseModel extends BaseModel>(
|
||||
return populate;
|
||||
};
|
||||
|
||||
|
||||
const hasPermissionOnField: Function = (fieldName: string): boolean => {
|
||||
let userPermissions: Array<Permission> =
|
||||
PermissionUtil.getGlobalPermissions()?.globalPermissions || [];
|
||||
@@ -164,21 +162,19 @@ const ModelForm: Function = <TBaseModel extends BaseModel>(
|
||||
}
|
||||
|
||||
if (
|
||||
(fieldPermissions &&
|
||||
PermissionHelper.doesPermissionsIntersect(
|
||||
userPermissions,
|
||||
fieldPermissions
|
||||
))
|
||||
fieldPermissions &&
|
||||
PermissionHelper.doesPermissionsIntersect(
|
||||
userPermissions,
|
||||
fieldPermissions
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const setFormFields: Function = async (): Promise<void> => {
|
||||
|
||||
|
||||
let fieldsToSet: Fields<TBaseModel> = [];
|
||||
|
||||
for (const field of props.fields) {
|
||||
@@ -187,12 +183,9 @@ const ModelForm: Function = <TBaseModel extends BaseModel>(
|
||||
if (keys.length > 0) {
|
||||
const key: string = keys[0] as string;
|
||||
|
||||
const hasPermission = hasPermissionOnField(key);
|
||||
const hasPermission: boolean = hasPermissionOnField(key);
|
||||
|
||||
if (
|
||||
field.forceShow ||
|
||||
hasPermission
|
||||
) {
|
||||
if (field.forceShow || hasPermission) {
|
||||
fieldsToSet.push(field);
|
||||
}
|
||||
}
|
||||
@@ -255,7 +248,7 @@ const ModelForm: Function = <TBaseModel extends BaseModel>(
|
||||
isModelArray = true;
|
||||
idArray.push(
|
||||
(itemInArray as any as JSONObject)[
|
||||
'_id'
|
||||
'_id'
|
||||
] as string
|
||||
);
|
||||
}
|
||||
@@ -334,7 +327,7 @@ const ModelForm: Function = <TBaseModel extends BaseModel>(
|
||||
try {
|
||||
setError(
|
||||
(err as HTTPErrorResponse).message ||
|
||||
'Server Error. Please try again'
|
||||
'Server Error. Please try again'
|
||||
);
|
||||
} catch (e) {
|
||||
setError('Server Error. Please try again');
|
||||
@@ -442,7 +435,7 @@ const ModelForm: Function = <TBaseModel extends BaseModel>(
|
||||
Array.isArray(valuesToSend[key]) &&
|
||||
(valuesToSend[key] as Array<any>).length > 0 &&
|
||||
typeof (valuesToSend[key] as Array<any>)[0] ===
|
||||
Typeof.String
|
||||
Typeof.String
|
||||
) {
|
||||
const arr: Array<BaseModel> = [];
|
||||
for (const id of valuesToSend[key] as Array<string>) {
|
||||
@@ -479,7 +472,7 @@ const ModelForm: Function = <TBaseModel extends BaseModel>(
|
||||
} catch (err) {
|
||||
setError(
|
||||
(err as HTTPErrorResponse).message ||
|
||||
'Server Error. Please try again'
|
||||
'Server Error. Please try again'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
enum FormFieldSchemaType {
|
||||
ObjectID = "ObjectID",
|
||||
Name = "Name",
|
||||
Hostname = "Hostname",
|
||||
ImageFile = "ImageFile",
|
||||
URL = "URL",
|
||||
Route = "Route",
|
||||
Number = "Number",
|
||||
Password = "Password",
|
||||
Text = "Text",
|
||||
Email = "Email",
|
||||
PositveNumber = "PositveNumber",
|
||||
Date = "Date",
|
||||
Phone = "Phone",
|
||||
DateTime = "DateTime",
|
||||
Domain = "Domain",
|
||||
LongText = "LongText",
|
||||
Color = "Color",
|
||||
Dropdown = "Dropdown",
|
||||
File = "File",
|
||||
MultiSelectDropdown = "MultiSelectDropdown",
|
||||
Checkbox = "Boolean",
|
||||
Port = "Port",
|
||||
EncryptedText = "EncryptedText",
|
||||
Markdown = "Markdown",
|
||||
JavaScript = "JavaScript",
|
||||
CSS = "CSS",
|
||||
HTML = "HTML",
|
||||
RadioButton = "RadioButton",
|
||||
JSON = "JSON",
|
||||
Query = "Query",
|
||||
ObjectID = 'ObjectID',
|
||||
Name = 'Name',
|
||||
Hostname = 'Hostname',
|
||||
ImageFile = 'ImageFile',
|
||||
URL = 'URL',
|
||||
Route = 'Route',
|
||||
Number = 'Number',
|
||||
Password = 'Password',
|
||||
Text = 'Text',
|
||||
Email = 'Email',
|
||||
PositveNumber = 'PositveNumber',
|
||||
Date = 'Date',
|
||||
Phone = 'Phone',
|
||||
DateTime = 'DateTime',
|
||||
Domain = 'Domain',
|
||||
LongText = 'LongText',
|
||||
Color = 'Color',
|
||||
Dropdown = 'Dropdown',
|
||||
File = 'File',
|
||||
MultiSelectDropdown = 'MultiSelectDropdown',
|
||||
Checkbox = 'Boolean',
|
||||
Port = 'Port',
|
||||
EncryptedText = 'EncryptedText',
|
||||
Markdown = 'Markdown',
|
||||
JavaScript = 'JavaScript',
|
||||
CSS = 'CSS',
|
||||
HTML = 'HTML',
|
||||
RadioButton = 'RadioButton',
|
||||
JSON = 'JSON',
|
||||
Query = 'Query',
|
||||
}
|
||||
|
||||
export default FormFieldSchemaType;
|
||||
|
||||
@@ -148,7 +148,11 @@ const Icon: FunctionComponent<ComponentProps> = ({
|
||||
);
|
||||
} else if (icon === IconProp.TableCells) {
|
||||
return getSvgWrapper(
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 01-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0112 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5" />
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 01-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0112 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"
|
||||
/>
|
||||
);
|
||||
} else if (icon === IconProp.Database) {
|
||||
return getSvgWrapper(
|
||||
|
||||
@@ -66,7 +66,6 @@ import ScheduledMaintenanceEventPublicNote from './Pages/ScheduledMaintenanceEve
|
||||
import OngoingScheduledMaintenanceEvents from './Pages/ScheduledMaintenanceEvents/Ongoing';
|
||||
import ScheduledMaintenanceEventsViewCustomFields from './Pages/ScheduledMaintenanceEvents/View/CustomFields';
|
||||
|
||||
|
||||
import Logs from './Pages/Logs/Logs';
|
||||
import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import RouteMap from './Utils/RouteMap';
|
||||
@@ -200,7 +199,7 @@ const App: FunctionComponent = () => {
|
||||
} catch (err) {
|
||||
setError(
|
||||
(err as HTTPErrorResponse).message ||
|
||||
'Server Error. Please try again'
|
||||
'Server Error. Please try again'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -285,7 +284,7 @@ const App: FunctionComponent = () => {
|
||||
<NotOperationalMonitors
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.HOME_NOT_OPERATIONAL_MONITORS
|
||||
PageMap.HOME_NOT_OPERATIONAL_MONITORS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -305,8 +304,8 @@ const App: FunctionComponent = () => {
|
||||
<OngoingScheduledEvents
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap
|
||||
.HOME_ONGOING_SCHEDULED_MAINTENANCE_EVENTS
|
||||
PageMap
|
||||
.HOME_ONGOING_SCHEDULED_MAINTENANCE_EVENTS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -334,7 +333,7 @@ const App: FunctionComponent = () => {
|
||||
<MonitorInoperational
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.MONITORS_INOPERATIONAL
|
||||
PageMap.MONITORS_INOPERATIONAL
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -376,7 +375,7 @@ const App: FunctionComponent = () => {
|
||||
<MonitorViewStatusTimeline
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.MONITOR_VIEW_STATUS_TIMELINE
|
||||
PageMap.MONITOR_VIEW_STATUS_TIMELINE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -393,7 +392,7 @@ const App: FunctionComponent = () => {
|
||||
<MonitorIncidents
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.MONITOR_VIEW_INCIDENTS
|
||||
PageMap.MONITOR_VIEW_INCIDENTS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -403,14 +402,15 @@ const App: FunctionComponent = () => {
|
||||
|
||||
<PageRoute
|
||||
path={
|
||||
RouteMap[PageMap.MONITOR_VIEW_CUSTOM_FIELDS]?.toString() ||
|
||||
''
|
||||
RouteMap[
|
||||
PageMap.MONITOR_VIEW_CUSTOM_FIELDS
|
||||
]?.toString() || ''
|
||||
}
|
||||
element={
|
||||
<MonitorViewCustomFields
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.MONITOR_VIEW_CUSTOM_FIELDS
|
||||
PageMap.MONITOR_VIEW_CUSTOM_FIELDS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -561,7 +561,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewDelete
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_DELETE
|
||||
PageMap.STATUS_PAGE_VIEW_DELETE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -579,7 +579,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewBranding
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_BRANDING
|
||||
PageMap.STATUS_PAGE_VIEW_BRANDING
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -597,7 +597,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewCustomHtmlCss
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_CUSTOM_HTML_CSS
|
||||
PageMap.STATUS_PAGE_VIEW_CUSTOM_HTML_CSS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -615,7 +615,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewAdvancedOptions
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_ADVANCED_OPTIONS
|
||||
PageMap.STATUS_PAGE_VIEW_ADVANCED_OPTIONS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -633,7 +633,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPageViewCustomFields
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS
|
||||
PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -651,7 +651,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewEmailSubscribers
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_EMAIL_SUBSCRIBERS
|
||||
PageMap.STATUS_PAGE_VIEW_EMAIL_SUBSCRIBERS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -669,7 +669,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPageViewPrivateUser
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_PRIVATE_USERS
|
||||
PageMap.STATUS_PAGE_VIEW_PRIVATE_USERS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -687,7 +687,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewSMSSubscribers
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_SMS_SUBSCRIBERS
|
||||
PageMap.STATUS_PAGE_VIEW_SMS_SUBSCRIBERS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -705,7 +705,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewHeaderStyle
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_HEADER_STYLE
|
||||
PageMap.STATUS_PAGE_VIEW_HEADER_STYLE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -723,7 +723,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewFooterStyle
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_FOOTER_STYLE
|
||||
PageMap.STATUS_PAGE_VIEW_FOOTER_STYLE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -741,7 +741,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewNavBarStyle
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_NAVBAR_STYLE
|
||||
PageMap.STATUS_PAGE_VIEW_NAVBAR_STYLE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -759,7 +759,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewWebhookSubscribers
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_WEBHOOK_SUBSCRIBERS
|
||||
PageMap.STATUS_PAGE_VIEW_WEBHOOK_SUBSCRIBERS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -777,7 +777,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewEmbedded
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_EMBEDDED
|
||||
PageMap.STATUS_PAGE_VIEW_EMBEDDED
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -795,7 +795,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewResources
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_RESOURCES
|
||||
PageMap.STATUS_PAGE_VIEW_RESOURCES
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -813,7 +813,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewDomains
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_DOMAINS
|
||||
PageMap.STATUS_PAGE_VIEW_DOMAINS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -830,7 +830,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewGroups
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_GROUPS
|
||||
PageMap.STATUS_PAGE_VIEW_GROUPS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -848,7 +848,7 @@ const App: FunctionComponent = () => {
|
||||
<StatusPagesViewAnnouncement
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_ANNOUNCEMENTS
|
||||
PageMap.STATUS_PAGE_VIEW_ANNOUNCEMENTS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -916,7 +916,7 @@ const App: FunctionComponent = () => {
|
||||
<IncidentViewStateTimeline
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.INCIDENT_VIEW_STATE_TIMELINE
|
||||
PageMap.INCIDENT_VIEW_STATE_TIMELINE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -933,7 +933,7 @@ const App: FunctionComponent = () => {
|
||||
<IncidentInternalNote
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.INCIDENT_INTERNAL_NOTE
|
||||
PageMap.INCIDENT_INTERNAL_NOTE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -943,14 +943,15 @@ const App: FunctionComponent = () => {
|
||||
|
||||
<PageRoute
|
||||
path={
|
||||
RouteMap[PageMap.INCIDENT_VIEW_CUSTOM_FIELDS]?.toString() ||
|
||||
''
|
||||
RouteMap[
|
||||
PageMap.INCIDENT_VIEW_CUSTOM_FIELDS
|
||||
]?.toString() || ''
|
||||
}
|
||||
element={
|
||||
<IncidentViewCustomFields
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.INCIDENT_VIEW_CUSTOM_FIELDS
|
||||
PageMap.INCIDENT_VIEW_CUSTOM_FIELDS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -958,7 +959,6 @@ const App: FunctionComponent = () => {
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
<PageRoute
|
||||
path={
|
||||
RouteMap[PageMap.INCIDENT_PUBLIC_NOTE]?.toString() || ''
|
||||
@@ -985,7 +985,7 @@ const App: FunctionComponent = () => {
|
||||
<ScheduledMaintenanceEvents
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_EVENTS
|
||||
PageMap.SCHEDULED_MAINTENANCE_EVENTS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1003,7 +1003,7 @@ const App: FunctionComponent = () => {
|
||||
<OngoingScheduledMaintenanceEvents
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.ONGOING_SCHEDULED_MAINTENANCE_EVENTS
|
||||
PageMap.ONGOING_SCHEDULED_MAINTENANCE_EVENTS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1021,7 +1021,7 @@ const App: FunctionComponent = () => {
|
||||
<ScheduledMaintenanceEventView
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1031,14 +1031,16 @@ const App: FunctionComponent = () => {
|
||||
|
||||
<PageRoute
|
||||
path={
|
||||
RouteMap[PageMap.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS]?.toString() ||
|
||||
''
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS
|
||||
]?.toString() || ''
|
||||
}
|
||||
element={
|
||||
<ScheduledMaintenanceEventsViewCustomFields
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS
|
||||
PageMap
|
||||
.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1056,7 +1058,7 @@ const App: FunctionComponent = () => {
|
||||
<ScheduledMaintenanceEventViewDelete
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW_DELETE
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW_DELETE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1074,8 +1076,8 @@ const App: FunctionComponent = () => {
|
||||
<ScheduledMaintenanceEventViewStateTimeline
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap
|
||||
.SCHEDULED_MAINTENANCE_VIEW_STATE_TIMELINE
|
||||
PageMap
|
||||
.SCHEDULED_MAINTENANCE_VIEW_STATE_TIMELINE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1093,7 +1095,7 @@ const App: FunctionComponent = () => {
|
||||
<ScheduledMaintenanceEventInternalNote
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_INTERNAL_NOTE
|
||||
PageMap.SCHEDULED_MAINTENANCE_INTERNAL_NOTE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1111,7 +1113,7 @@ const App: FunctionComponent = () => {
|
||||
<ScheduledMaintenanceEventPublicNote
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_PUBLIC_NOTE
|
||||
PageMap.SCHEDULED_MAINTENANCE_PUBLIC_NOTE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1173,7 +1175,7 @@ const App: FunctionComponent = () => {
|
||||
<SettingsMonitors
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_MONITORS_STATUS
|
||||
PageMap.SETTINGS_MONITORS_STATUS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1191,7 +1193,7 @@ const App: FunctionComponent = () => {
|
||||
<SettingsIncidents
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_INCIDENTS_STATE
|
||||
PageMap.SETTINGS_INCIDENTS_STATE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1209,7 +1211,7 @@ const App: FunctionComponent = () => {
|
||||
<SettingsScheduledMaintenanceState
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE
|
||||
PageMap.SETTINGS_SCHEDULED_MAINTENANCE_STATE
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1227,7 +1229,7 @@ const App: FunctionComponent = () => {
|
||||
<SettingsIncidentSeverity
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_INCIDENTS_SEVERITY
|
||||
PageMap.SETTINGS_INCIDENTS_SEVERITY
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
@@ -1289,27 +1291,34 @@ const App: FunctionComponent = () => {
|
||||
|
||||
<PageRoute
|
||||
path={
|
||||
RouteMap[PageMap.SETTINGS_MONITOR_CUSTOM_FIELDS]?.toString() || ''
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_MONITOR_CUSTOM_FIELDS
|
||||
]?.toString() || ''
|
||||
}
|
||||
element={
|
||||
<MonitorCustomFields
|
||||
pageRoute={
|
||||
RouteMap[PageMap.SETTINGS_MONITOR_CUSTOM_FIELDS] as Route
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_MONITOR_CUSTOM_FIELDS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
<PageRoute
|
||||
path={
|
||||
RouteMap[PageMap.SETTINGS_STATUS_PAGE_CUSTOM_FIELDS]?.toString() || ''
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_STATUS_PAGE_CUSTOM_FIELDS
|
||||
]?.toString() || ''
|
||||
}
|
||||
element={
|
||||
<StatusPageCustomFields
|
||||
pageRoute={
|
||||
RouteMap[PageMap.SETTINGS_STATUS_PAGE_CUSTOM_FIELDS] as Route
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_STATUS_PAGE_CUSTOM_FIELDS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
/>
|
||||
@@ -1318,27 +1327,35 @@ const App: FunctionComponent = () => {
|
||||
|
||||
<PageRoute
|
||||
path={
|
||||
RouteMap[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS]?.toString() || ''
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS
|
||||
]?.toString() || ''
|
||||
}
|
||||
element={
|
||||
<ScheduledMaintenanceCustomFields
|
||||
pageRoute={
|
||||
RouteMap[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS] as Route
|
||||
RouteMap[
|
||||
PageMap
|
||||
.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
<PageRoute
|
||||
path={
|
||||
RouteMap[PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS]?.toString() || ''
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS
|
||||
]?.toString() || ''
|
||||
}
|
||||
element={
|
||||
<IncidentCustomFields
|
||||
pageRoute={
|
||||
RouteMap[PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS] as Route
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_INCIDENT_CUSTOM_FIELDS
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
/>
|
||||
@@ -1367,7 +1384,7 @@ const App: FunctionComponent = () => {
|
||||
<SettingsInvoices
|
||||
pageRoute={
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_BILLING_INVOICES
|
||||
PageMap.SETTINGS_BILLING_INVOICES
|
||||
] as Route
|
||||
}
|
||||
currentProject={selectedProject}
|
||||
|
||||
@@ -7,7 +7,7 @@ import PageComponentProps from '../../PageComponentProps';
|
||||
import SideMenu from './SideMenu';
|
||||
import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import CustomFieldsDetail from "CommonUI/src/Components/CustomFields/CustomFieldsDetail";
|
||||
import CustomFieldsDetail from 'CommonUI/src/Components/CustomFields/CustomFieldsDetail';
|
||||
import Incident from 'Model/Models/Incident';
|
||||
import IncidentCustomField from 'Model/Models/IncidentCustomField';
|
||||
import ProjectUtil from 'CommonUI/src/Utils/Project';
|
||||
@@ -52,9 +52,9 @@ const IncidentCustomFields: FunctionComponent<PageComponentProps> = (
|
||||
]}
|
||||
sideMenu={<SideMenu modelId={modelId} />}
|
||||
>
|
||||
<CustomFieldsDetail
|
||||
title='Incident Custom Fields'
|
||||
description='Custom fields help you add new fields to your resources in OneUptime.'
|
||||
<CustomFieldsDetail
|
||||
title="Incident Custom Fields"
|
||||
description="Custom fields help you add new fields to your resources in OneUptime."
|
||||
modelType={Incident}
|
||||
customFieldType={IncidentCustomField}
|
||||
name="Incident Custom Fields"
|
||||
|
||||
@@ -33,7 +33,7 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
title: 'State Timeline',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[
|
||||
PageMap.INCIDENT_VIEW_STATE_TIMELINE
|
||||
PageMap.INCIDENT_VIEW_STATE_TIMELINE
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
@@ -70,7 +70,9 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
link={{
|
||||
title: 'Custom Fields',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.INCIDENT_VIEW_CUSTOM_FIELDS] as Route,
|
||||
RouteMap[
|
||||
PageMap.INCIDENT_VIEW_CUSTOM_FIELDS
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
}}
|
||||
|
||||
@@ -7,7 +7,7 @@ import PageComponentProps from '../../PageComponentProps';
|
||||
import SideMenu from './SideMenu';
|
||||
import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import CustomFieldsDetail from "CommonUI/src/Components/CustomFields/CustomFieldsDetail";
|
||||
import CustomFieldsDetail from 'CommonUI/src/Components/CustomFields/CustomFieldsDetail';
|
||||
import Monitor from 'Model/Models/Monitor';
|
||||
import MonitorCustomField from 'Model/Models/MonitorCustomField';
|
||||
import ProjectUtil from 'CommonUI/src/Utils/Project';
|
||||
@@ -52,9 +52,9 @@ const MonitorCustomFields: FunctionComponent<PageComponentProps> = (
|
||||
]}
|
||||
sideMenu={<SideMenu modelId={modelId} />}
|
||||
>
|
||||
<CustomFieldsDetail
|
||||
title='Monitor Custom Fields'
|
||||
description='Custom fields help you add new fields to your resources in OneUptime.'
|
||||
<CustomFieldsDetail
|
||||
title="Monitor Custom Fields"
|
||||
description="Custom fields help you add new fields to your resources in OneUptime."
|
||||
modelType={Monitor}
|
||||
customFieldType={MonitorCustomField}
|
||||
name="Monitor Custom Fields"
|
||||
|
||||
@@ -33,7 +33,7 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
title: 'Status Timeline',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[
|
||||
PageMap.MONITOR_VIEW_STATUS_TIMELINE
|
||||
PageMap.MONITOR_VIEW_STATUS_TIMELINE
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
@@ -57,7 +57,9 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
link={{
|
||||
title: 'Custom Fields',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.MONITOR_VIEW_CUSTOM_FIELDS] as Route,
|
||||
RouteMap[
|
||||
PageMap.MONITOR_VIEW_CUSTOM_FIELDS
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
}}
|
||||
|
||||
@@ -7,14 +7,14 @@ import PageComponentProps from '../../PageComponentProps';
|
||||
import SideMenu from './SideMenu';
|
||||
import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import CustomFieldsDetail from "CommonUI/src/Components/CustomFields/CustomFieldsDetail";
|
||||
import CustomFieldsDetail from 'CommonUI/src/Components/CustomFields/CustomFieldsDetail';
|
||||
import ScheduledMaintenance from 'Model/Models/ScheduledMaintenance';
|
||||
import ScheduledMaintenanceCustomField from 'Model/Models/ScheduledMaintenanceCustomField';
|
||||
import ProjectUtil from 'CommonUI/src/Utils/Project';
|
||||
|
||||
const ScheduledMaintenanceCustomFields: FunctionComponent<PageComponentProps> = (
|
||||
_props: PageComponentProps
|
||||
): ReactElement => {
|
||||
const ScheduledMaintenanceCustomFields: FunctionComponent<
|
||||
PageComponentProps
|
||||
> = (_props: PageComponentProps): ReactElement => {
|
||||
const modelId: ObjectID = Navigation.getLastParamAsObjectID(1);
|
||||
|
||||
return (
|
||||
@@ -45,16 +45,18 @@ const ScheduledMaintenanceCustomFields: FunctionComponent<PageComponentProps> =
|
||||
{
|
||||
title: 'Custom Fields',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS] as Route,
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS
|
||||
] as Route,
|
||||
modelId
|
||||
),
|
||||
},
|
||||
]}
|
||||
sideMenu={<SideMenu modelId={modelId} />}
|
||||
>
|
||||
<CustomFieldsDetail
|
||||
title='Scheduled Maintenance Custom Fields'
|
||||
description='Custom fields help you add new fields to your resources in OneUptime.'
|
||||
<CustomFieldsDetail
|
||||
title="Scheduled Maintenance Custom Fields"
|
||||
description="Custom fields help you add new fields to your resources in OneUptime."
|
||||
modelType={ScheduledMaintenance}
|
||||
customFieldType={ScheduledMaintenanceCustomField}
|
||||
name="Scheduled Maintenance Custom Fields"
|
||||
|
||||
@@ -23,7 +23,7 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
title: 'Overview',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
@@ -35,8 +35,8 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
title: 'State Timeline',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[
|
||||
PageMap
|
||||
.SCHEDULED_MAINTENANCE_VIEW_STATE_TIMELINE
|
||||
PageMap
|
||||
.SCHEDULED_MAINTENANCE_VIEW_STATE_TIMELINE
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
@@ -51,7 +51,7 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
title: 'Private Notes',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_INTERNAL_NOTE
|
||||
PageMap.SCHEDULED_MAINTENANCE_INTERNAL_NOTE
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
@@ -63,7 +63,7 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
title: 'Public Notes',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_PUBLIC_NOTE
|
||||
PageMap.SCHEDULED_MAINTENANCE_PUBLIC_NOTE
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
@@ -77,7 +77,9 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
link={{
|
||||
title: 'Custom Fields',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS] as Route,
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW_CUSTOM_FIELDS
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
}}
|
||||
@@ -89,7 +91,7 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
title: 'Delete Scheduled Maintenance',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW_DELETE
|
||||
PageMap.SCHEDULED_MAINTENANCE_VIEW_DELETE
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
|
||||
@@ -14,10 +14,11 @@ import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import BaseModel from 'Common/Models/BaseModel';
|
||||
import CustomFieldType from 'Common/Types/CustomField/CustomFieldType';
|
||||
|
||||
export interface ComponentProps<TBaseModel extends BaseModel> extends PageComponentProps {
|
||||
export interface ComponentProps<TBaseModel extends BaseModel>
|
||||
extends PageComponentProps {
|
||||
title: string;
|
||||
currentRoute: Route;
|
||||
modelType: { new(): TBaseModel };
|
||||
modelType: { new (): TBaseModel };
|
||||
}
|
||||
|
||||
const CustomFieldsPageBase: Function = <TBaseModel extends BaseModel>(
|
||||
@@ -52,7 +53,7 @@ const CustomFieldsPageBase: Function = <TBaseModel extends BaseModel>(
|
||||
projectId: DashboardNavigation.getProjectId()?.toString(),
|
||||
}}
|
||||
id="custom-fields-table"
|
||||
name={"Settings > " + props.title}
|
||||
name={'Settings > ' + props.title}
|
||||
isDeleteable={true}
|
||||
isEditable={true}
|
||||
isCreateable={true}
|
||||
@@ -95,19 +96,19 @@ const CustomFieldsPageBase: Function = <TBaseModel extends BaseModel>(
|
||||
fieldType: FormFieldSchemaType.Dropdown,
|
||||
required: true,
|
||||
placeholder: 'Please select field type.',
|
||||
dropdownOptions: Object.keys(CustomFieldType).map((item) => {
|
||||
return {
|
||||
label: item,
|
||||
value: item
|
||||
dropdownOptions: Object.keys(CustomFieldType).map(
|
||||
(item: string) => {
|
||||
return {
|
||||
label: item,
|
||||
value: item,
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
),
|
||||
},
|
||||
]}
|
||||
showRefreshButton={true}
|
||||
showFilterButton={true}
|
||||
columns={[
|
||||
|
||||
{
|
||||
field: {
|
||||
name: true,
|
||||
|
||||
@@ -6,12 +6,11 @@ import CustomFieldsPageBase from './Base/CustomFieldsPageBase';
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import IncidentCustomField from 'Model/Models/IncidentCustomField';
|
||||
|
||||
|
||||
const IncidentCustomFields: FunctionComponent<PageComponentProps> = (
|
||||
props: PageComponentProps
|
||||
): ReactElement => {
|
||||
return (
|
||||
<CustomFieldsPageBase
|
||||
<CustomFieldsPageBase
|
||||
{...props}
|
||||
title="Incident Custom Fields"
|
||||
currentRoute={RouteUtil.populateRouteParams(
|
||||
|
||||
@@ -6,12 +6,11 @@ import CustomFieldsPageBase from './Base/CustomFieldsPageBase';
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import MonitorCustomField from 'Model/Models/MonitorCustomField';
|
||||
|
||||
|
||||
const MonitorCustomFields: FunctionComponent<PageComponentProps> = (
|
||||
props: PageComponentProps
|
||||
): ReactElement => {
|
||||
return (
|
||||
<CustomFieldsPageBase
|
||||
<CustomFieldsPageBase
|
||||
{...props}
|
||||
title="Monitor Custom Fields"
|
||||
currentRoute={RouteUtil.populateRouteParams(
|
||||
|
||||
@@ -6,16 +6,17 @@ import CustomFieldsPageBase from './Base/CustomFieldsPageBase';
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import ScheduledMaintenanceCustomField from 'Model/Models/ScheduledMaintenanceCustomField';
|
||||
|
||||
|
||||
const ScheduledMaintenanceCustomFields: FunctionComponent<PageComponentProps> = (
|
||||
props: PageComponentProps
|
||||
): ReactElement => {
|
||||
const ScheduledMaintenanceCustomFields: FunctionComponent<
|
||||
PageComponentProps
|
||||
> = (props: PageComponentProps): ReactElement => {
|
||||
return (
|
||||
<CustomFieldsPageBase
|
||||
<CustomFieldsPageBase
|
||||
{...props}
|
||||
title="Scheduled Maintenance Custom Fields"
|
||||
currentRoute={RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS] as Route
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS
|
||||
] as Route
|
||||
)}
|
||||
modelType={ScheduledMaintenanceCustomField}
|
||||
/>
|
||||
|
||||
@@ -64,7 +64,7 @@ const DashboardSideMenu: FunctionComponent = (): ReactElement => {
|
||||
}}
|
||||
icon={IconProp.AltGlobe}
|
||||
/>
|
||||
<SideMenuItem
|
||||
<SideMenuItem
|
||||
link={{
|
||||
title: 'Monitor Custom Fields',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
@@ -77,7 +77,7 @@ const DashboardSideMenu: FunctionComponent = (): ReactElement => {
|
||||
/>
|
||||
</SideMenuSection>
|
||||
<SideMenuSection title="Status Pages">
|
||||
<SideMenuItem
|
||||
<SideMenuItem
|
||||
link={{
|
||||
title: 'Staus Page Custom Fields',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
@@ -146,7 +146,8 @@ const DashboardSideMenu: FunctionComponent = (): ReactElement => {
|
||||
title: 'Scheduled Maintenance Custom Fields',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[
|
||||
PageMap.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS
|
||||
PageMap
|
||||
.SETTINGS_SCHEDULED_MAINTENANCE_CUSTOM_FIELDS
|
||||
] as Route
|
||||
),
|
||||
}}
|
||||
|
||||
@@ -6,12 +6,11 @@ import CustomFieldsPageBase from './Base/CustomFieldsPageBase';
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import StatusPageCustomField from 'Model/Models/StatusPageCustomField';
|
||||
|
||||
|
||||
const StatusPageCustomFields: FunctionComponent<PageComponentProps> = (
|
||||
props: PageComponentProps
|
||||
): ReactElement => {
|
||||
return (
|
||||
<CustomFieldsPageBase
|
||||
<CustomFieldsPageBase
|
||||
{...props}
|
||||
title="Status Page Custom Fields"
|
||||
currentRoute={RouteUtil.populateRouteParams(
|
||||
|
||||
@@ -7,7 +7,7 @@ import PageComponentProps from '../../PageComponentProps';
|
||||
import SideMenu from './SideMenu';
|
||||
import Navigation from 'CommonUI/src/Utils/Navigation';
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import CustomFieldsDetail from "CommonUI/src/Components/CustomFields/CustomFieldsDetail";
|
||||
import CustomFieldsDetail from 'CommonUI/src/Components/CustomFields/CustomFieldsDetail';
|
||||
import StatusPage from 'Model/Models/StatusPage';
|
||||
import StatusPageCustomField from 'Model/Models/StatusPageCustomField';
|
||||
import ProjectUtil from 'CommonUI/src/Utils/Project';
|
||||
@@ -45,16 +45,18 @@ const StatusPageCustomFields: FunctionComponent<PageComponentProps> = (
|
||||
{
|
||||
title: 'Custom Fields',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS] as Route,
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS
|
||||
] as Route,
|
||||
modelId
|
||||
),
|
||||
},
|
||||
]}
|
||||
sideMenu={<SideMenu modelId={modelId} />}
|
||||
>
|
||||
<CustomFieldsDetail
|
||||
title='Status Page Custom Fields'
|
||||
description='Custom fields help you add new fields to your resources in OneUptime.'
|
||||
<CustomFieldsDetail
|
||||
title="Status Page Custom Fields"
|
||||
description="Custom fields help you add new fields to your resources in OneUptime."
|
||||
modelType={StatusPage}
|
||||
customFieldType={StatusPageCustomField}
|
||||
name="Status Page Custom Fields"
|
||||
|
||||
@@ -228,19 +228,19 @@ const DashboardSideMenu: FunctionComponent<ComponentProps> = (
|
||||
</SideMenuSection>
|
||||
|
||||
<SideMenuSection title="Advanced">
|
||||
|
||||
<SideMenuItem
|
||||
<SideMenuItem
|
||||
link={{
|
||||
title: 'Custom Fields',
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS] as Route,
|
||||
RouteMap[
|
||||
PageMap.STATUS_PAGE_VIEW_CUSTOM_FIELDS
|
||||
] as Route,
|
||||
props.modelId
|
||||
),
|
||||
}}
|
||||
icon={IconProp.TableCells}
|
||||
/>
|
||||
|
||||
|
||||
<SideMenuItem
|
||||
link={{
|
||||
title: 'Advanced Settings',
|
||||
|
||||
@@ -35,7 +35,6 @@ enum PageMap {
|
||||
MONITOR_VIEW_INCIDENTS = 'MONITOR_VIEW_INCIDENTS',
|
||||
MONITOR_VIEW_CUSTOM_FIELDS = 'MONITOR_VIEW_CUSTOM_FIELDS',
|
||||
|
||||
|
||||
STATUS_PAGES = 'STATUS_PAGES',
|
||||
STATUS_PAGE_VIEW = 'STATUS_PAGE_VIEW',
|
||||
STATUS_PAGE_VIEW_BRANDING = 'STATUS_PAGE_VIEW_BRADNING',
|
||||
@@ -81,7 +80,7 @@ enum PageMap {
|
||||
SETTINGS_INCIDENTS_SEVERITY = 'SETTINGS_INCIDENTS_SEVERITY',
|
||||
SETTINGS_INCIDENT_CUSTOM_FIELDS = 'SETTINGS_INCIDENT_CUSTOM_FIELDS',
|
||||
|
||||
// Status Page
|
||||
// Status Page
|
||||
SETTINGS_STATUS_PAGE_CUSTOM_FIELDS = 'SETTINGS_STATUS_PAGE_CUSTOM_FIELDS',
|
||||
|
||||
// monitors
|
||||
|
||||
@@ -197,7 +197,6 @@ const RouteMap: Dictionary<Route> = {
|
||||
`/dashboard/${RouteParams.ProjectID}/monitors/${RouteParams.ModelID}/custom-fields`
|
||||
),
|
||||
|
||||
|
||||
[PageMap.MONITOR_VIEW_DELETE]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/monitors/${RouteParams.ModelID}/delete`
|
||||
),
|
||||
@@ -309,11 +308,8 @@ const RouteMap: Dictionary<Route> = {
|
||||
[PageMap.WORKFLOW_DELETE]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/workflows/workflow/${RouteParams.ModelID}/delete`
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
/// custom fields settings.
|
||||
/// custom fields settings.
|
||||
|
||||
[PageMap.SETTINGS_MONITOR_CUSTOM_FIELDS]: new Route(
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/monitor-custom-fields`
|
||||
@@ -330,10 +326,6 @@ const RouteMap: Dictionary<Route> = {
|
||||
`/dashboard/${RouteParams.ProjectID}/settings/status-page-custom-fields`
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// logout.
|
||||
[PageMap.LOGOUT]: new Route(`/dashboard/logout`),
|
||||
};
|
||||
|
||||
@@ -201,14 +201,12 @@ import StatusPageAPI from 'CommonServer/API/StatusPageAPI';
|
||||
|
||||
import StatusPageSubscriberAPI from 'CommonServer/API/StatusPageSubscriberAPI';
|
||||
|
||||
|
||||
// Custom Fields API
|
||||
// Custom Fields API
|
||||
import StatusPageCustomField from 'Model/Models/StatusPageCustomField';
|
||||
import StatusPageCustomFieldService, {
|
||||
Service as StatusPageCustomFieldServiceType,
|
||||
} from 'CommonServer/Services/StatusPageCustomFieldService';
|
||||
|
||||
|
||||
import MonitorCustomField from 'Model/Models/MonitorCustomField';
|
||||
import MonitorCustomFieldService, {
|
||||
Service as MonitorCustomFieldServiceType,
|
||||
@@ -224,7 +222,6 @@ import ScheduledMaintenanceCustomFieldService, {
|
||||
Service as ScheduledMaintenanceCustomFieldServiceType,
|
||||
} from 'CommonServer/Services/ScheduledMaintenanceCustomFieldService';
|
||||
|
||||
|
||||
const app: ExpressApplication = Express.getExpressApp();
|
||||
|
||||
const APP_NAME: string = 'api';
|
||||
@@ -540,18 +537,17 @@ app.use(
|
||||
).getRouter()
|
||||
);
|
||||
|
||||
|
||||
|
||||
app.use(
|
||||
`/${APP_NAME.toLocaleLowerCase()}`,
|
||||
new BaseAPI<ScheduledMaintenanceCustomField, ScheduledMaintenanceCustomFieldServiceType>(
|
||||
new BaseAPI<
|
||||
ScheduledMaintenanceCustomField,
|
||||
ScheduledMaintenanceCustomFieldServiceType
|
||||
>(
|
||||
ScheduledMaintenanceCustomField,
|
||||
ScheduledMaintenanceCustomFieldService
|
||||
).getRouter()
|
||||
);
|
||||
|
||||
|
||||
|
||||
app.use(
|
||||
`/${APP_NAME.toLocaleLowerCase()}`,
|
||||
new BaseAPI<IncidentCustomField, IncidentCustomFieldServiceType>(
|
||||
@@ -560,8 +556,6 @@ app.use(
|
||||
).getRouter()
|
||||
);
|
||||
|
||||
|
||||
|
||||
app.use(
|
||||
`/${APP_NAME.toLocaleLowerCase()}`,
|
||||
new BaseAPI<MonitorCustomField, MonitorCustomFieldServiceType>(
|
||||
@@ -570,7 +564,6 @@ app.use(
|
||||
).getRouter()
|
||||
);
|
||||
|
||||
|
||||
app.use(
|
||||
`/${APP_NAME.toLocaleLowerCase()}`,
|
||||
new BaseAPI<StatusPageCustomField, StatusPageCustomFieldServiceType>(
|
||||
@@ -579,8 +572,6 @@ app.use(
|
||||
).getRouter()
|
||||
);
|
||||
|
||||
|
||||
|
||||
const init: Function = async (): Promise<void> => {
|
||||
try {
|
||||
// init the app
|
||||
|
||||
@@ -144,8 +144,6 @@ export default class IncidentCustomField extends AccessControlModel {
|
||||
@UniqueColumnBy('projectId')
|
||||
public name?: string = undefined;
|
||||
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
@@ -172,7 +170,6 @@ export default class IncidentCustomField extends AccessControlModel {
|
||||
})
|
||||
public description?: string = undefined;
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
@@ -185,9 +182,7 @@ export default class IncidentCustomField extends AccessControlModel {
|
||||
Permission.ProjectMember,
|
||||
Permission.CanReadIncidentCustomField,
|
||||
],
|
||||
update: [
|
||||
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({ required: false, type: TableColumnType.LongText })
|
||||
@Column({
|
||||
@@ -298,5 +293,4 @@ export default class IncidentCustomField extends AccessControlModel {
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public deletedByUserId?: ObjectID = undefined;
|
||||
|
||||
}
|
||||
|
||||
@@ -144,8 +144,6 @@ export default class MonitorCustomField extends AccessControlModel {
|
||||
@UniqueColumnBy('projectId')
|
||||
public name?: string = undefined;
|
||||
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
@@ -172,7 +170,6 @@ export default class MonitorCustomField extends AccessControlModel {
|
||||
})
|
||||
public description?: string = undefined;
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
@@ -185,9 +182,7 @@ export default class MonitorCustomField extends AccessControlModel {
|
||||
Permission.ProjectMember,
|
||||
Permission.CanReadMonitorCustomField,
|
||||
],
|
||||
update: [
|
||||
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({ required: false, type: TableColumnType.LongText })
|
||||
@Column({
|
||||
@@ -298,5 +293,4 @@ export default class MonitorCustomField extends AccessControlModel {
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public deletedByUserId?: ObjectID = undefined;
|
||||
|
||||
}
|
||||
|
||||
@@ -144,8 +144,6 @@ export default class ScheduledMaintenanceCustomField extends AccessControlModel
|
||||
@UniqueColumnBy('projectId')
|
||||
public name?: string = undefined;
|
||||
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
@@ -172,7 +170,6 @@ export default class ScheduledMaintenanceCustomField extends AccessControlModel
|
||||
})
|
||||
public description?: string = undefined;
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
@@ -185,9 +182,7 @@ export default class ScheduledMaintenanceCustomField extends AccessControlModel
|
||||
Permission.ProjectMember,
|
||||
Permission.CanReadScheduledMaintenanceCustomField,
|
||||
],
|
||||
update: [
|
||||
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({ required: false, type: TableColumnType.LongText })
|
||||
@Column({
|
||||
@@ -298,5 +293,4 @@ export default class ScheduledMaintenanceCustomField extends AccessControlModel
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public deletedByUserId?: ObjectID = undefined;
|
||||
|
||||
}
|
||||
|
||||
@@ -144,8 +144,6 @@ export default class StatusPageCustomField extends AccessControlModel {
|
||||
@UniqueColumnBy('projectId')
|
||||
public name?: string = undefined;
|
||||
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
@@ -172,7 +170,6 @@ export default class StatusPageCustomField extends AccessControlModel {
|
||||
})
|
||||
public description?: string = undefined;
|
||||
|
||||
|
||||
@ColumnAccessControl({
|
||||
create: [
|
||||
Permission.ProjectOwner,
|
||||
@@ -185,9 +182,7 @@ export default class StatusPageCustomField extends AccessControlModel {
|
||||
Permission.ProjectMember,
|
||||
Permission.CanReadStatusPageCustomField,
|
||||
],
|
||||
update: [
|
||||
|
||||
],
|
||||
update: [],
|
||||
})
|
||||
@TableColumn({ required: false, type: TableColumnType.LongText })
|
||||
@Column({
|
||||
@@ -298,5 +293,4 @@ export default class StatusPageCustomField extends AccessControlModel {
|
||||
transformer: ObjectID.getDatabaseTransformer(),
|
||||
})
|
||||
public deletedByUserId?: ObjectID = undefined;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user