Skip to content

Commit

Permalink
feat(conprof): refine
Browse files Browse the repository at this point in the history
  • Loading branch information
baurine committed Nov 9, 2023
1 parent 9ad3206 commit f0901fd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ export const ctx: (
cfg: {
apiPathBase: client.getBasePath(),
publicPathBase,
checkNgm: true,
showSetting: true,
...cfg
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ export const ctx: IConProfilingContext = {
ds,
cfg: {
apiPathBase: client.getBasePath(),
publicPathBase,
checkNgm: true,
showSetting: true,
listDuration: 2
publicPathBase
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,13 @@ export interface IConProfilingDataSource {

export interface IConProfilingConfig extends IContextConfig {
publicPathBase: string
checkNgm: boolean

showSetting: boolean
checkNgm?: boolean // default value is true
showSetting?: boolean // default value is true
enableDownloadGroup?: boolean // default value is true
enableDotGraph?: boolean // default value is true
enablePreviewGoroutine?: boolean // default value is true

listDuration?: number // unit hour, 1 means 1 hour, 2 means 2 hours
listDuration?: number // unit hour, 1 means 1 hour, 2 means 2 hours, default value is 2 hours
}

export interface IConProfilingContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ addTranslations(translations)
function AppRoutes() {
useLocationChange()
const ctx = useContext(ConProfilingContext)
const checkNgm = ctx?.cfg.checkNgm ?? true

return (
<Routes>
<Route
path="/continuous_profiling"
element={
ctx?.cfg.checkNgm ? (
checkNgm ? (
<NgmNotStartedGuard>
<List />
</NgmNotStartedGuard>
Expand All @@ -32,7 +33,7 @@ function AppRoutes() {
<Route
path="/continuous_profiling/detail"
element={
ctx?.cfg.checkNgm ? (
checkNgm ? (
<NgmNotStartedGuard>
<ParamsPageWrapper>
<Detail />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { useURLTimeRange } from '@lib/hooks/useURLTimeRange'

export default function Page() {
const ctx = useContext(ConProfilingContext)
const showSetting = ctx?.cfg.showSetting ?? true
const durationHour = ctx?.cfg.listDuration ?? 2

const { timeRange, setTimeRange } = useURLTimeRange()
Expand Down Expand Up @@ -257,7 +258,7 @@ export default function Page() {
<ReloadOutlined onClick={refresh} />
)}
</Tooltip>
{ctx?.cfg.showSetting && (
{showSetting && (
<Tooltip
mouseEnterDelay={0}
mouseLeaveDelay={0}
Expand Down

0 comments on commit f0901fd

Please sign in to comment.