2020-04-10 01:01:46 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
2020-05-14 21:35:25 +08:00
|
|
|
import { FormattedTime, defineMessages, injectIntl } from 'react-intl';
|
2020-04-10 01:01:46 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2020-05-14 21:35:25 +08:00
|
|
|
import UserAvatar from '/imports/ui/components/user-avatar/component';
|
2021-04-23 09:07:48 +08:00
|
|
|
import Icon from '/imports/ui/components/connection-status/icon/component';
|
2021-03-26 05:22:50 +08:00
|
|
|
import Service from '../service';
|
2021-11-09 19:54:48 +08:00
|
|
|
import Styled from './styles';
|
2021-10-19 04:52:59 +08:00
|
|
|
import ConnectionStatusHelper from '../status-helper/container';
|
2020-04-10 01:01:46 +08:00
|
|
|
|
2022-09-15 09:16:27 +08:00
|
|
|
const NETWORK_MONITORING_INTERVAL_MS = 2000;
|
2021-10-07 08:05:15 +08:00
|
|
|
const MIN_TIMEOUT = 3000;
|
2021-08-13 03:39:04 +08:00
|
|
|
|
2020-04-10 01:01:46 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
ariaTitle: {
|
|
|
|
id: 'app.connection-status.ariaTitle',
|
|
|
|
description: 'Connection status aria title',
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
id: 'app.connection-status.title',
|
|
|
|
description: 'Connection status title',
|
|
|
|
},
|
|
|
|
description: {
|
|
|
|
id: 'app.connection-status.description',
|
|
|
|
description: 'Connection status description',
|
|
|
|
},
|
2020-05-14 21:35:25 +08:00
|
|
|
empty: {
|
|
|
|
id: 'app.connection-status.empty',
|
|
|
|
description: 'Connection status empty',
|
|
|
|
},
|
2020-04-14 02:45:14 +08:00
|
|
|
more: {
|
|
|
|
id: 'app.connection-status.more',
|
|
|
|
description: 'More about conectivity issues',
|
|
|
|
},
|
2021-08-13 03:39:04 +08:00
|
|
|
audioLabel: {
|
|
|
|
id: 'app.settings.audioTab.label',
|
|
|
|
description: 'Audio label',
|
|
|
|
},
|
|
|
|
videoLabel: {
|
|
|
|
id: 'app.settings.videoTab.label',
|
|
|
|
description: 'Video label',
|
|
|
|
},
|
2021-08-11 07:45:59 +08:00
|
|
|
copy: {
|
|
|
|
id: 'app.connection-status.copy',
|
|
|
|
description: 'Copy network data',
|
|
|
|
},
|
|
|
|
copied: {
|
|
|
|
id: 'app.connection-status.copied',
|
|
|
|
description: 'Copied network data',
|
|
|
|
},
|
2021-04-02 02:10:15 +08:00
|
|
|
offline: {
|
|
|
|
id: 'app.connection-status.offline',
|
|
|
|
description: 'Offline user',
|
|
|
|
},
|
2021-03-26 05:22:50 +08:00
|
|
|
dataSaving: {
|
|
|
|
id: 'app.settings.dataSavingTab.description',
|
|
|
|
description: 'Description of data saving',
|
|
|
|
},
|
|
|
|
webcam: {
|
|
|
|
id: 'app.settings.dataSavingTab.webcam',
|
|
|
|
description: 'Webcam data saving switch',
|
|
|
|
},
|
|
|
|
screenshare: {
|
|
|
|
id: 'app.settings.dataSavingTab.screenShare',
|
|
|
|
description: 'Screenshare data saving switch',
|
2020-05-12 21:26:08 +08:00
|
|
|
},
|
2021-05-11 04:41:52 +08:00
|
|
|
on: {
|
|
|
|
id: 'app.switch.onLabel',
|
|
|
|
description: 'label for toggle switch on state',
|
|
|
|
},
|
|
|
|
off: {
|
|
|
|
id: 'app.switch.offLabel',
|
|
|
|
description: 'label for toggle switch off state',
|
|
|
|
},
|
2021-08-25 03:35:41 +08:00
|
|
|
no: {
|
|
|
|
id: 'app.connection-status.no',
|
|
|
|
description: 'No to is using turn',
|
|
|
|
},
|
|
|
|
yes: {
|
|
|
|
id: 'app.connection-status.yes',
|
|
|
|
description: 'Yes to is using turn',
|
|
|
|
},
|
|
|
|
usingTurn: {
|
|
|
|
id: 'app.connection-status.usingTurn',
|
|
|
|
description: 'User is using turn server',
|
|
|
|
},
|
|
|
|
jitter: {
|
|
|
|
id: 'app.connection-status.jitter',
|
|
|
|
description: 'Jitter buffer in ms',
|
|
|
|
},
|
|
|
|
lostPackets: {
|
|
|
|
id: 'app.connection-status.lostPackets',
|
|
|
|
description: 'Number of lost packets',
|
|
|
|
},
|
2021-10-19 04:52:59 +08:00
|
|
|
audioUploadRate: {
|
|
|
|
id: 'app.connection-status.audioUploadRate',
|
|
|
|
description: 'Label for audio current upload rate',
|
|
|
|
},
|
|
|
|
audioDownloadRate: {
|
|
|
|
id: 'app.connection-status.audioDownloadRate',
|
|
|
|
description: 'Label for audio current download rate',
|
|
|
|
},
|
|
|
|
videoUploadRate: {
|
|
|
|
id: 'app.connection-status.videoUploadRate',
|
|
|
|
description: 'Label for video current upload rate',
|
|
|
|
},
|
|
|
|
videoDownloadRate: {
|
|
|
|
id: 'app.connection-status.videoDownloadRate',
|
|
|
|
description: 'Label for video current download rate',
|
|
|
|
},
|
|
|
|
connectionStats: {
|
|
|
|
id: 'app.connection-status.connectionStats',
|
2021-11-23 20:05:02 +08:00
|
|
|
description: 'Label for Connection Stats tab',
|
2021-10-19 04:52:59 +08:00
|
|
|
},
|
|
|
|
myLogs: {
|
|
|
|
id: 'app.connection-status.myLogs',
|
2021-11-23 20:05:02 +08:00
|
|
|
description: 'Label for My Logs tab',
|
2021-10-19 04:52:59 +08:00
|
|
|
},
|
|
|
|
sessionLogs: {
|
|
|
|
id: 'app.connection-status.sessionLogs',
|
2021-11-23 20:05:02 +08:00
|
|
|
description: 'Label for Session Logs tab',
|
|
|
|
},
|
|
|
|
next: {
|
|
|
|
id: 'app.connection-status.next',
|
|
|
|
description: 'Label for the next page of the connection stats tab',
|
|
|
|
},
|
|
|
|
prev: {
|
|
|
|
id: 'app.connection-status.prev',
|
|
|
|
description: 'Label for the previous page of the connection stats tab',
|
|
|
|
},
|
2022-09-15 09:16:27 +08:00
|
|
|
clientNotResponding: {
|
|
|
|
id: 'app.connection-status.clientNotRespondingWarning',
|
|
|
|
description: 'Text for Client not responding warning',
|
|
|
|
},
|
2020-04-10 01:01:46 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
const propTypes = {
|
2023-03-21 01:57:36 +08:00
|
|
|
setModalIsOpen: PropTypes.func.isRequired,
|
2020-04-10 01:01:46 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
|
|
|
};
|
|
|
|
|
2021-03-26 05:22:50 +08:00
|
|
|
const isConnectionStatusEmpty = (connectionStatus) => {
|
|
|
|
// Check if it's defined
|
|
|
|
if (!connectionStatus) return true;
|
|
|
|
|
|
|
|
// Check if it's an array
|
|
|
|
if (!Array.isArray(connectionStatus)) return true;
|
|
|
|
|
|
|
|
// Check if is empty
|
|
|
|
if (connectionStatus.length === 0) return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
2020-04-10 01:01:46 +08:00
|
|
|
class ConnectionStatusComponent extends PureComponent {
|
2021-03-26 05:22:50 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
2021-08-13 03:39:04 +08:00
|
|
|
const { intl } = this.props;
|
|
|
|
|
2021-03-26 05:22:50 +08:00
|
|
|
this.help = Service.getHelp();
|
2021-08-13 03:39:04 +08:00
|
|
|
this.state = {
|
2022-10-28 22:10:07 +08:00
|
|
|
selectedTab: 0,
|
2021-08-13 03:39:04 +08:00
|
|
|
hasNetworkData: false,
|
2022-05-24 01:09:50 +08:00
|
|
|
copyButtonText: intl.formatMessage(intlMessages.copy),
|
2021-08-13 03:39:04 +08:00
|
|
|
networkData: {
|
|
|
|
user: {
|
|
|
|
|
|
|
|
},
|
|
|
|
audio: {
|
|
|
|
audioCurrentUploadRate: 0,
|
|
|
|
audioCurrentDownloadRate: 0,
|
2021-08-18 03:51:50 +08:00
|
|
|
jitter: 0,
|
|
|
|
packetsLost: 0,
|
2021-08-25 03:35:41 +08:00
|
|
|
transportStats: {},
|
2021-08-13 03:39:04 +08:00
|
|
|
},
|
|
|
|
video: {
|
|
|
|
videoCurrentUploadRate: 0,
|
|
|
|
videoCurrentDownloadRate: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2022-05-24 01:09:50 +08:00
|
|
|
this.setButtonMessage = this.setButtonMessage.bind(this);
|
2021-08-13 03:39:04 +08:00
|
|
|
this.rateInterval = null;
|
2021-10-19 04:52:59 +08:00
|
|
|
this.audioUploadLabel = intl.formatMessage(intlMessages.audioUploadRate);
|
|
|
|
this.audioDownloadLabel = intl.formatMessage(intlMessages.audioDownloadRate);
|
|
|
|
this.videoUploadLabel = intl.formatMessage(intlMessages.videoUploadRate);
|
|
|
|
this.videoDownloadLabel = intl.formatMessage(intlMessages.videoDownloadRate);
|
2022-10-28 22:10:07 +08:00
|
|
|
this.handleSelectTab = this.handleSelectTab.bind(this);
|
2021-08-13 03:39:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async componentDidMount() {
|
|
|
|
this.startMonitoringNetwork();
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
2021-08-16 20:21:59 +08:00
|
|
|
Meteor.clearInterval(this.rateInterval);
|
2021-03-26 05:22:50 +08:00
|
|
|
}
|
|
|
|
|
2022-10-28 22:10:07 +08:00
|
|
|
handleSelectTab(tab) {
|
|
|
|
this.setState({
|
|
|
|
selectedTab: tab,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
setButtonMessage(msg) {
|
|
|
|
this.setState({
|
|
|
|
copyButtonText: msg,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-08-13 03:39:04 +08:00
|
|
|
/**
|
|
|
|
* Start monitoring the network data.
|
|
|
|
* @return {Promise} A Promise that resolves when process started.
|
|
|
|
*/
|
|
|
|
async startMonitoringNetwork() {
|
|
|
|
let previousData = await Service.getNetworkData();
|
2021-08-16 20:21:59 +08:00
|
|
|
this.rateInterval = Meteor.setInterval(async () => {
|
2021-08-13 03:39:04 +08:00
|
|
|
const data = await Service.getNetworkData();
|
|
|
|
|
|
|
|
const {
|
|
|
|
outbound: audioCurrentUploadRate,
|
|
|
|
inbound: audioCurrentDownloadRate,
|
2021-08-14 04:24:44 +08:00
|
|
|
} = Service.calculateBitsPerSecond(data.audio, previousData.audio);
|
2021-08-13 03:39:04 +08:00
|
|
|
|
2022-02-04 22:09:43 +08:00
|
|
|
const inboundRtp = Service.getDataType(data.audio, 'inbound-rtp')[0];
|
|
|
|
|
|
|
|
const jitter = inboundRtp
|
|
|
|
? inboundRtp.jitterBufferAverage
|
2021-08-23 23:21:05 +08:00
|
|
|
: 0;
|
|
|
|
|
2022-02-04 22:09:43 +08:00
|
|
|
const packetsLost = inboundRtp
|
|
|
|
? inboundRtp.packetsLost
|
2021-08-23 23:21:05 +08:00
|
|
|
: 0;
|
|
|
|
|
2021-08-13 03:39:04 +08:00
|
|
|
const audio = {
|
|
|
|
audioCurrentUploadRate,
|
|
|
|
audioCurrentDownloadRate,
|
2021-08-23 23:21:05 +08:00
|
|
|
jitter,
|
|
|
|
packetsLost,
|
2021-08-25 03:35:41 +08:00
|
|
|
transportStats: data.audio.transportStats,
|
2021-08-13 03:39:04 +08:00
|
|
|
};
|
|
|
|
|
2021-08-14 04:24:44 +08:00
|
|
|
const {
|
|
|
|
outbound: videoCurrentUploadRate,
|
|
|
|
inbound: videoCurrentDownloadRate,
|
|
|
|
} = Service.calculateBitsPerSecondFromMultipleData(data.video,
|
|
|
|
previousData.video);
|
|
|
|
|
2021-08-13 03:39:04 +08:00
|
|
|
const video = {
|
2021-08-14 04:24:44 +08:00
|
|
|
videoCurrentUploadRate,
|
|
|
|
videoCurrentDownloadRate,
|
2021-08-13 03:39:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const { user } = data;
|
|
|
|
|
|
|
|
const networkData = {
|
|
|
|
user,
|
|
|
|
audio,
|
|
|
|
video,
|
|
|
|
};
|
|
|
|
|
|
|
|
previousData = data;
|
|
|
|
this.setState({
|
|
|
|
networkData,
|
|
|
|
hasNetworkData: true,
|
|
|
|
});
|
|
|
|
}, NETWORK_MONITORING_INTERVAL_MS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy network data to clipboard
|
|
|
|
* @return {Promise} A Promise that is resolved after data is copied.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2022-10-28 22:10:07 +08:00
|
|
|
async copyNetworkData() {
|
2021-08-11 22:10:49 +08:00
|
|
|
const { intl } = this.props;
|
2021-08-13 03:39:04 +08:00
|
|
|
const {
|
|
|
|
networkData,
|
|
|
|
hasNetworkData,
|
|
|
|
} = this.state;
|
|
|
|
|
|
|
|
if (!hasNetworkData) return;
|
|
|
|
|
2022-05-24 01:09:50 +08:00
|
|
|
this.setButtonMessage(intl.formatMessage(intlMessages.copied));
|
2021-08-11 22:10:49 +08:00
|
|
|
|
2021-08-13 03:39:04 +08:00
|
|
|
const data = JSON.stringify(networkData, null, 2);
|
|
|
|
|
2021-08-11 22:10:49 +08:00
|
|
|
await navigator.clipboard.writeText(data);
|
|
|
|
|
|
|
|
this.copyNetworkDataTimeout = setTimeout(() => {
|
2022-05-24 01:09:50 +08:00
|
|
|
this.setButtonMessage(intl.formatMessage(intlMessages.copy));
|
2021-10-07 08:05:15 +08:00
|
|
|
}, MIN_TIMEOUT);
|
2021-08-11 07:45:59 +08:00
|
|
|
}
|
|
|
|
|
2022-10-28 22:10:07 +08:00
|
|
|
renderEmpty() {
|
|
|
|
const { intl } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Styled.Item last data-test="connectionStatusItemEmpty">
|
|
|
|
<Styled.Left>
|
|
|
|
<Styled.FullName>
|
|
|
|
<Styled.Text>
|
|
|
|
{intl.formatMessage(intlMessages.empty)}
|
|
|
|
</Styled.Text>
|
|
|
|
</Styled.FullName>
|
|
|
|
</Styled.Left>
|
|
|
|
</Styled.Item>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-05-14 21:35:25 +08:00
|
|
|
renderConnections() {
|
2020-05-12 21:26:08 +08:00
|
|
|
const {
|
|
|
|
connectionStatus,
|
|
|
|
intl,
|
|
|
|
} = this.props;
|
2020-05-14 21:35:25 +08:00
|
|
|
|
2021-10-19 04:52:59 +08:00
|
|
|
const { selectedTab } = this.state;
|
|
|
|
|
2021-03-26 05:22:50 +08:00
|
|
|
if (isConnectionStatusEmpty(connectionStatus)) return this.renderEmpty();
|
2020-05-14 21:35:25 +08:00
|
|
|
|
2021-10-19 04:52:59 +08:00
|
|
|
let connections = connectionStatus;
|
2023-01-11 20:27:31 +08:00
|
|
|
if (selectedTab === 1) {
|
2021-10-19 04:52:59 +08:00
|
|
|
connections = connections.filter(conn => conn.you);
|
|
|
|
if (isConnectionStatusEmpty(connections)) return this.renderEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
return connections.map((conn, index) => {
|
2020-05-14 21:35:25 +08:00
|
|
|
const dateTime = new Date(conn.timestamp);
|
|
|
|
return (
|
2021-11-09 19:54:48 +08:00
|
|
|
<Styled.Item
|
2023-02-15 23:43:24 +08:00
|
|
|
key={`${conn?.name}-${conn.userId}`}
|
2021-10-19 04:52:59 +08:00
|
|
|
last={(index + 1) === connections.length}
|
2021-04-01 21:55:27 +08:00
|
|
|
data-test="connectionStatusItemUser"
|
2020-05-14 21:35:25 +08:00
|
|
|
>
|
2021-11-09 19:54:48 +08:00
|
|
|
<Styled.Left>
|
|
|
|
<Styled.Avatar>
|
2020-05-14 21:35:25 +08:00
|
|
|
<UserAvatar
|
|
|
|
you={conn.you}
|
2020-09-15 07:13:47 +08:00
|
|
|
avatar={conn.avatar}
|
2020-05-14 21:35:25 +08:00
|
|
|
moderator={conn.moderator}
|
2020-05-15 01:33:32 +08:00
|
|
|
color={conn.color}
|
2020-05-14 21:35:25 +08:00
|
|
|
>
|
|
|
|
{conn.name.toLowerCase().slice(0, 2)}
|
|
|
|
</UserAvatar>
|
2021-11-09 19:54:48 +08:00
|
|
|
</Styled.Avatar>
|
2020-05-12 21:26:08 +08:00
|
|
|
|
2021-11-09 19:54:48 +08:00
|
|
|
<Styled.Name>
|
|
|
|
<Styled.Text
|
|
|
|
offline={conn.offline}
|
2021-04-07 08:39:18 +08:00
|
|
|
data-test={conn.offline ? "offlineUser" : null}
|
|
|
|
>
|
2020-05-14 21:35:25 +08:00
|
|
|
{conn.name}
|
2021-04-02 02:10:15 +08:00
|
|
|
{conn.offline ? ` (${intl.formatMessage(intlMessages.offline)})` : null}
|
2021-11-09 19:54:48 +08:00
|
|
|
</Styled.Text>
|
|
|
|
</Styled.Name>
|
2022-09-15 09:16:27 +08:00
|
|
|
<Styled.Status aria-label={`${intl.formatMessage(intlMessages.title)} ${conn.status}`}>
|
2021-11-09 19:54:48 +08:00
|
|
|
<Styled.Icon>
|
2022-09-15 09:16:27 +08:00
|
|
|
<Icon level={conn.status} />
|
2021-11-09 19:54:48 +08:00
|
|
|
</Styled.Icon>
|
|
|
|
</Styled.Status>
|
2023-01-24 22:00:51 +08:00
|
|
|
{ conn.notResponding && !conn.offline
|
2022-09-15 09:16:27 +08:00
|
|
|
? (
|
|
|
|
<Styled.ClientNotRespondingText>
|
|
|
|
{intl.formatMessage(intlMessages.clientNotResponding)}
|
|
|
|
</Styled.ClientNotRespondingText>
|
|
|
|
) : null }
|
2021-11-09 19:54:48 +08:00
|
|
|
</Styled.Left>
|
2023-02-15 23:43:24 +08:00
|
|
|
<Styled.Right>
|
|
|
|
<Styled.Time>
|
|
|
|
{ conn.timestamp ?
|
|
|
|
<time dateTime={dateTime}>
|
|
|
|
<FormattedTime value={dateTime} />
|
|
|
|
</time>
|
|
|
|
: null
|
|
|
|
}
|
|
|
|
</Styled.Time>
|
|
|
|
</Styled.Right>
|
2021-11-09 19:54:48 +08:00
|
|
|
</Styled.Item>
|
2020-05-14 21:35:25 +08:00
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-08-13 03:39:04 +08:00
|
|
|
/**
|
|
|
|
* Render network data , containing information abount current upload and
|
|
|
|
* download rates
|
|
|
|
* @return {Object} The component to be renderized.
|
|
|
|
*/
|
|
|
|
renderNetworkData() {
|
2021-08-26 03:38:36 +08:00
|
|
|
const { enableNetworkStats } = Meteor.settings.public.app;
|
|
|
|
|
|
|
|
if (!enableNetworkStats) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-08-13 03:39:04 +08:00
|
|
|
const {
|
2021-10-19 04:52:59 +08:00
|
|
|
audioUploadLabel,
|
|
|
|
audioDownloadLabel,
|
|
|
|
videoUploadLabel,
|
|
|
|
videoDownloadLabel,
|
2021-08-13 03:39:04 +08:00
|
|
|
} = this;
|
|
|
|
|
2023-03-21 01:57:36 +08:00
|
|
|
const { intl, setModalIsOpen } = this.props;
|
2021-08-25 03:35:41 +08:00
|
|
|
|
2023-02-17 20:58:24 +08:00
|
|
|
const { networkData } = this.state;
|
2021-08-13 03:39:04 +08:00
|
|
|
|
|
|
|
const {
|
|
|
|
audioCurrentUploadRate,
|
|
|
|
audioCurrentDownloadRate,
|
2021-08-25 03:35:41 +08:00
|
|
|
jitter,
|
|
|
|
packetsLost,
|
|
|
|
transportStats,
|
2021-08-13 03:39:04 +08:00
|
|
|
} = networkData.audio;
|
|
|
|
|
|
|
|
const {
|
|
|
|
videoCurrentUploadRate,
|
|
|
|
videoCurrentDownloadRate,
|
|
|
|
} = networkData.video;
|
|
|
|
|
2021-08-25 03:35:41 +08:00
|
|
|
let isUsingTurn = '--';
|
|
|
|
|
|
|
|
if (transportStats) {
|
|
|
|
switch (transportStats.isUsingTurn) {
|
|
|
|
case true:
|
|
|
|
isUsingTurn = intl.formatMessage(intlMessages.yes);
|
|
|
|
break;
|
|
|
|
case false:
|
|
|
|
isUsingTurn = intl.formatMessage(intlMessages.no);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-13 03:39:04 +08:00
|
|
|
return (
|
2022-06-10 22:50:35 +08:00
|
|
|
<Styled.NetworkDataContainer
|
|
|
|
data-test="networkDataContainer"
|
|
|
|
tabIndex={0}
|
|
|
|
>
|
|
|
|
<Styled.HelperWrapper>
|
|
|
|
<Styled.Helper>
|
2023-03-21 01:57:36 +08:00
|
|
|
<ConnectionStatusHelper closeModal={() => setModalIsOpen(false)} />
|
2022-06-10 22:50:35 +08:00
|
|
|
</Styled.Helper>
|
|
|
|
</Styled.HelperWrapper>
|
|
|
|
<Styled.NetworkDataContent>
|
2021-10-19 04:52:59 +08:00
|
|
|
<Styled.DataColumn>
|
|
|
|
<Styled.NetworkData>
|
2021-11-23 20:05:02 +08:00
|
|
|
<div>{`${audioUploadLabel}`}</div>
|
2021-10-19 04:52:59 +08:00
|
|
|
<div>{`${audioCurrentUploadRate}k ↑`}</div>
|
|
|
|
</Styled.NetworkData>
|
|
|
|
<Styled.NetworkData>
|
2021-11-23 20:05:02 +08:00
|
|
|
<div>{`${videoUploadLabel}`}</div>
|
2022-09-13 01:10:57 +08:00
|
|
|
<div data-test="videoUploadRateData">{`${videoCurrentUploadRate}k ↑`}</div>
|
2021-10-19 04:52:59 +08:00
|
|
|
</Styled.NetworkData>
|
|
|
|
<Styled.NetworkData>
|
2021-11-23 20:05:02 +08:00
|
|
|
<div>{`${intl.formatMessage(intlMessages.jitter)}`}</div>
|
2021-10-19 04:52:59 +08:00
|
|
|
<div>{`${jitter} ms`}</div>
|
|
|
|
</Styled.NetworkData>
|
|
|
|
<Styled.NetworkData>
|
2021-11-23 20:05:02 +08:00
|
|
|
<div>{`${intl.formatMessage(intlMessages.usingTurn)}`}</div>
|
2021-10-19 04:52:59 +08:00
|
|
|
<div>{`${isUsingTurn}`}</div>
|
|
|
|
</Styled.NetworkData>
|
|
|
|
</Styled.DataColumn>
|
|
|
|
|
|
|
|
<Styled.DataColumn>
|
|
|
|
<Styled.NetworkData>
|
2021-11-23 20:05:02 +08:00
|
|
|
<div>{`${audioDownloadLabel}`}</div>
|
2021-10-19 04:52:59 +08:00
|
|
|
<div>{`${audioCurrentDownloadRate}k ↓`}</div>
|
|
|
|
</Styled.NetworkData>
|
|
|
|
<Styled.NetworkData>
|
2021-11-23 20:05:02 +08:00
|
|
|
<div>{`${videoDownloadLabel}`}</div>
|
2021-10-19 04:52:59 +08:00
|
|
|
<div>{`${videoCurrentDownloadRate}k ↓`}</div>
|
|
|
|
</Styled.NetworkData>
|
|
|
|
<Styled.NetworkData>
|
2021-11-23 20:05:02 +08:00
|
|
|
<div>{`${intl.formatMessage(intlMessages.lostPackets)}`}</div>
|
2021-10-19 04:52:59 +08:00
|
|
|
<div>{`${packetsLost}`}</div>
|
|
|
|
</Styled.NetworkData>
|
|
|
|
<Styled.NetworkData invisible>
|
2021-11-23 20:05:02 +08:00
|
|
|
<div>Content Hidden</div>
|
2021-10-19 04:52:59 +08:00
|
|
|
<div>0</div>
|
|
|
|
</Styled.NetworkData>
|
|
|
|
</Styled.DataColumn>
|
|
|
|
</Styled.NetworkDataContent>
|
2021-11-09 19:54:48 +08:00
|
|
|
</Styled.NetworkDataContainer>
|
2021-08-13 03:39:04 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders the clipboard's copy button, for network stats.
|
|
|
|
* @return {Object} - The component to be renderized
|
|
|
|
*/
|
|
|
|
renderCopyDataButton() {
|
2021-08-26 03:38:36 +08:00
|
|
|
const { enableCopyNetworkStatsButton } = Meteor.settings.public.app;
|
|
|
|
|
|
|
|
if (!enableCopyNetworkStatsButton) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-10-28 22:10:07 +08:00
|
|
|
const { hasNetworkData, copyButtonText } = this.state;
|
2021-08-13 03:39:04 +08:00
|
|
|
return (
|
2021-11-09 19:54:48 +08:00
|
|
|
<Styled.CopyContainer aria-live="polite">
|
|
|
|
<Styled.Copy
|
|
|
|
disabled={!hasNetworkData}
|
2021-08-13 03:39:04 +08:00
|
|
|
role="button"
|
2022-10-28 22:10:07 +08:00
|
|
|
data-test="copyStats"
|
2021-08-13 03:39:04 +08:00
|
|
|
onClick={this.copyNetworkData.bind(this)}
|
|
|
|
onKeyPress={this.copyNetworkData.bind(this)}
|
|
|
|
tabIndex={0}
|
|
|
|
>
|
2022-10-28 22:10:07 +08:00
|
|
|
{copyButtonText}
|
2021-11-09 19:54:48 +08:00
|
|
|
</Styled.Copy>
|
|
|
|
</Styled.CopyContainer>
|
2021-08-13 03:39:04 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-04-10 01:01:46 +08:00
|
|
|
render() {
|
|
|
|
const {
|
2023-03-21 01:57:36 +08:00
|
|
|
setModalIsOpen,
|
2020-04-10 01:01:46 +08:00
|
|
|
intl,
|
2023-03-21 01:57:36 +08:00
|
|
|
isModalOpen,
|
2020-04-10 01:01:46 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2023-02-17 20:58:24 +08:00
|
|
|
const { selectedTab } = this.state;
|
2021-02-25 21:14:09 +08:00
|
|
|
|
2020-04-10 01:01:46 +08:00
|
|
|
return (
|
2021-11-09 19:54:48 +08:00
|
|
|
<Styled.ConnectionStatusModal
|
2023-03-21 01:57:36 +08:00
|
|
|
priority="low"
|
|
|
|
onRequestClose={() => setModalIsOpen(false)}
|
|
|
|
setIsOpen={setModalIsOpen}
|
2020-04-10 01:01:46 +08:00
|
|
|
hideBorder
|
2023-03-21 01:57:36 +08:00
|
|
|
isOpen={isModalOpen}
|
2020-04-10 01:01:46 +08:00
|
|
|
contentLabel={intl.formatMessage(intlMessages.ariaTitle)}
|
2022-01-20 21:03:18 +08:00
|
|
|
data-test="connectionStatusModal"
|
2020-04-10 01:01:46 +08:00
|
|
|
>
|
2021-11-09 19:54:48 +08:00
|
|
|
<Styled.Container>
|
|
|
|
<Styled.Header>
|
|
|
|
<Styled.Title>
|
2020-04-10 01:01:46 +08:00
|
|
|
{intl.formatMessage(intlMessages.title)}
|
2021-11-09 19:54:48 +08:00
|
|
|
</Styled.Title>
|
|
|
|
</Styled.Header>
|
2022-10-28 22:10:07 +08:00
|
|
|
|
|
|
|
<Styled.ConnectionTabs
|
|
|
|
onSelect={this.handleSelectTab}
|
|
|
|
selectedIndex={selectedTab}
|
|
|
|
>
|
|
|
|
<Styled.ConnectionTabList>
|
|
|
|
<Styled.ConnectionTabSelector selectedClassName="is-selected">
|
2022-10-28 23:58:32 +08:00
|
|
|
<span id="connection-status-tab">{intl.formatMessage(intlMessages.title)}</span>
|
2022-10-28 22:10:07 +08:00
|
|
|
</Styled.ConnectionTabSelector>
|
|
|
|
<Styled.ConnectionTabSelector selectedClassName="is-selected">
|
2022-10-28 23:58:32 +08:00
|
|
|
<span id="my-logs-tab">{intl.formatMessage(intlMessages.myLogs)}</span>
|
2022-10-28 22:10:07 +08:00
|
|
|
</Styled.ConnectionTabSelector>
|
2022-10-29 00:07:06 +08:00
|
|
|
{Service.isModerator()
|
|
|
|
&& (
|
|
|
|
<Styled.ConnectionTabSelector selectedClassName="is-selected">
|
|
|
|
<span id="session-logs-tab">{intl.formatMessage(intlMessages.sessionLogs)}</span>
|
|
|
|
</Styled.ConnectionTabSelector>
|
|
|
|
)
|
2021-10-19 04:52:59 +08:00
|
|
|
}
|
2022-10-28 22:10:07 +08:00
|
|
|
</Styled.ConnectionTabList>
|
|
|
|
<Styled.ConnectionTabPanel selectedClassName="is-selected">
|
|
|
|
<div>
|
|
|
|
{this.renderNetworkData()}
|
|
|
|
{this.renderCopyDataButton()}
|
|
|
|
</div>
|
|
|
|
</Styled.ConnectionTabPanel>
|
|
|
|
<Styled.ConnectionTabPanel selectedClassName="is-selected">
|
2023-07-17 21:00:51 +08:00
|
|
|
<ul>{this.renderConnections()}</ul>
|
2022-10-28 22:10:07 +08:00
|
|
|
</Styled.ConnectionTabPanel>
|
2022-10-29 00:07:06 +08:00
|
|
|
{Service.isModerator()
|
|
|
|
&& (
|
|
|
|
<Styled.ConnectionTabPanel selectedClassName="is-selected">
|
2023-07-15 03:47:40 +08:00
|
|
|
<ul>{this.renderConnections()}</ul>
|
2022-10-29 00:07:06 +08:00
|
|
|
</Styled.ConnectionTabPanel>
|
|
|
|
)
|
2021-02-25 21:14:09 +08:00
|
|
|
}
|
2022-10-28 22:10:07 +08:00
|
|
|
</Styled.ConnectionTabs>
|
2021-11-09 19:54:48 +08:00
|
|
|
</Styled.Container>
|
|
|
|
</Styled.ConnectionStatusModal>
|
2020-04-10 01:01:46 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ConnectionStatusComponent.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default injectIntl(ConnectionStatusComponent);
|