Skip to content

Commit 36367fc

Browse files
authored
Merge pull request #522 from metrico/feat/faro-logs
fix: default timerange to five minutes
2 parents f857561 + 0166433 commit 36367fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1860
-224
lines changed

Diff for: README.md

+6
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ _JSON stringifyed and URL encoded_
151151

152152
------------
153153

154+
### Local Proxy for headeless qryn-view (for experimentation purposes only):
155+
156+
Add to you .env file:
157+
158+
`VITE_API_BASE_URL= { your local qryn api }`
159+
should we with same protocol as your qryn-view instance
154160

155161
### About qryn
156162

Diff for: packages/main/helpers/stateFromQueryParams.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import setDebug from "./setDebug";
33
import moment from "moment";
44
import { nanoid } from "nanoid";
55
import DOMPurify from "isomorphic-dompurify";
6+
import addMinutes from "date-fns/addMinutes";
67
const BOOLEAN_VALUES = ["isSubmit", "isSplit", "autoTheme", "isEmbed"];
78
export const initialUrlState: any = {
89
query: "",
@@ -35,7 +36,7 @@ export const initialUrlState: any = {
3536
values: [], // label name selected
3637
response: {}, // the target should be just the last one
3738
open: true,
38-
start: new Date(Date.now() - 5 * 60000),
39+
start: addMinutes(new Date(Date.now()), -5),
3940
time: "", // for instant queries
4041
stop: new Date(Date.now()),
4142
label: "",
@@ -66,7 +67,7 @@ export const initialUrlState: any = {
6667
values: [], // label name selected
6768
response: {}, // the target should be just the last one
6869
open: false,
69-
start: new Date(Date.now() - 5 * 60000),
70+
start: addMinutes(new Date(Date.now()), -5),
7071
time: "", // for instant queries
7172
stop: new Date(Date.now()),
7273
label: "",

Diff for: packages/main/package.json

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"@emotion/is-prop-valid": "^1.3.0",
1515
"@emotion/react": "^11.13.0",
1616
"@emotion/styled": "^11.11.5",
17+
"@fingerprintjs/fingerprintjs": "^4.5.0",
1718
"@microlink/react-json-view": "latest",
1819
"@mui/base": "5.0.0-beta.5",
1920
"@mui/icons-material": "^5.15.20",
@@ -30,6 +31,7 @@
3031
"dayjs": "^1.11.12",
3132
"deep-freeze": "^0.0.1",
3233
"dnd-core": "^16.0.1",
34+
"echarts": "^5.5.1",
3335
"fuzzy": "^0.1.3",
3436
"immutability-helper": "^3.1.1",
3537
"isomorphic-dompurify": "^1.13.0",
@@ -62,19 +64,23 @@
6264
"slate-history": "^0.100.0",
6365
"slate-react": "^0.105.0",
6466
"tss-react": "^4.9.10",
67+
"uuid": "^10.0.0",
68+
"web-vitals": "^4.2.3",
6569
"zod": "^3.23.8",
6670
"zustand": "^4.5.2"
6771
},
6872
"devDependencies": {
6973
"@emotion/babel-plugin": "^11.12.0",
7074
"@testing-library/react": "^14.3.1",
75+
"@types/fingerprintjs": "^0.5.28",
7176
"@types/jest": "^29.5.12",
7277
"@types/react": "^18.3.3",
7378
"@types/react-dom": "^18.3.0",
7479
"@typescript-eslint/eslint-plugin": "^7.17.0",
7580
"@typescript-eslint/parser": "^7.17.0",
7681
"@vitejs/plugin-basic-ssl": "^1.1.0",
7782
"@vitejs/plugin-react": "^4.3.1",
83+
"dayjs-plugin-utc": "^0.1.2",
7884
"eslint": "^8.57.0",
7985
"eslint-plugin-react-hooks": "^4.6.2",
8086
"eslint-plugin-react-refresh": "^0.4.7",

Diff for: packages/main/plugins/PluginCards.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const PluginCards: React.FC<{
6868
const theme = useTheme();
6969

7070
return (
71-
<div>
71+
<div style={{ display: "flex", gap: ".5em" }}>
7272
{filteredComponentList?.length > 0 &&
7373
filteredComponentList?.map((component: any, k: number) => (
7474
<PluginCard

Diff for: packages/main/plugins/PluginStyles.tsx

+25-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { css } from '@emotion/css'
1+
import { css } from "@emotion/css";
22
import { QrynTheme } from "@ui/theme/types";
33

44
export const PluginPageStyles = (theme: QrynTheme) => css`
@@ -15,6 +15,7 @@ export const PluginPageStyles = (theme: QrynTheme) => css`
1515
flex: 1;
1616
overflow-x: hidden;
1717
display: flex;
18+
flex-direction: column;
1819
flex: 1;
1920
height: 100%;
2021
overflow: hidden;
@@ -25,6 +26,28 @@ export const PluginPageStyles = (theme: QrynTheme) => css`
2526
font-size: 14px;
2627
color: ${theme.contrast};
2728
}
29+
.page-header {
30+
border-bottom: 1px solid ${theme.shadow};
31+
margin-bottom: 0.5em;
32+
padding: 1em 0.25em;
33+
display: flex;
34+
gap: 0.25em;
35+
align-items: baseline;
36+
h1 {
37+
font-size: 1.5em;
38+
color: ${theme.contrast};
39+
}
40+
h3 {
41+
font-size: 1.25em;
42+
color: ${theme.contrastNeutral};
43+
}
44+
}
45+
.cards-container {
46+
display: flex;
47+
flex-direction: row;
48+
flex: 1;
49+
gap: 1em;
50+
}
2851
`;
2952

3053
export const PluginCardStyles = (theme: QrynTheme) => css`
@@ -77,4 +100,4 @@ export const InlineSwitch = css`
77100
display: flex;
78101
align-items: center;
79102
justify-content: space-between;
80-
`;
103+
`;

Diff for: packages/main/plugins/Plugins.tsx

+19-9
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ import useTheme from "@ui/theme/useTheme";
44
import { LocalPluginsManagement } from "./PluginManagerFactory";
55
import { PluginPageStyles } from "./PluginStyles";
66
import { PluginCards } from "./PluginCards";
7+
import { useWebVitals } from "@ui/plugins/WebVitals/useWebVitals";
78

89
export default function Plugins() {
910
const theme = useTheme();
11+
// check web vitals
12+
useWebVitals({ page: "Plugins" });
1013
const pl = LocalPluginsManagement();
1114
const [local] = useState(pl.getAll());
1215
const plugins: any = useMemo(() => {
@@ -18,15 +21,22 @@ export default function Plugins() {
1821

1922
return (
2023
<div className={cx(PluginPageStyles(theme))}>
21-
{plugins?.length > 0 &&
22-
plugins?.map(([section, components]: any, index: number) => (
23-
<div style={{ marginTop: "4px" }} key={index}>
24-
<PluginCards
25-
components={components}
26-
section={section}
27-
/>
28-
</div>
29-
))}
24+
<div className="page-header">
25+
<h1>Plugins</h1>
26+
<h3>(need to reload page to activate)</h3>
27+
</div>
28+
<div className="cards-container">
29+
{plugins?.length > 0 &&
30+
plugins?.map(
31+
([section, components]: any, index: number) => (
32+
<PluginCards
33+
key={index}
34+
components={components}
35+
section={section}
36+
/>
37+
)
38+
)}
39+
</div>
3040
</div>
3141
);
3242
}

Diff for: packages/main/plugins/PluginsRenderer.tsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ interface PluginRendererProps {
88

99
const PluginRenderer: React.FC<PluginRendererProps> = (props) => {
1010
const { section, localProps } = props;
11-
return (
12-
<div className="renderer-content">
11+
return (
12+
<div
13+
style={{
14+
display: "flex",
15+
gap: ".5em",
16+
alignItems: "center",
17+
padding: ".5em",
18+
}}
19+
>
1320
{PluginManager.getPlugins(section)?.length > 0 &&
1421
PluginManager.getPlugins(section)?.map(
15-
(
22+
(
1623
{
1724
name,
1825
Component,

Diff for: packages/main/plugins/QueryTest/index.tsx

-12
This file was deleted.

Diff for: packages/main/plugins/WebVitals/WebVitals.tsx

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React from "react";
2+
import { WebVitalsStore } from "./store";
3+
import CustomSwitch from "@ui/qrynui/CustomSwitch/CustomSwitch";
4+
import { css, cx } from "@emotion/css";
5+
import useTheme from "@ui/theme/useTheme";
6+
import { QrynTheme } from "@ui/theme/types";
7+
import Tooltip from "@mui/material/Tooltip";
8+
const WebVitalStyles = (theme: QrynTheme) => css`
9+
display: flex;
10+
align-items: center;
11+
p {
12+
font-size: 0.75em;
13+
color: ${theme.contrast};
14+
}
15+
`;
16+
17+
export const WebVitals: React.FC = () => {
18+
const {
19+
webVitalsActive,
20+
httpPerformanceActive,
21+
setWebVitalsActive,
22+
setHttpPerformanceActive,
23+
qrynInstance
24+
} = WebVitalsStore();
25+
26+
const theme = useTheme();
27+
const onWebVitalsActivate = () => {
28+
setWebVitalsActive(webVitalsActive);
29+
};
30+
const onHttpPerformanceRequestActivate = () => {
31+
setHttpPerformanceActive(httpPerformanceActive)
32+
}
33+
34+
return (
35+
<div className={cx(WebVitalStyles(theme))}>
36+
<Tooltip title="Monitor Web vitals sending data to Qryn">
37+
<p>Monitor WebVitals</p>
38+
</Tooltip>
39+
<CustomSwitch
40+
onChange={onWebVitalsActivate}
41+
defaultActive={webVitalsActive}
42+
/>
43+
<Tooltip title="Monitor HTTP Requests sending data to Qryn">
44+
<p>Monitor HTTP Requests</p>
45+
</Tooltip>
46+
<CustomSwitch
47+
onChange={onHttpPerformanceRequestActivate}
48+
defaultActive={httpPerformanceActive}
49+
/>
50+
<Tooltip title="Your qryn-view instance tag to monitor statistics">
51+
<p>Instance: {qrynInstance ?? ""}</p>
52+
</Tooltip>
53+
</div>
54+
);
55+
};

0 commit comments

Comments
 (0)