@syncular/console 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +67 -0
- package/src/App.tsx +44 -0
- package/src/hooks/ConnectionContext.tsx +213 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useConsoleApi.ts +926 -0
- package/src/hooks/useInstanceContext.ts +31 -0
- package/src/hooks/useLiveEvents.ts +267 -0
- package/src/hooks/useLocalStorage.ts +40 -0
- package/src/hooks/usePartitionContext.ts +31 -0
- package/src/hooks/usePreferences.ts +72 -0
- package/src/hooks/useRequestEvents.ts +35 -0
- package/src/hooks/useTimeRange.ts +34 -0
- package/src/index.ts +8 -0
- package/src/layout.tsx +240 -0
- package/src/lib/api.ts +26 -0
- package/src/lib/topology.ts +102 -0
- package/src/lib/types.ts +228 -0
- package/src/mount.tsx +39 -0
- package/src/pages/Command.tsx +382 -0
- package/src/pages/Config.tsx +1190 -0
- package/src/pages/Fleet.tsx +242 -0
- package/src/pages/Ops.tsx +753 -0
- package/src/pages/Stream.tsx +854 -0
- package/src/pages/index.ts +5 -0
- package/src/routeTree.ts +18 -0
- package/src/routes/__root.tsx +6 -0
- package/src/routes/config.tsx +9 -0
- package/src/routes/fleet.tsx +9 -0
- package/src/routes/index.tsx +9 -0
- package/src/routes/investigate-commit.tsx +14 -0
- package/src/routes/investigate-event.tsx +14 -0
- package/src/routes/ops.tsx +9 -0
- package/src/routes/stream.tsx +9 -0
- package/src/sentry.ts +70 -0
- package/src/styles/globals.css +1 -0
package/src/routeTree.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Route as rootRoute } from './routes/__root';
|
|
2
|
+
import { Route as configRoute } from './routes/config';
|
|
3
|
+
import { Route as fleetRoute } from './routes/fleet';
|
|
4
|
+
import { Route as indexRoute } from './routes/index';
|
|
5
|
+
import { Route as investigateCommitRoute } from './routes/investigate-commit';
|
|
6
|
+
import { Route as investigateEventRoute } from './routes/investigate-event';
|
|
7
|
+
import { Route as opsRoute } from './routes/ops';
|
|
8
|
+
import { Route as streamRoute } from './routes/stream';
|
|
9
|
+
|
|
10
|
+
export const routeTree = rootRoute.addChildren([
|
|
11
|
+
indexRoute,
|
|
12
|
+
streamRoute,
|
|
13
|
+
investigateCommitRoute,
|
|
14
|
+
investigateEventRoute,
|
|
15
|
+
fleetRoute,
|
|
16
|
+
opsRoute,
|
|
17
|
+
configRoute,
|
|
18
|
+
]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRoute } from '@tanstack/react-router';
|
|
2
|
+
import { Stream } from '../pages';
|
|
3
|
+
import { Route as rootRoute } from './__root';
|
|
4
|
+
|
|
5
|
+
function InvestigateCommit() {
|
|
6
|
+
const { seq } = Route.useParams();
|
|
7
|
+
return <Stream initialSelectedEntryId={`#${seq}`} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Route = createRoute({
|
|
11
|
+
getParentRoute: () => rootRoute,
|
|
12
|
+
path: '/investigate/commit/$seq',
|
|
13
|
+
component: InvestigateCommit,
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRoute } from '@tanstack/react-router';
|
|
2
|
+
import { Stream } from '../pages';
|
|
3
|
+
import { Route as rootRoute } from './__root';
|
|
4
|
+
|
|
5
|
+
function InvestigateEvent() {
|
|
6
|
+
const { id } = Route.useParams();
|
|
7
|
+
return <Stream initialSelectedEntryId={`E${id}`} />;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Route = createRoute({
|
|
11
|
+
getParentRoute: () => rootRoute,
|
|
12
|
+
path: '/investigate/event/$id',
|
|
13
|
+
component: InvestigateEvent,
|
|
14
|
+
});
|
package/src/sentry.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { BrowserSentryInitOptions } from '@syncular/observability-sentry';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
var __SYNCULAR_SENTRY_DSN__: string | undefined;
|
|
5
|
+
var __SYNCULAR_SENTRY_ENVIRONMENT__: string | undefined;
|
|
6
|
+
var __SYNCULAR_SENTRY_RELEASE__: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const SENTRY_DSN_META = 'syncular-sentry-dsn';
|
|
10
|
+
const SENTRY_ENVIRONMENT_META = 'syncular-sentry-environment';
|
|
11
|
+
const SENTRY_RELEASE_META = 'syncular-sentry-release';
|
|
12
|
+
|
|
13
|
+
function cleanValue(value: string | null | undefined): string | undefined {
|
|
14
|
+
if (!value) return undefined;
|
|
15
|
+
const trimmed = value.trim();
|
|
16
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function readMeta(name: string): string | undefined {
|
|
20
|
+
if (typeof document === 'undefined') return undefined;
|
|
21
|
+
const value = document
|
|
22
|
+
.querySelector(`meta[name="${name}"]`)
|
|
23
|
+
?.getAttribute('content');
|
|
24
|
+
return cleanValue(value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function readEnv(name: string): string | undefined {
|
|
28
|
+
if (typeof process === 'undefined') return undefined;
|
|
29
|
+
return cleanValue(process.env[name]);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function firstDefined(values: Array<string | undefined>): string | undefined {
|
|
33
|
+
for (const value of values) {
|
|
34
|
+
if (value) return value;
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Resolve browser Sentry options from globals, meta tags, or build-time env.
|
|
41
|
+
*/
|
|
42
|
+
export function resolveConsoleBrowserSentryOptions(): BrowserSentryInitOptions | null {
|
|
43
|
+
const dsn = firstDefined([
|
|
44
|
+
cleanValue(globalThis.__SYNCULAR_SENTRY_DSN__),
|
|
45
|
+
readMeta(SENTRY_DSN_META),
|
|
46
|
+
readEnv('SYNCULAR_SENTRY_DSN'),
|
|
47
|
+
]);
|
|
48
|
+
|
|
49
|
+
if (!dsn) return null;
|
|
50
|
+
|
|
51
|
+
const environment = firstDefined([
|
|
52
|
+
cleanValue(globalThis.__SYNCULAR_SENTRY_ENVIRONMENT__),
|
|
53
|
+
readMeta(SENTRY_ENVIRONMENT_META),
|
|
54
|
+
readEnv('SYNCULAR_SENTRY_ENVIRONMENT'),
|
|
55
|
+
]);
|
|
56
|
+
const release = firstDefined([
|
|
57
|
+
cleanValue(globalThis.__SYNCULAR_SENTRY_RELEASE__),
|
|
58
|
+
readMeta(SENTRY_RELEASE_META),
|
|
59
|
+
readEnv('SYNCULAR_SENTRY_RELEASE'),
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
dsn,
|
|
64
|
+
environment,
|
|
65
|
+
release,
|
|
66
|
+
enableLogs: true,
|
|
67
|
+
tracesSampleRate: 0.2,
|
|
68
|
+
tracePropagationTargets: [/^https?:\/\/.*\/api\/.*/],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "@syncular/ui/styles.css";
|