-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update network interfaces (#8210)
* feat: update network interfaces WIP * fix: metrics in node info popup * fix: update network metrics store * fix: update node info interface --------- Co-authored-by: Begoña Álvarez de la Cruz <[email protected]>
- Loading branch information
1 parent
58cbb06
commit 3a9283a
Showing
10 changed files
with
84 additions
and
31 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
19 changes: 19 additions & 0 deletions
19
packages/shared/lib/core/network/actions/getAndUpdateNetworkMetrics.ts
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,19 @@ | ||
import { getNetworkMetrics } from '@core/wallet/actions' | ||
import { NetworkMetricsResponse } from '@iota/sdk' | ||
import { setNetworkMetrics } from '../stores' | ||
|
||
export async function getAndUpdateNetworkMetrics(forwardErrors = false): Promise<NetworkMetricsResponse | undefined> { | ||
let networkMetricsResponse: NetworkMetricsResponse | ||
try { | ||
networkMetricsResponse = await getNetworkMetrics() | ||
setNetworkMetrics(networkMetricsResponse) | ||
return networkMetricsResponse | ||
} catch (err) { | ||
setNetworkMetrics(undefined) | ||
if (forwardErrors) { | ||
return Promise.reject(err) | ||
} else { | ||
console.error(err) | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './network-status.store' | ||
export * from './node-info.store' | ||
export * from './network-metrics.store' |
8 changes: 8 additions & 0 deletions
8
packages/shared/lib/core/network/stores/network-metrics.store.ts
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,8 @@ | ||
import { NetworkMetricsResponse } from '@iota/sdk/out/types' | ||
import { writable } from 'svelte/store' | ||
|
||
export const networkMetrics = writable<NetworkMetricsResponse | undefined>(undefined) | ||
|
||
export function setNetworkMetrics(newNetworkMetrics: NetworkMetricsResponse | undefined): void { | ||
return networkMetrics.set(newNetworkMetrics) | ||
} |
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,7 @@ | ||
import { NetworkMetricsResponse } from '@iota/sdk/out/types' | ||
import { getClient } from './getClient' | ||
|
||
export async function getNetworkMetrics(): Promise<NetworkMetricsResponse> { | ||
const client = await getClient() | ||
return client.getNetworkMetrics() | ||
} |
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