forked from mannheim-network/ipfs-webui
-
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: add ipfs connection indicator and notifications (ipfs#802)
- show the api address when connect via http - otherwise show api provider (window.ipfs, embedded js-ipfs) - notify on connection error - add connected bundle and status indicator - keep polling api when in the background - link to release where possible - auto-reinit ipfs after first failure - add a retry-init bundle to track ipfs init failures and retry - Make connection indicator a link to welcome page - Improve language around network traffic graphs License: MIT Signed-off-by: Oli Evans <[email protected]>
- Loading branch information
Showing
44 changed files
with
971 additions
and
89 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"connectingToIpfs": "Connecting to IPFS", | ||
"connectedToIpfs": "Connected to IPFS", | ||
"ipfsApiRequestFailed": "IPFS request failed. Please check your daemon is running", | ||
"windowIpfsRequestFailed": "IPFS request failed. Please check your IPFS Companion settings", | ||
"ipfsIsBack": "Normal IPFS service has resumed. Enjoy!" | ||
} |
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
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,8 +1,8 @@ | ||
{ | ||
"title": "피어들", | ||
"peerId": "Peer ID", | ||
"peerId": "피어 아이디", | ||
"peers": "피어들", | ||
"address": "Address", | ||
"address": "주소", | ||
"location": "위치", | ||
"unknownLocation": "Unknown" | ||
"unknownLocation": "알 수 없음" | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { createSelector } from 'redux-bundler' | ||
|
||
// We ask for the stats every few seconds, so that gives a good indication | ||
// that ipfs things are working (or not), without additional polling of the api. | ||
const connected = { | ||
name: 'status', | ||
selectIpfsConnected: createSelector( | ||
'selectIpfsReady', | ||
'selectStatsLastSuccess', | ||
'selectStatsLastError', | ||
(ipfsReady, lastSuccess, lastError) => ipfsReady && lastSuccess && lastSuccess > lastError | ||
) | ||
} | ||
|
||
export default connected |
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { createSelector } from 'redux-bundler' | ||
|
||
/* | ||
# Notify | ||
- show error when ipfs goes away. | ||
- show ok when it comes back. | ||
- dismiss the the ok after 3s | ||
*/ | ||
|
||
const defaultState = { | ||
show: false, | ||
error: false, | ||
eventId: null | ||
} | ||
|
||
const notify = { | ||
name: 'notify', | ||
|
||
reducer: (state = defaultState, action) => { | ||
if (action.type === 'NOTIFY_DISMISSED') { | ||
return { ...state, show: false } | ||
} | ||
|
||
if (action.type.match(/_FETCH_FAILED$/) || action.type.match(/^FILES_\w+_FAILED$/)) { | ||
if (action.type === 'CONFIG_FETCH_FAILED') { | ||
// TODO: this avoids flashing the error message when booting with window.ipfs, but it's very loose. | ||
return state | ||
} | ||
if (state.eventId !== 'FETCH_FAILED') { | ||
return { | ||
...state, | ||
show: true, | ||
error: true, | ||
eventId: 'FETCH_FAILED' | ||
} | ||
} | ||
} | ||
|
||
if (action.type.match(/_FETCH_FINISHED$/) || action.type.match(/^FILES_\w+_FINISHED$/)) { | ||
// Finsihing with an error is not a good finish. | ||
// TODO: fix explore bundle to not do that. | ||
if (action.payload && action.payload.error) return state | ||
if (state.eventId === 'FETCH_FAILED') { | ||
return { | ||
...state, | ||
error: false, | ||
eventId: 'FETCH_FINISHED', | ||
lastSuccess: Date.now() | ||
} | ||
} | ||
} | ||
|
||
return state | ||
}, | ||
|
||
selectNotify: state => state.notify, | ||
|
||
selectNotifyI18nKey: createSelector( | ||
'selectNotify', | ||
'selectIpfsProvider', | ||
(notify, provider) => { | ||
const { eventId } = notify | ||
|
||
if (eventId === 'FETCH_FAILED') { | ||
if (provider === 'window.ipfs') { | ||
return 'windowIpfsRequestFailed' | ||
} | ||
return 'ipfsApiRequestFailed' | ||
} | ||
|
||
if (eventId === 'FETCH_FINISHED') { | ||
return 'ipfsIsBack' | ||
} | ||
|
||
return eventId | ||
} | ||
), | ||
|
||
doNotifyDismiss: () => ({ dispatch }) => dispatch({ type: 'NOTIFY_DISMISSED' }), | ||
|
||
// Dismiss the "all ok" message after 3 seconds | ||
reactNotifyOkDismiss: createSelector( | ||
'selectAppTime', | ||
'selectNotify', | ||
(appTime, notify) => { | ||
if (notify.eventId === 'FETCH_FINISHED' && notify.show && appTime - notify.lastSuccess > 3000) { | ||
return { type: 'NOTIFY_DISMISSED' } | ||
} | ||
} | ||
) | ||
} | ||
|
||
export default notify |
Oops, something went wrong.