GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Show the UDF files in the profiler · feldera/feldera@bc20408

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • js-packages
    • profiler-app
      • src
        • App.svelte
      • vite.config.ts
    • profiler-layout
      • README.md
      • src/lib
        • components
          • SourceCodeView.svelte.spec.ts
          • SourceCodeView.svelte
          • SupportBundleViewerLayout.svelte.spec.ts
          • SupportBundleViewerLayout.svelte
          • sqlSelection.test.ts
          • tabs
            • SourceTab.svelte
            • SqlTab.svelte
        • functions
          • processZipBundle.test.ts
          • processZipBundle.ts
        • index.ts
        • test-support
          • ComponentStub.svelte
          • LayoutPanelStub.svelte
    • web-console/src/routes/(system)/(authenticated)/(authorized)/profile-viewer
      • +page.svelte
      • profileViewerPage.svelte.spec.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎js-packages/profiler-app/src/App.svelte‎

Copy file name to clipboardExpand all lines: js-packages/profiler-app/src/App.svelte
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
type GlobalMetrics,
77
getSuitableProfiles,
88
processProfileFiles,
9+
type SourceFile,
910
SupportBundleViewerLayout,
1011
type ZipItem
1112
} from 'profiler-layout'
@@ -24,12 +25,12 @@
2425
let profileData: {
2526
profile: JsonProfiles | undefined
2627
dataflow: Dataflow | undefined
27-
sources: string[] | undefined
2828
logText: string | undefined
2929
globalMetrics: GlobalMetrics | undefined
3030
connectorStatus: ConnectorStatus | undefined
3131
runtimeConfig: unknown
3232
pipelineEvents: PipelineMonitorEvent[] | undefined
33+
sourceFiles: SourceFile[] | undefined
3334
} | null = $state(null)
3435
3536
let fileInput: HTMLInputElement | null = $state(null)
@@ -50,12 +51,12 @@
5051
profileData = {
5152
profile: data.profile,
5253
dataflow: data.dataflow,
53-
sources: data.sources,
5454
logText: data.logText,
5555
globalMetrics: data.globalMetrics,
5656
connectorStatus: data.connectorStatus,
5757
runtimeConfig: data.runtimeConfig,
58-
pipelineEvents: data.pipelineEvents
58+
pipelineEvents: data.pipelineEvents,
59+
sourceFiles: data.sourceFiles
5960
}
6061
}
6162
@@ -120,12 +121,12 @@
120121
<SupportBundleViewerLayout
121122
profileData={profileData.profile}
122123
dataflowData={profileData.dataflow}
123-
programCode={profileData.sources}
124124
logText={profileData.logText}
125125
globalMetrics={profileData.globalMetrics}
126126
connectorStatus={profileData.connectorStatus}
127127
runtimeConfig={profileData.runtimeConfig}
128128
pipelineEvents={profileData.pipelineEvents}
129+
sourceFiles={profileData.sourceFiles}
129130
triageResults={new TriageResults()}
130131
{profileFiles}
131132
{selectedTimestamp}
Collapse file

‎js-packages/profiler-app/vite.config.ts‎

