mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Refactor Markdown class to convert tags > and < to > and <
This commit is contained in:
@@ -17,6 +17,10 @@ export default class Markdown {
|
||||
markdown: string,
|
||||
contentType: MarkdownContentType,
|
||||
): Promise<string> {
|
||||
// convert tags > and < to > and <
|
||||
markdown = markdown.replace(/</g, "<");
|
||||
markdown = markdown.replace(/>/g, ">");
|
||||
|
||||
let renderer: Renderer | null = null;
|
||||
|
||||
if (contentType === MarkdownContentType.Blog) {
|
||||
|
||||
@@ -133,15 +133,19 @@ const DashboardCanvas: FunctionComponent<ComponentProps> = (
|
||||
setSelectedComponentId(component.componentId.toString());
|
||||
}}
|
||||
onComponentUpdate={(updatedComponent: DashboardBaseComponent) => {
|
||||
const updatedComponents: Array<DashboardBaseComponent> = props.dashboardViewConfig.components.map(
|
||||
(component: DashboardBaseComponent) => {
|
||||
if (component.componentId.toString() === updatedComponent.componentId.toString()) {
|
||||
return updatedComponent;
|
||||
}
|
||||
const updatedComponents: Array<DashboardBaseComponent> =
|
||||
props.dashboardViewConfig.components.map(
|
||||
(component: DashboardBaseComponent) => {
|
||||
if (
|
||||
component.componentId.toString() ===
|
||||
updatedComponent.componentId.toString()
|
||||
) {
|
||||
return updatedComponent;
|
||||
}
|
||||
|
||||
return component;
|
||||
},
|
||||
);
|
||||
return component;
|
||||
},
|
||||
);
|
||||
|
||||
const updatedDashboardViewConfig: DashboardViewConfig = {
|
||||
...props.dashboardViewConfig,
|
||||
|
||||
@@ -52,17 +52,9 @@ const DashboardBaseComponentElement: FunctionComponent<ComponentProps> = (
|
||||
left: "-9px",
|
||||
}}
|
||||
className="move-element cursor-move absolute w-4 h-4 bg-indigo-400 rounded-full cursor-pointer"
|
||||
onDragStart={(_event: React.DragEvent<HTMLDivElement>) => {
|
||||
|
||||
|
||||
}}
|
||||
onDragEnd={(_event: React.DragEvent<HTMLDivElement>) => {
|
||||
|
||||
|
||||
}}
|
||||
>
|
||||
|
||||
</div>
|
||||
onDragStart={(_event: React.DragEvent<HTMLDivElement>) => {}}
|
||||
onDragEnd={(_event: React.DragEvent<HTMLDivElement>) => {}}
|
||||
></div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -111,7 +103,6 @@ const DashboardBaseComponentElement: FunctionComponent<ComponentProps> = (
|
||||
style={{
|
||||
height: `${heightInRem}rem`,
|
||||
}}
|
||||
|
||||
>
|
||||
{getMoveElement()}
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@ export interface ComponentProps extends DashboardBaseComponentProps {
|
||||
component: DashboardChartComponent;
|
||||
}
|
||||
|
||||
const DashboardChartComponentElement: FunctionComponent<ComponentProps> = (
|
||||
_props: ComponentProps,
|
||||
): ReactElement => {
|
||||
const DashboardChartComponentElement: FunctionComponent = (): ReactElement => {
|
||||
return <div>Chart Component</div>;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@ export interface ComponentProps extends DashboardBaseComponentProps {
|
||||
component: DashboardTextComponent;
|
||||
}
|
||||
|
||||
const DashboardTextComponentElement: FunctionComponent<ComponentProps> = (
|
||||
_props: ComponentProps,
|
||||
): ReactElement => {
|
||||
const DashboardTextComponentElement: FunctionComponent = (): ReactElement => {
|
||||
return <div>Text Component</div>;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@ export interface ComponentProps extends DashboardBaseComponentProps {
|
||||
component: DashboardValueComponent;
|
||||
}
|
||||
|
||||
const DashboardValueComponentElement: FunctionComponent<ComponentProps> = (
|
||||
_props: ComponentProps,
|
||||
): ReactElement => {
|
||||
const DashboardValueComponentElement: FunctionComponent = (): ReactElement => {
|
||||
return <div>Value Component</div>;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,4 +4,7 @@ FROM fluentd
|
||||
USER root
|
||||
|
||||
# Install bash and curl.
|
||||
RUN apk add bash curl
|
||||
RUN apk add bash curl
|
||||
|
||||
EXPOSE 24224
|
||||
EXPOSE 8888
|
||||
@@ -10,5 +10,18 @@ This guide will help you test fluentd logs with OneUptime.
|
||||
- Telemetry Ingestion Key (Create one from the OneUptime dashboard, Click on More -> Project Settings -> Telemetry Ingestion Key)
|
||||
|
||||
|
||||
## Configuration
|
||||
## Configuration and Testing
|
||||
|
||||
- Please make sure the correct token and url is in the configuration file located at `Fluentd/fluent.conf`.
|
||||
- Build the docker image using the command `npm run force-build fluentd`
|
||||
- Run the docker image using the command `npm run dev fluentd`
|
||||
- Send logs to the Fluentd container using the curl command
|
||||
|
||||
```bash
|
||||
curl -X POST -d 'json={"action":"login","user":2}' http://localhost:8888/test.tag.here;
|
||||
```
|
||||
|
||||
You should be able to see the logs in the OneUptime dashboard.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,15 +10,23 @@
|
||||
bind 0.0.0.0
|
||||
</source>
|
||||
|
||||
<source>
|
||||
@type http
|
||||
port 8888
|
||||
bind 0.0.0.0
|
||||
body_size_limit 32m
|
||||
keepalive_timeout 10s
|
||||
</source>
|
||||
|
||||
# Match all patterns
|
||||
<match **>
|
||||
@type http
|
||||
|
||||
# endpoint http://ingestor:3400/ingestor/fluentd/v1/logs # This is if you're testing in local development
|
||||
endpoint http://ingestor:3400/ingestor/fluentd/v1/logs # This is for test environment
|
||||
endpoint https://oneuptime.com/fluentd/logs # This is for prod environment
|
||||
open_timeout 2
|
||||
|
||||
headers {"x-oneuptime-token":"6e16cfd0-5071-11ef-a5d5-e16a17b3db89", "x-oneuptime-service-name": "fluentd"}
|
||||
# Please make sure you change the token and service name to your own
|
||||
headers {"x-oneuptime-token":"caf42a30-8ace-11ef-b10a-eb9302809cb8", "x-oneuptime-service-name": "fluentd-logs"}
|
||||
|
||||
content_type application/json
|
||||
json_array true
|
||||
|
||||
@@ -50,9 +50,9 @@ router.post(
|
||||
|
||||
const dbLogs: Array<Log> = [];
|
||||
|
||||
const logItems: Array<JSONObject | string> = req.body as Array<
|
||||
JSONObject | string
|
||||
>;
|
||||
let logItems: Array<JSONObject | string> | JSONObject = req.body as
|
||||
| Array<JSONObject | string>
|
||||
| JSONObject;
|
||||
|
||||
let oneuptimeServiceName: string | string[] | undefined =
|
||||
req.headers["x-oneuptime-service-name"];
|
||||
@@ -69,6 +69,20 @@ router.post(
|
||||
projectId: (req as TelemetryRequest).projectId,
|
||||
});
|
||||
|
||||
if (
|
||||
logItems &&
|
||||
typeof logItems === "object" &&
|
||||
(logItems as JSONObject)["json"]
|
||||
) {
|
||||
logItems = (logItems as JSONObject)["json"] as
|
||||
| Array<JSONObject | string>
|
||||
| JSONObject;
|
||||
}
|
||||
|
||||
if (!Array.isArray(logItems)) {
|
||||
logItems = [logItems];
|
||||
}
|
||||
|
||||
for (let logItem of logItems) {
|
||||
const dbLog: Log = new Log();
|
||||
|
||||
@@ -81,6 +95,15 @@ router.post(
|
||||
|
||||
dbLog.severityText = LogSeverity.Unspecified;
|
||||
|
||||
if (typeof logItem === "string") {
|
||||
// check if its parseable to json
|
||||
try {
|
||||
logItem = JSON.parse(logItem);
|
||||
} catch (err) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof logItem !== "string") {
|
||||
logItem = JSON.stringify(logItem);
|
||||
}
|
||||
|
||||
@@ -362,6 +362,7 @@ services:
|
||||
ports:
|
||||
- 24224:24224
|
||||
- 24224:24224/udp
|
||||
- 8888:8888
|
||||
user: fluent
|
||||
extends:
|
||||
file: ./docker-compose.base.yml
|
||||
|
||||
Reference in New Issue
Block a user