Display error when unable to join conference

This commit is contained in:
akshitkrnagpal 2018-07-08 12:07:31 +05:30 committed by Saúl Ibarra Corretgé
parent 921b7f6f9b
commit 736f2ae1cb
4 changed files with 88 additions and 23 deletions

View File

@ -101,7 +101,6 @@ class Conference extends Component<Props, State> {
this._ref = React.createRef();
this._navigateToHome = this._navigateToHome.bind(this);
this._onIframeLoad = this._onIframeLoad.bind(this);
}
@ -121,7 +120,8 @@ class Conference extends Component<Props, State> {
script.async = true;
script.onload = () => this._onScriptLoad(parentNode, room, serverURL);
script.onerror = this._navigateToHome;
script.onerror = (event: Event) =>
this._navigateToHome(event, room, serverURL);
script.src = getExternalApiURL(serverURL);
this._ref.current.appendChild(script);
@ -186,15 +186,20 @@ class Conference extends Component<Props, State> {
}
}
_navigateToHome: (*) => void;
/**
* Navigates to home screen (Welcome).
*
* @param {Event} event - Event by which the function is called.
* @param {string} room - Room name.
* @param {string} serverURL - Server URL.
* @returns {void}
*/
_navigateToHome() {
this.props.dispatch(push('/'));
_navigateToHome(event: Event, room: ?string, serverURL: ?string) {
this.props.dispatch(push('/', {
error: event.type === 'error',
room,
serverURL
}));
}
/**
@ -231,7 +236,8 @@ class Conference extends Component<Props, State> {
setupAlwaysOnTopRender(this._api);
setupWiFiStats(iframe);
this._api.on('readyToClose', this._navigateToHome);
this._api.on('readyToClose', (event: Event) =>
this._navigateToHome(event));
this._api.on('videoConferenceJoined',
(conferenceInfo: Object) =>
this._onVideoConferenceJoined(conferenceInfo));

View File

@ -22,6 +22,11 @@ type Props = {
* Redux dispatch.
*/
dispatch: Dispatch<*>;
/**
* React Router location object.
*/
location: Object;
};
type State = {
@ -55,12 +60,36 @@ class Welcome extends Component<Props, State> {
this._onJoin = this._onJoin.bind(this);
}
/**
* Initialize url value in state if passed using location state object.
*
* @param {Props} props - New props of the component.
* @returns {State} - New state of the component.
*/
static getDerivedStateFromProps(props) {
let url = '';
// Check and parse url if exists in location state.
if (props.location.state) {
const { room, serverURL } = props.location.state;
if (room && serverURL) {
url = `${serverURL}/${room}`;
}
}
// Return local state object having input url.
return { url };
}
/**
* Render function of component.
*
* @returns {ReactElement}
*/
render() {
const { state } = this.props.location;
return (
<Page navigation = { <Navbar /> }>
<AtlasKitThemeProvider mode = 'light'>
@ -69,6 +98,7 @@ class Welcome extends Component<Props, State> {
<Form onSubmit = { this._onFormSubmit }>
<FieldTextStateless
autoFocus = { true }
isInvalid = { state && state.error }
isLabelHidden = { true }
onChange = { this._onURLChange }
shouldFitContainer = { true }

59
package-lock.json generated
View File

@ -376,14 +376,24 @@
}
},
"@atlaskit/layer-manager": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@atlaskit/layer-manager/-/layer-manager-4.0.1.tgz",
"integrity": "sha512-TiFtqsdgpUKBJXk4izKkHd1QH8rTv37Gkjzj8yiQavx1ypaz1y6Eap23bu+/tIsRj67Izz73riS3Dqq6gF8HzA==",
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/@atlaskit/layer-manager/-/layer-manager-4.3.1.tgz",
"integrity": "sha512-gNopX8KJQJeV3M1+ObJO5jXQ/ZYv51L6rziz6dHiknOC9yZxNxZ5aueOO1NAXYdlmiXIUN1SvYpZLvRQ5TmmwA==",
"requires": {
"focusin": "^2.0.0",
"prop-types": "^15.5.10",
"react-transition-group": "^2.2.1",
"tabbable": "^1.1.0"
"react-focus-lock": "^1.11.1",
"react-scrolllock": "^3.0.1",
"react-transition-group": "^2.2.1"
},
"dependencies": {
"react-scrolllock": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/react-scrolllock/-/react-scrolllock-3.0.1.tgz",
"integrity": "sha512-2ZJdZKDfmriB+krhw3+rgJlQqJwnjLtqIS3DRYIZnLDBFeKp2tqGq/Odiq8IoV5MqCB6RHqXJhY6Hn0TZkBK3A==",
"requires": {
"exenv": "^1.2.2"
}
}
}
},
"@atlaskit/navigation": {
@ -5494,10 +5504,10 @@
"readable-stream": "^2.0.4"
}
},
"focusin": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/focusin/-/focusin-2.0.0.tgz",
"integrity": "sha1-WMARgN+xlJ8D493u4GNzn8M7b/w="
"focus-lock": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/focus-lock/-/focus-lock-0.3.0.tgz",
"integrity": "sha512-S8FLTSLUSFUC1eRf4lXkM4thjZhvNtE4LtpIWs6Pjmk5dqqIEExoCs0dcFI2Zk7hDAokk+KV//8Hk9OWvavMBQ=="
},
"for-in": {
"version": "1.0.2",
@ -10478,6 +10488,16 @@
"prop-types": "^15.6.0"
}
},
"react-focus-lock": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/react-focus-lock/-/react-focus-lock-1.11.1.tgz",
"integrity": "sha512-LqqZ0GpnwMKiaGRMD+OOjXklI15PY8/ys2+w9ST+bvDmbMXgLssLS7saVHKy7vxUnQ+gi0TiLoOufaMsS8ropA==",
"requires": {
"focus-lock": "^0.3.0",
"prop-types": "^15.0.0",
"react-side-effect": "^1.1.3"
}
},
"react-is": {
"version": "16.4.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.4.0.tgz",
@ -10534,6 +10554,15 @@
"react-prop-toggle": "^1.0.2"
}
},
"react-side-effect": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-1.1.5.tgz",
"integrity": "sha512-Z2ZJE4p/jIfvUpiUMRydEVpQRf2f8GMHczT6qLcARmX7QRb28JDBTpnM2g/i5y/p7ZDEXYGHWg0RbhikE+hJRw==",
"requires": {
"exenv": "^1.2.1",
"shallowequal": "^1.0.1"
}
},
"react-transition-group": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-2.3.1.tgz",
@ -11299,6 +11328,11 @@
"safe-buffer": "^5.0.1"
}
},
"shallowequal": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz",
"integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ=="
},
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
@ -11885,11 +11919,6 @@
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
"integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ=="
},
"tabbable": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/tabbable/-/tabbable-1.1.3.tgz",
"integrity": "sha512-nOWwx35/JuDI4ONuF0ZTo6lYvI0fY0tZCH1ErzY2EXfu4az50ZyiUX8X073FLiZtmWUVlkRnuXsehjJgCw9tYg=="
},
"table": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/table/-/table-4.0.3.tgz",

View File

@ -88,8 +88,8 @@
"electron-window-state": "4.1.1",
"history": "4.7.2",
"jitsi-meet-electron-utils": "github:jitsi/jitsi-meet-electron-utils#1972c3bf0884ace68eb496894dabae593d6dbf49",
"mousetrap": "1.6.2",
"js-utils": "github:jitsi/js-utils#0c53500a5120be2aa3fc590f0f932a0d4771920f",
"mousetrap": "1.6.2",
"react": "16.3.2",
"react-dom": "16.3.2",
"react-redux": "5.0.7",