From 00da25be8963d592e46ebdbce9a955067f51d72a Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Sat, 20 May 2023 09:06:10 +0200 Subject: [PATCH] Changed WebUI to display NodeId and address in all tabs, see #130 --- webui/src/Config.jsx | 14 ++++++++++++++ webui/src/ConfigTabs.jsx | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/webui/src/Config.jsx b/webui/src/Config.jsx index 91b12f9..29f2309 100644 --- a/webui/src/Config.jsx +++ b/webui/src/Config.jsx @@ -19,12 +19,17 @@ // import React, {Component} from 'react'; +import PropTypes from 'prop-types'; import { toast } from 'react-toastify'; import RestAPI from './Services'; import Loader from './Loader'; class Config extends Component { + static propTypes = { + setTitleExtras: PropTypes.func.isRequired + }; + constructor(props) { super(props); this.state = { @@ -64,6 +69,7 @@ class Config extends Component { }; this.onSubmit = this.onSubmit.bind(this); this.inputIsValid = this.inputIsValid.bind(this); + this.setTitleExtras = this.setTitleExtras.bind(this); } componentDidMount() { @@ -111,6 +117,13 @@ class Config extends Component { .catch(err => this.setState({isConfigLoading: false})); } + setTitleExtras() { + if (!this.state.isConfigLoading) { + var nodeId = this.state.customNodeId === '' ? this.state.nodeId : this.state.customNodeId; + this.props.setTitleExtras(nodeId + " - " + this.state.ipAddr); + } + } + inputIsValid() { return !this.state.playoutDelayErr && !this.state.maxTicFrameSizeErr && @@ -149,6 +162,7 @@ class Config extends Component { render() { return (
+ {this.setTitleExtras()} {this.state.isVersionLoading ? :

Version

} diff --git a/webui/src/ConfigTabs.jsx b/webui/src/ConfigTabs.jsx index 434e739..8d6baa8 100644 --- a/webui/src/ConfigTabs.jsx +++ b/webui/src/ConfigTabs.jsx @@ -33,13 +33,27 @@ class ConfigTabs extends Component { currentTab: PropTypes.string.isRequired }; + constructor(props) { + super(props); + this.state = { + titleExtras: '' + }; + this.setTitleExtras = this.setTitleExtras.bind(this); + } + + setTitleExtras(extras) { + if (this.state.titleExtras != extras) + this.setState({titleExtras: extras}); + } + render() { return (

AES67 Daemon

+

Running on {this.state.titleExtras}

- +