Skip to content

Commit

Permalink
Reorder session menu
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Jun 11, 2024
1 parent cba2251 commit ffa3b37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 1 addition & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,11 @@
Load URL ...
</button>

<!-- Session List -->
<div id="igv-session-list-divider" class="dropdown-divider"></div>

<div class="dropdown-divider"></div>

<!-- Save local session file -->
<button class="dropdown-item" type="button" data-toggle="modal"
id="save-session-button"
data-target="#igv-app-session-save-modal">
Save ...
</button>
Expand Down
16 changes: 7 additions & 9 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ async function initializationHelper(browser, container, options) {
sessionSaver)

if (options.sessionRegistryFile) {
await createSessionMenu('igv-session-list-divider', options.sessionRegistryFile, sessionLoader)
await createSessionMenu('save-session-button', options.sessionRegistryFile, sessionLoader)
} else {
document.querySelector('#igv-session-list-divider').style.display = 'none'
}
Expand Down Expand Up @@ -402,7 +402,9 @@ function createSampleInfoMenu(igvMain,
{
success: dbFiles => {

const configList = dbFiles.map(({link}) => { return {url: link} })
const configList = dbFiles.map(({link}) => {
return {url: link}
})

sampleInfoFileLoadHandler(configList[0])
},
Expand Down Expand Up @@ -489,7 +491,7 @@ function createSampleInfoMenu(igvMain,

Utils.configureModal(fileLoadWidget, urlModal, async fileLoadWidget => {
const paths = fileLoadWidget.retrievePaths()
await sampleInfoFileLoadHandler({url:paths[0]})
await sampleInfoFileLoadHandler({url: paths[0]})
return true
})

Expand Down Expand Up @@ -564,8 +566,7 @@ async function createSessionMenu(sessionListDivider, sessionRegistryFile, sessio
if (sessionJSON) {

const sessions = sessionJSON['sessions']

let firstSection = true

for (let {name, url} of sessions.reverse()) {

const referenceNode = document.getElementById(sessionListDivider)
Expand All @@ -591,10 +592,7 @@ async function createSessionMenu(sessionListDivider, sessionRegistryFile, sessio
const html = `<h6 class="dropdown-header">${name}</h6>`
const el = fromHTML(html)
referenceNode.after(el)
if (!firstSection) {
referenceNode.after(fromHTML('<div class="dropdown-divider"/>'))
firstSection = false
}
referenceNode.after(fromHTML('<div class="dropdown-divider"/>'))
}
}

Expand Down

0 comments on commit ffa3b37

Please sign in to comment.