diff options
| author | Emīls <emils@mullvad.net> | 2019-12-09 11:24:37 +0000 |
|---|---|---|
| committer | Emīls <emils@mullvad.net> | 2019-12-09 11:24:37 +0000 |
| commit | be89341733b58f2e992141fe99713e4d6e4ba7fd (patch) | |
| tree | 5c5c7413fab96d3c874cc882b7f80e253892cef0 /gui/src/renderer/components | |
| parent | 345bebcf9cd75dc29328b1355c2feacbf7b65aad (diff) | |
| parent | 3a041298b1433ec8b81656d77bc2379978af2691 (diff) | |
| download | mullvadvpn-be89341733b58f2e992141fe99713e4d6e4ba7fd.tar.xz mullvadvpn-be89341733b58f2e992141fe99713e4d6e4ba7fd.zip | |
Merge branch 'add-error-state'
Diffstat (limited to 'gui/src/renderer/components')
| -rw-r--r-- | gui/src/renderer/components/Connect.tsx | 14 | ||||
| -rw-r--r-- | gui/src/renderer/components/NotificationArea.tsx | 31 | ||||
| -rw-r--r-- | gui/src/renderer/components/TunnelControl.tsx | 15 |
3 files changed, 26 insertions, 34 deletions
diff --git a/gui/src/renderer/components/Connect.tsx b/gui/src/renderer/components/Connect.tsx index e8d5c0e096..7f73fb7ea0 100644 --- a/gui/src/renderer/components/Connect.tsx +++ b/gui/src/renderer/components/Connect.tsx @@ -117,9 +117,9 @@ export default class Connect extends Component<IProps, IState> { // Blocked with auth failure / expired account if ( - tunnelState.state === 'blocked' && - tunnelState.details.reason === 'auth_failed' && - parseAuthFailure(tunnelState.details.details).kind === AuthFailureKind.expiredAccount + tunnelState.state === 'error' && + tunnelState.details.cause.reason === 'auth_failed' && + parseAuthFailure(tunnelState.details.cause.reason).kind === AuthFailureKind.expiredAccount ) { return true; } @@ -200,8 +200,8 @@ export default class Connect extends Component<IProps, IState> { case 'connecting': case 'connected': return HeaderBarStyle.success; - case 'blocked': - switch (status.details.reason) { + case 'error': + switch (status.details.cause.reason) { case 'set_firewall_policy_error': return HeaderBarStyle.error; default: @@ -259,8 +259,8 @@ export default class Connect extends Component<IProps, IState> { case 'connecting': case 'connected': return MarkerStyle.secure; - case 'blocked': - switch (status.details.reason) { + case 'error': + switch (status.details.cause.reason) { case 'set_firewall_policy_error': return MarkerStyle.unsecure; default: diff --git a/gui/src/renderer/components/NotificationArea.tsx b/gui/src/renderer/components/NotificationArea.tsx index 1d65306ef9..c459695a30 100644 --- a/gui/src/renderer/components/NotificationArea.tsx +++ b/gui/src/renderer/components/NotificationArea.tsx @@ -13,7 +13,7 @@ import { NotificationTitle, } from './NotificationBanner'; -import { BlockReason, TunnelParameterError, TunnelState } from '../../shared/daemon-rpc-types'; +import { ErrorStateCause, TunnelParameterError, TunnelState } from '../../shared/daemon-rpc-types'; import AccountExpiry from '../lib/account-expiry'; import { parseAuthFailure } from '../lib/auth-failure'; import { IVersionReduxState } from '../redux/version/reducers'; @@ -63,7 +63,7 @@ function getTunnelParameterMessage(err: TunnelParameterError): string { } } -function getBlockReasonMessage(blockReason: BlockReason): string { +function getErrorCauseMessage(blockReason: ErrorStateCause): string { switch (blockReason.reason) { case 'auth_failed': return parseAuthFailure(blockReason.details).message; @@ -124,20 +124,19 @@ export default class NotificationArea extends Component<IProps, State> { reason: '', }; - case 'blocked': - switch (tunnelState.details.reason) { - case 'set_firewall_policy_error': - return { - visible: true, - type: 'failure-unsecured', - reason: getBlockReasonMessage(tunnelState.details), - }; - default: - return { - visible: true, - type: 'blocking', - reason: getBlockReasonMessage(tunnelState.details), - }; + case 'error': + if (tunnelState.details.isBlocking) { + return { + visible: true, + type: 'blocking', + reason: getErrorCauseMessage(tunnelState.details.cause), + }; + } else { + return { + visible: true, + type: 'failure-unsecured', + reason: getErrorCauseMessage(tunnelState.details.cause), + }; } case 'disconnecting': diff --git a/gui/src/renderer/components/TunnelControl.tsx b/gui/src/renderer/components/TunnelControl.tsx index 4acc2bd1ef..700603bd2e 100644 --- a/gui/src/renderer/components/TunnelControl.tsx +++ b/gui/src/renderer/components/TunnelControl.tsx @@ -115,21 +115,14 @@ export default class TunnelControl extends Component<ITunnelControlProps> { let state = this.props.tunnelState.state; switch (this.props.tunnelState.state) { - case 'blocked': - switch (this.props.tunnelState.details.reason) { - case 'set_firewall_policy_error': - state = 'disconnected'; - break; - default: - state = 'blocked'; - break; - } + case 'error': + state = this.props.tunnelState.details.isBlocking ? 'error' : 'disconnected'; break; case 'disconnecting': switch (this.props.tunnelState.details) { case 'block': - state = 'blocked'; + state = 'error'; break; case 'reconnect': state = 'connecting'; @@ -177,7 +170,7 @@ export default class TunnelControl extends Component<ITunnelControlProps> { </Wrapper> ); - case 'blocked': + case 'error': return ( <Wrapper> <Body> |
