Skip to content

Commit

Permalink
YDA-5458: Add button to go to group in group manager
Browse files Browse the repository at this point in the history
  • Loading branch information
claravox committed Oct 25, 2023
1 parent 9c5ea39 commit ee9ef21
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
18 changes: 18 additions & 0 deletions research/static/research/js/research.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ $(function () {
window.location.href = '/vault/?dir=' + encodeURIComponent('/' + $(this).attr('vault-area'))
})

$('.btn-go-to-group-manager').on('click', function () {
Yoda.storage.session.set('selected-group', $(this).attr('group'))
window.location.href = '/group_manager'
})

$('.btn-group button.metadata-form').on('click', function () {
showMetadataForm($(this).attr('data-path'))
})
Expand Down Expand Up @@ -753,6 +758,7 @@ function browse (dir = '', changeHistory = false) {
// remove hide class that could have been added when a erroneous vault path was used.
$('#file-browser_wrapper').removeClass('hide')
handleGoToVaultButton(dir)
handleGoToGroupManager(dir)
makeBreadcrumb(dir)
if (changeHistory) { changeBrowserUrl(dir) }
topInformation(dir, true) // only here topInformation should show its alertMessage
Expand All @@ -770,6 +776,18 @@ function handleGoToVaultButton (dir) {
}
}

function handleGoToGroupManager(dir) {
// Handle the button with which to return to the corresponding research area.
const parts = dir.split('/')
console.log(parts[1])

if (parts.length > 1) {
$('.btn-go-to-group-manager').attr('group', parts[1]).show()
} else {
$('.btn-go-to-group-manager').attr('group', '').hide()
}
}

function makeBreadcrumb (dir) {
const pathParts = dir.split('/').filter(x => x.length)

Expand Down
1 change: 1 addition & 0 deletions research/templates/research/browse.html
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ <h5 class="modal-title">Uploads
<nav aria-label="breadcrumb">
<div class="breadcrumb-container">
<button class="btn btn-sm btn-secondary float-end btn-go-to-vault mt-2 me-2" vault-area="">Go to vault</button>
<button class="btn btn-sm btn-secondary float-end btn-go-to-group-manager mt-2 me-2" group="">Go to group manager</button>
<ol class="breadcrumb">
<li class="breadcrumb-item">Research</li>
</ol>
Expand Down
2 changes: 1 addition & 1 deletion stats/static/stats/js/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ const getFolderContents = (() => {
search_groups: $('#search-group-table').val()
})

// If another requests has come while we were waiting, simply drop this one.
// If another request has come while we were waiting, simply drop this one.
if (i !== j) return null

// Update cache info.
Expand Down
17 changes: 17 additions & 0 deletions vault/static/vault/js/vault.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ $(function () {
window.location.href = '/research/?dir=' + encodeURIComponent('/' + $(this).attr('research-area'))
})

$('.btn-go-to-group-manager').on('click', function () {
Yoda.storage.session.set('selected-group', $(this).attr('group'))
window.location.href = '/group_manager'
})

$('.btn-group button.metadata-form').on('click', function () {
showMetadataForm($(this).attr('data-path'))
})
Expand Down Expand Up @@ -314,6 +319,7 @@ function browse (dir = '', changeHistory = false) {
// remove hide class that could have been added when a erroneous vault path was used.
$('#file-browser_wrapper').removeClass('hide')
handleGoToResearchButton(dir)
handleGoToGroupManager(dir)
makeBreadcrumb(dir)
if (changeHistory) { changeBrowserUrl(dir) }

Expand All @@ -340,6 +346,17 @@ function handleGoToResearchButton (dir) {
}
}

function handleGoToGroupManager(dir) {
// Handle the button with which to return to the corresponding research area.
const parts = dir.split('/')

if (parts.length > 1) {
$('.btn-go-to-group-manager').attr('group', parts[1].replace('vault-', 'research-')).show()
} else {
$('.btn-go-to-group-manager').attr('group', '').hide()
}
}

function makeBreadcrumb (dir) {
const pathParts = dir.split('/').filter(x => x.length)

Expand Down
1 change: 1 addition & 0 deletions vault/templates/vault/browse.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ <h5 class="modal-title">Unarchive datapackage from tape</h5>
<nav aria-label="breadcrumb">
<div class="breadcrumb-container">
<button class="btn btn-sm btn-secondary float-end btn-go-to-research mt-2 me-2" research-area="">Go to research</button>
<button class="btn btn-sm btn-secondary float-end btn-go-to-group-manager mt-2 me-2" group="">Go to group manager</button>
<ol class="breadcrumb">
<li class="breadcrumb-item">Vault</li>
</ol>
Expand Down

0 comments on commit ee9ef21

Please sign in to comment.