File tree 2 files changed +24
-0
lines changed
pages/ContentScripts/features/perceptor-layout
2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ import request from '../helpers/request' ;
2
+ import { ErrorCode , OSS_XLAB_ENDPOINT } from '../constant' ;
3
+
4
+ export const getMetricByDate = async ( repoName : string , date : string ) => {
5
+ try {
6
+ return await request (
7
+ `${ OSS_XLAB_ENDPOINT } /open_digger/github/${ repoName } /project_openrank_detail/${ date } .json`
8
+ ) ;
9
+ } catch ( error ) {
10
+ // the catched error being "404" means the metric file is not available so return a null
11
+ if ( error === ErrorCode . NOT_FOUND ) {
12
+ return null ;
13
+ } else {
14
+ // other errors should be throwed
15
+ throw error ;
16
+ }
17
+ }
18
+ } ;
19
+
20
+ export const getOpenrank = async ( repo : string , date : string ) => {
21
+ return getMetricByDate ( repo , date ) ;
22
+ } ;
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ const View = (): JSX.Element => {
5
5
< >
6
6
< div id = "hypercrx-perceptor-slot-repo-activity-racing-bar" />
7
7
< div id = "hypercrx-perceptor-slot-repo-networks" />
8
+ < div id = "hypercrx-perceptor-slot-community-openrank-racing-bar" />
9
+ < div id = "hypercrx-perceptor-slot-community-openrank-network" />
8
10
</ >
9
11
) ;
10
12
} ;
You can’t perform that action at this time.
0 commit comments