Update type definition

This commit is contained in:
Artem Baskal 2020-12-24 12:34:38 +03:00
parent 07497beb78
commit bc9be8d9ee
2 changed files with 12 additions and 5 deletions

View File

@ -190,6 +190,11 @@ export const getIpList = (interfaces) => Object.values(interfaces)
.reduce((acc, curr) => acc.concat(curr.ip_addresses), []) .reduce((acc, curr) => acc.concat(curr.ip_addresses), [])
.sort(); .sort();
/**
* @param {string} ip
* @param {number} [port]
* @returns {string}
*/
export const getDnsAddress = (ip, port = 0) => { export const getDnsAddress = (ip, port = 0) => {
const isStandardDnsPort = port === STANDARD_DNS_PORT; const isStandardDnsPort = port === STANDARD_DNS_PORT;
let address = ip; let address = ip;
@ -205,6 +210,11 @@ export const getDnsAddress = (ip, port = 0) => {
return address; return address;
}; };
/**
* @param {string} ip
* @param {number} [port]
* @returns {string}
*/
export const getWebAddress = (ip, port = 0) => { export const getWebAddress = (ip, port = 0) => {
const isStandardWebPort = port === STANDARD_WEB_PORT; const isStandardWebPort = port === STANDARD_WEB_PORT;
let address = `http://${ip}`; let address = `http://${ip}`;

View File

@ -41,16 +41,13 @@ const AddressList = ({
AddressList.propTypes = { AddressList.propTypes = {
interfaces: PropTypes.object.isRequired, interfaces: PropTypes.object.isRequired,
address: PropTypes.string.isRequired, address: PropTypes.string.isRequired,
port: PropTypes.oneOfType([ port: PropTypes.number.isRequired,
PropTypes.string,
PropTypes.number,
]),
isDns: PropTypes.bool, isDns: PropTypes.bool,
}; };
renderItem.propTypes = { renderItem.propTypes = {
ip: PropTypes.string.isRequired, ip: PropTypes.string.isRequired,
port: PropTypes.string.isRequired, port: PropTypes.number.isRequired,
isDns: PropTypes.bool.isRequired, isDns: PropTypes.bool.isRequired,
}; };