fix: Bug that caused duplicate links (eg Diagnostics and Logs) in the nav bar (#595)

This commit is contained in:
James Read 2025-05-31 20:20:37 +01:00 committed by GitHub
parent 74f0930dcc
commit 7110399d41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 34 additions and 29 deletions

View File

@ -5,8 +5,8 @@ package executor
import (
"context"
"os/exec"
"os"
"os/exec"
)
func (e *Executor) Kill(execReq *InternalLogEntry) error {

View File

@ -99,6 +99,7 @@ func cdToExecutableDir() {
}
}
//gocyclo:ignore
func startServiceHandler(mode string) {
cdToExecutableDir()

View File

@ -2,10 +2,10 @@ package updatecheck
import (
"encoding/json"
"github.com/Masterminds/semver"
config "github.com/OliveTin/OliveTin/internal/config"
"github.com/OliveTin/OliveTin/internal/installationinfo"
"github.com/robfig/cron/v3"
"github.com/Masterminds/semver"
log "github.com/sirupsen/logrus"
"io"
"net/http"

View File

@ -1,8 +1,8 @@
package updatecheck
import (
"testing"
"github.com/stretchr/testify/assert"
"testing"
)
func TestVersionLater(t *testing.T) {

View File

@ -1,33 +1,37 @@
export class NavigationBar {
constructor() {
this.navbar = document.getElementsByTagName('nav')[0]
this.mainLinks = document.getElementById('navigation-links')
this.supplementalLinks = document.getElementById('supplemental-links')
}
constructor () {
this.navbar = document.getElementsByTagName('nav')[0]
this.mainLinks = document.getElementById('navigation-links')
this.supplementalLinks = document.getElementById('supplemental-links')
}
createLink(title, url, isSupplemental) {
const linkA = document.createElement('a')
linkA.href = url
linkA.innerText = title
createLink (title, url, isSupplemental) {
let parent = (isSupplemental) ? this.supplementalLinks : this.mainLinks
const navigationLi = document.createElement('li')
navigationLi.appendChild(linkA)
navigationLi.title = title
const existsAlready = Array.from(parent.querySelectorAll('li')).some(el => el.title === title)
if (isSupplemental) {
this.supplementalLinks.appendChild(navigationLi)
} else {
this.mainLinks.appendChild(navigationLi)
}
}
if (existsAlready) {
return
}
refreshSectionPolicyLinks(policy) {
if (policy.showDiagnostics) {
this.createLink('Diagnostics', '/diagnostics', true)
}
const linkA = document.createElement('a')
linkA.href = url
linkA.innerText = title
if (policy.showLogList) {
this.createLink('Logs', '/logs', true)
}
}
const navigationLi = document.createElement('li')
navigationLi.appendChild(linkA)
navigationLi.title = title
parent.appendChild(navigationLi)
}
refreshSectionPolicyLinks (policy) {
if (policy.showDiagnostics) {
this.createLink('Diagnostics', '/diagnostics', true)
}
if (policy.showLogList) {
this.createLink('Logs', '/logs', true)
}
}
}