Update component descriptions and add InlineCode component

This commit is contained in:
Simon Larsen 2024-03-13 17:22:07 +00:00
parent c76132fec0
commit f4b92789e7
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
4 changed files with 49 additions and 5 deletions

View File

@ -0,0 +1,17 @@
import React, { FunctionComponent, ReactElement } from 'react';
export interface ComponentProps {
text: string;
}
const InlineCode: FunctionComponent<ComponentProps> = (
props: ComponentProps
): ReactElement => {
return (
<span className="font-medium text-xs text-gray-500 border-gray-300 border-2 p-1 pl-2 pr-2 rounded">
{props.text}
</span>
);
};
export default InlineCode;

View File

@ -14,7 +14,7 @@ export interface ComponentProps<TBaseModel extends BaseModel> {
modelType: { new (): TBaseModel };
fieldName: keyof TBaseModel;
title: string;
description: string;
description: string | ReactElement;
modelId: ObjectID;
onUpdateComplete?: undefined | ((updatedValue: ObjectID) => void);
}
@ -66,7 +66,7 @@ const ResetObjectID: <TBaseModel extends BaseModel>(
<>
<Card
title={`${props.title}`}
description={`${props.description}`}
description={props.description}
buttons={[
{
title: `Reset ${tableColumnName}`,

View File

@ -21,6 +21,7 @@ import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import DisabledWarning from '../../../Components/Monitor/DisabledWarning';
import useAsyncEffect from 'use-async-effect';
import InlineCode from 'CommonUI/src/Components/InlineCode/InlineCode';
import DuplicateModel from 'CommonUI/src/Components/DuplicateModel/DuplicateModel';
import { GetReactElementFunction } from 'CommonUI/src/Types/FunctionTypes';
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
@ -137,7 +138,20 @@ const MonitorCriteria: FunctionComponent<PageComponentProps> = (
}}
fieldName={'incomingRequestSecretKey'}
title={'Reset Incoming Request Secret Key'}
description={`Your current incoming request secret key is: ${monitor.incomingRequestSecretKey?.toString()}. Resetting the secret key will generate a new key. Secret is used to authenticate incoming requests.`}
description={
<p className="mt-2">
Your current incoming request secret key is:{' '}
<InlineCode
text={
monitor.incomingRequestSecretKey?.toString() ||
'No key generated'
}
/>{' '}
Resetting the secret key will generate a new
key. Secret is used to authenticate incoming
requests.
</p>
}
modelId={modelId}
/>
</div>
@ -154,7 +168,20 @@ const MonitorCriteria: FunctionComponent<PageComponentProps> = (
}}
fieldName={'serverMonitorSecretKey'}
title={'Reset Server Monitor Secret Key'}
description={`Your current server monitor secret key is: ${monitor.serverMonitorSecretKey?.toString()}. Resetting the secret key will generate a new key. Secret is used to authenticate monitoring agents deployed on the.`}
description={
<p className="mt-2">
Your current server monitor secret key is:{' '}
<InlineCode
text={
monitor.serverMonitorSecretKey?.toString() ||
'No key generated'
}
/>{' '}
Resetting the secret key will generate a new
key. Secret is used to authenticate
monitoring agents deployed on the.
</p>
}
modelId={modelId}
/>
</div>

View File

@ -12,7 +12,7 @@
"dep-check": "npm install -g depcheck && depcheck ./ --skip-missing=true",
"test": "rm -rf build && jest --detectOpenHandles",
"coverage": "jest --detectOpenHandles --coverage",
"publish": "PACKAGE_NAME=@oneuptime/infrastructure-agent && bash ../Scripts/NPM/Publish.sh"
"publish": "PACKAGE_NAME=@oneuptime/infrastructure-agent && bash ./Scripts/NPM/Publish.sh"
},
"author": "",
"license": "ISC",