forked from bytedance/fedlearner
-
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.
feat(web_console): show charts of job: (bytedance#293)
* mask sensible info in kibana url * add config KIBANA_HOST KIBANA_PORT Co-authored-by: shenshihao <[email protected]>
- Loading branch information
1 parent
769a18a
commit 2f75fa9
Showing
5 changed files
with
69 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import useSWR from 'swr'; | ||
import { useRouter } from 'next/router'; | ||
import { Text, Card, Grid } from '@zeit-ui/react' | ||
|
||
import { fetcher } from '../../../libs/http'; | ||
import Layout from '../../../components/Layout'; | ||
import css from 'styled-jsx/css'; | ||
|
||
const { converted2Urls } = require('../../../utils/kibana') | ||
|
||
function useStyle () { | ||
return css` | ||
iframe { | ||
border: none; | ||
width: 100%; | ||
height: 80vh; | ||
} | ||
` | ||
} | ||
|
||
export default function charts (props) { | ||
const router = useRouter() | ||
const styles = useStyle() | ||
const { id } = router.query | ||
const { data: jobData } = useSWR(id ? `job/${id}` : null, fetcher); | ||
const job = jobData ? jobData.data : null; | ||
const urls = job | ||
? converted2Urls( | ||
job.localdata.job_type, job.localdata.created_at, | ||
new Date().toISOString(), job.localdata.name | ||
) | ||
: [] | ||
return ( | ||
<Layout theme={props.theme} toggleTheme={props.toggleTheme}> | ||
<Text h2>{job?.localdata.name || 'Loading...'}</Text> | ||
<Grid.Container gap={2}> | ||
{urls.map(url => | ||
<Grid sm={24} md={24}> | ||
<Card> | ||
<iframe src={url}/> | ||
</Card> | ||
</Grid> | ||
)} | ||
</Grid.Container> | ||
<style jsx>{styles}</style> | ||
</Layout> | ||
) | ||
} |
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 |
---|---|---|
|
@@ -55,4 +55,6 @@ const metrics_list = { | |
title: "count of fail to load data block" | ||
} | ||
] | ||
}; | ||
}; | ||
|
||
module.exports = { metrics_list } |