Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metrics): Add monitor bandwidth
- Loading branch information
Showing
23 changed files
with
2,129 additions
and
405 deletions.
There are no files selected for viewing
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
client/react-native/common/components/Screens/Settings/Devtools/Networks/List.js
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,33 @@ | ||
import React, { PureComponent } from 'react' | ||
import { Header, Menu } from '../../../../Library' | ||
|
||
export default class List extends PureComponent { | ||
static navigationOptions = ({ navigation }) => ({ | ||
header: ( | ||
<Header | ||
navigation={navigation} | ||
title='Developer Tools' | ||
titleIcon='terminal' | ||
backBtn | ||
/> | ||
), | ||
tabBarVisible: false, | ||
}) | ||
|
||
render () { | ||
const { navigation } = this.props | ||
return ( | ||
<Menu absolute> | ||
<Menu.Section> | ||
<Menu.Item | ||
icon='list' | ||
title='List peers (not implemented)' | ||
onPress={() => { | ||
navigation.push('networks/peers') | ||
}} | ||
/> | ||
</Menu.Section> | ||
</Menu> | ||
) | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
client/react-native/common/components/Screens/Settings/Devtools/Networks/Peers.js
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,43 @@ | ||
import React, { PureComponent } from 'react' | ||
import { Text, View, ActivityIndicator } from 'react-native' | ||
import { Header, Screen } from '../../../../Library' | ||
import { QueryReducer } from '../../../../../relay' | ||
import { queries } from '../../../../../graphql' | ||
import { colors } from '../../../../../constants' | ||
|
||
export default class Peers extends PureComponent { | ||
static navigationOptions = ({ navigation }) => ({ | ||
header: ( | ||
<Header | ||
navigation={navigation} | ||
title='Peers List' | ||
titleIcon='list' | ||
backBtn | ||
/> | ||
), | ||
}) | ||
|
||
render () { | ||
return ( | ||
<Screen style={[{ backgroundColor: colors.white }]}> | ||
<QueryReducer query={queries.Peers}> | ||
{(state, retry) => { | ||
console.log('state:', state) | ||
switch (state.type) { | ||
case state.success: | ||
return ( | ||
<View> | ||
{state.data.Peers.list.map((peer, i) => ( | ||
<Text key={i}>{peer.id}</Text> | ||
))} | ||
</View> | ||
) | ||
default: | ||
return <ActivityIndicator /> | ||
} | ||
}} | ||
</QueryReducer> | ||
</Screen> | ||
) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
client/react-native/common/components/Screens/Settings/Devtools/Networks/index.js
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,21 @@ | ||
import React from 'react' | ||
import { createSubStackNavigator } from '../../../../../helpers/react-navigation' | ||
import { Header } from '../../../../Library' | ||
import List from './List' | ||
import Peers from './Peers' | ||
|
||
export default createSubStackNavigator( | ||
{ | ||
'networks/list': List, | ||
'networks/peers': Peers, | ||
}, | ||
{ | ||
initialRouteName: 'networks/list', | ||
navigationOptions: ({ navigation }) => ({ | ||
header: ( | ||
<Header navigation={navigation} title='Networks' titleIcon='activity' /> | ||
), | ||
tabBarVisible: false, | ||
}), | ||
} | ||
) |
43 changes: 43 additions & 0 deletions
43
client/react-native/common/components/Screens/Settings/Devtools/Peers.js
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,43 @@ | ||
import React, { PureComponent } from 'react' | ||
import { Menu, Header } from '../../../Library' | ||
import { mutations } from '../../../../graphql' | ||
|
||
export default class Database extends PureComponent { | ||
static navigationOptions = ({ navigation }) => ({ | ||
header: ( | ||
<Header | ||
navigation={navigation} | ||
title='Peers List' | ||
// titleIcon='Peers' | ||
backBtn | ||
/> | ||
), | ||
}) | ||
render () { | ||
return ( | ||
<Menu absolute> | ||
<Menu.Section> | ||
<Menu.Item | ||
icon='database' | ||
title='' | ||
onPress={async () => { | ||
try { | ||
await mutations.generateFakeData.commit({ t: true }) | ||
} catch (err) { | ||
this.setState({ err }) | ||
console.error(err) | ||
} | ||
}} | ||
/> | ||
<Menu.Item | ||
icon='refresh-ccw' | ||
title='Reset database (not implemented)' | ||
onPress={() => { | ||
console.log('Reset') | ||
}} | ||
/> | ||
</Menu.Section> | ||
</Menu> | ||
) | ||
} | ||
} |
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,12 @@ | ||
import { graphql } from 'react-relay' | ||
|
||
export default graphql` | ||
query PeersListQuery { | ||
Peers(T: true) { | ||
list { | ||
id | ||
addrs | ||
} | ||
} | ||
} | ||
` |
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
14 changes: 14 additions & 0 deletions
14
client/react-native/common/graphql/subscriptions/MonitorPeers.js
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,14 @@ | ||
import { graphql } from 'react-relay' | ||
import { subscriber } from '../../relay' | ||
|
||
const MonitorPeers = graphql` | ||
subscription MonitorPeersSubscription { | ||
MonitorPeers { | ||
id | ||
addrs | ||
connection | ||
} | ||
} | ||
` | ||
|
||
export default subscriber({ subscription: MonitorPeers }) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.