Copy file name to clipboardExpand all lines: js-packages/profiler-app/vite.config.ts
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ export default defineConfig({
1212
tailwindcss(),
1313
svelte(),
1414
svg(),
15-
// Trim monaco to the bare minimum needed for read-only SQL viewing, and
16-
// inline the workers so `viteSingleFile` produces a true self-contained bundle.
17-
// The SqlCodeView (consumed via profiler-layout) renders SQL with line numbers,
18-
// range highlighting via decorations, and a small lookup-cycling search.
15+
// Bundle only the Monaco languages and features that the read-only SourceCodeView of
16+
// profiler-layout uses, and inline the workers so that `viteSingleFile` makes one
17+
// self-contained file. SourceCodeView shows TOML with the `graphql` grammar.
1918
// The plugin neuters `vs/language/<x>/` dynamic imports for any language not
2019
// listed here, so MonacoEditor's optional JSON-schema field costs nothing.
2120
monaco({
22-
languages: ['sql'],
21+
languages: ['sql', 'rust', 'graphql'],
2322
features: ['browser', 'clipboard', 'find', 'wordHighlighter'],
2423
inlineWorkers: true
2524
}),
Collapse file

‎js-packages/profiler-layout/README.md‎

Copy file name to clipboardExpand all lines: js-packages/profiler-layout/README.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Runthe build to test changes in consuming apps.
2828
- **`ProfilerDiagram`** - Circuit graph renderer
2929
- **`ProfilerTooltip`** - Node metrics details display
3030
- **`ProfileTimestampSelector`** - Timestamp navigation dropdown
31-
- **`SqlCodeView`**, **`BundleLogsView`**, **`TriageResultsView`** - The panels the layout hosts
31+
- **`SourceCodeView`**, **`BundleLogsView`**, **`TriageResultsView`** - The panels the layout hosts
3232

3333
## Exported Utilities
3434

Collapse file

‎…ut/src/lib/components/SqlCodeView.svelte‎ ‎…src/lib/components/SourceCodeView.svelte‎js-packages/profiler-layout/src/lib/components/SqlCodeView.svelte renamed to js-packages/profiler-layout/src/lib/components/SourceCodeView.svelte js-packages/profiler-layout/src/lib/components/SqlCodeView.svelte renamed to js-packages/profiler-layout/src/lib/components/SourceCodeView.svelte

Copy file name to clipboardExpand all lines: js-packages/profiler-layout/src/lib/components/SourceCodeView.svelte
+13-10Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@
1414
import { MonacoEditor, setSelections } from 'common-ui'
1515
import * as monaco from 'monaco-editor'
1616
import type { SourcePositionRange } from 'profiler-lib'
17+
import { untrack } from 'svelte'
18+
import type { SourceFile } from '../functions/processZipBundle'
1719
1820
interface Props {
19-
code: string
21+
/** The view reads `name` and `language` once, at mount. `name` is the URI of the Monaco
22+
* model, so two mounted views must show different files. */
23+
file: SourceFile
2024
highlightRanges?: SourcePositionRange[]
2125
}
2226
23-
let { code, highlightRanges = [] }: Props = $props()
27+
let { file, highlightRanges = [] }: Props = $props()
2428
2529
let editor: monaco.editor.IStandaloneCodeEditor | undefined = $state()
2630
let isDarkMode = $state(false)
@@ -34,16 +38,15 @@
3438
return () => observer.disconnect()
3539
})
3640
37-
// This component is mounted once (hoisted into a <PersistentContent> overlay by
38-
// SupportBundleViewerLayout), so it owns a single model on a fixed URI. The model's contents are
39-
// refreshed whenever `code` changes — including when a new support bundle loads a different
40-
// program — and the model is disposed when the component unmounts.
41-
const modelUri = monaco.Uri.parse('inmemory://profiler/program.sql')
42-
const model = monaco.editor.createModel('', 'sql', modelUri)
41+
// The view updates its model when `file.code` changes, for example when a new bundle loads. It
42+
// disposes the model when it unmounts.
43+
const { name, language } = untrack(() => file)
44+
const modelUri = monaco.Uri.parse(`inmemory://profiler/${name}`)
45+
const model = monaco.editor.createModel('', language, modelUri)
4346
4447
$effect(() => {
45-
if (model.getValue() !== code) {
46-
model.setValue(code)
48+
if (model.getValue() !== file.code) {
49+
model.setValue(file.code)
4750
}
4851
})
4952
Collapse file

‎js-packages/profiler-layout/src/lib/components/SourceCodeView.svelte.spec.ts‎

Copy file name to clipboard
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import * as monaco from 'monaco-editor'
2+
import { describe, expect, it } from 'vitest'
3+
import { render } from 'vitest-browser-svelte'
4+
import SourceCodeView from './SourceCodeView.svelte'
5+
6+
const modelOf = (name: string) =>
7+
monaco.editor.getModel(monaco.Uri.parse(`inmemory://profiler/${name}`))
8+
9+
describe('SourceCodeView', () => {
10+
it('shows a file in the language of the file', () => {
11+
const view = render(SourceCodeView, {
12+
file: { name: 'udf.rs', language: 'rust', code: 'pub fn f() {}' }
13+
})
14+
expect(modelOf('udf.rs')?.getLanguageId()).toBe('rust')
15+
expect(modelOf('udf.rs')?.getValue()).toBe('pub fn f() {}')
16+
view.unmount()
17+
expect(modelOf('udf.rs')).toBeNull()
18+
})
19+
20+
it('shows the new code when the file changes', async () => {
21+
const file = { name: 'udf.rs', language: 'rust', code: 'pub fn f() {}' } as const
22+
const view = render(SourceCodeView, { file })
23+
await view.rerender({ file: { ...file, code: 'pub fn g() {}' } })
24+
expect(modelOf('udf.rs')?.getValue()).toBe('pub fn g() {}')
25+
view.unmount()
26+
})
27+
28+
it('gives each file its own model, so two files can be mounted at the same time', () => {
29+
// A tab switch can mount the next file before it unmounts the previous file.
30+
const sql = render(SourceCodeView, {
31+
file: { name: 'program.sql', language: 'sql', code: 'SELECT 1;' }
32+
})
33+
const udf = render(SourceCodeView, {
34+
file: { name: 'udf.rs', language: 'rust', code: 'pub fn f() {}' }
35+
})
36+
expect(modelOf('program.sql')?.getValue()).toBe('SELECT 1;')
37+
expect(modelOf('udf.rs')?.getValue()).toBe('pub fn f() {}')
38+
sql.unmount()
39+
udf.unmount()
40+
})
41+
})

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.