forked from grafana/pyroscope
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
loading app names, which is a proxy to /label-values?label=__name_
- Loading branch information
Showing
12 changed files
with
145 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useEffect } from 'react'; | ||
import { useAppDispatch } from '@webapp/redux/hooks'; | ||
import { reloadAppNames } from '@webapp/redux/reducers/continuous'; | ||
|
||
export function loadAppNames() { | ||
const dispatch = useAppDispatch(); | ||
|
||
useEffect(() => { | ||
async function run() { | ||
await dispatch(reloadAppNames()); | ||
} | ||
|
||
run(); | ||
}, [dispatch]); | ||
|
||
return []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Noop from './Noop'; | ||
export default Noop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function () { | ||
return <div>I am noop!!!!!!</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function () { | ||
<></>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { App, appsModel } from '@webapp/models/app'; | ||
import { Result } from '@webapp/util/fp'; | ||
import { z } from 'zod'; | ||
import type { ZodError } from 'zod'; | ||
import type { RequestError } from '@webapp/services/base'; | ||
import { parseResponse, request } from '@webapp/services/base'; | ||
|
||
export interface FetchAppsError { | ||
message?: string; | ||
} | ||
|
||
const appNamesResponse = z.array(z.string()).transform((names) => { | ||
return names.map((name) => { | ||
return { | ||
name, | ||
spyName: 'unknown', | ||
units: 'unknown', | ||
}; | ||
}); | ||
}); | ||
|
||
export async function fetchApps(): Promise< | ||
Result<App[], RequestError | ZodError> | ||
> { | ||
const response = await request('/pyroscope/label-values?label=__name__'); | ||
|
||
if (response.isOk) { | ||
return parseResponse(response, appNamesResponse); | ||
} | ||
|
||
return Result.err<App[], RequestError>(response.error); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import ContinuousSingleView from '@webapp/pages/ContinuousSingleView'; | ||
import { loadAppNames } from '../hooks/loadAppNames'; | ||
|
||
export { ContinuousSingleView as SingleView }; | ||
export function SingleView() { | ||
loadAppNames(); | ||
|
||
return <ContinuousSingleView />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters