get info after api recovers

This commit is contained in:
controlol 2021-11-03 22:32:05 +01:00
parent e15f23b535
commit 8d7375af4f

View File

@ -108,20 +108,28 @@ class App extends Component {
* also updates the favicon * also updates the favicon
*/ */
checkApiEndpoint = () => { checkApiEndpoint = () => {
if (API.getEndpointStatus() !== this.state.endPointAvailable) { const status = API.getEndpointStatus()
if (status !== this.state.endPointAvailable) {
this.setState({ endPointAvailable: !this.state.endPointAvailable }) this.setState({ endPointAvailable: !this.state.endPointAvailable })
const link = document.querySelectorAll("link[rel~='icon']"); const link = document.querySelectorAll("link[rel~='icon']");
link.forEach(v => { link.forEach(v => {
let segments = v.href.split(".") let segments = v.href.split(".")
if (this.state.endPointAvailable) { if (status) {
segments[0] = segments[0].substring(0, segments[0].length - 3) segments[0] = segments[0].substring(0, segments[0].length - 3)
} else { } else {
segments[0] += "-gs" segments[0] += "-gs"
} }
v.href = segments.join(".") v.href = segments.join(".")
}) })
// get info after api recovers
if (status) {
this.fetchRemotes()
this.fetchMounts()
this.fetchVersionInfo()
}
} }
} }
@ -282,6 +290,7 @@ class App extends Component {
> >
<p> {v.name} </p> <p> {v.name} </p>
<p> {v.type} </p> <p> {v.type} </p>
{/* add EDIT button */}
<ReactTooltip id={"size"+v.MountPoint} place="left" type="info" effect="solid" globalEventOff="click" /> <ReactTooltip id={"size"+v.MountPoint} place="left" type="info" effect="solid" globalEventOff="click" />
</InfosRow> </InfosRow>
)) ))
@ -296,6 +305,7 @@ class App extends Component {
<Fragment key={v.MountPoint} > <Fragment key={v.MountPoint} >
<p> {v.Fs} </p> <p> {v.Fs} </p>
<p> {v.MountPoint} </p> <p> {v.MountPoint} </p>
{/* add DELETE button */}
</Fragment> </Fragment>
)) ))
} }
@ -394,12 +404,12 @@ class App extends Component {
</InfosWrapper> </InfosWrapper>
<InfosWrapper style={{ minHeight: "6rem" }}> <InfosWrapper style={{ minHeight: "6rem" }}>
<h2> Remotes </h2> <h2> Remotes </h2> {/* add NEW button */}
{ this.renderRemotes() } { this.renderRemotes() }
</InfosWrapper> </InfosWrapper>
<InfosWrapper style={{ minHeight: "4.5rem" }}> <InfosWrapper style={{ minHeight: "4.5rem" }}>
<h2> Mounts </h2> <h2> Mounts </h2> {/* add NEW button */}
{ this.renderMounts() } { this.renderMounts() }
</InfosWrapper> </InfosWrapper>